diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index f2a45acb7..6d60043a7 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -1,7 +1,7 @@ { "nodes": { "fallbackPublicExplorer": "FALLBACK_PUBLIC_EXPLORER", - "apiVersion": "API_VERSION", + "requiredApiVersion": "REQUIRED_API_VERSION", "defaultHttpdPort": "DEFAULT_HTTPD_PORT", "defaultHttpdScheme": "DEFAULT_HTTPD_SCHEME" }, @@ -9,6 +9,7 @@ "commitsPerPage": "COMMITS_PER_PAGE" }, "supportWebsite": "SUPPORT_WEBSITE", + "deploymentId": "VERCEL_DEPLOYMENT_ID", "fallbackPreferredSeed": { "__name": "PREFERRED_SEEDS", "__format": "json" diff --git a/config/default.json b/config/default.json index 3a4e2aa43..e5f8c46b3 100644 --- a/config/default.json +++ b/config/default.json @@ -1,7 +1,7 @@ { "nodes": { "fallbackPublicExplorer": "https://app.radicle.xyz/nodes/$host/$rid$path", - "requiredApiVersion": "^6.0.0", + "requiredApiVersion": "~0.18.0", "defaultHttpdPort": 443, "defaultHttpdScheme": "https" }, @@ -9,6 +9,7 @@ "commitsPerPage": 30 }, "supportWebsite": "https://radicle.zulipchat.com", + "deploymentId": null, "preferredSeeds": [ { "hostname": "ash.radicle.garden", diff --git a/http-client/lib/fetcher.ts b/http-client/lib/fetcher.ts index 14e08b8d7..71da753af 100644 --- a/http-client/lib/fetcher.ts +++ b/http-client/lib/fetcher.ts @@ -113,10 +113,12 @@ export class Fetcher { params: FetchParams, schema: T, ): Promise> { - const response = await this.fetch({ - ...params, - query: { ...params.query, v: config.nodes.requiredApiVersion }, - }); + if (config.deploymentId) { + params.query ||= {}; + params.query["deployment_id"] = config.deploymentId; + } + + const response = await this.fetch(params); if (!response.ok) { let responseBody = await response.text(); @@ -138,7 +140,7 @@ export class Fetcher { throw new ResponseParseError( params.method, responseBody, - info.apiVersion, + info.version, result.error.errors, params.path, ); diff --git a/module.d.ts b/module.d.ts index e5798d2b9..244a8817e 100644 --- a/module.d.ts +++ b/module.d.ts @@ -10,6 +10,7 @@ declare module "virtual:*" { source: { commitsPerPage: number; }; + deploymentId: string | null; reactions: string[]; supportWebsite: string; preferredSeeds: BaseUrl[];