Use CDN URL from PUBLIC_IMAGINE_CDN_URL

This commit is contained in:
Torsten Dittmann committed 2025-11-13 18:26:38 +04:00
1 parent e3735b9f5a
commit 0fff4a00a6
3 files changed
+7 -11

No files matched your search

+2 -1
View File
@@ -7,4 +7,5 @@ PUBLIC_STRIPE_KEY=
PUBLIC_GROWTH_ENDPOINT=
PUBLIC_CONSOLE_EMAIL_VERIFICATION=false
PUBLIC_CONSOLE_MOCK_AI_SUGGESTIONS=true
PUBLIC_AI_SERVICE_BASE_URL=
PUBLIC_AI_SERVICE_BASE_URL=
PUBLIC_IMAGINE_CDN_URL=
+2
View File
@@ -20,6 +20,7 @@ ADD ./vite.config.ts /app/vite.config.ts
ADD ./src /app/src
ADD ./static /app/static
ARG PUBLIC_IMAGINE_CDN_URL
ARG PUBLIC_CONSOLE_MODE
ARG PUBLIC_CONSOLE_PROFILE
ARG PUBLIC_AI_SERVICE_BASE_URL
@@ -45,6 +46,7 @@ ENV PUBLIC_CONSOLE_MOCK_AI_SUGGESTIONS=$PUBLIC_CONSOLE_MOCK_AI_SUGGESTIONS
ENV PUBLIC_STRIPE_KEY=$PUBLIC_STRIPE_KEY
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
ENV SENTRY_RELEASE=$SENTRY_RELEASE
ENV PUBLIC_IMAGINE_CDN_URL=$PUBLIC_IMAGINE_CDN_URL
ENV NODE_OPTIONS=--max_old_space_size=8192
RUN pnpm run build
+3 -10
View File
@@ -10,12 +10,8 @@ const COMPONENT_SELECTOR = 'imagine-web-components-wrapper[data-appwrite-studio]
const STYLE_ATTRIBUTE = 'data-appwrite-studio-style';
const BLOCK_START_BASE_OFFSET = 48;
const INLINE_START_BASE_OFFSET = 8;
const CACHE_BUSTER = new Date().getTime();
export const CDN_URL =
'https://esm.sh/@imagine.dev/web-components@0/web-components?bundle=false&deps=react@19.1.0,react-dom@19.1.0&cache=' +
CACHE_BUSTER;
export const CDN_CSS_URL =
'https://esm.sh/@imagine.dev/web-components@0/imagine-web-components.css?cache=' + CACHE_BUSTER;
export const CDN_URL = env?.PUBLIC_IMAGINE_CDN_URL + '/web-components.js';
export const CDN_CSS_URL = env?.PUBLIC_IMAGINE_CDN_URL + '/web-components.css';
const DEV_OVERRIDE_WEB_COMPONENTS = env?.PUBLIC_AI_OVERRIDE_WEB_COMPONENTS === 'true';
let component: HTMLElement | null = null;
@@ -93,10 +89,7 @@ function injectStyles(node: HTMLElement, attempt = 0) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = DEV_OVERRIDE_WEB_COMPONENTS
? DEV_CSS_URL
: 'https://esm.sh/@imagine.dev/web-components@0/imagine-web-components.css?cache=' +
CACHE_BUSTER;
link.href = DEV_OVERRIDE_WEB_COMPONENTS ? DEV_CSS_URL : CDN_CSS_URL;
link.setAttribute(STYLE_ATTRIBUTE, 'true');
shadow.prepend(link);
})