Merge branch 'main' into feat-pink-v2

This commit is contained in:
Torsten Dittmann authored and GitHub committed 2025-05-18 11:48:40 +02:00
commit eb05481835
2 files changed
+14 -5

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
import { VARS } from '$lib/system';
import { isMultiRegionSupported, VARS } from '$lib/system';
import {
Account,
Assistant,
@@ -46,7 +46,7 @@ export function getApiEndpoint(region?: string): string {
const hostname = url.hostname;
// If instance supports multi-region, add the region subdomain.
const subdomain = VARS.APPWRITE_MULTI_REGION ? getSubdomain(region) : '';
const subdomain = isMultiRegionSupported(url) ? getSubdomain(region) : '';
return `${protocol}//${subdomain}${hostname}/v1`;
}
+12 -3
View File
@@ -10,8 +10,7 @@ export const VARS = {
CONSOLE_MODE: (env.PUBLIC_CONSOLE_MODE as Mode) ?? undefined,
APPWRITE_ENDPOINT: env.PUBLIC_APPWRITE_ENDPOINT ?? undefined,
GROWTH_ENDPOINT: env.PUBLIC_GROWTH_ENDPOINT ?? undefined,
PUBLIC_STRIPE_KEY: env.PUBLIC_STRIPE_KEY ?? undefined,
APPWRITE_MULTI_REGION: env.PUBLIC_APPWRITE_MULTI_REGION === 'true'
PUBLIC_STRIPE_KEY: env.PUBLIC_STRIPE_KEY ?? undefined
};
export const ENV = {
@@ -29,5 +28,15 @@ export const isProd = ENV.PROD;
export const hasStripePublicKey = !!VARS.PUBLIC_STRIPE_KEY;
export const GRACE_PERIOD_OVERRIDE = false;
// start showing 1.7.x feats!
export const SHOW_INIT_FEATURES = true;
export function isMultiRegionSupported(url: URL): boolean {
if (env.PUBLIC_APPWRITE_MULTI_REGION === 'true') return true;
try {
return url.hostname.endsWith('cloud.appwrite.io');
} catch {
return false;
}
}