feat: update desktop workflows and app center

This commit is contained in:
inman
2026-05-13 19:14:56 +08:00
parent 20b5aff4ad
commit 7c8781a6e3
160 changed files with 55492 additions and 1423 deletions

View File

@@ -0,0 +1,28 @@
import type { IncomingMessage, ServerResponse } from 'http';
import { getAllLocalPreferences, patchLocalPreferences, type AppLocalPreferences } from '../../utils/local-preferences';
import type { HostApiContext } from '../context';
import { parseJsonBody, sendJson } from '../route-utils';
export async function handleLocalPreferenceRoutes(
req: IncomingMessage,
res: ServerResponse,
url: URL,
_ctx: HostApiContext,
): Promise<boolean> {
if (url.pathname === '/api/local-preferences' && req.method === 'GET') {
sendJson(res, 200, await getAllLocalPreferences());
return true;
}
if (url.pathname === '/api/local-preferences' && req.method === 'PUT') {
try {
const patch = await parseJsonBody<AppLocalPreferences>(req);
sendJson(res, 200, await patchLocalPreferences(patch));
} catch (error) {
sendJson(res, 500, { success: false, error: String(error) });
}
return true;
}
return false;
}