=> 64eaaaac57fc909a9c9d47302f17f0801b7f2965
[1mdiff --git a/src/gmdocument.c b/src/gmdocument.c[m [1mindex a3e233f3..bc0cc073 100644[m [1m--- a/src/gmdocument.c[m [1m+++ b/src/gmdocument.c[m [36m@@ -1292,7 +1292,7 @@[m [mstatic void updateIconBasedOnUrl_GmDocument_(iGmDocument *d) {[m }[m }[m [m [31m-void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {[m [32m+[m[32mvoid setThemeSeed_GmDocument(iGmDocument *d, const iBlock *paletteSeed, const iBlock *iconSeed) {[m const iPrefs * prefs = prefs_App();[m enum iGmDocumentTheme theme = currentTheme_();[m static const iChar siteIcons[] = {[m [36m@@ -1303,6 +1303,16 @@[m [mvoid setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {[m 0x1f306, 0x1f308, 0x1f30a, 0x1f319, 0x1f31f, 0x1f320, 0x1f340, 0x1f4cd, 0x1f4e1, 0x1f531,[m 0x1f533, 0x1f657, 0x1f659, 0x1f665, 0x1f668, 0x1f66b, 0x1f78b, 0x1f796, 0x1f79c,[m };[m [32m+[m[32m if (!iconSeed) {[m [32m+[m[32m iconSeed = paletteSeed;[m [32m+[m[32m }[m [32m+[m[32m if (iconSeed && !isEmpty_Block(iconSeed)) {[m [32m+[m[32m const uint32_t seedHash = themeHash_(iconSeed);[m [32m+[m[32m d->siteIcon = siteIcons[(seedHash >> 7) % iElemCount(siteIcons)];[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m d->siteIcon = 0;[m[41m [m [32m+[m[32m }[m /* Default colors. These are used on "about:" pages and local files, for example. */ {[m /* Link colors are generally the same in all themes. */[m set_Color(tmBadLink_ColorId, get_Color(red_ColorId));[m [36m@@ -1504,13 +1514,11 @@[m [mvoid setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {[m }[m }[m }[m [31m- if (seed && !isEmpty_Block(seed)) {[m [31m- d->themeSeed = themeHash_(seed);[m [31m- d->siteIcon = siteIcons[(d->themeSeed >> 7) % iElemCount(siteIcons)];[m [32m+[m[32m if (paletteSeed && !isEmpty_Block(paletteSeed)) {[m [32m+[m[32m d->themeSeed = themeHash_(paletteSeed);[m }[m else {[m d->themeSeed = 0;[m [31m- d->siteIcon = 0;[m }[m /* Set up colors. */[m if (d->themeSeed) {[m [36m@@ -1739,8 +1747,8 @@[m [mvoid setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {[m /* Derived colors. */[m setDerivedThemeColors_(theme);[m /* Special exceptions. */[m [31m- if (seed) {[m [31m- if (equal_CStr(cstr_Block(seed), "gemini.circumlunar.space")) {[m [32m+[m[32m if (iconSeed) {[m [32m+[m[32m if (equal_CStr(cstr_Block(iconSeed), "gemini.circumlunar.space")) {[m d->siteIcon = 0x264a; /* gemini symbol */[m }[m updateIconBasedOnUrl_GmDocument_(d);[m [36m@@ -1761,7 +1769,8 @@[m [mvoid setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {[m void makePaletteGlobal_GmDocument(const iGmDocument *d) {[m if (!d->isPaletteValid) {[m /* Recompute the palette since it's needed now. */[m [31m- setThemeSeed_GmDocument((iGmDocument *) d, urlThemeSeed_String(&d->url));[m [32m+[m[32m setThemeSeed_GmDocument([m [32m+[m[32m (iGmDocument *) d, urlPaletteSeed_String(&d->url), urlThemeSeed_String(&d->url));[m }[m iAssert(d->isPaletteValid);[m memcpy(get_Root()->tmPalette, d->palette, sizeof(d->palette));[m [36m@@ -1938,7 +1947,7 @@[m [mstatic void normalize_GmDocument(iGmDocument *d) {[m void setUrl_GmDocument(iGmDocument *d, const iString *url) {[m url = canonicalUrl_String(url);[m set_String(&d->url, url);[m [31m- setThemeSeed_GmDocument(d, urlThemeSeed_String(url));[m [32m+[m[32m setThemeSeed_GmDocument(d, urlPaletteSeed_String(url), urlThemeSeed_String(url));[m iUrl parts;[m init_Url(&parts, url);[m setRange_String(&d->localHost, parts.host);[m [1mdiff --git a/src/gmdocument.h b/src/gmdocument.h[m [1mindex 0969794c..6c25dd6f 100644[m [1m--- a/src/gmdocument.h[m [1m+++ b/src/gmdocument.h[m [36m@@ -181,7 +181,9 @@[m [menum iGmDocumentUpdate {[m final_GmDocumentUpdate, /* process all lines, including the last one if not terminated */[m };[m [m [31m-void setThemeSeed_GmDocument (iGmDocument *, const iBlock *seed);[m [32m+[m[32mvoid setThemeSeed_GmDocument (iGmDocument *,[m [32m+[m[32m const iBlock *paletteSeed,[m [32m+[m[32m const iBlock *iconSeed); /* seeds may be NULL; NULL iconSeed will use paletteSeed instead */[m void setFormat_GmDocument (iGmDocument *, enum iSourceFormat format);[m void setWidth_GmDocument (iGmDocument *, int width, int canvasWidth);[m iBool updateWidth_GmDocument (iGmDocument *, int width, int canvasWidth);[m [1mdiff --git a/src/gmutil.c b/src/gmutil.c[m [1mindex 0573aac1..9188091d 100644[m [1m--- a/src/gmutil.c[m [1m+++ b/src/gmutil.c[m [36m@@ -23,6 +23,7 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m #include "gmutil.h"[m #include "fontpack.h"[m #include "lang.h"[m [32m+[m[32m#include "sitespec.h"[m #include "ui/color.h"[m [m #include[m [36m@@ -279,6 +280,19 @@[m [mconst iBlock *urlThemeSeed_String(const iString *url) {[m return collect_Block(newRange_Block(user));[m }[m [m [32m+[m[32mconst iBlock *urlPaletteSeed_String(const iString *url) {[m [32m+[m[32m if (equalCase_Rangecc(urlScheme_String(url), "file")) {[m [32m+[m[32m return urlThemeSeed_String(url);[m [32m+[m[32m }[m [32m+[m[32m /* Check for a site-specific setting. */[m [32m+[m[32m const iString *seed =[m [32m+[m[32m valueString_SiteSpec(collectNewRange_String(urlRoot_String(url)), paletteSeed_SiteSpecKey);[m [32m+[m[32m if (!isEmpty_String(seed)) {[m [32m+[m[32m return utf8_String(seed);[m [32m+[m[32m }[m [32m+[m[32m return urlThemeSeed_String(url);[m [32m+[m[32m}[m [32m+[m static iBool isAbsolutePath_(iRangecc path) {[m return isAbsolute_Path(collect_String(urlDecode_String(collect_String(newRange_String(path)))));[m }[m [1mdiff --git a/src/gmutil.h b/src/gmutil.h[m [1mindex c9d7baae..01eb8e52 100644[m [1m--- a/src/gmutil.h[m [1m+++ b/src/gmutil.h[m [36m@@ -120,6 +120,7 @@[m [muint16_t urlPort_String (const iString *);[m iRangecc urlUser_String (const iString *);[m iRangecc urlRoot_String (const iString *);[m const iBlock * urlThemeSeed_String (const iString *);[m [32m+[m[32mconst iBlock * urlPaletteSeed_String (const iString *);[m [m const iString * absoluteUrl_String (const iString *, const iString *urlMaybeRelative);[m iBool isLikelyUrl_String (const iString *);[m [1mdiff --git a/src/sitespec.c b/src/sitespec.c[m [1mindex fe80ad13..31094981 100644[m [1m--- a/src/sitespec.c[m [1m+++ b/src/sitespec.c[m [36m@@ -37,7 +37,8 @@[m [mstruct Impl_SiteParams {[m iString titanIdentity; /* fingerprint */[m int dismissWarnings;[m iStringArray usedIdentities; /* fingerprints; latest ones at the end */[m [31m- /* TODO: theme seed, style settings */[m [32m+[m[32m iString paletteSeed;[m [32m+[m[32m /* TODO: style settings */[m };[m [m void init_SiteParams(iSiteParams *d) {[m [36m@@ -45,9 +46,11 @@[m [mvoid init_SiteParams(iSiteParams *d) {[m init_String(&d->titanIdentity);[m d->dismissWarnings = 0;[m init_StringArray(&d->usedIdentities);[m [32m+[m[32m init_String(&d->paletteSeed);[m }[m [m void deinit_SiteParams(iSiteParams *d) {[m [32m+[m[32m deinit_String(&d->paletteSeed);[m deinit_StringArray(&d->usedIdentities);[m deinit_String(&d->titanIdentity);[m }[m [36m@@ -149,6 +152,9 @@[m [mstatic void handleIniKeyValue_SiteSpec_(void *context, const iString *table, con[m pushBack_StringArray(&d->loadParams->usedIdentities, collectNewRange_String(seg));[m }[m }[m [32m+[m[32m else if (!cmp_String(key, "paletteSeed") && value->type == string_TomlType) {[m [32m+[m[32m set_String(&d->loadParams->paletteSeed, value->value.string);[m [32m+[m[32m }[m }[m [m static iBool load_SiteSpec_(iSiteSpec *d) {[m [36m@@ -190,6 +196,11 @@[m [mstatic void save_SiteSpec_(iSiteSpec *d) {[m "usedIdentities = \"%s\"\n",[m cstrCollect_String(joinCStr_StringArray(¶ms->usedIdentities, " ")));[m }[m [32m+[m[32m if (!isEmpty_String(¶ms->paletteSeed)) {[m [32m+[m[32m appendCStr_String(buf, "paletteSeed = \"");[m [32m+[m[32m append_String(buf, collect_String(quote_String(¶ms->paletteSeed, iFalse)));[m [32m+[m[32m appendCStr_String(buf, "\"\n");[m [32m+[m[32m }[m appendCStr_String(buf, "\n");[m write_File(f, utf8_String(buf));[m iEndCollect();[m [1mdiff --git a/src/sitespec.h b/src/sitespec.h[m [1mindex 11c40e3c..372e021e 100644[m [1m--- a/src/sitespec.h[m [1m+++ b/src/sitespec.h[m [36m@@ -31,6 +31,7 @@[m [menum iSiteSpecKey {[m titanIdentity_SiteSpecKey, /* String */[m dismissWarnings_SiteSpecKey, /* int */[m usedIdentities_SiteSpecKey, /* StringArray */[m [32m+[m[32m paletteSeed_SiteSpecKey, /* String */[m };[m [m void init_SiteSpec (const char *saveDir);[m [1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex 293e4507..7d9ac154 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -3936,12 +3936,12 @@[m [mstatic iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)[m const char *unchecked = red_ColorEscape "\u2610";[m const char *checked = green_ColorEscape "\u2611";[m const iBool haveFingerprint = (d->certFlags & haveFingerprint_GmCertFlag) != 0;[m [31m- const int requiredForTrust = (available_GmCertFlag | haveFingerprint_GmCertFlag |[m [31m- timeVerified_GmCertFlag);[m [32m+[m[32m const int requiredForTrust =[m [32m+[m[32m (available_GmCertFlag | haveFingerprint_GmCertFlag | timeVerified_GmCertFlag);[m const iBool canTrust = ~d->certFlags & trusted_GmCertFlag &&[m ((d->certFlags & requiredForTrust) == requiredForTrust);[m const iRecentUrl *recent = constMostRecentUrl_History(d->mod.history);[m [31m- const iString *meta = &d->sourceMime;[m [32m+[m[32m const iString *meta = &d->sourceMime;[m if (recent && recent->cachedResponse) {[m meta = &recent->cachedResponse->meta;[m }[m [36m@@ -4006,6 +4006,10 @@[m [mstatic iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)[m if (haveFingerprint) {[m pushBack_Array(items, &(iMenuItem){ "${dlg.cert.fingerprint}", 0, 0, "server.copycert" });[m }[m [32m+[m[32m const iRangecc root = urlRoot_String(d->mod.url);[m [32m+[m[32m if (!isEmpty_Range(&root)) {[m [32m+[m[32m pushBack_Array(items, &(iMenuItem){ "${pageinfo.settings}", 0, 0, "document.sitespec" });[m [32m+[m[32m }[m if (!isEmpty_Array(items)) {[m pushBack_Array(items, &(iMenuItem){ "---", 0, 0, 0 });[m }[m [36m@@ -4937,7 +4941,7 @@[m [mstatic iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e[m for (size_t i = 0; i < 64; ++i) {[m setByte_Block(seed, i, iRandom(0, 256));[m }[m [31m- setThemeSeed_GmDocument(view->doc, seed);[m [32m+[m[32m setThemeSeed_GmDocument(view->doc, seed, NULL);[m delete_Block(seed);[m invalidate_DocumentWidget_(d);[m refresh_Widget(w);[m [1mdiff --git a/src/ui/util.c b/src/ui/util.c[m [1mindex befc2fd5..54715121 100644[m [1m--- a/src/ui/util.c[m [1m+++ b/src/ui/util.c[m [36m@@ -3169,15 +3169,14 @@[m [mstatic iBool handleFeedSettingCommands_(iWidget *dlg, const char *cmd) {[m }[m [m iWidget *makeFeedSettings_Widget(uint32_t bookmarkId) {[m [31m- const char *headingText = bookmarkId ? uiHeading_ColorEscape "${heading.feedcfg}"[m [31m- : uiHeading_ColorEscape "${heading.subscribe}";[m [31m- const iMenuItem actions[] = { { "${cancel}" },[m [31m- { bookmarkId ? uiTextCaution_ColorEscape "${dlg.feed.save}"[m [31m- : uiTextCaution_ColorEscape "${dlg.feed.sub}",[m [31m- SDLK_RETURN,[m [31m- KMOD_PRIMARY,[m [31m- format_CStr("feedcfg.accept bmid:%d", bookmarkId) } };[m [31m- iWidget *dlg;[m [32m+[m[32m iWidget *dlg;[m [32m+[m[32m const char *headingText = bookmarkId ? "${heading.feedcfg}" : "${heading.subscribe}";[m [32m+[m[32m const iMenuItem actions[] = { { "${cancel}" },[m [32m+[m[32m { bookmarkId ? uiTextCaution_ColorEscape "${dlg.feed.save}"[m [32m+[m[32m : uiTextCaution_ColorEscape "${dlg.feed.sub}",[m [32m+[m[32m SDLK_RETURN,[m [32m+[m[32m KMOD_PRIMARY,[m [32m+[m[32m format_CStr("feedcfg.accept bmid:%d", bookmarkId) } };[m if (isUsingPanelLayout_Mobile()) {[m const iMenuItem typeItems[] = {[m { "button id:feedcfg.type.gemini label:dlg.feed.type.gemini", 0, 0, "feedcfg.type arg:0" },[m [36m@@ -3234,6 +3233,32 @@[m [miWidget *makeFeedSettings_Widget(uint32_t bookmarkId) {[m return dlg;[m }[m [m [32m+[m[32miWidget *makeSiteSpecificSettings_Widget(const iString *url) {[m [32m+[m[32m iWidget *dlg;[m [32m+[m[32m const iMenuItem actions[] = {[m [32m+[m[32m { "${cancel}" }, { "${sitespec.accept}", SDLK_RETURN, KMOD_PRIMARY, "sitespec.accept" }[m [32m+[m[32m };[m [32m+[m[32m if (isUsingPanelLayout_Mobile()) {[m [32m+[m[32m iAssert(iFalse);[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m iWidget *headings, *values;[m [32m+[m[32m dlg = makeSheet_Widget("sitespec");[m [32m+[m[32m addDialogTitle_(dlg, "${heading.sitespec}", "heading.sitespec");[m [32m+[m[32m addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values)));[m [32m+[m[32m addDialogToggle_(headings, values, "${sitespec.ansi}", "sitespec.ansi");[m [32m+[m[32m iInputWidget *palInput = new_InputWidget(0);[m [32m+[m[32m addPrefsInputWithHeading_(headings, values, "sitespec.palette", iClob(palInput));[m [32m+[m[32m as_Widget(palInput)->rect.size.x = 80 * gap_UI;[m [32m+[m[32m addChild_Widget(dlg, iClob(makeDialogButtons_Widget(actions, iElemCount(actions))));[m [32m+[m[32m }[m [32m+[m[32m /* Initialize. */ {[m [32m+[m[32m const iRangecc root = urlRoot_String(url);[m [32m+[m[41m [m [32m+[m[32m }[m [32m+[m[32m return dlg;[m [32m+[m[32m}[m [32m+[m iWidget *makeIdentityCreation_Widget(void) {[m const iMenuItem actions[] = { { "${dlg.newident.more}", 0, 0, "ident.showmore" },[m { "---" },[m [1mdiff --git a/src/ui/util.h b/src/ui/util.h[m [1mindex 0289d579..31c8cedc 100644[m [1m--- a/src/ui/util.h[m [1m+++ b/src/ui/util.h[m [36m@@ -336,13 +336,14 @@[m [miWidget * makeQuestion_Widget (const char *title, const char *msg,[m iWidget * makePreferences_Widget (void);[m void updatePreferencesLayout_Widget (iWidget *prefs);[m [m [31m-iWidget * makeBookmarkEditor_Widget (void);[m [31m-void setBookmarkEditorFolder_Widget(iWidget *editor, uint32_t folderId);[m [31m-iWidget * makeBookmarkCreation_Widget (const iString *url, const iString *title, iChar icon);[m [31m-iWidget * makeIdentityCreation_Widget (void);[m [31m-iWidget * makeFeedSettings_Widget (uint32_t bookmarkId);[m [31m-iWidget * makeTranslation_Widget (iWidget *parent);[m [31m-iWidget * makeGlyphFinder_Widget (void);[m [32m+[m[32miWidget * makeBookmarkEditor_Widget (void);[m [32m+[m[32mvoid setBookmarkEditorFolder_Widget (iWidget *editor, uint32_t folderId);[m [32m+[m[32miWidget * makeBookmarkCreation_Widget (const iString *url, const iString *title, iChar icon);[m [32m+[m[32miWidget * makeIdentityCreation_Widget (void);[m [32m+[m[32miWidget * makeFeedSettings_Widget (uint32_t bookmarkId);[m [32m+[m[32miWidget * makeSiteSpecificSettings_Widget (const iString *url);[m [32m+[m[32miWidget * makeTranslation_Widget (iWidget *parent);[m [32m+[m[32miWidget * makeGlyphFinder_Widget (void);[m [m const char * languageId_String (const iString *menuItemLabel);[m int languageIndex_CStr (const char *langId);[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).