mirror of https://codeberg.org/cage/tinmop/
- [gemini] made fetching of favicon opt-in
by default tinmop will not fetch favicon.txt anymore, this feature must be enabled by user using a configuration directive.
This commit is contained in:
parent
cb55b56c13
commit
8230056152
|
@ -155,6 +155,10 @@ color-regexp = ":rendering" cyan
|
||||||
|
|
||||||
# ignore-user-regexp = "^user-name@domain-name"
|
# ignore-user-regexp = "^user-name@domain-name"
|
||||||
|
|
||||||
|
# Use gemini favicon?
|
||||||
|
# see gemini://mozz.us/files/rfc_gemini_favicon.gm
|
||||||
|
# gemini.fetch.favicon = no
|
||||||
|
|
||||||
# you can instruct the program to open some non gemini link with a
|
# you can instruct the program to open some non gemini link with a
|
||||||
# program installed with your system like below
|
# program installed with your system like below
|
||||||
# syntax open "REGEXP" with "PROGRAM-NAME" [use cache]
|
# syntax open "REGEXP" with "PROGRAM-NAME" [use cache]
|
||||||
|
|
|
@ -314,22 +314,25 @@
|
||||||
|
|
||||||
(let ((cache ()))
|
(let ((cache ()))
|
||||||
(defun fetch-favicon (parsed-url)
|
(defun fetch-favicon (parsed-url)
|
||||||
(flet ((fetch-from-cache (key)
|
(if (not (swconf:gemini-fetch-favicon-p))
|
||||||
(assoc-value cache key :test #'string=)))
|
(swconf:gemini-default-favicon)
|
||||||
(multiple-value-bind (actual-iri host path query port fragment)
|
(flet ((fetch-from-cache (key)
|
||||||
(gemini-client:displace-iri parsed-url)
|
(assoc-value cache key :test #'string=)))
|
||||||
(declare (ignore actual-iri path query fragment))
|
(multiple-value-bind (actual-iri host path query port fragment)
|
||||||
(or (fetch-from-cache host)
|
(gemini-client:displace-iri parsed-url)
|
||||||
(ignore-errors
|
(declare (ignore actual-iri path query fragment))
|
||||||
(let* ((favicon-url (gemini-parser:make-gemini-iri host
|
(or (fetch-from-cache host)
|
||||||
"/favicon.txt"
|
(ignore-errors
|
||||||
:port port))
|
(let* ((favicon-url (gemini-parser:make-gemini-iri host
|
||||||
(response-body (gemini-client:slurp-gemini-url favicon-url))
|
"/favicon.txt"
|
||||||
(favicon (misc:safe-subseq (babel:octets-to-string response-body :errorp t)
|
:port port))
|
||||||
0 1)))
|
(response-body (gemini-client:slurp-gemini-url favicon-url))
|
||||||
(setf cache (acons host favicon cache))
|
(favicon (misc:safe-subseq (babel:octets-to-string response-body
|
||||||
(fetch-favicon parsed-url)))
|
:errorp t)
|
||||||
(swconf:gemini-default-favicon))))))
|
0 1)))
|
||||||
|
(setf cache (acons host favicon cache))
|
||||||
|
(fetch-favicon parsed-url)))
|
||||||
|
(swconf:gemini-default-favicon)))))))
|
||||||
|
|
||||||
(defun request-stream-gemini-document-thread (wrapper-object host
|
(defun request-stream-gemini-document-thread (wrapper-object host
|
||||||
port path query fragment favicon)
|
port path query fragment favicon)
|
||||||
|
|
|
@ -1077,6 +1077,7 @@
|
||||||
:load-config-file
|
:load-config-file
|
||||||
:external-editor
|
:external-editor
|
||||||
:gemini-default-favicon
|
:gemini-default-favicon
|
||||||
|
:gemini-fetch-favicon-p
|
||||||
:gemini-link-prefix-to-gemini
|
:gemini-link-prefix-to-gemini
|
||||||
:gemini-link-prefix-to-other
|
:gemini-link-prefix-to-other
|
||||||
:gemini-quote-prefix
|
:gemini-quote-prefix
|
||||||
|
|
|
@ -488,6 +488,7 @@
|
||||||
input
|
input
|
||||||
read
|
read
|
||||||
unread
|
unread
|
||||||
|
fetch
|
||||||
password-echo-character
|
password-echo-character
|
||||||
color-re
|
color-re
|
||||||
ignore-user-re
|
ignore-user-re
|
||||||
|
@ -554,6 +555,13 @@
|
||||||
+key-gemini+
|
+key-gemini+
|
||||||
+key-favicon+))
|
+key-favicon+))
|
||||||
|
|
||||||
|
(defun gemini-fetch-favicon-p ()
|
||||||
|
(let ((fetchp (access:accesses *software-configuration*
|
||||||
|
+key-gemini+
|
||||||
|
+key-fetch+
|
||||||
|
+key-favicon+)))
|
||||||
|
(db-utils:db-not-nil-p fetchp)))
|
||||||
|
|
||||||
(defun gemini-link-prefix (scheme)
|
(defun gemini-link-prefix (scheme)
|
||||||
(access-non-null-conf-value *software-configuration*
|
(access-non-null-conf-value *software-configuration*
|
||||||
+key-gemini+
|
+key-gemini+
|
||||||
|
|
Loading…
Reference in New Issue