|
|
@ -18,10 +18,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
(define/contract (route-wrapper route-proc)
|
|
|
|
(define/contract (route-wrapper route-proc)
|
|
|
|
(procedure? . -> . procedure?)
|
|
|
|
(procedure? . -> . procedure?)
|
|
|
|
(λ(req string-arg)
|
|
|
|
(λ(req . string-args)
|
|
|
|
(logger req)
|
|
|
|
(logger req)
|
|
|
|
(define filename string-arg)
|
|
|
|
(define path (apply build-path PROJECT_ROOT (flatten string-args)))
|
|
|
|
(response/xexpr (route-proc (build-path PROJECT_ROOT filename)))))
|
|
|
|
(response/xexpr (route-proc path))))
|
|
|
|
|
|
|
|
|
|
|
|
(define-values (start url)
|
|
|
|
(define-values (start url)
|
|
|
|
(dispatch-rules
|
|
|
|
(dispatch-rules
|
|
|
@ -29,19 +29,12 @@
|
|
|
|
;; (as if the url is split on slashes into a list before matching)
|
|
|
|
;; (as if the url is split on slashes into a list before matching)
|
|
|
|
;; dashboard page: works on any url of form /dir/dir/dir/poldash.html
|
|
|
|
;; dashboard page: works on any url of form /dir/dir/dir/poldash.html
|
|
|
|
;; todo: figure out how to use world:DASHBOARD_NAME here
|
|
|
|
;; todo: figure out how to use world:DASHBOARD_NAME here
|
|
|
|
[((string-arg) ... "poldash.html") (λ(req . string-args)
|
|
|
|
[((string-arg) ... "poldash.html") (route-wrapper route-dashboard)]
|
|
|
|
(logger req)
|
|
|
|
|
|
|
|
(define subdirs (flatten string-args))
|
|
|
|
|
|
|
|
(define dir (apply build-path PROJECT_ROOT subdirs))
|
|
|
|
|
|
|
|
(response/xexpr (route-dashboard dir)))]
|
|
|
|
|
|
|
|
;; raw viewer: works on any url of form /dir/dir/raw/name.html
|
|
|
|
;; raw viewer: works on any url of form /dir/dir/raw/name.html
|
|
|
|
;; (pattern matcher automatically takes out the "raw")
|
|
|
|
;; (pattern matcher automatically takes out the "raw")
|
|
|
|
[((string-arg) ... "raw" (string-arg)) (λ(req . string-args)
|
|
|
|
[((string-arg) ... "raw" (string-arg)) (route-wrapper route-raw)]
|
|
|
|
(logger req)
|
|
|
|
[((string-arg) ... "xexpr" (string-arg)) (route-wrapper route-xexpr)]
|
|
|
|
(define path (apply build-path PROJECT_ROOT (flatten string-args)))
|
|
|
|
;; [((string-arg) ... "force" (string-arg)) (route-wrapper route-force)]
|
|
|
|
(response/xexpr (route-raw path)))]
|
|
|
|
|
|
|
|
[("xexpr" (string-arg)) (route-wrapper route-xexpr)]
|
|
|
|
|
|
|
|
[("html" (string-arg)) (route-wrapper route-html)]
|
|
|
|
|
|
|
|
[else (λ(req)
|
|
|
|
[else (λ(req)
|
|
|
|
;; because it's the "else" route, can't use string-arg matcher
|
|
|
|
;; because it's the "else" route, can't use string-arg matcher
|
|
|
|
(logger req)
|
|
|
|
(logger req)
|
|
|
|