1
0
Fork 0
tinmop/src/gui/server/public-api-gemini-certifica...

40 lines
1.5 KiB
Common Lisp

;; 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)
(defclass gemini-certificates (box) ())
(defmethod yason:encode ((object gemini-certificates) &optional (stream *standard-output*))
(let ((json:*symbol-encoder* #'json:encode-symbol-as-lowercase)
(yason:*list-encoder* #'yason:encode-plist)
(json:*symbol-key-encoder* #'json:encode-symbol-as-lowercase))
(yason:with-output (stream)
(yason:with-array ()
(loop for certificate in (unbox object) do
(yason:encode-array-element certificate))))))
(defun gemini-certificates ()
(make-instance 'gemini-certificates :contents (db:find-tls-certificates-rows)))
(defun invalidate-cached-value (cache-key)
(db:cache-invalidate cache-key)
t)
(defun gemini-delete-certificate (cache-key)
(invalidate-cached-value cache-key))