-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add address_block_list for new address (#185)
- Loading branch information
1 parent
e81142f
commit 83b9bc9
Showing
12 changed files
with
178 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist/ | ||
test/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,21 @@ | |
|
||
## main branch to be released | ||
|
||
### DB Changes | ||
|
||
新增 `settings` 表,用于存储通用配置信息 | ||
|
||
- `db/2024-05-01-patch.sql` | ||
|
||
### Changes | ||
|
||
- `ENABLE_USER_CREATE_EMAIL` 是否允许用户创建邮件 | ||
- 允许 admin 创建无前缀的邮件 | ||
- 添加 `SMTP proxy server`,支持 SMTP 发送邮件 | ||
- 修复某些情况浏览器无法加载 `wasm` 时使用 js 解析邮件 | ||
- 页脚添加 `COPYRIGHT` | ||
- UI 允许用户切换邮件展示模式 `v-html` / `iframe` | ||
- 添加 `admin` 账户配置页面,支持配置用户注册名称黑名单 | ||
|
||
## v0.3.0 | ||
|
||
|
@@ -36,7 +46,6 @@ set | |
* feat: admin page add account mail count && sendbox default all && sen… by @dreamhunter2333 in https://github.com/dreamhunter2333/cloudflare_temp_email/pull/172 | ||
* feat: all mail use MailBox Component by @dreamhunter2333 in https://github.com/dreamhunter2333/cloudflare_temp_email/pull/173 | ||
|
||
|
||
**Full Changelog**: https://github.com/dreamhunter2333/cloudflare_temp_email/compare/0.2.10...v0.3.0 | ||
|
||
## v0.2.10 | ||
|
@@ -52,7 +61,7 @@ set | |
## v0.2.9 | ||
|
||
- 添加富文本编辑器 | ||
- admin 联系方式,不配置则不显示,可配置任意字符串 `ADMIN_CONTACT = "[email protected]"` | ||
- admin 联系方式,不配置则不显示,可配置任意字符串 `ADMIN_CONTACT = "[email protected]"` | ||
- 默认发送邮件余额,如果不设置,将为 0 `DEFAULT_SEND_BALANCE = 1` | ||
|
||
## v0.2.8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE IF NOT EXISTS settings ( | ||
key TEXT PRIMARY KEY, | ||
value TEXT, | ||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, | ||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<script setup> | ||
import { onMounted, ref } from 'vue'; | ||
import { useI18n } from 'vue-i18n' | ||
import { useGlobalState } from '../../store' | ||
import { api } from '../../api' | ||
const { | ||
localeCache, loading, openSettings, | ||
} = useGlobalState() | ||
const message = useMessage() | ||
const { t } = useI18n({ | ||
locale: localeCache.value || 'zh', | ||
messages: { | ||
en: { | ||
save: 'Save', | ||
successTip: 'Save Success', | ||
address_block_list: 'Address Block Keywords for Users(Admin can skip)', | ||
address_block_list_placeholder: 'Please enter the keywords you want to block', | ||
}, | ||
zh: { | ||
save: '保存', | ||
successTip: '保存成功', | ||
address_block_list: '用户地址屏蔽关键词(管理员可跳过检查)', | ||
address_block_list_placeholder: '请输入您想要屏蔽的关键词', | ||
} | ||
} | ||
}); | ||
const addressBlockList = ref([]) | ||
const fetchData = async () => { | ||
try { | ||
const res = await api.fetch(`/admin/account_settings`) | ||
addressBlockList.value = res.blockList || [] | ||
} catch (error) { | ||
message.error(error.message || "error"); | ||
} | ||
} | ||
const save = async () => { | ||
try { | ||
await api.fetch(`/admin/account_settings`, { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
blockList: addressBlockList.value || [] | ||
}) | ||
}) | ||
message.success(t('successTip')) | ||
} catch (error) { | ||
message.error(error.message || "error"); | ||
} | ||
} | ||
onMounted(async () => { | ||
await fetchData(); | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="center"> | ||
<n-card style="max-width: 600px;"> | ||
<n-form-item-row :label="t('address_block_list')"> | ||
<n-select v-model:value="addressBlockList" filterable multiple tag | ||
:placeholder="t('address_block_list_placeholder')" /> | ||
</n-form-item-row> | ||
<n-button @click="save" type="primary" block :loading="loading"> | ||
{{ t('save') }} | ||
</n-button> | ||
</n-card> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.center { | ||
display: flex; | ||
text-align: left; | ||
place-items: center; | ||
justify-content: center; | ||
margin: 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const CONSTANTS = { | ||
ADDRESS_BLOCK_LIST_KEY: 'address_block_list', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters