diff --git a/README.md b/README.md
index b124154..b62ddf8 100644
--- a/README.md
+++ b/README.md
@@ -4,19 +4,24 @@ A Cloudflare Worker for managing ZLS build artifacts.
The API Endpoint is `releases.zigtools.org`.
-## /v1/select-zls-version?zig_version=${VERSION}
+## /v1/select-zls-version?zig_version=${VERSION}&compatibility=${COMPATIBILITY}
> [!IMPORTANT]
> If you are developing a tool that automatically installs ZLS then you came to the right place!
-Will respond with metadata about a ZLS build that is compatible with the given Zig version.
+Will respond with metadata about a ZLS build that is useable with the given Zig version.
The response body is similar to Zig's [index.json](https://ziglang.org/download/index.json).
+The `compatibility` query-string must be either `only-runtime` or `full`:
+
+- `full`: Request a ZLS build that can be built and used with the given Zig version.
+- `only-runtime`: Request a ZLS build that can be used at runtime with the given Zig version but may not be able to build ZLS from source.
+
Example 1
```bash
- curl "https://releases.zigtools.org/v1/select-zls-version?zig_version=0.13.0-dev.7%2B73c6c13a" # 0.13.0-dev.7+73c6c13a
+ curl "https://releases.zigtools.org/v1/select-zls-version?zig_version=0.13.0-dev.7%2B73c6c13a&compatibility=only-runtime" # 0.13.0-dev.7+73c6c13a
```
```json
@@ -225,7 +230,7 @@ The response body imitates Zig's [index.json](https://ziglang.org/download/index
-## /v1/publish
+## /publish
> [!IMPORTANT]
> This request is only intended to be used by ZLS's GitHub CI.
diff --git a/src/index.ts b/src/index.ts
index 891efab..bd88c0c 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,7 +9,7 @@ export default {
switch (url.pathname) {
case "/v1/select-zls-version":
return handleSelectZLSVersion(request, env);
- case "/v1/publish":
+ case "/publish":
return handlePublish(request, env);
default:
return new Response(null, {
diff --git a/test/publish.test.ts b/test/publish.test.ts
index 905fd4e..1a69989 100644
--- a/test/publish.test.ts
+++ b/test/publish.test.ts
@@ -29,7 +29,7 @@ async function searchZLSRelease(
async function sendPublishForm(form: FormData): Promise {
assert(typeof env.API_TOKEN === "string" && env.API_TOKEN);
return await SELF.fetch(
- new Request("https://example.com/v1/publish", {
+ new Request("https://example.com/publish", {
body: form,
method: "POST",
headers: {
@@ -104,9 +104,9 @@ function getSampleArtifacts(
];
}
-describe("/v1/publish", () => {
+describe("/publish", () => {
test("expect POST method", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish");
+ const response = await SELF.fetch("https://example.com/publish");
expect(await response.text()).toBe("method must be 'POST'");
expect(response.status).toBe(405);
});
@@ -115,7 +115,7 @@ describe("/v1/publish", () => {
"check for invalid API_TOKEN: %j",
async (value) => {
const response = await handlePublish(
- new Request("https://example.com/v1/publish", {
+ new Request("https://example.com/publish", {
method: "POST",
}),
{
@@ -131,7 +131,7 @@ describe("/v1/publish", () => {
describe("check authorization", () => {
test("missing Authorization header", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish", {
+ const response = await SELF.fetch("https://example.com/publish", {
method: "POST",
});
@@ -140,7 +140,7 @@ describe("/v1/publish", () => {
});
test("invalid Authorization header", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish", {
+ const response = await SELF.fetch("https://example.com/publish", {
body: null,
method: "POST",
headers: {
@@ -154,7 +154,7 @@ describe("/v1/publish", () => {
});
test("non Basic Authorization header", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish", {
+ const response = await SELF.fetch("https://example.com/publish", {
body: null,
method: "POST",
headers: {
@@ -168,7 +168,7 @@ describe("/v1/publish", () => {
});
test("invalid Basic Authorization header", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish", {
+ const response = await SELF.fetch("https://example.com/publish", {
body: null,
method: "POST",
headers: {
@@ -182,7 +182,7 @@ describe("/v1/publish", () => {
});
test("wrong username", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish", {
+ const response = await SELF.fetch("https://example.com/publish", {
body: null,
method: "POST",
headers: {
@@ -194,7 +194,7 @@ describe("/v1/publish", () => {
});
test("wrong password", async () => {
- const response = await SELF.fetch("https://example.com/v1/publish", {
+ const response = await SELF.fetch("https://example.com/publish", {
body: null,
method: "POST",
headers: {