Skip to content

Commit

Permalink
fix: name check bug (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamhunter2333 authored Aug 25, 2024
1 parent a24cc1f commit a57a42b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
# CHANGE LOG

## v0.7.5

- fix: 修复 `name` 的校验检查

## v0.7.4

- feat: UI 列表页面增加最小宽度
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudflare_temp_email",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion pages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "temp-email-pages",
"version": "0.7.4",
"version": "0.7.5",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion vitepress-docs/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudflare_temp_email",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"type": "module",
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions worker/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion worker/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const CONSTANTS = {
VERSION: 'v0.7.4',
VERSION: 'v0.7.5',

// DB settings
ADDRESS_BLOCK_LIST_KEY: 'address_block_list',
Expand Down

0 comments on commit a57a42b

Please sign in to comment.