From 39ff5175ef610b59cfe8266b5686a95d285a216c Mon Sep 17 00:00:00 2001 From: David Botton Date: Wed, 30 Dec 2020 20:38:09 -0500 Subject: [PATCH] Add support to encode call back messages --- clog-window.lisp | 12 ++++++------ clog.asd | 2 +- doc/clog-manual.html | 10 +++++++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/clog-window.lisp b/clog-window.lisp index 2c75266..ffe9bc4 100644 --- a/clog-window.lisp +++ b/clog-window.lisp @@ -473,16 +473,16 @@ If ON-ORIENTATION-CHANGE-HANDLER is nil unbind the event.")) ;; need to change to use a true on-storage event (defparameter storage-event-script - "+ e.originalEvent.key + ':' + - e.originalEvent.oldValue + ':' + - e.originalEvent.newValue + ':'") + "+ encodeURIComponent(e.originalEvent.key) + ':' + + encodeURIComponent(e.originalEvent.oldValue) + ':' + + encodeURIComponent(e.originalEvent.newValue) + ':'") (defun parse-storage-event (data) (let ((f (ppcre:split ":" data))) (list - :key-value (nth 0 f) - :old-value (nth 1 f) - :new-value (nth 2 f)))) + :key-value (quri:url-decode (nth 0 f)) + :old-value (quri:url-decode (nth 1 f)) + :new-value (quri:url-decode (nth 2 f))))) (defgeneric set-on-storage (clog-window on-storage-handler) (:documentation "Set the ON-STORAGE-HANDLER for CLOG-OBJ. If diff --git a/clog.asd b/clog.asd index b8f408e..b8c1cd5 100644 --- a/clog.asd +++ b/clog.asd @@ -10,7 +10,7 @@ :depends-on (#:clack #:websocket-driver #:alexandria #:hunchentoot #:cl-ppcre #:bordeaux-threads #:trivial-open-browser #:lack-middleware-static #:lack-middleware-session - #:mgl-pax) + #:mgl-pax #:quri) :components ((:file "clog-connection") (:file "clog") (:file "clog-system") diff --git a/doc/clog-manual.html b/doc/clog-manual.html index e70923b..de55cbf 100644 --- a/doc/clog-manual.html +++ b/doc/clog-manual.html @@ -77,13 +77,21 @@ application.

+

+ + +