Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Remove `apiVersion` in favor of `deploymentId`
Sebastian Martinez committed 1 year ago
commit 249f2741624724e2519cf1f6b574dcafcbbb9b91
parent 2e8b817
4 files changed +12 -7
modified 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"
modified 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",
modified http-client/lib/fetcher.ts
@@ -113,10 +113,12 @@ export class Fetcher {
    params: FetchParams,
    schema: T,
  ): Promise<TypeOf<T>> {
-
    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,
      );
modified module.d.ts
@@ -10,6 +10,7 @@ declare module "virtual:*" {
    source: {
      commitsPerPage: number;
    };
+
    deploymentId: string | null;
    reactions: string[];
    supportWebsite: string;
    preferredSeeds: BaseUrl[];