mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-07-02 21:01:55 +08:00
Refactor delete setting helper and link skills (#994)
* refactor: add deleteSetting helper and link skills * chore: reorganize project skills layout * docs: update skill paths * chore: add AGENTS link and prune skill links * chore: localize agent skill links
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Context } from 'hono'
|
||||
|
||||
import i18n from '../i18n'
|
||||
import { getJsonSetting, saveSetting } from '../utils'
|
||||
import { deleteSetting, getJsonSetting, saveSetting } from '../utils'
|
||||
import { getAddressCreationSettings, getAddressCreationSubdomainMatchStatus } from '../common'
|
||||
import { CONSTANTS } from '../constants'
|
||||
import {
|
||||
@@ -109,9 +109,7 @@ const save = async (c: Context<HonoCustomType>) => {
|
||||
await saveSetting(c, CONSTANTS.EMAIL_RULE_SETTINGS_KEY, JSON.stringify(emailRuleSettings || {}));
|
||||
if (addressCreationSettingsUpdate.shouldUpdate) {
|
||||
if (addressCreationSettingsUpdate.shouldClear) {
|
||||
await c.env.DB.prepare(
|
||||
`DELETE FROM settings WHERE key = ?`
|
||||
).bind(CONSTANTS.ADDRESS_CREATION_SETTINGS_KEY).run();
|
||||
await deleteSetting(c, CONSTANTS.ADDRESS_CREATION_SETTINGS_KEY);
|
||||
} else {
|
||||
await saveSetting(
|
||||
c, CONSTANTS.ADDRESS_CREATION_SETTINGS_KEY,
|
||||
|
||||
@@ -64,6 +64,16 @@ export const saveSetting = async (
|
||||
return true;
|
||||
}
|
||||
|
||||
export const deleteSetting = async (
|
||||
c: Context<HonoCustomType>,
|
||||
key: string
|
||||
) => {
|
||||
await c.env.DB.prepare(
|
||||
`DELETE FROM settings WHERE key = ?`
|
||||
).bind(key).run();
|
||||
return true;
|
||||
}
|
||||
|
||||
export const getStringValue = (value: any): string => {
|
||||
if (typeof value === "string") {
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user