|
|
|
@ -6,18 +6,14 @@
|
|
|
|
(declaim (inline json-request format-url generate-authorization download-media
|
|
|
|
(declaim (inline json-request format-url generate-authorization download-media
|
|
|
|
format-hostname)))
|
|
|
|
format-hostname)))
|
|
|
|
|
|
|
|
|
|
|
|
(defun format-hostname ()
|
|
|
|
|
|
|
|
(if (uiop:string-suffix-p (uiop:hostname) ".local")
|
|
|
|
|
|
|
|
(subseq (uiop:hostname) 0 (- (length (uiop:hostname)) 6))
|
|
|
|
|
|
|
|
(uiop:hostname)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun generate-authorization (&optional token)
|
|
|
|
(defun generate-authorization (&optional token)
|
|
|
|
"generates a properly formatted authorization header"
|
|
|
|
"generates a properly formatted authorization header"
|
|
|
|
|
|
|
|
(let ((hostname (str:replace-first ".local" "" (uiop:hostname))))
|
|
|
|
(apply #'format `(nil ,*authorization-format*
|
|
|
|
(apply #'format `(nil ,*authorization-format*
|
|
|
|
,@(mapcar #'url-encode
|
|
|
|
,@(mapcar #'url-encode
|
|
|
|
(list (concatenate 'string "Seanut " (seanut-version))
|
|
|
|
(list (str:concat "Seanut " (seanut-version))
|
|
|
|
(format-hostname) (string-downcase (md5-string (format-hostname)))
|
|
|
|
hostname (string-downcase (md5-string hostname))
|
|
|
|
(seanut-version) (or token ""))))))
|
|
|
|
(seanut-version) (or token "")))))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun format-url (domain slug &rest args)
|
|
|
|
(defun format-url (domain slug &rest args)
|
|
|
|
"formats DOMAIN into a url, ensures we include the url scheme
|
|
|
|
"formats DOMAIN into a url, ensures we include the url scheme
|
|
|
|
|