From d4979bbdb2f6864a75c5e1683b0409c13294561d Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:21:22 +0100 Subject: [PATCH] feat: switch lib & cli to v1 api --- .env.example | 2 +- docs/src/content/docs/guides/self-hosting-registries.mdx | 4 ++-- src/cli/commands/deprecate.rs | 2 +- src/cli/commands/publish.rs | 2 +- src/cli/commands/yank.rs | 2 +- src/source/pesde/mod.rs | 2 +- website/wrangler.toml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index b17436e..be0a422 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ PUBLIC_REGISTRY_URL= # url of the registry API, this must have a trailing slash and include the version - # example: https://registry.pesde.daimond113.com/v0/ \ No newline at end of file + # example: https://registry.pesde.daimond113.com/v1/ \ No newline at end of file diff --git a/docs/src/content/docs/guides/self-hosting-registries.mdx b/docs/src/content/docs/guides/self-hosting-registries.mdx index c2e1d18..871e8f7 100644 --- a/docs/src/content/docs/guides/self-hosting-registries.mdx +++ b/docs/src/content/docs/guides/self-hosting-registries.mdx @@ -23,7 +23,7 @@ the following content: api = "https://registry.acme.local/" # package download URL (optional) -download = "{API_URL}/v0/packages/{PACKAGE}/{PACKAGE_VERSION}/{PACKAGE_TARGET}/archive" +download = "{API_URL}/v1/packages/{PACKAGE}/{PACKAGE_VERSION}/{PACKAGE_TARGET}/archive" # the client ID of the GitHub OAuth app (optional) github_oauth_client_id = "a1d648966fdfbdcd9295" @@ -58,7 +58,7 @@ scripts_packages = ["pesde/scripts_rojo"] - `{PACKAGE_VERSION}`: The package version. - `{PACKAGE_TARGET}`: The package target. - Defaults to `{API_URL}/v0/packages/{PACKAGE}/{PACKAGE_VERSION}/{PACKAGE_TARGET}/archive`. + Defaults to `{API_URL}/v1/packages/{PACKAGE}/{PACKAGE_VERSION}/{PACKAGE_TARGET}/archive`. - **github_oauth_client_id**: This is required if you use GitHub OAuth for authentication. See below for more information. diff --git a/src/cli/commands/deprecate.rs b/src/cli/commands/deprecate.rs index 08212fa..658729e 100644 --- a/src/cli/commands/deprecate.rs +++ b/src/cli/commands/deprecate.rs @@ -53,7 +53,7 @@ impl DeprecateCommand { Method::PUT }, format!( - "{}/v0/packages/{}/deprecate", + "{}/v1/packages/{}/deprecate", config.api(), urlencoding::encode(&self.package.to_string()), ), diff --git a/src/cli/commands/publish.rs b/src/cli/commands/publish.rs index 818a421..da057d8 100644 --- a/src/cli/commands/publish.rs +++ b/src/cli/commands/publish.rs @@ -677,7 +677,7 @@ info: otherwise, the file was deemed unnecessary, if you don't understand why, p } let mut request = reqwest - .post(format!("{}/v0/packages", config.api())) + .post(format!("{}/v1/packages", config.api())) .body(archive); if let Some(token) = project.auth_config().tokens().get(index_url) { diff --git a/src/cli/commands/yank.rs b/src/cli/commands/yank.rs index dd2ffae..4a4ad3b 100644 --- a/src/cli/commands/yank.rs +++ b/src/cli/commands/yank.rs @@ -108,7 +108,7 @@ impl YankCommand { Method::PUT }, format!( - "{}/v0/packages/{}/{}/{}/yank", + "{}/v1/packages/{}/{}/{}/yank", config.api(), urlencoding::encode(&package.to_string()), urlencoding::encode(&version.to_string()), diff --git a/src/source/pesde/mod.rs b/src/source/pesde/mod.rs index 33a6ced..ca5bc7b 100644 --- a/src/source/pesde/mod.rs +++ b/src/source/pesde/mod.rs @@ -412,7 +412,7 @@ impl IndexConfig { pub fn download(&self) -> String { self.download .as_deref() - .unwrap_or("{API_URL}/v0/packages/{PACKAGE}/{PACKAGE_VERSION}/{PACKAGE_TARGET}/archive") + .unwrap_or("{API_URL}/v1/packages/{PACKAGE}/{PACKAGE_VERSION}/{PACKAGE_TARGET}/archive") .replace("{API_URL}", self.api()) } } diff --git a/website/wrangler.toml b/website/wrangler.toml index b4c7116..844afaf 100644 --- a/website/wrangler.toml +++ b/website/wrangler.toml @@ -3,7 +3,7 @@ compatibility_date = "2024-11-30" pages_build_output_dir = ".svelte-kit/cloudflare" [vars] -PUBLIC_REGISTRY_URL = "https://registry.pesde.daimond113.com/v0/" +PUBLIC_REGISTRY_URL = "https://registry.pesde.daimond113.com/v1/" [observability] enabled = true