mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-08-29 03:57:05 +08:00
feat: allow custom subdomains in create UI (#1109)
* feat: allow custom subdomains in create UI * test: stabilize custom subdomain browser flow * test: fix normalized address expectation * fix: gate custom subdomain input by setting * fix: scope custom subdomains to random domains * test: recreate random subdomain manually * refactor: minimize custom subdomain changes * refactor: reduce custom subdomain changes * test: fix custom subdomain locator * refactor: clarify manual subdomain validation * test: target visible custom subdomain input * refactor: simplify manual subdomain validation * refactor: use subdomain mode selector * style: stack subdomain modes vertically * test: click visible subdomain mode labels
This commit is contained in:
@@ -2,7 +2,7 @@ import { Context } from 'hono';
|
||||
import { Jwt } from 'hono/utils/jwt'
|
||||
import { WorkerMailerOptions } from 'worker-mailer';
|
||||
|
||||
import { getBooleanValue, getDomains, getStringArray, getStringValue, getIntValue, getUserRoles, getDefaultDomains, getJsonSetting, getAnotherWorkerList, hashPassword, getJsonObjectValue, getRandomSubdomainDomains, getDomainMapValue, normalizeDomains, trimLower } from './utils';
|
||||
import { getBooleanValue, getDomains, getStringArray, getStringValue, getIntValue, getUserRoles, getDefaultDomains, getJsonSetting, getAnotherWorkerList, hashPassword, getJsonObjectValue, getRandomSubdomainDomains, getDomainMapValue, isDomainOrSubdomain, normalizeDomains, trimLower } from './utils';
|
||||
import { unbindTelegramByAddress } from './telegram_api/common';
|
||||
import { CONSTANTS } from './constants';
|
||||
import { AddressCreationSettings, AdminWebhookSettings, ExtractResult, WebhookMail, WebhookSettings } from './models';
|
||||
@@ -410,8 +410,12 @@ export const newAddress = async (
|
||||
domain = normalizeDomainValue(domain);
|
||||
}
|
||||
const { effectiveEnabled: enableSubdomainMatch } = await getAddressCreationSubdomainMatchStatus(c);
|
||||
const allowManualSubdomain = domain
|
||||
? allowDomains.some((baseDomain) =>
|
||||
allowRandomSubdomainForDomain(c, baseDomain) && isDomainOrSubdomain(domain, baseDomain))
|
||||
: false;
|
||||
const matchedAllowDomain = domain
|
||||
? findMatchedAllowedDomain(domain, allowDomains, enableSubdomainMatch)
|
||||
? findMatchedAllowedDomain(domain, allowDomains, enableSubdomainMatch || allowManualSubdomain)
|
||||
: null;
|
||||
// check domain is valid
|
||||
if (!domain || !matchedAllowDomain) {
|
||||
|
||||
Reference in New Issue
Block a user