diff --git a/main.fasl b/main.fasl deleted file mode 100644 index a56ea7d..0000000 Binary files a/main.fasl and /dev/null differ diff --git a/main.lisp~ b/main.lisp~ deleted file mode 100644 index e8bfe1b..0000000 --- a/main.lisp~ +++ /dev/null @@ -1,71 +0,0 @@ - -(ql:quickload "hunchentoot") -(ql:quickload "easy-routes") -(ql:quickload "djula") - -(setf *default-pathname-defaults* (uiop:getcwd)) - -;;;; if you're gonna run a public instance, change to the url other people -;;;; will use to connect! -(defvar *server-external-address* "http://localhost:8080/") -(defvar *server* nil) - -;; we probably don't actually need a template for the root, -;; it's more or less static anyhow. -;; i guess retrieving a paste is the only place that actually needs -;; the dynamic templating thingy - -(defparameter *root-template* - (uiop:read-file-string "root.html")) - -(defparameter *paste-template* - (uiop:read-file-string "paste.html")) - -;; google code -;; holy hell, actual business logic - -(defun get-paste-contents (id) - "read file lmao. also do some checks. we don't want LFI" - (let ((path (probe-file (concatenate 'string "bin/" id)))) - (if (and path - (not (search "." id)) - (not (search "/" id))) - (uiop:read-file-string path) - "err: bin not found"))) - - - -(defun render-root () - (djula:render-template* - (djula:compile-string *root-template*) - nil)) -(defun render-paste (id) - (djula:render-template* - (djula:compile-string *paste-template*) - nil - :contents (get-paste-contents id) - :link-home *server-external-address* - :link-bin (concatenate 'string *server-external-address* "bin/" id) - :link-raw (concatenate 'string *server-external-address* "raw/" id))) - -(easy-routes:defroute root ("/" :method :get) () - (render-root)) - -(easy-routes:defroute paste ("/bin/:n") () - (render-paste n)) - -(easy-routes:defroute raw ("/raw/:n") () - (get-paste-contents n)) - -;; todo: handle new pastes TODO: doesn't work, fix. -(easy-routes:defroute new ("/" :method :post) (content) - (format t "got somethin: ~a ~%" content)) - - -(defun start-server (&key (port 8080)) - (format t "Starting server on port ~a~%" port) - (force-output) - (setf *server* (make-instance 'easy-routes:easy-routes-acceptor :port port)) - (hunchentoot:start *server*)) -(defun stop-server () - (hunchentoot:stop *server*)) diff --git a/paste.html~ b/paste.html~ deleted file mode 100644 index 7554f65..0000000 --- a/paste.html~ +++ /dev/null @@ -1,47 +0,0 @@ - - - bin - - - - -
- home - bin - raw -
-
-
-
{{ contents }}
-
- - - diff --git a/root.html b/root.html index a14cee8..2f24a81 100644 --- a/root.html +++ b/root.html @@ -19,18 +19,17 @@ padding: 2px; border-radius: 5px; width: 80%; - height: 95%; margin: auto; } - main { - margin: auto; - width: 80%; - } - main a { - margin-left: 5%; - color: #FFFDD0; - text-decoration: none; + form { + border: 3px solid #FFFDD0; + padding: 2px; + margin-top: 10px; + border-radius: 5px; + width: 80%; + margin-left: auto; + margin-right: auto; } @@ -39,14 +38,11 @@

Lispy paste

- -
-

New Paste:


-
- -
+
+

New Paste:

+
+ +
diff --git a/root.html~ b/root.html~ deleted file mode 100644 index 1e90460..0000000 --- a/root.html~ +++ /dev/null @@ -1,44 +0,0 @@ - - - lispy pasty thingy - - - - - -
-

Lispy paste

- -
- - -