summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-02-13 20:57:09 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-02-13 20:57:34 +0200
commit672a534a044d811aa57e927288de50360882ac54 (patch)
treee605b769a9e40dcdf0b2976dd277ac29beb4c15d
parentfb71407409b2debd8e03c42faecd811d168321bf (diff)
Added a preference for maximum URL size
The setting defaults to 8 KB. Link lines with longer URLs are not recognized as links.
-rw-r--r--po/en.po3
-rw-r--r--res/about/help.gmi7
-rw-r--r--res/lang/cs.binbin32779 -> 32811 bytes
-rw-r--r--res/lang/de.binbin31589 -> 31621 bytes
-rw-r--r--res/lang/en.binbin27658 -> 27690 bytes
-rw-r--r--res/lang/eo.binbin26848 -> 26880 bytes
-rw-r--r--res/lang/es.binbin31501 -> 31533 bytes
-rw-r--r--res/lang/es_MX.binbin28728 -> 28760 bytes
-rw-r--r--res/lang/fi.binbin31299 -> 31331 bytes
-rw-r--r--res/lang/fr.binbin32386 -> 32418 bytes
-rw-r--r--res/lang/gl.binbin30662 -> 30694 bytes
-rw-r--r--res/lang/hu.binbin32411 -> 32443 bytes
-rw-r--r--res/lang/ia.binbin30441 -> 30473 bytes
-rw-r--r--res/lang/ie.binbin30398 -> 30430 bytes
-rw-r--r--res/lang/isv.binbin26379 -> 26411 bytes
-rw-r--r--res/lang/nl.binbin29768 -> 29800 bytes
-rw-r--r--res/lang/pl.binbin31014 -> 31046 bytes
-rw-r--r--res/lang/ru.binbin46361 -> 46393 bytes
-rw-r--r--res/lang/sk.binbin26715 -> 26747 bytes
-rw-r--r--res/lang/sr.binbin45657 -> 45689 bytes
-rw-r--r--res/lang/tok.binbin28504 -> 28536 bytes
-rw-r--r--res/lang/tr.binbin30605 -> 30637 bytes
-rw-r--r--res/lang/uk.binbin45738 -> 45770 bytes
-rw-r--r--res/lang/zh_Hans.binbin26623 -> 26655 bytes
-rw-r--r--res/lang/zh_Hant.binbin27021 -> 27053 bytes
-rw-r--r--src/app.c12
-rw-r--r--src/gmdocument.c17
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/util.c1
30 files changed, 33 insertions, 9 deletions
diff --git a/po/en.po b/po/en.po
index 100cfb9f..aae67ff0 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1670,6 +1670,9 @@ msgstr "Wrap plain text:"
1670msgid "prefs.decodeurls" 1670msgid "prefs.decodeurls"
1671msgstr "Decode URLs:" 1671msgstr "Decode URLs:"
1672 1672
1673msgid "prefs.urlsize"
1674msgstr "Maximum URL size:"
1675
1673msgid "prefs.cachesize" 1676msgid "prefs.cachesize"
1674msgstr "Cache size:" 1677msgstr "Cache size:"
1675 1678
diff --git a/res/about/help.gmi b/res/about/help.gmi
index 93bc6a05..5bf77a76 100644
--- a/res/about/help.gmi
+++ b/res/about/help.gmi
@@ -106,10 +106,15 @@ The type and destination of a link are indicated by the link's icon and color: â
106 106
107Link colors remain the same regardless of which color theme is being used for page content. (Color themes are discussed in the Customization section.) 107Link colors remain the same regardless of which color theme is being used for page content. (Color themes are discussed in the Customization section.)
108 108
109When you move the mouse cursor over a link, additional information will appear: the destination domain, with the URL scheme shown for non-Gemini links, and the date of the last visit to the URL. 109The "Show URL on hover" option can be enabled in Preferences to show additional information when you move the mouse cursor over a link: the destination domain, URL scheme for non-Gemini links, date of the last visit to the URL, and the identity that will be used when opening the link.
110 110
111If a link would normally use the default ➤ icon but there is an Emoji at the beginning of the link label, that Emoji is used as the link icon instead. In these cases, you can always assume that the link is a Gemini link whose destination is the same domain that you're currently on. 111If a link would normally use the default ➤ icon but there is an Emoji at the beginning of the link label, that Emoji is used as the link icon instead. In these cases, you can always assume that the link is a Gemini link whose destination is the same domain that you're currently on.
112 112
113The "Network" tab of Preferences has a few settings that affect the presentation of links and URLs in general:
114
115* "Decode URLs" causes percent-coding to be decoded for the user interface, so one can see international characters in URLs.
116* "Maximum URL size" sets a limit for how long URLs can be. While Gemini servers are required to enforce a limit of 1024 bytes for URLs, this setting affects all URLs regardless of scheme. Link lines with URLs longer than this will be presented as plain text.
117
113### 1.1.3 Page caching 118### 1.1.3 Page caching
114 119
115When navigating to a new page, the old page is cached in memory. If you navigate back, the cached copy of the page is restored. Think of it as rewinding time — you return to a past time as if nothing had happened. The same applies to forward navigation; cached pages are loaded if available. This allows back and forward navigation to happen instantly, without any network requests. 120When navigating to a new page, the old page is cached in memory. If you navigate back, the cached copy of the page is restored. Think of it as rewinding time — you return to a past time as if nothing had happened. The same applies to forward navigation; cached pages are loaded if available. This allows back and forward navigation to happen instantly, without any network requests.
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index a45f34ca..a14c5cf4 100644
--- a/res/lang/cs.bin
+++ b/res/lang/cs.bin
Binary files differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 9b99e7ed..8dd9d478 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index 7b06807d..dd3389ef 100644
--- a/res/lang/en.bin
+++ b/res/lang/en.bin
Binary files differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 6c3bab91..c65c893c 100644
--- a/res/lang/eo.bin
+++ b/res/lang/eo.bin
Binary files differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index f82aca48..a0f2a07f 100644
--- a/res/lang/es.bin
+++ b/res/lang/es.bin
Binary files differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index e1956da3..e83f92e2 100644
--- a/res/lang/es_MX.bin
+++ b/res/lang/es_MX.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index fc7ccab8..f390cdca 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 44b391b4..c268b356 100644
--- a/res/lang/fr.bin
+++ b/res/lang/fr.bin
Binary files differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 583f7909..04311f53 100644
--- a/res/lang/gl.bin
+++ b/res/lang/gl.bin
Binary files differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index 6776ea40..28ba0e48 100644
--- a/res/lang/hu.bin
+++ b/res/lang/hu.bin
Binary files differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index 2659c595..27e3ba71 100644
--- a/res/lang/ia.bin
+++ b/res/lang/ia.bin
Binary files differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index 33bc6419..244ade42 100644
--- a/res/lang/ie.bin
+++ b/res/lang/ie.bin
Binary files differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 23726e20..8c177e99 100644
--- a/res/lang/isv.bin
+++ b/res/lang/isv.bin
Binary files differ
diff --git a/res/lang/nl.bin b/res/lang/nl.bin
index 32ec0205..2bdf4a71 100644
--- a/res/lang/nl.bin
+++ b/res/lang/nl.bin
Binary files differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index 52e02876..129d34da 100644
--- a/res/lang/pl.bin
+++ b/res/lang/pl.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 7445fe10..ac407168 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index 76d4dd6f..099f0ccf 100644
--- a/res/lang/sk.bin
+++ b/res/lang/sk.bin
Binary files differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 11ab7e1d..e550a05a 100644
--- a/res/lang/sr.bin
+++ b/res/lang/sr.bin
Binary files differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 7e9b02d9..2bf27e86 100644
--- a/res/lang/tok.bin
+++ b/res/lang/tok.bin
Binary files differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index c13d575f..6bd0c26c 100644
--- a/res/lang/tr.bin
+++ b/res/lang/tr.bin
Binary files differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index 609b1c53..520f6c97 100644
--- a/res/lang/uk.bin
+++ b/res/lang/uk.bin
Binary files differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index 904fe90d..81ea7de6 100644
--- a/res/lang/zh_Hans.bin
+++ b/res/lang/zh_Hans.bin
Binary files differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 9161c061..029551c7 100644
--- a/res/lang/zh_Hant.bin
+++ b/res/lang/zh_Hant.bin
Binary files differ
diff --git a/src/app.c b/src/app.c
index 0f9249cc..a2ada36e 100644
--- a/src/app.c
+++ b/src/app.c
@@ -244,6 +244,7 @@ static iString *serializePrefs_App_(const iApp *d) {
244 appendFormat_String(str, "imageloadscroll arg:%d\n", d->prefs.loadImageInsteadOfScrolling); 244 appendFormat_String(str, "imageloadscroll arg:%d\n", d->prefs.loadImageInsteadOfScrolling);
245 appendFormat_String(str, "cachesize.set arg:%d\n", d->prefs.maxCacheSize); 245 appendFormat_String(str, "cachesize.set arg:%d\n", d->prefs.maxCacheSize);
246 appendFormat_String(str, "memorysize.set arg:%d\n", d->prefs.maxMemorySize); 246 appendFormat_String(str, "memorysize.set arg:%d\n", d->prefs.maxMemorySize);
247 appendFormat_String(str, "urlsize.set arg:%d\n", d->prefs.maxUrlSize);
247 appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs); 248 appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs);
248 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); 249 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth);
249 appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing); 250 appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing);
@@ -1974,6 +1975,8 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
1974 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize")))); 1975 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize"))));
1975 postCommandf_App("memorysize.set arg:%d", 1976 postCommandf_App("memorysize.set arg:%d",
1976 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.memorysize")))); 1977 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.memorysize"))));
1978 postCommandf_App("urlsize.set arg:%d",
1979 toInt_String(text_InputWidget(findChild_Widget(d, "prefs.urlsize"))));
1977 postCommandf_App("ca.file path:%s", 1980 postCommandf_App("ca.file path:%s",
1978 cstrText_InputWidget(findChild_Widget(d, "prefs.ca.file"))); 1981 cstrText_InputWidget(findChild_Widget(d, "prefs.ca.file")));
1979 postCommandf_App("ca.path path:%s", 1982 postCommandf_App("ca.path path:%s",
@@ -2771,6 +2774,13 @@ iBool handleCommand_App(const char *cmd) {
2771 } 2774 }
2772 return iTrue; 2775 return iTrue;
2773 } 2776 }
2777 else if (equal_Command(cmd, "urlsize.set")) {
2778 d->prefs.maxUrlSize = arg_Command(cmd);
2779 if (d->prefs.maxUrlSize < 1024) {
2780 d->prefs.maxUrlSize = 1024; /* Gemini protocol requirement */
2781 }
2782 return iTrue;
2783 }
2774 else if (equal_Command(cmd, "searchurl")) { 2784 else if (equal_Command(cmd, "searchurl")) {
2775 iString *url = &d->prefs.strings[searchUrl_PrefsString]; 2785 iString *url = &d->prefs.strings[searchUrl_PrefsString];
2776 setCStr_String(url, suffixPtr_Command(cmd, "address")); 2786 setCStr_String(url, suffixPtr_Command(cmd, "address"));
@@ -3158,6 +3168,8 @@ iBool handleCommand_App(const char *cmd) {
3158 collectNewFormat_String("%d", d->prefs.maxCacheSize)); 3168 collectNewFormat_String("%d", d->prefs.maxCacheSize));
3159 setText_InputWidget(findChild_Widget(dlg, "prefs.memorysize"), 3169 setText_InputWidget(findChild_Widget(dlg, "prefs.memorysize"),
3160 collectNewFormat_String("%d", d->prefs.maxMemorySize)); 3170 collectNewFormat_String("%d", d->prefs.maxMemorySize));
3171 setText_InputWidget(findChild_Widget(dlg, "prefs.urlsize"),
3172 collectNewFormat_String("%d", d->prefs.maxUrlSize));
3161 setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs); 3173 setToggle_Widget(findChild_Widget(dlg, "prefs.decodeurls"), d->prefs.decodeUserVisibleURLs);
3162 setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.strings[searchUrl_PrefsString]); 3174 setText_InputWidget(findChild_Widget(dlg, "prefs.searchurl"), &d->prefs.strings[searchUrl_PrefsString]);
3163 setText_InputWidget(findChild_Widget(dlg, "prefs.ca.file"), &d->prefs.strings[caFile_PrefsString]); 3175 setText_InputWidget(findChild_Widget(dlg, "prefs.ca.file"), &d->prefs.strings[caFile_PrefsString]);
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 63d100e2..5cae4138 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -333,13 +333,14 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li
333 link->urlRange = capturedRange_RegExpMatch(&m, 1); 333 link->urlRange = capturedRange_RegExpMatch(&m, 1);
334 setRange_String(&link->url, link->urlRange); 334 setRange_String(&link->url, link->urlRange);
335 set_String(&link->url, canonicalUrl_String(absoluteUrl_String(&d->url, &link->url))); 335 set_String(&link->url, canonicalUrl_String(absoluteUrl_String(&d->url, &link->url)));
336 if (startsWithCase_String(&link->url, "about:command")) { 336 /* If invalid, disregard the link. */
337 /* This is a special internal page that allows submitting UI events. */ 337 if (size_String(&link->url) > prefs_App()->maxUrlSize ||
338 if (!d->enableCommandLinks) { 338 (startsWithCase_String(&link->url, "about:command")
339 delete_GmLink(link); 339 /* this is a special internal page that allows submitting UI events */
340 *linkId = 0; 340 && !d->enableCommandLinks)) {
341 return line; 341 delete_GmLink(link);
342 } 342 *linkId = 0;
343 return line;
343 } 344 }
344 /* Check the URL. */ { 345 /* Check the URL. */ {
345 iUrl parts; 346 iUrl parts;
@@ -385,7 +386,7 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li
385 iString *path = newRange_String(parts.path); 386 iString *path = newRange_String(parts.path);
386 if (endsWithCase_String(path, ".gif") || endsWithCase_String(path, ".jpg") || 387 if (endsWithCase_String(path, ".gif") || endsWithCase_String(path, ".jpg") ||
387 endsWithCase_String(path, ".jpeg") || endsWithCase_String(path, ".png") || 388 endsWithCase_String(path, ".jpeg") || endsWithCase_String(path, ".png") ||
388 endsWithCase_String(path, ".tga") || endsWithCase_String(path, ".psd") || 389 endsWithCase_String(path, ".tga") || endsWithCase_String(path, ".psd") ||
389#if defined (LAGRANGE_ENABLE_WEBP) 390#if defined (LAGRANGE_ENABLE_WEBP)
390 endsWithCase_String(path, ".webp") || 391 endsWithCase_String(path, ".webp") ||
391#endif 392#endif
diff --git a/src/prefs.c b/src/prefs.c
index 13a1dab7..cd86bf60 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -73,6 +73,7 @@ void init_Prefs(iPrefs *d) {
73 d->decodeUserVisibleURLs = iTrue; 73 d->decodeUserVisibleURLs = iTrue;
74 d->maxCacheSize = 10; 74 d->maxCacheSize = 10;
75 d->maxMemorySize = 200; 75 d->maxMemorySize = 200;
76 d->maxUrlSize = 8192;
76 setCStr_String(&d->strings[uiFont_PrefsString], "default"); 77 setCStr_String(&d->strings[uiFont_PrefsString], "default");
77 setCStr_String(&d->strings[headingFont_PrefsString], "default"); 78 setCStr_String(&d->strings[headingFont_PrefsString], "default");
78 setCStr_String(&d->strings[bodyFont_PrefsString], "default"); 79 setCStr_String(&d->strings[bodyFont_PrefsString], "default");
diff --git a/src/prefs.h b/src/prefs.h
index ea864f51..25bf56c4 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -172,6 +172,7 @@ struct Impl_Prefs {
172 /* Network */ 172 /* Network */
173 int maxCacheSize; /* MB */ 173 int maxCacheSize; /* MB */
174 int maxMemorySize; /* MB */ 174 int maxMemorySize; /* MB */
175 int maxUrlSize; /* bytes; longer ones will be disregarded */
175 /* Style */ 176 /* Style */
176 iStringSet * disabledFontPacks; 177 iStringSet * disabledFontPacks;
177 int gemtextAnsiEscapes; 178 int gemtextAnsiEscapes;
diff --git a/src/ui/util.c b/src/ui/util.c
index 41f8eaa9..53ee8fda 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2902,6 +2902,7 @@ iWidget *makePreferences_Widget(void) {
2902 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.network}", '6', &headings, &values); 2902 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.network}", '6', &headings, &values);
2903 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.decodeurls}"))); 2903 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.decodeurls}")));
2904 addChild_Widget(values, iClob(makeToggle_Widget("prefs.decodeurls"))); 2904 addChild_Widget(values, iClob(makeToggle_Widget("prefs.decodeurls")));
2905 addPrefsInputWithHeading_(headings, values, "prefs.urlsize", iClob(new_InputWidget(10)));
2905 /* Cache size. */ { 2906 /* Cache size. */ {
2906 iInputWidget *cache = new_InputWidget(4); 2907 iInputWidget *cache = new_InputWidget(4);
2907 setSelectAllOnFocus_InputWidget(cache, iTrue); 2908 setSelectAllOnFocus_InputWidget(cache, iTrue);