mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
We have a new apiVersion value in the config json that needs to be changed for each breaking change on httpd so we can simulate a new resource to the cache and get it cleared. Also improves the ResponseParseError giving the user more information on, if the node or the web client is outdated
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import type { BaseUrl } from "@httpd-client";
|
|
|
|
import configJson from "@app/config.json";
|
|
|
|
export interface Config {
|
|
nodes: {
|
|
apiVersion: string;
|
|
fallbackPublicExplorer: string;
|
|
defaultHttpdPort: number;
|
|
defaultHttpdHostname: string;
|
|
defaultLocalHttpdPort: number;
|
|
defaultNodePort: number;
|
|
defaultHttpdScheme: string;
|
|
pinned: { baseUrl: BaseUrl }[];
|
|
};
|
|
supportWebsite: string;
|
|
fallbackPreferredSeed: BaseUrl;
|
|
}
|
|
|
|
function getConfig(): Config {
|
|
if (window.VITEST) {
|
|
return {
|
|
nodes: {
|
|
fallbackPublicExplorer: "https://app.radicle.xyz/nodes/$host/$rid$path",
|
|
apiVersion: "0.1.0",
|
|
defaultHttpdHostname: "127.0.0.1",
|
|
defaultHttpdPort: 8081,
|
|
defaultLocalHttpdPort: 8081,
|
|
defaultHttpdScheme: "http",
|
|
defaultNodePort: 8776,
|
|
pinned: [],
|
|
},
|
|
supportWebsite: "https://radicle.zulipchat.com",
|
|
fallbackPreferredSeed: {
|
|
hostname: "seed.radicle.garden",
|
|
port: 443,
|
|
scheme: "https",
|
|
},
|
|
};
|
|
} else if (window.PLAYWRIGHT) {
|
|
return window.APP_CONFIG;
|
|
} else {
|
|
// In dev and production environments we use data from config.json.
|
|
return configJson;
|
|
}
|
|
}
|
|
|
|
export const config = getConfig();
|