From 163d9451f7517e49da53c5921abc352521f1284e Mon Sep 17 00:00:00 2001 From: Dream Hunter Date: Mon, 22 Jul 2024 13:05:50 +0800 Subject: [PATCH] feat: worker: newAddress if domain is not set, use the first domain (#358) --- CHANGELOG.md | 1 + worker/src/common.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c55297..850bf3f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/worker/src/common.ts b/worker/src/common.ts index 0c569349..c2890ea2 100644 --- a/worker/src/common.ts +++ b/worker/src/common.ts @@ -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") }