63 lines
2.5 KiB
TypeScript
63 lines
2.5 KiB
TypeScript
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
import type { HostApiContext } from './context';
|
|
import { handleAiProxyRoutes } from './routes/ai-proxy';
|
|
import { handleAiHardwareRoutes } from './routes/ai-hardware';
|
|
import { handleAppRoutes } from './routes/app';
|
|
import { handleAuthRoutes } from './routes/auth';
|
|
import { handleImageWorkspaceRoutes } from './routes/image-workspace';
|
|
import { handleImagePromptMuseumRoutes } from './routes/image-prompt-museum';
|
|
import { handleLearningRoutes } from './routes/learning';
|
|
import { handleDataServiceRoutes } from './routes/data-service';
|
|
import { handleWorksRoutes } from './routes/works';
|
|
import { handleUserSyncRoutes } from './routes/user-sync';
|
|
import { handleSettingsRoutes } from './routes/settings';
|
|
import { handleProviderRoutes } from './routes/providers';
|
|
import { handleLogRoutes } from './routes/logs';
|
|
import { handleUsageRoutes } from './routes/usage';
|
|
import { handleFileRoutes } from './routes/files';
|
|
import { handleMeowaGameAssetsRoutes } from './routes/meowa-game-assets';
|
|
import { handleAgentBrowserRoutes } from './routes/agent-browser';
|
|
import { handleCodingFileRoutes } from './routes/coding-files';
|
|
import { handleCodingAttachmentRoutes } from './routes/coding-attachments';
|
|
import { handleCodingProjectRoutes } from './routes/coding-projects';
|
|
import { handleCodingConversationRoutes } from './routes/coding-conversations';
|
|
import { handleCodingPluginRoutes } from './routes/coding-plugins';
|
|
|
|
export type HostApiRouteHandler = (
|
|
req: IncomingMessage,
|
|
res: ServerResponse,
|
|
url: URL,
|
|
ctx: HostApiContext,
|
|
) => Promise<boolean>;
|
|
|
|
/**
|
|
* The same route list is used by the loopback compatibility server and by the
|
|
* Main-owned IPC dispatcher. Keeping one ordered list prevents the two
|
|
* transports from drifting into subtly different authorization or response
|
|
* behavior.
|
|
*/
|
|
export const hostApiRouteHandlers: readonly HostApiRouteHandler[] = [
|
|
handleAiProxyRoutes,
|
|
handleAiHardwareRoutes,
|
|
handleAppRoutes,
|
|
handleAuthRoutes,
|
|
handleImageWorkspaceRoutes,
|
|
handleImagePromptMuseumRoutes,
|
|
handleLearningRoutes,
|
|
handleDataServiceRoutes,
|
|
handleWorksRoutes,
|
|
handleAgentBrowserRoutes,
|
|
handleUserSyncRoutes,
|
|
handleCodingAttachmentRoutes,
|
|
handleCodingProjectRoutes,
|
|
handleCodingPluginRoutes,
|
|
handleCodingConversationRoutes,
|
|
handleCodingFileRoutes,
|
|
handleSettingsRoutes,
|
|
handleProviderRoutes,
|
|
handleFileRoutes,
|
|
handleMeowaGameAssetsRoutes,
|
|
handleLogRoutes,
|
|
handleUsageRoutes,
|
|
];
|