mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-04 23:17:34 +08:00
feat: add DOMAIN_LABELS for chinese domain label (#322)
This commit is contained in:
@@ -79,6 +79,24 @@ export const getIntValue = (
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
export const getStringArray = (
|
||||
value: string | string[] | undefined | null
|
||||
): string[] => {
|
||||
if (!value) {
|
||||
return [];
|
||||
}
|
||||
// check if value is an array, if not use json.parse
|
||||
if (!Array.isArray(value)) {
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
console.error("Failed to parse value", e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export const getDomains = (c: Context<HonoCustomType>): string[] => {
|
||||
if (!c.env.DOMAINS) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user