diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-27 18:54:19 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-27 18:54:19 +0300 |
commit | 68f36a4b8d8717e9dc0525e0e6f8d2ca5574b34d (patch) | |
tree | 613e82a38fb6ae36205623da4f821f7d891bce8f /src | |
parent | 16ccf8b50b8e82ec258496d6d04c2851eaa10ca2 (diff) |
GmCerts: As a fallback, use Gemini identities for Titan URLs
Allows configuring Titan-specific identities.
Diffstat (limited to 'src')
-rw-r--r-- | src/gmcerts.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gmcerts.c b/src/gmcerts.c index 902576f3..9073f2e7 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c | |||
@@ -551,13 +551,6 @@ const iGmIdentity *constIdentity_GmCerts(const iGmCerts *d, unsigned int id) { | |||
551 | } | 551 | } |
552 | 552 | ||
553 | const iGmIdentity *identityForUrl_GmCerts(const iGmCerts *d, const iString *url) { | 553 | const iGmIdentity *identityForUrl_GmCerts(const iGmCerts *d, const iString *url) { |
554 | /* Titan URLs use the Gemini identities. */ | ||
555 | if (startsWithCase_String(url, "titan://")) { | ||
556 | iString *mod = copy_String(url); | ||
557 | remove_Block(&mod->chars, 0, 5); | ||
558 | prependCStr_String(mod, "gemini"); | ||
559 | url = collect_String(mod); | ||
560 | } | ||
561 | lock_Mutex(d->mtx); | 554 | lock_Mutex(d->mtx); |
562 | const iGmIdentity *found = NULL; | 555 | const iGmIdentity *found = NULL; |
563 | iConstForEach(PtrArray, i, &d->idents) { | 556 | iConstForEach(PtrArray, i, &d->idents) { |
@@ -572,6 +565,13 @@ const iGmIdentity *identityForUrl_GmCerts(const iGmCerts *d, const iString *url) | |||
572 | } | 565 | } |
573 | done: | 566 | done: |
574 | unlock_Mutex(d->mtx); | 567 | unlock_Mutex(d->mtx); |
568 | /* Fallback: Titan URLs use the Gemini identities, if not otherwise specified. */ | ||
569 | if (!found && startsWithCase_String(url, "titan://")) { | ||
570 | iString *mod = copy_String(url); | ||
571 | remove_Block(&mod->chars, 0, 5); | ||
572 | prependCStr_String(mod, "gemini"); | ||
573 | found = identityForUrl_GmCerts(d, collect_String(mod)); | ||
574 | } | ||
575 | return found; | 575 | return found; |
576 | } | 576 | } |
577 | 577 | ||