Remove apiVersion in favor of deploymentId

Instead of relying on a `apiVersion` config variable that has to be
changed and semver respected we use a deployment id that is new on each
deployment to do cache busting
This commit is contained in:
Sebastian Martinez
2024-12-05 14:21:08 +01:00
parent 2e8b817d53
commit 249f274162
4 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -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"
+2 -1
View File
@@ -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",
+7 -5
View File
@@ -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,
);
Vendored
+1
View File
@@ -10,6 +10,7 @@ declare module "virtual:*" {
source: {
commitsPerPage: number;
};
deploymentId: string | null;
reactions: string[];
supportWebsite: string;
preferredSeeds: BaseUrl[];