mirror of https://codeberg.org/cage/tinmop/
- changed 'uri' to 'iri' where does makes sense to me.
This commit is contained in:
parent
bafa0c596b
commit
c9d9559f1a
|
@ -152,7 +152,7 @@ list af all possible candidtae for completion."
|
||||||
|
|
||||||
(with-simple-complete conversation-folder db:all-conversation-folders)
|
(with-simple-complete conversation-folder db:all-conversation-folders)
|
||||||
|
|
||||||
(defun make-complete-gemini-uri-fn (prompt)
|
(defun make-complete-gemini-iri-fn (prompt)
|
||||||
(lambda (hint)
|
(lambda (hint)
|
||||||
(when-let ((matched (remove-if-not (starts-with-clsr hint)
|
(when-let ((matched (remove-if-not (starts-with-clsr hint)
|
||||||
(funcall #'db:history-prompt->values prompt))))
|
(funcall #'db:history-prompt->values prompt))))
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
(pushnew stream-object
|
(pushnew stream-object
|
||||||
*gemini-streams-db*
|
*gemini-streams-db*
|
||||||
:test (lambda (a b)
|
:test (lambda (a b)
|
||||||
(string= (download-uri a)
|
(string= (download-iri a)
|
||||||
(download-uri b))))
|
(download-iri b))))
|
||||||
*gemini-streams-db*)
|
*gemini-streams-db*)
|
||||||
|
|
||||||
(defun remove-db-stream (stream-object)
|
(defun remove-db-stream (stream-object)
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
(find-if predicate *gemini-streams-db*))
|
(find-if predicate *gemini-streams-db*))
|
||||||
|
|
||||||
(defun find-db-stream-url (url)
|
(defun find-db-stream-url (url)
|
||||||
(find-db-stream-if (lambda (a) (string= (download-uri a) url))))
|
(find-db-stream-if (lambda (a) (string= (download-iri a) url))))
|
||||||
|
|
||||||
(defun ensure-just-one-stream-rendering ()
|
(defun ensure-just-one-stream-rendering ()
|
||||||
(with-lock (*gemini-db-streams-lock*)
|
(with-lock (*gemini-db-streams-lock*)
|
||||||
|
@ -63,8 +63,8 @@
|
||||||
;; it will force displaying of gemini cached file on the screen
|
;; it will force displaying of gemini cached file on the screen
|
||||||
(setf (stream-status stream-object) :rendering))
|
(setf (stream-status stream-object) :rendering))
|
||||||
|
|
||||||
(defun db-entry-to-foreground (uri)
|
(defun db-entry-to-foreground (iri)
|
||||||
(when-let* ((stream-object (find-db-stream-url uri)))
|
(when-let* ((stream-object (find-db-stream-url iri)))
|
||||||
(with-accessors ((support-file support-file)
|
(with-accessors ((support-file support-file)
|
||||||
(meta meta)) stream-object
|
(meta meta)) stream-object
|
||||||
(if (gemini-client:mime-gemini-p meta)
|
(if (gemini-client:mime-gemini-p meta)
|
||||||
|
@ -87,10 +87,10 @@
|
||||||
(stream-status
|
(stream-status
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :stream-status)
|
:initarg :stream-status)
|
||||||
(download-uri
|
(download-iri
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :download-uri
|
:initarg :download-iri
|
||||||
:accessor download-uri)
|
:accessor download-iri)
|
||||||
(start-time
|
(start-time
|
||||||
:initform (db-utils:local-time-obj-now)
|
:initform (db-utils:local-time-obj-now)
|
||||||
:initarg :start-time
|
:initarg :start-time
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
(print-unreadable-object (object stream :type t :identity t)
|
(print-unreadable-object (object stream :type t :identity t)
|
||||||
(format stream
|
(format stream
|
||||||
"~a ~d ~a ~a"
|
"~a ~d ~a ~a"
|
||||||
(download-uri object)
|
(download-iri object)
|
||||||
(octect-count object)
|
(octect-count object)
|
||||||
(meta object)
|
(meta object)
|
||||||
(stream-status object))))
|
(stream-status object))))
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
(color-re (swconf:color-regexps))
|
(color-re (swconf:color-regexps))
|
||||||
(fitted-line (format nil
|
(fitted-line (format nil
|
||||||
"~a ~d ~a ~a"
|
"~a ~d ~a ~a"
|
||||||
(pad (download-uri object) url-w)
|
(pad (download-iri object) url-w)
|
||||||
(pad (to-s (octect-count object))
|
(pad (to-s (octect-count object))
|
||||||
octect-count-w)
|
octect-count-w)
|
||||||
(pad (meta object) meta-w)
|
(pad (meta object) meta-w)
|
||||||
|
@ -213,11 +213,11 @@
|
||||||
(with-accessors ((start-time start-time)
|
(with-accessors ((start-time start-time)
|
||||||
(thread thread)
|
(thread thread)
|
||||||
(stream-status stream-status)
|
(stream-status stream-status)
|
||||||
(download-uri download-uri)) object
|
(download-iri download-iri)) object
|
||||||
(setf thread
|
(setf thread
|
||||||
(bt:make-thread function))
|
(bt:make-thread function))
|
||||||
(setf start-time (db-utils:local-time-obj-now))
|
(setf start-time (db-utils:local-time-obj-now))
|
||||||
(setf download-uri (gemini-parser:make-gemini-uri host path query port))
|
(setf download-iri (gemini-parser:make-gemini-iri host path query port))
|
||||||
object))
|
object))
|
||||||
|
|
||||||
(defclass gemini-file-stream (gemini-stream) ())
|
(defclass gemini-file-stream (gemini-stream) ())
|
||||||
|
@ -259,7 +259,7 @@
|
||||||
(incf octect-count data)))
|
(incf octect-count data)))
|
||||||
|
|
||||||
(defun make-gemini-download-event (src-data stream-object append-text)
|
(defun make-gemini-download-event (src-data stream-object append-text)
|
||||||
(with-accessors ((download-uri download-uri)
|
(with-accessors ((download-iri download-iri)
|
||||||
(host host)
|
(host host)
|
||||||
(port port)
|
(port port)
|
||||||
(path path)
|
(path path)
|
||||||
|
@ -272,7 +272,7 @@
|
||||||
status-code-description
|
status-code-description
|
||||||
meta
|
meta
|
||||||
parsed
|
parsed
|
||||||
download-uri
|
download-iri
|
||||||
src-data
|
src-data
|
||||||
links)))
|
links)))
|
||||||
(make-instance 'program-events:gemini-got-line-event
|
(make-instance 'program-events:gemini-got-line-event
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
(program-events:push-event line-event))))
|
(program-events:push-event line-event))))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-open-support-file (file-stream support-file character)
|
(with-open-support-file (file-stream support-file character)
|
||||||
(let* ((url (gemini-parser:make-gemini-uri host path query port))
|
(let* ((url (gemini-parser:make-gemini-iri host path query port))
|
||||||
(url-header (format nil "-> ~a~%" url))
|
(url-header (format nil "-> ~a~%" url))
|
||||||
(parsed-url (gemini-parser:parse-gemini-file url-header))
|
(parsed-url (gemini-parser:parse-gemini-file url-header))
|
||||||
(url-response (gemini-client:make-gemini-file-response nil
|
(url-response (gemini-client:make-gemini-file-response nil
|
||||||
|
@ -323,7 +323,7 @@
|
||||||
(if (not (downloading-allowed-p wrapper-object))
|
(if (not (downloading-allowed-p wrapper-object))
|
||||||
(ui:notify (_ "Gemini document downloading aborted"))
|
(ui:notify (_ "Gemini document downloading aborted"))
|
||||||
(let ((compact-event (make-instance 'program-events:gemini-compact-lines-event
|
(let ((compact-event (make-instance 'program-events:gemini-compact-lines-event
|
||||||
:download-uri (download-uri wrapper-object)
|
:download-iri (download-iri wrapper-object)
|
||||||
:priority
|
:priority
|
||||||
program-events:+maximum-event-priority+)))
|
program-events:+maximum-event-priority+)))
|
||||||
(program-events:push-event compact-event)
|
(program-events:push-event compact-event)
|
||||||
|
@ -373,7 +373,7 @@
|
||||||
(query (uri:query iri))
|
(query (uri:query iri))
|
||||||
(port (or (uri:port iri)
|
(port (or (uri:port iri)
|
||||||
gemini-client:+gemini-default-port+))
|
gemini-client:+gemini-default-port+))
|
||||||
(actual-iri (gemini-parser:make-gemini-uri host
|
(actual-iri (gemini-parser:make-gemini-iri host
|
||||||
path
|
path
|
||||||
query
|
query
|
||||||
port)))
|
port)))
|
||||||
|
@ -389,19 +389,19 @@
|
||||||
(certificate-key nil)
|
(certificate-key nil)
|
||||||
(use-cached-file-if-exists nil)
|
(use-cached-file-if-exists nil)
|
||||||
(do-nothing-if-exists-in-db t))
|
(do-nothing-if-exists-in-db t))
|
||||||
(let ((parsed-uri (ignore-errors (iri:iri-parse url))))
|
(let ((parsed-iri (ignore-errors (iri:iri-parse url))))
|
||||||
(maybe-initialize-metadata specials:*message-window*)
|
(maybe-initialize-metadata specials:*message-window*)
|
||||||
(cond
|
(cond
|
||||||
((null parsed-uri)
|
((null parsed-iri)
|
||||||
(ui:error-message (format nil
|
(ui:error-message (format nil
|
||||||
(_ "Could not understand the address ~s")
|
(_ "Could not understand the address ~s")
|
||||||
url)))
|
url)))
|
||||||
(use-cached-file-if-exists
|
(use-cached-file-if-exists
|
||||||
(multiple-value-bind (actual-iri host path query port)
|
(multiple-value-bind (actual-iri host path query port)
|
||||||
(displace-iri parsed-uri)
|
(displace-iri parsed-iri)
|
||||||
(if (find-db-stream-url actual-iri)
|
(if (find-db-stream-url actual-iri)
|
||||||
(gemini-viewer:db-entry-to-foreground actual-iri)
|
(gemini-viewer:db-entry-to-foreground actual-iri)
|
||||||
(request (gemini-parser:make-gemini-uri host
|
(request (gemini-parser:make-gemini-iri host
|
||||||
path
|
path
|
||||||
query
|
query
|
||||||
port)
|
port)
|
||||||
|
@ -411,10 +411,10 @@
|
||||||
:do-nothing-if-exists-in-db
|
:do-nothing-if-exists-in-db
|
||||||
do-nothing-if-exists-in-db))))
|
do-nothing-if-exists-in-db))))
|
||||||
(t
|
(t
|
||||||
(multiple-value-bind (actual-uri host path query port)
|
(multiple-value-bind (actual-iri host path query port)
|
||||||
(displace-iri parsed-uri)
|
(displace-iri parsed-iri)
|
||||||
(when (not (and do-nothing-if-exists-in-db
|
(when (not (and do-nothing-if-exists-in-db
|
||||||
(find-db-stream-url actual-uri)))
|
(find-db-stream-url actual-iri)))
|
||||||
(when (null enqueue)
|
(when (null enqueue)
|
||||||
(ensure-just-one-stream-rendering))
|
(ensure-just-one-stream-rendering))
|
||||||
(handler-case
|
(handler-case
|
||||||
|
@ -428,12 +428,12 @@
|
||||||
(if enqueue
|
(if enqueue
|
||||||
:streaming
|
:streaming
|
||||||
:running)))
|
:running)))
|
||||||
(fetch-cached-certificate (actual-uri)
|
(fetch-cached-certificate (actual-iri)
|
||||||
(let* ((certificate-and-key
|
(let* ((certificate-and-key
|
||||||
(or (multiple-value-list
|
(or (multiple-value-list
|
||||||
(db:ssl-cert-find actual-uri))
|
(db:ssl-cert-find actual-iri))
|
||||||
(multiple-value-list
|
(multiple-value-list
|
||||||
(gemini-client:make-client-certificate actual-uri))))
|
(gemini-client:make-client-certificate actual-iri))))
|
||||||
(certificate (first certificate-and-key))
|
(certificate (first certificate-and-key))
|
||||||
(key (second certificate-and-key)))
|
(key (second certificate-and-key)))
|
||||||
(assert certificate)
|
(assert certificate)
|
||||||
|
@ -443,7 +443,7 @@
|
||||||
(flet ((on-input-complete (input)
|
(flet ((on-input-complete (input)
|
||||||
(when (string-not-empty-p input)
|
(when (string-not-empty-p input)
|
||||||
(db-utils:with-ready-database (:connect nil)
|
(db-utils:with-ready-database (:connect nil)
|
||||||
(request (gemini-parser:make-gemini-uri host
|
(request (gemini-parser:make-gemini-iri host
|
||||||
path
|
path
|
||||||
input
|
input
|
||||||
port)
|
port)
|
||||||
|
@ -462,15 +462,15 @@
|
||||||
:client-certificate certificate
|
:client-certificate certificate
|
||||||
:query query
|
:query query
|
||||||
:port port)
|
:port port)
|
||||||
(add-url-to-history specials:*message-window* actual-uri)
|
(add-url-to-history specials:*message-window* actual-iri)
|
||||||
(cond
|
(cond
|
||||||
((gemini-client:response-redirect-p status)
|
((gemini-client:response-redirect-p status)
|
||||||
(flet ((on-input-complete (maybe-accepted)
|
(flet ((on-input-complete (maybe-accepted)
|
||||||
(when (ui::boolean-input-accepted-p maybe-accepted)
|
(when (ui::boolean-input-accepted-p maybe-accepted)
|
||||||
(let ((new-url (gemini-parser:absolutize-link meta
|
(let ((new-url (gemini-parser:absolutize-link meta
|
||||||
(uri:host parsed-uri)
|
(uri:host parsed-iri)
|
||||||
(uri:port parsed-uri)
|
(uri:port parsed-iri)
|
||||||
(uri:path parsed-uri))))
|
(uri:path parsed-iri))))
|
||||||
(db-utils:with-ready-database (:connect nil)
|
(db-utils:with-ready-database (:connect nil)
|
||||||
(request new-url
|
(request new-url
|
||||||
:certificate-key certificate-key
|
:certificate-key certificate-key
|
||||||
|
@ -483,8 +483,8 @@
|
||||||
meta))))
|
meta))))
|
||||||
((gemini-client:response-certificate-requested-p status)
|
((gemini-client:response-certificate-requested-p status)
|
||||||
(multiple-value-bind (cached-certificate cached-key)
|
(multiple-value-bind (cached-certificate cached-key)
|
||||||
(fetch-cached-certificate actual-uri)
|
(fetch-cached-certificate actual-iri)
|
||||||
(request actual-uri
|
(request actual-iri
|
||||||
:enqueue enqueue
|
:enqueue enqueue
|
||||||
:do-nothing-if-exists-in-db do-nothing-if-exists-in-db
|
:do-nothing-if-exists-in-db do-nothing-if-exists-in-db
|
||||||
:certificate-key cached-key
|
:certificate-key cached-key
|
||||||
|
|
|
@ -276,8 +276,8 @@
|
||||||
(defun close-ssl-socket (socket)
|
(defun close-ssl-socket (socket)
|
||||||
(usocket:socket-close socket))
|
(usocket:socket-close socket))
|
||||||
|
|
||||||
(defun make-client-certificate (uri)
|
(defun make-client-certificate (iri)
|
||||||
(let* ((cache-id (db:cache-put uri +cache-tls-certificate-type+))
|
(let* ((cache-id (db:cache-put iri +cache-tls-certificate-type+))
|
||||||
(cert-dir (os-utils:cached-file-path (text-utils:to-s cache-id))))
|
(cert-dir (os-utils:cached-file-path (text-utils:to-s cache-id))))
|
||||||
(fs:make-directory cert-dir)
|
(fs:make-directory cert-dir)
|
||||||
(multiple-value-bind (certificate key)
|
(multiple-value-bind (certificate key)
|
||||||
|
@ -289,10 +289,10 @@
|
||||||
(port +gemini-default-port+)
|
(port +gemini-default-port+)
|
||||||
(client-certificate nil)
|
(client-certificate nil)
|
||||||
(certificate-key nil))
|
(certificate-key nil))
|
||||||
(let* ((uri (make-gemini-uri host path query port))
|
(let* ((iri (make-gemini-iri host path query port))
|
||||||
(ctx (cl+ssl:make-context :verify-mode cl+ssl:+ssl-verify-none+)))
|
(ctx (cl+ssl:make-context :verify-mode cl+ssl:+ssl-verify-none+)))
|
||||||
(when query
|
(when query
|
||||||
(setf uri (strcat uri "?" (percent-encode query))))
|
(setf iri (strcat iri "?" (percent-encode query))))
|
||||||
(cl+ssl:with-global-context (ctx :auto-free-p t)
|
(cl+ssl:with-global-context (ctx :auto-free-p t)
|
||||||
(let ((socket (usocket:socket-connect (idn:unicode->ascii host)
|
(let ((socket (usocket:socket-connect (idn:unicode->ascii host)
|
||||||
port
|
port
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
:unwrap-stream-p t
|
:unwrap-stream-p t
|
||||||
:verify nil
|
:verify nil
|
||||||
:hostname host))
|
:hostname host))
|
||||||
(request (format nil "~a~a~a" uri #\return #\newline))
|
(request (format nil "~a~a~a" iri #\return #\newline))
|
||||||
(cert-hash (crypto-shortcuts:sha512 (x509:dump-certificate ssl-stream))))
|
(cert-hash (crypto-shortcuts:sha512 (x509:dump-certificate ssl-stream))))
|
||||||
(if (not (db:tofu-passes-p host cert-hash))
|
(if (not (db:tofu-passes-p host cert-hash))
|
||||||
(error 'gemini-tofu-error :host host)
|
(error 'gemini-tofu-error :host host)
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
(path-last-dir original-path)
|
(path-last-dir original-path)
|
||||||
"/")
|
"/")
|
||||||
link-value))))
|
link-value))))
|
||||||
(make-gemini-uri original-host
|
(make-gemini-iri original-host
|
||||||
(uri:normalize-path path)
|
(uri:normalize-path path)
|
||||||
nil
|
nil
|
||||||
original-port)))
|
original-port)))
|
||||||
|
@ -189,20 +189,20 @@
|
||||||
(t
|
(t
|
||||||
(to-s (uri:normalize-path parsed))))))
|
(to-s (uri:normalize-path parsed))))))
|
||||||
|
|
||||||
(defun make-gemini-uri (host path &optional (query nil) (port +gemini-default-port+))
|
(defun make-gemini-iri (host path &optional (query nil) (port +gemini-default-port+))
|
||||||
(let* ((actual-path (if (string-starts-with-p "/" path)
|
(let* ((actual-path (if (string-starts-with-p "/" path)
|
||||||
(subseq path 1)
|
(subseq path 1)
|
||||||
path))
|
path))
|
||||||
(actual-port (if port
|
(actual-port (if port
|
||||||
(to-s port)
|
(to-s port)
|
||||||
(to-s +gemini-default-port+)))
|
(to-s +gemini-default-port+)))
|
||||||
(uri (strcat +gemini-scheme+ "://"
|
(iri (strcat +gemini-scheme+ "://"
|
||||||
host ":"
|
host ":"
|
||||||
actual-port "/"
|
actual-port "/"
|
||||||
actual-path)))
|
actual-path)))
|
||||||
(when query
|
(when query
|
||||||
(setf uri (strcat uri "?" query)))
|
(setf iri (strcat iri "?" query)))
|
||||||
uri))
|
iri))
|
||||||
|
|
||||||
(defun sexp->links (parsed-gemini original-host original-port original-path)
|
(defun sexp->links (parsed-gemini original-host original-port original-path)
|
||||||
(loop for node in parsed-gemini when (html-utils:tag= :a node) collect
|
(loop for node in parsed-gemini when (html-utils:tag= :a node) collect
|
||||||
|
@ -214,10 +214,10 @@
|
||||||
original-path)
|
original-path)
|
||||||
:name (tag-value node)))))
|
:name (tag-value node)))))
|
||||||
|
|
||||||
(defun gemini-link-uri-p (uri)
|
(defun gemini-link-iri-p (iri)
|
||||||
(conditions:with-default-on-error (nil)
|
(conditions:with-default-on-error (nil)
|
||||||
(or (text-utils:string-starts-with-p +gemini-scheme+ uri)
|
(or (text-utils:string-starts-with-p +gemini-scheme+ iri)
|
||||||
(null (uri:scheme (iri:iri-parse uri))))))
|
(null (uri:scheme (iri:iri-parse iri))))))
|
||||||
|
|
||||||
(defclass gemini-page-theme ()
|
(defclass gemini-page-theme ()
|
||||||
((link-prefix-gemini
|
((link-prefix-gemini
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
(trim text)
|
(trim text)
|
||||||
text)))
|
text)))
|
||||||
(linkify (link-name link-value)
|
(linkify (link-name link-value)
|
||||||
(if (gemini-link-uri-p link-value)
|
(if (gemini-link-iri-p link-value)
|
||||||
(format nil "~a~a~%" (link-prefix-gemini theme) link-name)
|
(format nil "~a~a~%" (link-prefix-gemini theme) link-name)
|
||||||
(format nil "~a~a~%" (link-prefix-other theme) link-name))))
|
(format nil "~a~a~%" (link-prefix-other theme) link-name))))
|
||||||
(with-output-to-string (stream)
|
(with-output-to-string (stream)
|
||||||
|
@ -378,9 +378,9 @@
|
||||||
+max-meta-length+))
|
+max-meta-length+))
|
||||||
parsed)))
|
parsed)))
|
||||||
|
|
||||||
(defun gemini-uri-p (maybe-uri)
|
(defun gemini-iri-p (maybe-iri)
|
||||||
(conditions:with-default-on-error (nil)
|
(conditions:with-default-on-error (nil)
|
||||||
(let ((parsed (iri:iri-parse maybe-uri)))
|
(let ((parsed (iri:iri-parse maybe-iri)))
|
||||||
(and parsed
|
(and parsed
|
||||||
(string-equal +gemini-scheme+
|
(string-equal +gemini-scheme+
|
||||||
(uri:scheme parsed))
|
(uri:scheme parsed))
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
:meta
|
:meta
|
||||||
:parse-gemini-file
|
:parse-gemini-file
|
||||||
:absolutize-link
|
:absolutize-link
|
||||||
:make-gemini-uri
|
:make-gemini-iri
|
||||||
:sexp->links
|
:sexp->links
|
||||||
:gemini-page-theme
|
:gemini-page-theme
|
||||||
:link-prefix-gemini
|
:link-prefix-gemini
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
:bullet-prefix
|
:bullet-prefix
|
||||||
:sexp->text
|
:sexp->text
|
||||||
:parse-gemini-response-header
|
:parse-gemini-response-header
|
||||||
:gemini-uri-p))
|
:gemini-iri-p))
|
||||||
|
|
||||||
(defpackage :gemini-client
|
(defpackage :gemini-client
|
||||||
(:use
|
(:use
|
||||||
|
|
|
@ -1212,7 +1212,7 @@
|
||||||
:followed-user-complete
|
:followed-user-complete
|
||||||
:tags-complete
|
:tags-complete
|
||||||
:conversation-folder
|
:conversation-folder
|
||||||
:make-complete-gemini-uri-fn
|
:make-complete-gemini-iri-fn
|
||||||
:complete-chat-message
|
:complete-chat-message
|
||||||
:complete-always-empty))
|
:complete-always-empty))
|
||||||
|
|
||||||
|
@ -2111,7 +2111,7 @@
|
||||||
:history-back
|
:history-back
|
||||||
:view-source
|
:view-source
|
||||||
:gemini-stream
|
:gemini-stream
|
||||||
:download-uri
|
:download-iri
|
||||||
:start-time
|
:start-time
|
||||||
:download-stream
|
:download-stream
|
||||||
:download-socket
|
:download-socket
|
||||||
|
|
|
@ -1014,13 +1014,13 @@
|
||||||
(windows:draw win))))))
|
(windows:draw win))))))
|
||||||
|
|
||||||
(defclass gemini-compact-lines-event (program-event)
|
(defclass gemini-compact-lines-event (program-event)
|
||||||
((download-uri
|
((download-iri
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :download-uri
|
:initarg :download-iri
|
||||||
:accessor download-uri)))
|
:accessor download-iri)))
|
||||||
|
|
||||||
(defmethod process-event ((object gemini-compact-lines-event))
|
(defmethod process-event ((object gemini-compact-lines-event))
|
||||||
(with-accessors ((download-uri download-uri)) object
|
(with-accessors ((download-iri download-iri)) object
|
||||||
(let ((all-lines "")
|
(let ((all-lines "")
|
||||||
(all-links ())
|
(all-links ())
|
||||||
(all-source "")
|
(all-source "")
|
||||||
|
@ -1034,8 +1034,8 @@
|
||||||
(text-rendering-theme gemini-client:text-rendering-theme))
|
(text-rendering-theme gemini-client:text-rendering-theme))
|
||||||
response
|
response
|
||||||
(when (and (typep a 'gemini-got-line-event)
|
(when (and (typep a 'gemini-got-line-event)
|
||||||
(string= download-uri
|
(string= download-iri
|
||||||
(gemini-viewer:download-uri wrapper-object))
|
(gemini-viewer:download-iri wrapper-object))
|
||||||
(gemini-viewer:downloading-allowed-p wrapper-object)
|
(gemini-viewer:downloading-allowed-p wrapper-object)
|
||||||
(not (skip-rendering-p a)))
|
(not (skip-rendering-p a)))
|
||||||
(let ((rendered-text (gemini-parser:sexp->text parsed-file
|
(let ((rendered-text (gemini-parser:sexp->text parsed-file
|
||||||
|
@ -1052,8 +1052,8 @@
|
||||||
(remove-event-if (lambda (a)
|
(remove-event-if (lambda (a)
|
||||||
(with-accessors ((wrapper-object wrapper-object)) a
|
(with-accessors ((wrapper-object wrapper-object)) a
|
||||||
(and (typep a 'gemini-got-line-event)
|
(and (typep a 'gemini-got-line-event)
|
||||||
(string= download-uri
|
(string= download-iri
|
||||||
(gemini-viewer:download-uri wrapper-object))))))
|
(gemini-viewer:download-iri wrapper-object))))))
|
||||||
(let* ((win specials:*message-window*))
|
(let* ((win specials:*message-window*))
|
||||||
(setf (windows:keybindings win)
|
(setf (windows:keybindings win)
|
||||||
keybindings:*gemini-message-keymap*)
|
keybindings:*gemini-message-keymap*)
|
||||||
|
@ -1063,13 +1063,13 @@
|
||||||
(defclass gemini-abort-downloading-event (program-event) ())
|
(defclass gemini-abort-downloading-event (program-event) ())
|
||||||
|
|
||||||
(defmethod process-event ((object gemini-abort-downloading-event))
|
(defmethod process-event ((object gemini-abort-downloading-event))
|
||||||
(with-accessors ((uri payload)) object
|
(with-accessors ((iri payload)) object
|
||||||
(when-let ((stream-object (gemini-viewer:find-db-stream-url uri)))
|
(when-let ((stream-object (gemini-viewer:find-db-stream-url iri)))
|
||||||
(gemini-viewer:abort-downloading stream-object)
|
(gemini-viewer:abort-downloading stream-object)
|
||||||
(gemini-viewer:remove-db-stream stream-object)
|
(gemini-viewer:remove-db-stream stream-object)
|
||||||
(remove-event-if (lambda (a)
|
(remove-event-if (lambda (a)
|
||||||
(and (typep a 'gemini-got-line-event)
|
(and (typep a 'gemini-got-line-event)
|
||||||
(string= uri (gemini-viewer:download-uri stream-object)))))
|
(string= iri (gemini-viewer:download-iri stream-object)))))
|
||||||
(line-oriented-window:resync-rows-db specials:*gemini-streams-window*))))
|
(line-oriented-window:resync-rows-db specials:*gemini-streams-window*))))
|
||||||
|
|
||||||
(defclass gemini-abort-all-downloading-event (program-event) ())
|
(defclass gemini-abort-all-downloading-event (program-event) ())
|
||||||
|
|
|
@ -1693,7 +1693,7 @@ mot recent updated to least recent"
|
||||||
(defun open-gemini-address ()
|
(defun open-gemini-address ()
|
||||||
"Ask for a gemini address and try to load it"
|
"Ask for a gemini address and try to load it"
|
||||||
(flet ((on-input-complete (url)
|
(flet ((on-input-complete (url)
|
||||||
(if (gemini-parser:gemini-uri-p url)
|
(if (gemini-parser:gemini-iri-p url)
|
||||||
(let* ((event (make-instance 'gemini-request-event
|
(let* ((event (make-instance 'gemini-request-event
|
||||||
:priority
|
:priority
|
||||||
program-events:+maximum-event-priority+
|
program-events:+maximum-event-priority+
|
||||||
|
@ -1704,7 +1704,7 @@ mot recent updated to least recent"
|
||||||
(let ((prompt (_ "Open Gemini url: ")))
|
(let ((prompt (_ "Open Gemini url: ")))
|
||||||
(ask-string-input #'on-input-complete
|
(ask-string-input #'on-input-complete
|
||||||
:prompt prompt
|
:prompt prompt
|
||||||
:complete-fn (complete:make-complete-gemini-uri-fn prompt)))))
|
:complete-fn (complete:make-complete-gemini-iri-fn prompt)))))
|
||||||
|
|
||||||
(defun gemini-history-back ()
|
(defun gemini-history-back ()
|
||||||
"Reopen a previous visited gemini address"
|
"Reopen a previous visited gemini address"
|
||||||
|
@ -1717,9 +1717,9 @@ mot recent updated to least recent"
|
||||||
(defun gemini-abort-download ()
|
(defun gemini-abort-download ()
|
||||||
"Stop a transferring data from a gemini server"
|
"Stop a transferring data from a gemini server"
|
||||||
(when-let* ((fields (line-oriented-window:selected-row-fields *gemini-streams-window*))
|
(when-let* ((fields (line-oriented-window:selected-row-fields *gemini-streams-window*))
|
||||||
(uri-to-abort (gemini-viewer:download-uri fields))
|
(iri-to-abort (gemini-viewer:download-iri fields))
|
||||||
(event (make-instance 'gemini-abort-downloading-event
|
(event (make-instance 'gemini-abort-downloading-event
|
||||||
:payload uri-to-abort
|
:payload iri-to-abort
|
||||||
:priority program-events:+maximum-event-priority+)))
|
:priority program-events:+maximum-event-priority+)))
|
||||||
(push-event event)))
|
(push-event event)))
|
||||||
|
|
||||||
|
@ -1749,5 +1749,5 @@ mot recent updated to least recent"
|
||||||
(defun gemini-streams-window-open-stream ()
|
(defun gemini-streams-window-open-stream ()
|
||||||
"Open the selected stream."
|
"Open the selected stream."
|
||||||
(when-let* ((fields (line-oriented-window:selected-row-fields *gemini-streams-window*))
|
(when-let* ((fields (line-oriented-window:selected-row-fields *gemini-streams-window*))
|
||||||
(uri-to-open (gemini-viewer:download-uri fields)))
|
(iri-to-open (gemini-viewer:download-iri fields)))
|
||||||
(gemini-viewer:db-entry-to-foreground uri-to-open)))
|
(gemini-viewer:db-entry-to-foreground iri-to-open)))
|
||||||
|
|
Loading…
Reference in New Issue