cf-worker-api/src/index.ts

34 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-06-12 00:13:57 +08:00
import {Context, Hono} from 'hono'
import {KVNamespace} from '@cloudflare/workers-types';
import {serveStatic} from 'hono/cloudflare-workers' // @ts-ignore
import manifest from '__STATIC_CONTENT_MANIFEST'
2025-06-12 13:01:25 +08:00
import * as local from "hono/cookie";
2025-06-12 17:21:53 +08:00
import * as oneui from './oneui';
import * as aliui from './aliui';
2025-06-12 00:13:57 +08:00
export type Bindings = {
2025-06-12 13:01:25 +08:00
MAIN_URLS: string
2025-06-12 00:13:57 +08:00
}
const app = new Hono<{ Bindings: Bindings }>()
app.use("*", serveStatic({manifest: manifest, root: "./"}));
2025-06-12 17:21:53 +08:00
2025-06-12 13:01:25 +08:00
// 登录申请 ##############################################################################
2025-06-12 00:13:57 +08:00
app.get('/onedrive/requests', async (c) => {
2025-06-12 17:21:53 +08:00
return oneui.oneLogin(c);
2025-06-12 00:13:57 +08:00
})
2025-06-12 13:01:25 +08:00
// 令牌申请 ##############################################################################
app.get('/onedrive/callback', async (c) => {
2025-06-12 17:21:53 +08:00
return oneui.oneToken(c);
2025-06-12 13:01:25 +08:00
})
2025-06-12 17:21:53 +08:00
// 登录申请 ##############################################################################
app.get('/alicloud/requests', async (c: Context) => {
return aliui.alyLogin(c);
});
// 令牌申请 ##############################################################################
app.get('/alicloud/callback', async (c: Context) => {
return aliui.alyToken(c);
});
2025-06-12 00:13:57 +08:00
2025-06-12 17:21:53 +08:00
export default app