Feature #50
Feature #16: create a repository to host scripts
Standardize repository APIs/data formats
100%
Description
It doesn't need to be anything formal; however, without such a standard client- and server-side development in this area cannot proceed concurrently.
History
Updated by koszko about 2 years ago
Related topic: https://hachettebugs.koszko.org/boards/1/topics/56
Updated by koszko about 2 years ago
- % Done changed from 0 to 30
How about a JSON interface? Later on we can simply add more fields to the JSON objects described now. Please tell what you think.
Under current schema¶
Fetching script info¶
hydrilla.example.com/script?n=helloscript
returns:
{ "name": "helloscript", "location": "somedirectory/hello.js", "sha256": "e4dbe4dba40e8bd159fb987b0f0cf2c243d7e6b9b9dc792e58dedf1fae38b0a1" }
or 404 Not Found in case "helloscript" script does not exist. hydrilla.example.com/content/somedirecotry/hello.js
holds the actual script source.
Fetching bag info¶
hydrilla.example.com/bag?n=hellobag
returns:
{ "name": "hellobag", "components": [["s", "helloscript"], ["s", "someotherscript"], ["b", "somebag"]] }
or 404 Not Found in case "hellobag" bag does not exist.
Fetching pattern info¶
hydrilla.example.com/pattern?n=https://example.org/a/*
returns:
{ "pattern": "https://example.org/a/*", "payload": ["b", "hellobag"] }
or 404 Not Found in case requested pattern does not exist.
Querying patterns that match given URL¶
Finally, hydrilla.example.com/query?n=https://example.org/a/b
returns:
[{ "pattern": "https://example.org/a/*", "payload": ["b", "hellobag"] }, { "pattern": "https://example.org/a/b", "payload": ["b", "fix_by_mrcooldev"] }, { "pattern": "https://example.org/a/b", "payload": ["b", "mod_by_missgreatskill"] }]
or in case no patterns match the requested URL, it returns just:
[]
or in case the URL is of wrong format it returns some HTTP error.
Under the upcoming schema¶
Also, once we get to do the redesign discussed in the linked thread, the JSONs will look more like the following.
Fetching bag info¶
{ "name": "hellobag", "dependencies": ["someotherbag", "yetanotherone"], "scripts": [{ "location": "somedirectory/hello.js", "sha256": "e4dbe4dba40e8bd159fb987b0f0cf2c243d7e6b9b9dc792e58dedf1fae38b0a1" }, { "location": "somedirectory/bye.js", "sha256": "5099d27284c2257d2983450585cbd4bede6475519755508047e213d985cbc7c9" }] }
Fetching resource info¶
hydrilla.example.com/resource?n=example_org_minimal
returns:
{ "name": "example_org_minimal", "description": "suckless something something", "mappings": [{ "pattern": "https://example.org/a/*", "payload": "some_KISS_bag" }, { "pattern": "https://example.org/t/*", "payload": "another_KISS_bag" }] }
or 404 Not Found in case "example_org_minimal" resource does not exist.
Querying patterns that match given url¶
hydrilla.example.com/query?n=https://example.org/a/b
returns:
[{ "name": "example_org_minimal", "description": "suckless something something", "mappings": [{ "pattern": "https://example.org/a/*", "payload": "some_KISS_bag" }, { "pattern": "https://example.org/t/*", "payload": "another_KISS_bag" }] }, { "name": "example_org_experimantal", "description": "[...]\npatches are WANTED!", "mappings": [{ "pattern": "https://example.org/**", "payload": "quick_and_dirty_bag" }] }]
Updated by jahoti about 2 years ago
- % Done changed from 30 to 100
- Status changed from New to Closed
That seems good, and it's flexible enough (being JSON) to be modified as the system evolves or even if anybody disagrees with the current setup.
For that reason I'm provisionally closing this and adopting the above; if anyone wants changes, feel free to open a new issue (or even revive this one).