Skip to content

Commit

Permalink
fix: remove unneeded DNS_ALLOWED_DOMAINS in favor of PUBLIC_SUFFIXES.
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Dec 21, 2024
1 parent 3af2b87 commit c7517ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ PUBLIC_ENABLE_EXPERIMENTS=true

# DNS
APP_IPS="127.0.0.1"
DNS_ALLOWED_DOMAINS="localhost:9523"
DNS_NAMESERVERS="127.0.0.1:7753"
DNS_SOA_MASTER="localhost"
DNS_SOA_EMAIL="[email protected]"
Expand Down
7 changes: 1 addition & 6 deletions src/lib/dns/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,12 @@ const DNS_MASTER = env.DNS_SOA_MASTER;
const soaSplit = env.DNS_SOA_EMAIL.split('@');
const DNS_EMAIL = soaSplit[0].replace('.', '\\.') + '.' + soaSplit[1];
const DNS_NAMESERVERS = env.DNS_NAMESERVERS.split(',');
const ALLOWED_DOMAINS = env.DNS_ALLOWED_DOMAINS.toLowerCase().split(',');
const DNS_TTL = parseInt(env.DNS_TTL || '300');
const DNS_LOG_VERBOSE =
!!env.DNS_LOG_VERBOSE && env.DNS_LOG_VERBOSE != '0' && env.DNS_LOG_VERBOSE != 'false';
const matchesAllowedDomains = (name: string): boolean => {
const n = name.toLowerCase();
for (const domain of ALLOWED_DOMAINS) {
if (n == domain || n.endsWith(`.${domain}`)) return true;
}

return false;
return !!usernames.publicSuffix(n);
};
const makeNsAnswers = (name: string): SupportedAnswer[] => {
return DNS_NAMESERVERS.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@
<div class="input-group-shim">@</div>
<input type="text" bind:this={input} bind:value={handle} placeholder="name" />
<div class="input-group-shim">
{subscriptionInfo.benefits.has('non_numbered_username') ? '' : randomNumberSuffix}
{subscriptionInfo.benefits.has('non_numbered_username')
? ''
: randomNumberSuffix}
<select bind:value={publicSuffix} class="pl-0">
{#each usernames.publicSuffixes() as suffix}
<option value={suffix}>.{suffix}</option>
Expand Down

0 comments on commit c7517ec

Please sign in to comment.