mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-24 09:39:49 +08:00
fix: name check bug (#434)
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const CONSTANTS = {
|
||||
VERSION: 'v0.7.4',
|
||||
VERSION: 'v0.7.5',
|
||||
|
||||
// DB settings
|
||||
ADDRESS_BLOCK_LIST_KEY: 'address_block_list',
|
||||
|
||||
Reference in New Issue
Block a user