Skip to content

Commit 73234ef

Browse files
Marc Jakobimrcjkb
authored andcommitted
serve zipped json manifests
1 parent fa46a93 commit 73234ef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

applications/manifest.moon

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ zipable = (fn) ->
3434
=>
3535
@write fn @
3636

37-
return unless @format == "zip"
37+
return unless (@format == "zip" or @format == "json.zip")
3838
return unless (@options.status or 200) == 200
3939
return unless @req.cmd_mth == "GET"
4040

4141
fname = "manifest"
4242
if @version
4343
fname ..= "-#{@version}"
44+
if @format == "json.zip"
45+
fname ..= ".json"
4446

4547
@options.content_type = "application/zip"
4648
@res.content = zipped_file fname, table.concat @buffer
@@ -52,7 +54,7 @@ serve_manifest = capture_errors_404 =>
5254
@params.version = "#{@params.a}.#{@params.b}"
5355

5456
params = assert_valid @params, types.params_shape {
55-
{"format", types.nil + types.one_of {"json", "zip"}}
57+
{"format", types.nil + types.one_of {"json", "zip", "json.zip"}}
5658
{"version", types.nil + types.one_of {"5.1", "5.2", "5.3", "5.4", "5.5"}}
5759

5860
{"user", types.nil + types.limited_text(256) / slugify }
@@ -94,7 +96,7 @@ serve_manifest = capture_errors_404 =>
9496
modules = get_all_pages pager
9597
manifest = build_manifest modules, @version, @development
9698

97-
if @format == "json"
99+
if @format == "json" or @format == "json.zip"
98100
json: manifest
99101
else
100102
serve_lua_table @, manifest

0 commit comments

Comments
 (0)