summaryrefslogtreecommitdiff
path: root/session.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-10-27 07:17:04 -0500
committerColin Okay <colin@cicadas.surf>2022-10-27 07:17:04 -0500
commit52c0408569a0b1de932d52e71fee5fb0163782e2 (patch)
tree33501b371d3f036b4a60f76ca1177ba484720ac3 /session.lisp
parentf0eff7d9c69de2e6c7257b8d94e7deb7b89becdf (diff)
Add: session file
Diffstat (limited to 'session.lisp')
-rw-r--r--session.lisp29
1 files changed, 29 insertions, 0 deletions
diff --git a/session.lisp b/session.lisp
new file mode 100644
index 0000000..770bc8d
--- /dev/null
+++ b/session.lisp
@@ -0,0 +1,29 @@
+;;;; session.lisp
+
+(in-package :vampire)
+
+;;; session parameter keys
+
+(defparameter +session-key+ "vampire-session-key"
+ "Stored in the browser's local storage")
+
+(defparameter +playlist-connection-key+ "playlist-connection-key"
+ "Stored in the clog connection object")
+
+;;; SESSION ACCESSORS
+
+(defun session-key (window)
+ (jonathan:parse (storage-element window :local +session-key+)))
+
+(defun (setf session-key) (val window)
+ (setf (storage-element window :local +session-key+) (jonathan:to-json val)))
+
+(defun session-user (clog-obj)
+ (user-with-key (session-key (window (connection-body clog-obj)))))
+
+(defun cur-playlist-ctl (obj)
+ (connection-data-item obj +playlist-connection-key+))
+
+(defun (setf cur-playlist-ctl) (newval obj)
+ (setf (connection-data-item obj +playlist-connection-key+) newval))
+