diff options
Diffstat (limited to 'session.lisp')
-rw-r--r-- | session.lisp | 29 |
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)) + |