X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fnetworking.scm;h=1c28b38dcbb4ef872c8e1663e5fa12dac2eb6329;hp=f69f47a92cc13dc3a3d305954e321c76793ad857;hb=18c74950d1bd9fc915411bde06b99a273b55ae25;hpb=d97fa236de7c359ac318819062131137e3064082 diff --git a/mudsync/networking.scm b/mudsync/networking.scm index f69f47a..1c28b38 100644 --- a/mudsync/networking.scm +++ b/mudsync/networking.scm @@ -32,6 +32,7 @@ #:use-module (web response) #:use-module (web uri) #:use-module (mudsync package-config) + #:use-module (mudsync contrib mime-types) #:use-module (rnrs io ports) #:export (;; Should we be exporting these? @@ -208,10 +209,17 @@ #:websocket-handler (wrap-apply websocket-handler))))) (define (view:main-display request body) + (define one-entry + '(div (@ (class "stream-entry")) + (p "This is an entry!") + (p "Let's try a few paragraphs") + (p "okay?"))) + (define body-tmpl - '((div (@ (id "stream-output")) - (p "nope")) - (div (@ (id "input-box")) + `((div (@ (id "stream-metabox")) + (div (@ (id "stream")) + ,@(map (const one-entry) (iota 10)))) + (div (@ (id "input-metabox")) (p "test test") (input (@ (id "input")))))) @@ -220,21 +228,22 @@ (head (title "Mudsync!") (meta (@ (charset "UTF-8"))) (link (@ (rel "stylesheet") - (href "/static/css/main.css")))) + (href "/static/css/main.css"))) + (script (@ (type "text/javascript") + (src "/static/js/mudsync.js")))) (body ,@body-tmpl))) (define (write-template-to-string) (with-fluids ((%default-port-encoding "UTF-8")) - (with-output-to-string - (lambda () - (sxml->xml (main-tmpl)))))) + (call-with-output-string + (lambda (p) + (sxml->xml (main-tmpl) p))))) (values (build-response #:code 200 #:headers '((content-type . (application/xhtml+xml)))) (write-template-to-string))) (define (view:render-static request body static-path) (values (build-response #:code 200 - ;; #:content-type (mime-type static-path) - ) + #:headers `((content-type . (,(mime-type static-path))))) (call-with-input-file (web-static-filepath static-path) get-bytevector-all))) (define (view:standard-four-oh-four . args)