mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-09 07:18:39 +01:00
- added link to the search results page that leads to the matching posts.
This commit is contained in:
parent
32de4f5bd4
commit
6d07aacbe1
@ -181,6 +181,8 @@ General Public License for more details."
|
||||
|
||||
(define-constant +internal-scheme-view-source+ "view-source" :test #'string=)
|
||||
|
||||
(define-constant +internal-scheme-local-posts+ "fediverse-virtual-path" :test #'string=)
|
||||
|
||||
(define-constant +fediverse-account-name-server-separator+ "@" :test #'string=)
|
||||
|
||||
(define-constant +language-codes+ '("ab"
|
||||
|
@ -77,12 +77,35 @@
|
||||
(draw *open-message-link-window*)
|
||||
*open-message-link-window*))
|
||||
|
||||
(defun parse-fediverse-virtual-iri (iri)
|
||||
(let ((parsed-iri (iri:iri-parse iri)))
|
||||
(if (string= (uri:scheme parsed-iri)
|
||||
+internal-scheme-local-posts+)
|
||||
(values (uri:host parsed-iri)
|
||||
(text-utils:trim-blanks (uri:path parsed-iri)
|
||||
'(#\/)))
|
||||
(error (_ "address ~a ias not a valid virtual path for fediverse folders")
|
||||
iri))))
|
||||
|
||||
(defun fediverse-virtual-iri-p (iri)
|
||||
(let ((parsed-iri (iri:iri-parse iri)))
|
||||
(string= (uri:scheme parsed-iri)
|
||||
+internal-scheme-local-posts+)))
|
||||
|
||||
(defun open-message-link (url enqueue)
|
||||
(tui-utils:with-notify-errors
|
||||
(if (text-utils:string-starts-with-p gopher-parser:+gopher-scheme+ url)
|
||||
(cond
|
||||
((text-utils:string-starts-with-p gopher-parser:+gopher-scheme+ url)
|
||||
(multiple-value-bind (host port type selector)
|
||||
(gopher-parser:parse-iri url)
|
||||
(gopher-window::make-request host port type selector))
|
||||
(gopher-window::make-request host port type selector)))
|
||||
((fediverse-virtual-iri-p url)
|
||||
(multiple-value-bind (timeline folder)
|
||||
(parse-fediverse-virtual-iri url)
|
||||
(program-events:push-event (make-instance 'program-events:refresh-thread-windows-event
|
||||
:new-timeline timeline
|
||||
:new-folder folder))))
|
||||
(t
|
||||
(let ((decoded-path (if (percent-encoded-p url)
|
||||
(percent-decode url)
|
||||
url)))
|
||||
@ -134,7 +157,7 @@
|
||||
((fs:dirp decoded-path)
|
||||
(ui:open-file-explorer decoded-path))
|
||||
(t
|
||||
(os-utils:open-resource-with-external-program decoded-path nil)))))))
|
||||
(os-utils:open-resource-with-external-program decoded-path nil))))))))
|
||||
|
||||
(defclass open-links-window ()
|
||||
((links
|
||||
|
@ -78,6 +78,7 @@
|
||||
:+internal-path-bookmark+
|
||||
:+internal-path-gemlogs+
|
||||
:+internal-scheme-view-source+
|
||||
:+internal-scheme-local-posts+
|
||||
:+fediverse-account-name-server-separator+
|
||||
:+language-codes+
|
||||
;; GUI
|
||||
|
@ -1978,11 +1978,18 @@
|
||||
(let ((line (text-utils:join-with-strings* " "
|
||||
(tooter:url result)
|
||||
(funcall name-fn result))))
|
||||
(format str "~a~%" (gemini-parser:geminize-link line))))))))
|
||||
(format str "~a~%" (gemini-parser:geminize-link line)))))))
|
||||
(link-to-search-results (folder)
|
||||
(format nil
|
||||
"~a://~a/~a"
|
||||
+internal-scheme-local-posts+
|
||||
db:+home-timeline+
|
||||
folder)))
|
||||
(with-accessors ((payload payload)) object
|
||||
(let* ((found-statuses (api-client:find-results payload))
|
||||
(found-hashtags (get-results-info payload "hashtags" 2 #'tooter:name))
|
||||
(found-accounts (get-results-info payload "accounts" 1 #'tooter:username))
|
||||
(link-to-results (gemini-parser:geminize-link (link-to-search-results (query-results-folder-name))))
|
||||
(query-page (text-utils:strcat (gemini-parser:geminize-h1 (format nil
|
||||
(_ "Query results~2%")))
|
||||
(format nil
|
||||
@ -1991,6 +1998,8 @@
|
||||
(length found-statuses))
|
||||
(length found-statuses)
|
||||
(query-results-folder-name))
|
||||
link-to-results
|
||||
(format nil "~%")
|
||||
(gemini-parser:geminize-h2 (format nil
|
||||
(_ "Query: ~a~2%")
|
||||
payload))
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
(in-package :scheduled-events)
|
||||
|
||||
(define-constant +refresh-all-chats-data-frequency+ 10000 :test #'=)
|
||||
(define-constant +refresh-all-chats-data-frequency+ 50000 :test #'=)
|
||||
|
||||
(define-constant +refresh-all-chats-messages-frequency+ 50 :test #'=)
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
(define-constant +purge-gemlog-entries-frequency+ 30000 :test #'=)
|
||||
|
||||
(define-constant +announcements-check-frequency+ 10000 :test #'=)
|
||||
(define-constant +announcements-check-frequency+ 50000 :test #'=)
|
||||
|
||||
(defun triggedp (ticks frequency)
|
||||
(= (rem ticks frequency)
|
||||
|
@ -715,7 +715,12 @@ printed in the box column by column; in the example above the results are:
|
||||
(defmethod lines->uri ((object null))
|
||||
object)
|
||||
|
||||
(defun collect-links (text &optional (schemes '("http" "https" "ftp" "gemini" "gopher")))
|
||||
(defun collect-links (text &optional (schemes (list "http"
|
||||
"https"
|
||||
"ftp"
|
||||
"gemini"
|
||||
"gopher"
|
||||
constants:+internal-scheme-local-posts+)))
|
||||
"Collect all hyperlinks in a text marked from a list of valid `schemes'"
|
||||
(flet ((build-re-scheme ()
|
||||
(let ((res ""))
|
||||
|
Loading…
x
Reference in New Issue
Block a user