Merge pull request #3 from archtika/devel

Set website production url correctly for NGINX
This commit is contained in:
Thilo Hohlt
2024-09-07 15:08:51 +02:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -60,9 +60,16 @@ export const load: PageServerLoad = async ({ params, fetch, cookies, parent }) =
: "http://localhost:18000"
}/previews/${websiteOverview.id}/index.html`;
const websiteProdUrl = dev
? `http://localhost:18000/${websiteOverview.id}/index.html`
: process.env.ORIGIN
? process.env.ORIGIN.replace("//", `//${websiteOverview.id}.`)
: `http://localhost:18000/${websiteOverview.id}/index.html`;
return {
websiteOverview,
websitePreviewUrl,
websiteProdUrl,
website
};
};

View File

@@ -7,8 +7,6 @@
const { data, form }: { data: PageServerData; form: ActionData } = $props();
const prodWebsiteUrl = data.websitePreviewUrl.replace("/previews", "");
let sending = $state(false);
</script>
@@ -56,7 +54,7 @@
<p>
Your website is published at:
<br />
<a href={prodWebsiteUrl}>{prodWebsiteUrl}</a>
<a href={data.websiteProdUrl}>{data.websiteProdUrl}</a>
</p>
</section>
{/if}