mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-09 19:41:32 +00:00
stronger typing and detection
This commit is contained in:
1 parent
1c00e3f32c
commit
7f11db3b33
2 files changed
+33
-22
No files matched your search
@@ -1,18 +1,24 @@
|
||||
type DomainConfig = Record<string, any>;
|
||||
export enum Website {
|
||||
FakeYou,
|
||||
StorytellerAi,
|
||||
}
|
||||
|
||||
export interface DomainConfig {
|
||||
website: Website,
|
||||
logo: string,
|
||||
title: string,
|
||||
link: string,
|
||||
}
|
||||
|
||||
const domainConfigs: Record<string, DomainConfig> = {
|
||||
"storyteller.ai": {
|
||||
"storyteller": {
|
||||
website: Website.StorytellerAi,
|
||||
logo: "/fakeyou/Storyteller-Logo-1.png",
|
||||
title: "Storyteller AI",
|
||||
link: "https://storyteller.ai",
|
||||
},
|
||||
"fakeyou.com": {
|
||||
logo: "/fakeyou/FakeYou-Logo-2.png",
|
||||
title: "FakeYou",
|
||||
link: "https://fakeyou.com",
|
||||
},
|
||||
// Default to FakeYou.com
|
||||
default: {
|
||||
"fakeyou": {
|
||||
website: Website.FakeYou,
|
||||
logo: "/fakeyou/FakeYou-Logo-2.png",
|
||||
title: "FakeYou",
|
||||
link: "https://fakeyou.com",
|
||||
@@ -20,16 +26,18 @@ const domainConfigs: Record<string, DomainConfig> = {
|
||||
};
|
||||
|
||||
export const getCurrentDomainConfig = (): DomainConfig => {
|
||||
const currentHostname = window.location.hostname;
|
||||
// Fast resolve without leaking domain details
|
||||
switch (window.location.hostname) {
|
||||
case "fakeyou.com":
|
||||
return domainConfigs.fakeyou;
|
||||
case "storyteller.ai":
|
||||
return domainConfigs.storyteller;
|
||||
}
|
||||
|
||||
const matchingConfigKey = Object.keys(domainConfigs).find(
|
||||
key => currentHostname === key || currentHostname.endsWith(`.${key}`)
|
||||
);
|
||||
if (window.location.hostname.includes("storyteller")) {
|
||||
return domainConfigs.storyteller;
|
||||
}
|
||||
|
||||
const domainConfig =
|
||||
matchingConfigKey !== undefined
|
||||
? domainConfigs[matchingConfigKey]
|
||||
: domainConfigs["default"];
|
||||
|
||||
return domainConfig;
|
||||
// Default fallback
|
||||
return domainConfigs.fakeyou;
|
||||
};
|
||||
@@ -19,6 +19,7 @@ import "./LandingPage.scss";
|
||||
// import VstSectionV1 from "./components/VstSectionV1";
|
||||
import VstSectionV2 from "./components/VstSectionV2";
|
||||
import FakeYouLandingBody from "./fakeyou/FakeYouLandingBody";
|
||||
import { DomainConfig, Website } from "utils/domainConfig";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -35,16 +36,18 @@ interface Props {
|
||||
|
||||
function LandingPage(props: Props) {
|
||||
usePrefixedDocumentTitle("FakeYou Celebrity Voice Generator");
|
||||
|
||||
PosthogClient.recordPageview();
|
||||
const domain = useDomainConfig();
|
||||
|
||||
const domain : DomainConfig = useDomainConfig();
|
||||
|
||||
const isLoggedIn = props.sessionWrapper.isLoggedIn();
|
||||
|
||||
return (
|
||||
<>
|
||||
{domain.title === "Storyteller AI" && !isLoggedIn && <LandingVideoReel />}
|
||||
{domain.website === Website.StorytellerAi && !isLoggedIn && <LandingVideoReel />}
|
||||
<Container type="panel">
|
||||
{domain.title === "FakeYou" ? (
|
||||
{domain.website === Website.FakeYou ? (
|
||||
<>
|
||||
{/* FAKEYOU.COM */}
|
||||
{!isLoggedIn && (
|
||||
|
||||
Reference in new issue
Block a user