mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
chore: remove dead code and unused dependencies
Cleans up stale implementation artifacts: - Delete legacy `src/webhook.ts` (dead code per AGENTS.md) - Delete admin composables `useMe.ts` and `useRoutes.ts` - Remove unused dependencies `jose` and `yaml` - Remove stale `Me` interface, `FILTER_LABELS`, `invalidateConfigCache`, and formatter re-exports
This commit is contained in:
parent
76ba2c0a89
commit
e1b1daac98
14 changed files with 7 additions and 320 deletions
|
|
@ -2,7 +2,6 @@ interface StoredToken {
|
|||
userId: string;
|
||||
accessToken: string;
|
||||
expiresAt: number;
|
||||
refreshToken?: string;
|
||||
}
|
||||
|
||||
async function hashToken(token: string): Promise<string> {
|
||||
|
|
@ -18,13 +17,11 @@ export async function saveToken(
|
|||
userId: string,
|
||||
accessToken: string,
|
||||
expiresInSeconds: number,
|
||||
refreshToken?: string,
|
||||
): Promise<void> {
|
||||
const token: StoredToken = {
|
||||
userId,
|
||||
accessToken,
|
||||
expiresAt: Date.now() + expiresInSeconds * 1000,
|
||||
refreshToken,
|
||||
};
|
||||
const ttl = Math.max(Math.floor(expiresInSeconds * 0.9), 60);
|
||||
await kv.put(`token:${userId}`, JSON.stringify(token), { expirationTtl: ttl });
|
||||
|
|
@ -44,12 +41,6 @@ export async function getToken(kv: KVNamespace, userId: string): Promise<string
|
|||
return t.accessToken;
|
||||
}
|
||||
|
||||
export async function getRefreshToken(kv: KVNamespace, userId: string): Promise<string | null> {
|
||||
const raw = await kv.get(`token:${userId}`, "json");
|
||||
if (!raw) return null;
|
||||
return (raw as StoredToken).refreshToken ?? null;
|
||||
}
|
||||
|
||||
export async function removeToken(kv: KVNamespace, userId: string): Promise<void> {
|
||||
const raw = await kv.get(`token:${userId}`, "json");
|
||||
if (raw) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue