Skip to content

Commit

Permalink
fix:template add desktop domain (labring#5130)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjy365 authored Oct 9, 2024
1 parent 1c6c054 commit a90ad40
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion frontend/providers/template/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ TEMPLATE_REPO_BRANCH="main"
# The CDN_URL environment variable is used to specify a CDN address; when set, it replaces raw.githubusercontent.com in the resource loading URL. If not set, the default address is used.
CDN_URL=
BLACKLIST_CATEGORIES=""
SIDEBAR_MENU_COUNT=""
SIDEBAR_MENU_COUNT=""

DESKTOP_DOMAIN=""
GUIDE_ENABLED="false"
BILLING_URL=""
2 changes: 1 addition & 1 deletion frontend/providers/template/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const App = ({ Component, pageProps }: AppProps) => {
type: string;
}>
) => {
const whitelist = [`https://${envs.SEALOS_CLOUD_DOMAIN}`];
const whitelist = [`https://${envs.DESKTOP_DOMAIN}`];
if (!whitelist.includes(e.origin)) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/providers/template/src/pages/deploy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default function EditApp({

const queryString = params.toString();

const baseUrl = `https://${platformEnvs?.SEALOS_CLOUD_DOMAIN}/`;
const baseUrl = `https://${platformEnvs?.DESKTOP_DOMAIN}/`;
const encodedTemplateQuery = encodeURIComponent(
`?templateName=${templateName}&sealos_inside=true`
);
Expand Down Expand Up @@ -270,7 +270,7 @@ export default function EditApp({
);

const copyTemplateLink = () => {
const str = `https://${platformEnvs?.SEALOS_CLOUD_DOMAIN}/?openapp=system-template%3FtemplateName%3D${appName}`;
const str = `https://${platformEnvs?.DESKTOP_DOMAIN}/?openapp=system-template%3FtemplateName%3D${appName}`;
copyData(str);
};

Expand Down Expand Up @@ -371,7 +371,7 @@ export default function EditApp({
backgroundColor={'rgba(255, 255, 255, 0.90)'}
>
<Header
cloudDomain={platformEnvs?.SEALOS_CLOUD_DOMAIN || ''}
cloudDomain={platformEnvs?.DESKTOP_DOMAIN || ''}
templateDetail={data?.templateYaml!}
appName={appName || ''}
title={title}
Expand Down
1 change: 1 addition & 0 deletions frontend/providers/template/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export type EnvResponse = {
SEALOS_NAMESPACE: string;
SEALOS_SERVICE_ACCOUNT: string;
SHOW_AUTHOR: string;
DESKTOP_DOMAIN: string;
};
3 changes: 2 additions & 1 deletion frontend/providers/template/src/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ export function getTemplateEnvs(namespace?: string): EnvResponse {
TEMPLATE_REPO_BRANCH: process.env.TEMPLATE_REPO_BRANCH || 'main',
SEALOS_NAMESPACE: namespace || '',
SEALOS_SERVICE_ACCOUNT: namespace?.replace('ns-', '') || '',
SHOW_AUTHOR: process.env.SHOW_AUTHOR || 'false'
SHOW_AUTHOR: process.env.SHOW_AUTHOR || 'false',
DESKTOP_DOMAIN: process.env.DESKTOP_DOMAIN || 'cloud.sealos.io'
};
return TemplateEnvs;
}
Expand Down

0 comments on commit a90ad40

Please sign in to comment.