feat: prepare Zhinian desktop pilot
This commit is contained in:
26
electron/api/routes/apps.ts
Normal file
26
electron/api/routes/apps.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { IncomingMessage, ServerResponse } from 'http';
|
||||
import type { HostApiContext } from '../context';
|
||||
import { sendJson } from '../route-utils';
|
||||
import {
|
||||
ensureNianxxPlayServiceStarted,
|
||||
getNianxxPlayServiceStatus,
|
||||
} from '../../utils/nianxx-play-service';
|
||||
|
||||
export async function handleAppIntegrationRoutes(
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
url: URL,
|
||||
_ctx: HostApiContext,
|
||||
): Promise<boolean> {
|
||||
if (url.pathname === '/api/apps/nianxx-play/status' && req.method === 'GET') {
|
||||
sendJson(res, 200, await getNianxxPlayServiceStatus());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (url.pathname === '/api/apps/nianxx-play/start' && req.method === 'POST') {
|
||||
sendJson(res, 200, await ensureNianxxPlayServiceStarted());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user