fix: name check bug (#434)

This commit is contained in:
Dream Hunter
2024-08-25 16:39:55 +08:00
committed by GitHub
parent a24cc1f642
commit a57a42b2a1
7 changed files with 14 additions and 9 deletions

View File

@@ -1,6 +1,10 @@
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
# CHANGE LOG
## v0.7.5
- fix: 修复 `name` 的校验检查
## v0.7.4
- feat: UI 列表页面增加最小宽度

View File

@@ -1,6 +1,6 @@
{
"name": "cloudflare_temp_email",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,6 +1,6 @@
{
"name": "temp-email-pages",
"version": "0.7.4",
"version": "0.7.5",
"description": "",
"main": "index.js",
"scripts": {

View File

@@ -1,7 +1,7 @@
{
"name": "temp-mail-docs",
"private": true,
"version": "0.7.4",
"version": "0.7.5",
"type": "module",
"devDependencies": {
"@types/node": "^22.3.0",

View File

@@ -1,6 +1,6 @@
{
"name": "cloudflare_temp_email",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"type": "module",
"scripts": {

View File

@@ -134,15 +134,16 @@ const checkNameBlockList = async (
c: Context<HonoCustomType>, name: string
): Promise<void> => {
// check name block list
const blockList = [] as string[];
try {
const value = await getJsonSetting(c, CONSTANTS.ADDRESS_BLOCK_LIST_KEY);
const blockList = (value || []) as string[];
if (blockList.some((item) => name.includes(item))) {
throw new Error(`Name[${name}]is blocked`);
}
blockList.push(...(value || []));
} catch (error) {
console.error(error);
}
if (blockList.some((item) => name.includes(item))) {
throw new Error(`Name[${name}]is blocked`);
}
}
export const cleanup = async (

View File

@@ -1,5 +1,5 @@
export const CONSTANTS = {
VERSION: 'v0.7.4',
VERSION: 'v0.7.5',
// DB settings
ADDRESS_BLOCK_LIST_KEY: 'address_block_list',