rewrote string-manipulation code to use str funcs

This commit is contained in:
a. fox 2023-11-17 14:30:22 -05:00
parent 5d9b4a4e22
commit 0b146a0cbc
2 changed files with 7 additions and 11 deletions

View File

@ -26,7 +26,7 @@
(defmacro quit-with-message (code message &rest args)
`(progn
(format t (concatenate 'string ,message "~&") ,@args)
(format t (str:concat ,message "~&") ,@args)
(uiop:quit ,code)))
(defmacro handle-user-abort (form &rest extra-cases)

View File

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