Add support for JSON listing #1

Merged
Francesco Siddi merged 7 commits from json-view into develop 2023-11-01 12:08:09 +01:00

7 Commits

Author SHA1 Message Date
8fbca889a5 Address feedback from code review 2023-11-01 11:59:49 +01:00
9cadc5cb1c Build a dedicated array for the JSON response
Do not modify the content of $builds in BuildsRenderer.
2023-11-01 11:03:06 +01:00
c2917f3e06 Use exit instead of return
Once we are done building the response, we should exit. Using return
allows for more content to be added to the response, and we don't
want that.
2023-11-01 11:02:03 +01:00
04d0ac80ce Check for 'format' before accessing it
Removes Warning of undefined key.
2023-10-31 23:50:02 +01:00
16b3ccec59 Implement JSON and HTML responses separately
Follow the single responsibility priciple.
2023-10-31 21:51:31 +01:00
4f8d64e555 Add support for JSON listing
By appending ?format=json&v=1 it is now possible to display the list
of builds as JSON object. This makes it easier for updaters or
download scripts to list the builds offered.

Notice that v=1 must be specified for the listing to appear, otherwise
we return code 400 with an error message.
2023-10-20 15:58:54 +02:00
a44d072cf2 Remove params from $request_uri in BuildsRenderer
This prevents url params from being included when building a file url
with getFileNameURL(), leading to a url that always works.
2023-10-20 15:54:26 +02:00