Refactor code structure for improved readability and maintainability

This commit is contained in:
shuaiplus
2026-02-26 04:54:11 +08:00
committed by Shuai
parent d80821edeb
commit 6bbc7554c1
3 changed files with 4 additions and 1487 deletions
+2 -7
View File
@@ -48,7 +48,7 @@ import {
import { handleSync } from './handlers/sync';
// Setup handlers
import { handleSetupPage, handleSetupStatus } from './handlers/setup';
import { handleSetupStatus } from './handlers/setup';
import { handleWebClientPage } from './handlers/web';
import { handleKnownDevice, handleGetDevices, handleUpdateDeviceToken } from './handlers/devices';
@@ -187,15 +187,10 @@ export async function handleRequest(request: Request, env: Env): Promise<Respons
try {
// Web client entry (single-path app)
if ((path === '/' || path === '/register' || path === '/login') && method === 'GET') {
if ((path === '/' || path === '/register' || path === '/login' || path === '/setup' || path === '/setup/legacy') && method === 'GET') {
return handleWebClientPage(request, env);
}
// Legacy setup page
if ((path === '/setup' || path === '/setup/legacy') && method === 'GET') {
return handleSetupPage(request, env);
}
// Setup status
if (path === '/setup/status' && method === 'GET') {
return handleSetupStatus(request, env);