feat: integrate Convex API and add N5 proxy functionality
- Added Convex client setup in a new module for handling Convex API interactions. - Implemented N5Proxy to handle requests for the /n5/:slug route, querying Convex for application links. - Updated app context to include Convex client and API. - Adjusted routing to support new Convex API endpoints. - Enhanced error handling for missing applications in the N5 proxy.
This commit is contained in:
@@ -6,7 +6,7 @@ import './routes/jwks.ts'
|
||||
|
||||
const simpleAppsPrefixs = [
|
||||
"/api/wxmsg",
|
||||
"/api/convex/"
|
||||
"/api/convex/",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import { UserV3Proxy } from '@/modules/v3/index.ts';
|
||||
import { hasBadUser, userIsBanned, appIsBanned, userPathIsBanned } from '@/modules/off/index.ts';
|
||||
import { robotsTxt } from '@/modules/html/index.ts';
|
||||
import { isBun } from '@/utils/get-engine.ts';
|
||||
import { N5Proxy } from '@/modules/n5/index.ts';
|
||||
const domain = config?.proxy?.domain;
|
||||
const allowedOrigins = config?.proxy?.allowedOrigin || [];
|
||||
|
||||
@@ -255,6 +256,11 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
|
||||
createNotFoundPage,
|
||||
});
|
||||
}
|
||||
if (user === 'n5') {
|
||||
return N5Proxy(req, res, {
|
||||
createNotFoundPage,
|
||||
});
|
||||
}
|
||||
if (user !== 'api' && app === 'v3') {
|
||||
return UserV3Proxy(req, res, {
|
||||
createNotFoundPage,
|
||||
|
||||
Reference in New Issue
Block a user