|
|
@@ -133,17 +133,17 @@
|
|
|
|
|
|
(defmacro with-user ((info) &body body)
|
|
|
(with-gensyms (auth bearer)
|
|
|
- `(let* ((,auth (gethash "authorization" (getf myway:*env* :headers)))
|
|
|
+ `(let* ((,auth (ignore-errors (gethash "authorization" (getf myway:*env* :headers))))
|
|
|
(,bearer (when (and ,auth
|
|
|
(> (length (the string ,auth)) 7)
|
|
|
(equal "Bearer " (subseq (the string ,auth) 0 7)))
|
|
|
(subseq (the string ,auth) 7)))
|
|
|
(,info (when ,bearer (gethash ,bearer (server-token-user *server*)))))
|
|
|
- (when (and (not ,info)
|
|
|
+ (when (and (null ,info)
|
|
|
(equal (getf myway:*env* :remote-addr) "127.0.0.1"))
|
|
|
- (setf ,info `(:|username| "admin" :|id| 0 :|first_name| "cli" :|last_name| "admin"))
|
|
|
- (if ,info (progn ,@body)
|
|
|
- +401+)))))
|
|
|
+ (setf ,info `(:|username| "admin" :|id| 0 :|first_name| "cli" :|last_name| "admin")))
|
|
|
+ (if ,info (handler-case (progn ,@body) (error (e) (log:error e) (print e)))
|
|
|
+ +401+))))
|
|
|
|
|
|
(defun get-category-list (params)
|
|
|
(declare #.*standard-optimize-settings* (ignore params))
|
|
|
@@ -188,7 +188,7 @@
|
|
|
(lambda (params)
|
|
|
(declare #.*standard-optimize-settings*)
|
|
|
(let ((file (probe-file (cl-fad:merge-pathnames-as-file
|
|
|
- root (car (getf params :splat))))))
|
|
|
+ root (uiop:parse-unix-namestring (car (getf params :splat)))))))
|
|
|
(if file (list 200 nil file) +404+))))
|
|
|
|
|
|
;; Admin tools
|