link-server-hook: add tile serving, %png mounts
Front-end work necessitates images being mounted, and the tile served on
Landscape. This commit adds it to link-server-hook.
::
++ on-init
^- (quip card _this)
- :_ this
- [start-serving:do]~
+ :- [start-serving:do launch-tile:do ~]
+ this
::
++ on-save !>(state)
++ on-load
^- (quip card _this)
?: ?=([%http-response *] path)
[~ this]
+ ?: =(/primary path)
+ [~ this]
(on-watch:def path)
::
++ on-poke
^- card
[%pass / %arvo %e %connect [~ /'~link'] dap.bowl]
::
+++ launch-tile
+ ^- card
+ (launch-poke [%link-server-hook /primary '/~link/js/tile.js'])
+::
+::
+++ launch-poke
+ |= act=[@tas path @t]
+ ^- card
+ [%pass / %agent [our.bowl %launch] %poke %launch-action !>(act)]
+::
++ do-action
|= =action
^- card
::
++ handle-get
|= [request-headers=header-list:http =request-line]
+ :: if we request base path, return index.html
+ ::
+ ?: ?=([[~ [%'~link' ~]] *] request-line)
+ $(request-line request-line(ext `%html, site [%'~link' /index]))
%+ include-cors-headers
request-headers
^- simple-payload:http
%html (html-response:gen u.file)
%js (js-response:gen u.file)
%css (css-response:gen u.file)
+ %png (png-response:gen u.file)
==
:: submissions by recency as json, including comment counts
::
^- (unit octs)
:: only expose html, css and js files for now
::
- ?. ?=(?(%html %css %js) ext)
+ ?. ?=(?(%html %css %js %png) ext)
~
=/ =path
:* (scot %p our.bowl)
