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:
Dream Hunter
2026-04-22 00:35:04 +08:00
committed by GitHub
parent e94ff52add
commit 063b6be2b1
14 changed files with 29 additions and 16 deletions

View File

@@ -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,

View File

@@ -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;