aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-11-01 12:48:24 +0000
committers-ol <s-ol@users.noreply.github.com>2019-11-01 12:48:24 +0000
commit16232a2509a87a900b69b2d0f826a2e3edec3f96 (patch)
tree801c1234e5e227acb1e1015d6b71bf77ac15b474 /build
parentfsck root dir (diff)
downloadmmm-16232a2509a87a900b69b2d0f826a2e3edec3f96.tar.gz
mmm-16232a2509a87a900b69b2d0f826a2e3edec3f96.zip
add fileder ordering in stores.web, fileder, browser
Diffstat (limited to 'build')
-rw-r--r--build/server.moon18
1 files changed, 15 insertions, 3 deletions
diff --git a/build/server.moon b/build/server.moon
index 395b903..a2d6c71 100644
--- a/build/server.moon
+++ b/build/server.moon
@@ -138,7 +138,18 @@ class Server
@store\update_facet path, facet.name, facet.type, value
200, 'ok'
else
- 501, "not implemented"
+ cmd, args = value\match '^([^\n]+)\n(.*)'
+ switch cmd
+ when 'swap'
+ child_a, child_b = args\match '^([^\n]+)\n([^\n]+)$'
+ assert child_a and child_b, "invalid arguments"
+
+ @store\swap_fileders path, child_a, child_b
+ 200, 'ok'
+ when nil
+ 400, "invalid request"
+ else
+ 501, "unknown command #{cmd}"
when 'DELETE'
if facet
@store\remove_facet path, facet.name, facet.type
@@ -175,8 +186,9 @@ class Server
res = headers.new!
response_type = if status > 299 then 'text/plain'
- else if facet.type == 'text/html+interactive' then 'text/html'
- else facet.type
+ else if facet and facet.type == 'text/html+interactive' then 'text/html'
+ else if facet then facet.type
+ else 'text/plain'
res\append ':status', tostring status
res\append 'content-type', response_type