Project

General

Profile

Actions

Repository API » History » Revision 2

« Previous | Revision 2/25 (diff) | Next »
jahoti, 09/05/2021 01:17 AM
Minor edits


Repository API

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/somedirectory/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 https://hachettebugs.koszko.org/boards/1/topics/56, the JSON 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_experimental",
    "description": "[...]\npatches are WANTED!",
    "mappings": [{
            "pattern":  "https://example.org/**",
            "payload":  "quick_and_dirty_bag"
        }]
}]

Updated by jahoti about 2 years ago · 2 revisions

Also available in: PDF HTML TXT