mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-06-09 09:29:54 +08:00
feat: worker: newAddress if domain is not set, use the first domain (#358)
This commit is contained in:
@@ -40,6 +40,11 @@ export const newAddress = async (
|
||||
}
|
||||
// check domain
|
||||
const allowDomains = checkAllowDomains ? await getAllowDomains(c) : getDomains(c);
|
||||
// if domain is not set, use the first domain
|
||||
if (!domain && allowDomains.length > 0) {
|
||||
domain = allowDomains[0];
|
||||
}
|
||||
// check domain is valid
|
||||
if (!domain || !allowDomains.includes(domain)) {
|
||||
throw new Error("Invalid domain")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user