feat: worker: newAddress if domain is not set, use the first domain (#358)

This commit is contained in:
Dream Hunter
2024-07-22 13:05:50 +08:00
committed by GitHub
parent 60dda7e3fe
commit 163d9451f7
2 changed files with 6 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
- pages github actions && 修复清理邮件天数为 0 不生效 by @tqjason (#355)
- fix: imap proxy server 不支持 密码 by @dreamhunter2333 (#356)
- worker 新增 `ANNOUNCEMENT` 配置, 用于配置公告信息 by @dreamhunter2333 (#357)
- fix: telegram bot 新建地址默认选择第一个域名 by @dreamhunter2333 (#358)
## v0.6.0

View File

@@ -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")
}