mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-17 08:10:36 +01:00
- removed 'uri-' prefix from 'uri' slots names.
This commit is contained in:
parent
13fdc439a8
commit
62394d319a
@ -371,10 +371,10 @@
|
|||||||
(ui:error-message (format nil
|
(ui:error-message (format nil
|
||||||
(_ "Could not understand the address ~s")
|
(_ "Could not understand the address ~s")
|
||||||
url))
|
url))
|
||||||
(let* ((host (uri:uri-host parsed-uri))
|
(let* ((host (uri:host parsed-uri))
|
||||||
(path (uri:uri-path parsed-uri))
|
(path (uri:path parsed-uri))
|
||||||
(query (uri:uri-query parsed-uri))
|
(query (uri:query parsed-uri))
|
||||||
(port (or (uri:uri-port parsed-uri)
|
(port (or (uri:port parsed-uri)
|
||||||
gemini-client:+gemini-default-port+))
|
gemini-client:+gemini-default-port+))
|
||||||
(actual-uri (gemini-parser:make-gemini-uri host
|
(actual-uri (gemini-parser:make-gemini-uri host
|
||||||
path
|
path
|
||||||
@ -435,9 +435,9 @@
|
|||||||
(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:uri-host parsed-uri)
|
(uri:host parsed-uri)
|
||||||
(uri:uri-port parsed-uri)
|
(uri:port parsed-uri)
|
||||||
(uri:uri-path parsed-uri))))
|
(uri:path parsed-uri))))
|
||||||
(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
|
||||||
|
@ -171,7 +171,7 @@
|
|||||||
(let ((parsed (or (ignore-errors (uri:uri-parse link-value))
|
(let ((parsed (or (ignore-errors (uri:uri-parse link-value))
|
||||||
(uri:make-uri nil nil nil nil link-value nil nil))))
|
(uri:make-uri nil nil nil nil link-value nil nil))))
|
||||||
(cond
|
(cond
|
||||||
((null (uri:uri-host parsed))
|
((null (uri:host parsed))
|
||||||
(let* ((absolute-path-p (string-starts-with-p "/" link-value))
|
(let* ((absolute-path-p (string-starts-with-p "/" link-value))
|
||||||
(path (if absolute-path-p
|
(path (if absolute-path-p
|
||||||
link-value
|
link-value
|
||||||
@ -183,7 +183,7 @@
|
|||||||
(uri:normalize-path path)
|
(uri:normalize-path path)
|
||||||
nil
|
nil
|
||||||
original-port)))
|
original-port)))
|
||||||
((null (uri:uri-scheme parsed))
|
((null (uri:scheme parsed))
|
||||||
(strcat +gemini-scheme+ ":"
|
(strcat +gemini-scheme+ ":"
|
||||||
(to-s (uri:normalize-path parsed))))
|
(to-s (uri:normalize-path parsed))))
|
||||||
(t
|
(t
|
||||||
@ -217,7 +217,7 @@
|
|||||||
(defun gemini-link-uri-p (uri)
|
(defun gemini-link-uri-p (uri)
|
||||||
(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+ uri)
|
||||||
(null (uri:uri-scheme (uri:uri-parse uri))))))
|
(null (uri:scheme (uri:uri-parse uri))))))
|
||||||
|
|
||||||
(defclass gemini-page-theme ()
|
(defclass gemini-page-theme ()
|
||||||
((link-prefix-gemini
|
((link-prefix-gemini
|
||||||
@ -383,5 +383,5 @@
|
|||||||
(let ((parsed (uri:uri-parse maybe-uri)))
|
(let ((parsed (uri:uri-parse maybe-uri)))
|
||||||
(and parsed
|
(and parsed
|
||||||
(string-equal +gemini-scheme+
|
(string-equal +gemini-scheme+
|
||||||
(uri:uri-scheme parsed))
|
(uri:scheme parsed))
|
||||||
(uri:uri-host parsed)))))
|
(uri:host parsed)))))
|
||||||
|
@ -215,8 +215,8 @@
|
|||||||
|
|
||||||
(defclass iri (uri-parser:uri) ())
|
(defclass iri (uri-parser:uri) ())
|
||||||
|
|
||||||
(defmethod uri-parser:uri-host ((object iri))
|
(defmethod uri-parser:host ((object iri))
|
||||||
(let ((host (slot-value object 'uri-host)))
|
(let ((host (slot-value object 'host)))
|
||||||
(if (text-utils:string-starts-with-p "[" host)
|
(if (text-utils:string-starts-with-p "[" host)
|
||||||
(subseq host 1 (1- (length host)))
|
(subseq host 1 (1- (length host)))
|
||||||
host)))
|
host)))
|
||||||
@ -250,13 +250,13 @@
|
|||||||
res)))
|
res)))
|
||||||
|
|
||||||
(defun copy-iri (from)
|
(defun copy-iri (from)
|
||||||
(let ((scheme (uri:uri-scheme from))
|
(let ((scheme (uri:scheme from))
|
||||||
(user-info (uri:uri-user-info from))
|
(user-info (uri:user-info from))
|
||||||
(host (slot-value from 'uri:uri-host))
|
(host (slot-value from 'uri:host))
|
||||||
(port (uri:uri-port from))
|
(port (uri:port from))
|
||||||
(path (uri:uri-path from))
|
(path (uri:path from))
|
||||||
(query (uri:uri-query from))
|
(query (uri:query from))
|
||||||
(fragment (uri:uri-fragment from)))
|
(fragment (uri:fragment from)))
|
||||||
(make-iri scheme
|
(make-iri scheme
|
||||||
user-info
|
user-info
|
||||||
host
|
host
|
||||||
@ -268,13 +268,13 @@
|
|||||||
(defun render-iri (iri &optional (stream *standard-output*))
|
(defun render-iri (iri &optional (stream *standard-output*))
|
||||||
(flet ((render ()
|
(flet ((render ()
|
||||||
(with-output-to-string (string-stream)
|
(with-output-to-string (string-stream)
|
||||||
(let ((scheme (uri:uri-scheme iri))
|
(let ((scheme (uri:scheme iri))
|
||||||
(user-info (uri:uri-user-info iri))
|
(user-info (uri:user-info iri))
|
||||||
(host (slot-value iri 'uri-host))
|
(host (slot-value iri 'host))
|
||||||
(port (uri:uri-port iri))
|
(port (uri:port iri))
|
||||||
(path (uri:uri-path iri))
|
(path (uri:path iri))
|
||||||
(query (uri:uri-query iri))
|
(query (uri:query iri))
|
||||||
(fragment (uri:uri-fragment iri)))
|
(fragment (uri:fragment iri)))
|
||||||
(when scheme
|
(when scheme
|
||||||
(format string-stream "~a:" scheme))
|
(format string-stream "~a:" scheme))
|
||||||
(write-string "//" string-stream)
|
(write-string "//" string-stream)
|
||||||
|
@ -628,15 +628,14 @@
|
|||||||
:uri
|
:uri
|
||||||
:copy-uri
|
:copy-uri
|
||||||
:render-uri
|
:render-uri
|
||||||
:uri-p
|
|
||||||
:uri-parse
|
:uri-parse
|
||||||
:uri-scheme
|
:scheme
|
||||||
:uri-user-info
|
:user-info
|
||||||
:uri-host
|
:host
|
||||||
:uri-port
|
:port
|
||||||
:uri-path
|
:path
|
||||||
:uri-query
|
:query
|
||||||
:uri-fragment
|
:fragment
|
||||||
:normalize-path
|
:normalize-path
|
||||||
:make-uri))
|
:make-uri))
|
||||||
|
|
||||||
|
@ -189,39 +189,39 @@
|
|||||||
(defrule uri-reference (or uri relative-ref))
|
(defrule uri-reference (or uri relative-ref))
|
||||||
|
|
||||||
(defclass uri ()
|
(defclass uri ()
|
||||||
((uri-scheme
|
((scheme
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :scheme
|
:initarg :scheme
|
||||||
:accessor uri-scheme)
|
:accessor scheme)
|
||||||
(uri-user-info
|
(user-info
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :user-info
|
:initarg :user-info
|
||||||
:accessor uri-user-info)
|
:accessor user-info)
|
||||||
(uri-host
|
(host
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :host
|
:initarg :host
|
||||||
:writer (setf uri-scheme))
|
:writer (setf host))
|
||||||
(uri-port
|
(port
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :port
|
:initarg :port
|
||||||
:accessor uri-port)
|
:accessor port)
|
||||||
(uri-path
|
(path
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :path
|
:initarg :path
|
||||||
:accessor uri-path)
|
:accessor path)
|
||||||
(uri-query
|
(query
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :query
|
:initarg :query
|
||||||
:accessor uri-query)
|
:accessor query)
|
||||||
(uri-fragment
|
(fragment
|
||||||
:initform nil
|
:initform nil
|
||||||
:initarg :fragment
|
:initarg :fragment
|
||||||
:accessor uri-fragment)))
|
:accessor fragment)))
|
||||||
|
|
||||||
(defgeneric uri-host (object))
|
(defgeneric host (object))
|
||||||
|
|
||||||
(defmethod uri-host ((object uri))
|
(defmethod host ((object uri))
|
||||||
(let ((host (slot-value object 'uri-host)))
|
(let ((host (slot-value object 'host)))
|
||||||
(if (text-utils:string-starts-with-p "[" host)
|
(if (text-utils:string-starts-with-p "[" host)
|
||||||
(subseq host 1 (1- (length host)))
|
(subseq host 1 (1- (length host)))
|
||||||
host)))
|
host)))
|
||||||
@ -255,13 +255,13 @@
|
|||||||
res)))
|
res)))
|
||||||
|
|
||||||
(defun copy-uri (from)
|
(defun copy-uri (from)
|
||||||
(let ((scheme (uri-scheme from))
|
(let ((scheme (scheme from))
|
||||||
(user-info (uri-user-info from))
|
(user-info (user-info from))
|
||||||
(host (slot-value from 'uri-host))
|
(host (slot-value from 'host))
|
||||||
(port (uri-port from))
|
(port (port from))
|
||||||
(path (uri-path from))
|
(path (path from))
|
||||||
(query (uri-query from))
|
(query (query from))
|
||||||
(fragment (uri-fragment from)))
|
(fragment (fragment from)))
|
||||||
(make-uri scheme
|
(make-uri scheme
|
||||||
user-info
|
user-info
|
||||||
host
|
host
|
||||||
@ -273,13 +273,13 @@
|
|||||||
(defun render-uri (uri &optional (stream *standard-output*))
|
(defun render-uri (uri &optional (stream *standard-output*))
|
||||||
(flet ((render ()
|
(flet ((render ()
|
||||||
(with-output-to-string (string-stream)
|
(with-output-to-string (string-stream)
|
||||||
(let ((scheme (uri-scheme uri))
|
(let ((scheme (scheme uri))
|
||||||
(user-info (uri-user-info uri))
|
(user-info (user-info uri))
|
||||||
(host (slot-value uri 'uri-host))
|
(host (slot-value uri 'host))
|
||||||
(port (uri-port uri))
|
(port (port uri))
|
||||||
(path (uri-path uri))
|
(path (path uri))
|
||||||
(query (uri-query uri))
|
(query (query uri))
|
||||||
(fragment (uri-fragment uri)))
|
(fragment (fragment uri)))
|
||||||
(when scheme
|
(when scheme
|
||||||
(format string-stream "~a:" scheme))
|
(format string-stream "~a:" scheme))
|
||||||
(write-string "//" string-stream)
|
(write-string "//" string-stream)
|
||||||
@ -299,10 +299,10 @@
|
|||||||
|
|
||||||
|
|
||||||
(defmethod normalize-path ((object uri:uri))
|
(defmethod normalize-path ((object uri:uri))
|
||||||
(let ((clean-path (normalize-path (uri:uri-path object)))
|
(let ((clean-path (normalize-path (uri:path object)))
|
||||||
(copy (uri:copy-uri object)))
|
(copy (uri:copy-uri object)))
|
||||||
(when clean-path
|
(when clean-path
|
||||||
(setf (uri:uri-path copy) clean-path))
|
(setf (uri:path copy) clean-path))
|
||||||
copy))
|
copy))
|
||||||
|
|
||||||
(defgeneric normalize-path (object))
|
(defgeneric normalize-path (object))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user