mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-15 20:38:06 +08:00
feat: telegram bot unbind && delete address (#254)
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
import { Context } from "hono";
|
||||
import { Bindings } from "../types";
|
||||
import { HonoCustomType } from "../types";
|
||||
import { CONSTANTS } from "../constants";
|
||||
import { AdminWebhookSettings } from "../models/models";
|
||||
// @ts-ignore
|
||||
import { getBooleanValue } from "../utils";
|
||||
|
||||
async function getWebhookSettings(c: Context<{ Bindings: Bindings }>): Promise<Response> {
|
||||
async function getWebhookSettings(c: Context<HonoCustomType>): Promise<Response> {
|
||||
const settings = await c.env.KV.get<AdminWebhookSettings>(CONSTANTS.WEBHOOK_KV_SETTINGS_KEY, "json");
|
||||
return c.json(settings || new AdminWebhookSettings([]));
|
||||
}
|
||||
|
||||
async function saveWebhookSettings(c: Context<{ Bindings: Bindings }>): Promise<Response> {
|
||||
async function saveWebhookSettings(c: Context<HonoCustomType>): Promise<Response> {
|
||||
const settings = await c.req.json<AdminWebhookSettings>();
|
||||
await c.env.KV.put(CONSTANTS.WEBHOOK_KV_SETTINGS_KEY, JSON.stringify(settings));
|
||||
return c.json({ success: true })
|
||||
|
||||
Reference in New Issue
Block a user