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
+4
View File
@@ -1,6 +1,10 @@
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 --> <!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
# CHANGE LOG # CHANGE LOG
## v0.7.5
- fix: 修复 `name` 的校验检查
## v0.7.4 ## v0.7.4
- feat: UI 列表页面增加最小宽度 - feat: UI 列表页面增加最小宽度
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "cloudflare_temp_email", "name": "cloudflare_temp_email",
"version": "0.7.4", "version": "0.7.5",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "temp-email-pages", "name": "temp-email-pages",
"version": "0.7.4", "version": "0.7.5",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "temp-mail-docs", "name": "temp-mail-docs",
"private": true, "private": true,
"version": "0.7.4", "version": "0.7.5",
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@types/node": "^22.3.0", "@types/node": "^22.3.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "cloudflare_temp_email", "name": "cloudflare_temp_email",
"version": "0.7.4", "version": "0.7.5",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
+5 -4
View File
@@ -134,15 +134,16 @@ const checkNameBlockList = async (
c: Context<HonoCustomType>, name: string c: Context<HonoCustomType>, name: string
): Promise<void> => { ): Promise<void> => {
// check name block list // check name block list
const blockList = [] as string[];
try { try {
const value = await getJsonSetting(c, CONSTANTS.ADDRESS_BLOCK_LIST_KEY); const value = await getJsonSetting(c, CONSTANTS.ADDRESS_BLOCK_LIST_KEY);
const blockList = (value || []) as string[]; blockList.push(...(value || []));
if (blockList.some((item) => name.includes(item))) {
throw new Error(`Name[${name}]is blocked`);
}
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
if (blockList.some((item) => name.includes(item))) {
throw new Error(`Name[${name}]is blocked`);
}
} }
export const cleanup = async ( export const cleanup = async (
+1 -1
View File
@@ -1,5 +1,5 @@
export const CONSTANTS = { export const CONSTANTS = {
VERSION: 'v0.7.4', VERSION: 'v0.7.5',
// DB settings // DB settings
ADDRESS_BLOCK_LIST_KEY: 'address_block_list', ADDRESS_BLOCK_LIST_KEY: 'address_block_list',