mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Enable wildcard domains for published websites
This commit is contained in:
@@ -130,7 +130,7 @@ in
|
|||||||
|
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"demo.archtika.com" = {
|
"demo.archtika.com" = {
|
||||||
enableACME = true;
|
useACMEHost = "demo.archtika.com";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
@@ -156,12 +156,30 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"~^(?<subdomain>.+)\\.demo\\.archtika\\.com$" = {
|
||||||
|
useACMEHost = "demo.archtika.com";
|
||||||
|
forceSSL = true;
|
||||||
|
locations = {
|
||||||
|
"/" = {
|
||||||
|
alias = "/var/www/archtika-websites/$subdomain/";
|
||||||
|
index = "index.html";
|
||||||
|
tryFiles = "$uri $uri/ $uri/index.html =404";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
defaults.email = "thilo.hohlt@tutanota.com";
|
defaults.email = "thilo.hohlt@tutanota.com";
|
||||||
|
certs."demo.archtika.com" = {
|
||||||
|
domain = "demo.archtika.com";
|
||||||
|
extraDomainNames = ["*.demo.archtika.com"];
|
||||||
|
dnsProvider = "porkbun";
|
||||||
|
environmentFile = /var/lib/porkbun.env;
|
||||||
|
group = config.services.nginx.group;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const load: PageServerLoad = async ({ params, fetch, cookies }) => {
|
|||||||
|
|
||||||
generateStaticFiles(websiteOverview);
|
generateStaticFiles(websiteOverview);
|
||||||
|
|
||||||
const websitePreviewUrl = `${NGINX_BASE_PREFIX}/previews/${websiteOverview.user_id}/${websiteOverview.id}/index.html`;
|
const websitePreviewUrl = `${NGINX_BASE_PREFIX}/previews/${websiteOverview.id}/index.html`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
websiteOverview,
|
websiteOverview,
|
||||||
@@ -60,17 +60,9 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
|||||||
let uploadDir = "";
|
let uploadDir = "";
|
||||||
|
|
||||||
if (isPreview) {
|
if (isPreview) {
|
||||||
uploadDir = join(
|
uploadDir = join("/", "var", "www", "archtika-websites", "previews", websiteData.id);
|
||||||
"/",
|
|
||||||
"var",
|
|
||||||
"www",
|
|
||||||
"archtika-websites",
|
|
||||||
"previews",
|
|
||||||
websiteData.user_id,
|
|
||||||
websiteData.id
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
uploadDir = join("/", "var", "www", "archtika-websites", websiteData.user_id, websiteData.id);
|
uploadDir = join("/", "var", "www", "archtika-websites", websiteData.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
await mkdir(uploadDir, { recursive: true });
|
await mkdir(uploadDir, { recursive: true });
|
||||||
@@ -86,7 +78,7 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
|||||||
logoType: websiteData.logo_type,
|
logoType: websiteData.logo_type,
|
||||||
logo: websiteData.logo_text,
|
logo: websiteData.logo_text,
|
||||||
coverImage: article.cover_image
|
coverImage: article.cover_image
|
||||||
? `${API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`
|
? `${API_BASE_PREFIX === "/api" ? "https://demo.archtika.com/api" : API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`
|
||||||
: "",
|
: "",
|
||||||
publicationDate: article.publication_date,
|
publicationDate: article.publication_date,
|
||||||
mainContent: md.render(article.main_content ?? ""),
|
mainContent: md.render(article.main_content ?? ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user