Add support to encode call back messages

This commit is contained in:
David Botton 2020-12-30 20:38:09 -05:00
parent 3c9e011cd8
commit 39ff5175ef
3 changed files with 16 additions and 8 deletions

View file

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

View file

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

View file

@ -77,13 +77,21 @@ application.</p>
<p><a id='x-28CLOG-3AINITIALIZE-20FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3AINITIALIZE-20FUNCTION-29" >INITIALIZE</a></span></span> <span class="locative-args">ON-NEW-WINDOW &amp;KEY (HOST &quot;0.0.0.0&quot;) (PORT 8080) (BOOT-FILE &quot;/boot.html&quot;) (STATIC-ROOT #P&quot;static-files/&quot;)</span></span></p>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3AINITIALIZE-20FUNCTION-29" >INITIALIZE</a></span></span> <span class="locative-args">ON-NEW-WINDOW-HANDLER &amp;KEY (HOST &quot;0.0.0.0&quot;) (PORT 8080) (BOOT-FILE &quot;/boot.html&quot;) (STATIC-ROOT #P&quot;static-files/&quot;)</span></span></p>
<p>Inititalze <a href="#x-28-22clog-22-20ASDF-2FSYSTEM-3ASYSTEM-29" title="(\&quot;clog\&quot; ASDF/SYSTEM:SYSTEM)"><code>CLOG</code></a> on a socket using <code>HOST</code> and <code>PORT</code> to serve <code>BOOT-FILE</code> as
the default route to establish web-socket connections and static files
located at <code>STATIC-ROOT</code>.</p></li>
</ul>
<p><a id='x-28CLOG-3ASET-ON-NEW-WINDOW-20FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3ASET-ON-NEW-WINDOW-20FUNCTION-29" >SET-ON-NEW-WINDOW</a></span></span> <span class="locative-args">ON-NEW-WINDOW-HANDLER</span></span></p>
<p>Change the on-new-window handler.</p></li>
</ul>
<p><a id='x-28CLOG-3ASHUTDOWN-20FUNCTION-29'></a></p>
<ul>