Innokentiy Enikeev 4 éve
szülő
commit
bafc2314f1
2 módosított fájl, 11 hozzáadás és 6 törlés
  1. 6 6
      back/server.lisp
  2. 5 0
      web/src/index.js

+ 6 - 6
back/server.lisp

@@ -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

+ 5 - 0
web/src/index.js

@@ -15,3 +15,8 @@ ReactDOM.render(
 // to log results (for example: reportWebVitals(console.log))
 // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
 reportWebVitals();
+if ('serviceWorker' in navigator) {
+    navigator.serviceWorker.ready.then(registration => {
+	registration.unregister();
+    });
+}