Browse Source

allow custom domain support to be toggled and IP to be configured

tags/v2.5.0
Joe 1 month ago
parent
commit
f6b19251aa
Signed by: joe GPG Key ID: 8595A3F8F2CE1B74
4 changed files with 52 additions and 22 deletions
  1. +4
    -0
      .example.env
  2. +1
    -1
      client/components/Settings/SettingsDomain.tsx
  3. +45
    -21
      client/pages/settings.tsx
  4. +2
    -0
      server/env.ts

+ 4
- 0
.example.env View File

@@ -39,8 +39,12 @@ NON_USER_COOLDOWN=0
# Max number of visits for each link to have detailed stats
DEFAULT_MAX_STATS_PER_LINK=5000

# Enable support for custom domains
CUSTOM_DOMAIN_ENABLED=false
# Use HTTPS for links with custom domain
CUSTOM_DOMAIN_USE_HTTPS=false
# IP address to direct custom domains to
CUSTOM_DOMAIN_IP=

# A passphrase to encrypt JWT. Use a long and secure key.
JWT_SECRET=securekey


+ 1
- 1
client/components/Settings/SettingsDomain.tsx View File

@@ -75,7 +75,7 @@ const SettingsDomain: FC = () => {
<b>example.com/shorturl.</b>
</Text>
<Text mb={4}>
Point your domain A record to <b>192.64.116.170</b> then add the domain
Point your domain A record to <b>{process.env.CUSTOM_DOMAIN_IP}</b> then add the domain
via form below:
</Text>
{domains.length ? (


+ 45
- 21
client/pages/settings.tsx View File

@@ -14,29 +14,53 @@ import { useStoreState } from "../store";

const SettingsPage: NextPage = () => {
const email = useStoreState(s => s.auth.email);
const domain = process.env.CUSTOM_DOMAIN_ENABLED;

if (!domain) {
return (
<AppWrapper>
<Col width={600} maxWidth="90%" alignItems="flex-start" pb={80} mt={4}>
<H1 alignItems="center" fontSize={[24, 28]} light>
Welcome,{" "}
<Span pb="2px" style={{ borderBottom: "2px dotted #999" }}>
{email}
</Span>
.
</H1>
<Divider mt={4} mb={48} />
<SettingsPassword />
<Divider mt={4} mb={48} />
<SettingsApi />
<Divider mt={4} mb={48} />
<SettingsDeleteAccount />
</Col>
<Footer />
</AppWrapper>
);
} else {
return (
<AppWrapper>
<Col width={600} maxWidth="90%" alignItems="flex-start" pb={80} mt={4}>
<H1 alignItems="center" fontSize={[24, 28]} light>
Welcome,{" "}
<Span pb="2px" style={{ borderBottom: "2px dotted #999" }}>
{email}
</Span>
.
</H1>
<Divider mt={4} mb={48} />
<SettingsDomain />
<Divider mt={4} mb={48} />
<SettingsPassword />
<Divider mt={4} mb={48} />
<SettingsApi />
<Divider mt={4} mb={48} />
<SettingsDeleteAccount />
</Col>
<Footer />
</AppWrapper>
);
<AppWrapper>
<Col width={600} maxWidth="90%" alignItems="flex-start" pb={80} mt={4}>
<H1 alignItems="center" fontSize={[24, 28]} light>
Welcome,{" "}
<Span pb="2px" style={{ borderBottom: "2px dotted #999" }}>
{email}
</Span>
.
</H1>
<Divider mt={4} mb={48} />
<SettingsDomain />
<Divider mt={4} mb={48} />
<SettingsPassword />
<Divider mt={4} mb={48} />
<SettingsApi />
<Divider mt={4} mb={48} />
<SettingsDeleteAccount />
</Col>
<Footer />
</AppWrapper>
);
};
};

export default SettingsPage;

+ 2
- 0
server/env.ts View File

@@ -22,7 +22,9 @@ const env = cleanEnv(process.env, {
USER_LIMIT_PER_DAY: num({ default: 50 }),
NON_USER_COOLDOWN: num({ default: 10 }),
DEFAULT_MAX_STATS_PER_LINK: num({ default: 5000 }),
CUSTOM_DOMAIN_ENABLED: bool({ default: false }),
CUSTOM_DOMAIN_USE_HTTPS: bool({ default: false }),
CUSTOM_DOMAIN_IP: str({ default: "" }),
JWT_SECRET: str(),
ADMIN_EMAILS: str({ default: "" }),
GOOGLE_SAFE_BROWSING_KEY: str({ default: "" }),


Loading…
Cancel
Save