2022-12-30 11:07:30 +01:00
|
|
|
;; tinmop: an humble gemini and pleroma client
|
|
|
|
;; Copyright (C) 2022 cage
|
|
|
|
|
|
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program.
|
|
|
|
;; If not, see [[http://www.gnu.org/licenses/][http://www.gnu.org/licenses/]].
|
|
|
|
|
|
|
|
(in-package :json-rpc-communication)
|
|
|
|
|
|
|
|
(defun make-rpc-parameters (&rest params)
|
|
|
|
(loop for (a b) on params by 'cddr collect (cons a b)))
|
|
|
|
|
|
|
|
(defmacro gen-rpc (public-function-name function-symbol &rest parameters)
|
|
|
|
`(rpc:register-function ,public-function-name
|
|
|
|
,function-symbol
|
|
|
|
(make-rpc-parameters ,@parameters)))
|
|
|
|
|
2023-01-13 15:34:01 +01:00
|
|
|
(defun quit-program ()
|
|
|
|
(fs:clean-temporary-directories)
|
|
|
|
(fs:clean-temporary-files)
|
|
|
|
(db-utils:close-db)
|
2023-02-10 12:57:08 +01:00
|
|
|
(stop-server))
|
2023-01-13 15:34:01 +01:00
|
|
|
|
2022-12-30 11:07:30 +01:00
|
|
|
(defmacro prepare-rpc (&body body)
|
|
|
|
`(let ((rpc:*function-db* '()))
|
|
|
|
(gen-rpc "add"
|
|
|
|
'+
|
|
|
|
"a" 0
|
|
|
|
"b" 1)
|
|
|
|
(gen-rpc "complete-net-address"
|
|
|
|
'complete-net-address
|
|
|
|
"hint" 0)
|
|
|
|
(gen-rpc "gemini-request"
|
|
|
|
'gemini-request
|
|
|
|
"iri" 0
|
|
|
|
"use-cache" 1)
|
|
|
|
(gen-rpc "gemini-stream-info"
|
|
|
|
'gemini-stream-info
|
|
|
|
"iri" 0)
|
2023-01-01 18:31:27 +01:00
|
|
|
(gen-rpc "gemini-stream-parsed-line"
|
|
|
|
'gemini-stream-parsed-line
|
|
|
|
"iri" 0
|
|
|
|
"line-number" 1)
|
2023-01-06 11:56:21 +01:00
|
|
|
(gen-rpc "gemini-stream-parsed-line-slice"
|
|
|
|
'gemini-stream-parsed-line-slice
|
|
|
|
"iri" 0
|
|
|
|
"line-number-start" 1
|
|
|
|
"line-number-end" 2)
|
2023-01-06 13:50:33 +01:00
|
|
|
(gen-rpc "gemini-all-stream-info" 'gemini-all-stream-info)
|
2023-02-05 14:07:13 +01:00
|
|
|
(gen-rpc "gemini-stream-status"
|
|
|
|
'gemini-stream-status
|
|
|
|
"iri" 0)
|
2023-03-29 18:13:46 +02:00
|
|
|
(gen-rpc "gemini-remove-stream"
|
|
|
|
'gemini-remove-stream
|
|
|
|
"iri" 0)
|
2023-02-05 14:07:13 +01:00
|
|
|
(gen-rpc "gemini-stream-completed-p"
|
|
|
|
'gemini-stream-completed-p
|
|
|
|
"iri" 0)
|
2023-01-06 13:50:33 +01:00
|
|
|
(gen-rpc "gemini-current-url" 'gemini-current-url)
|
|
|
|
(gen-rpc "gemini-pop-url-from-history" 'gemini-pop-url-from-history)
|
2023-01-12 16:08:10 +01:00
|
|
|
(gen-rpc "gemini-certificates" 'gemini-certificates)
|
|
|
|
(gen-rpc "gemini-delete-certificate"
|
|
|
|
'gemini-delete-certificate
|
|
|
|
"cache-key" 0)
|
2023-03-24 10:46:54 +01:00
|
|
|
(gen-rpc "gemini-import-certificate"
|
|
|
|
'gemini-import-certificate
|
|
|
|
"uri" 0
|
|
|
|
"cert-file" 1
|
|
|
|
"key-file" 2)
|
2023-03-18 20:27:24 +01:00
|
|
|
(gen-rpc "gemini-table-of-contents"
|
2023-01-15 15:54:49 +01:00
|
|
|
'gemini-table-of-contents
|
2023-03-18 20:27:24 +01:00
|
|
|
"iri" 0
|
|
|
|
"width" 1)
|
2023-03-06 18:38:46 +01:00
|
|
|
(gen-rpc "gemini-parse-local-file"
|
|
|
|
'gemini-parse-local-file
|
|
|
|
"path" 0)
|
2023-03-12 15:36:13 +01:00
|
|
|
(gen-rpc "gemini-parse-string"
|
|
|
|
'gemini-parse-string
|
|
|
|
"string" 0)
|
|
|
|
(gen-rpc "make-error-page"
|
|
|
|
'make-error-page
|
|
|
|
"iri" 0
|
|
|
|
"code" 1
|
|
|
|
"description" 2
|
|
|
|
"meta" 3)
|
2023-03-06 18:38:46 +01:00
|
|
|
(gen-rpc "gemini-slurp-local-file"
|
|
|
|
'gemini-slurp-local-file
|
|
|
|
"path" 0)
|
2023-01-12 16:08:10 +01:00
|
|
|
(gen-rpc "tour-shuffle" 'tour-shuffle)
|
|
|
|
(gen-rpc "tour-add-link"
|
|
|
|
'tour-add-link
|
|
|
|
"link-value" 0
|
|
|
|
"link-label" 1)
|
|
|
|
(gen-rpc "tour-pop-link" 'tour-pop-link)
|
|
|
|
(gen-rpc "tour-delete-link"
|
|
|
|
'tour-delete-link
|
2023-04-06 15:06:31 +02:00
|
|
|
"iri" 0)
|
2023-01-13 15:34:01 +01:00
|
|
|
(gen-rpc "clear-tour" 'clear-tour)
|
2023-04-06 15:06:31 +02:00
|
|
|
(gen-rpc "iri-to-parent-path" 'iri-to-parent-path "iri" 0)
|
2023-01-13 15:34:01 +01:00
|
|
|
(gen-rpc "quit-program" 'quit-program)
|
2022-12-30 11:07:30 +01:00
|
|
|
,@body))
|