Fix token handling, remove orchestrator API call, improve mobile responsive footer layout
This commit is contained in:
@@ -13,6 +13,7 @@ const ORCHESTRATOR_PORT = 3006;
|
||||
const MODE_FOLDERS: Record<string, string> = {
|
||||
'Mode1Test': 'Mode1Test',
|
||||
'Mode2Test': 'Mode2Test',
|
||||
'Mode3Test': 'Mode3Test',
|
||||
};
|
||||
|
||||
let currentMode: string = 'Mode1Test';
|
||||
@@ -82,7 +83,7 @@ async function startMode(mode: string): Promise<boolean> {
|
||||
|
||||
// Determine server path based on mode
|
||||
// Mode2Test uses AuthAndToken/backend/server.ts
|
||||
// Mode1Test uses backend/server.ts
|
||||
// Mode1Test and Mode3Test use backend/server.ts
|
||||
let serverPath = 'backend/server.ts';
|
||||
if (mode === 'Mode2Test') {
|
||||
serverPath = 'AuthAndToken/backend/server.ts';
|
||||
@@ -94,10 +95,6 @@ async function startMode(mode: string): Promise<boolean> {
|
||||
cwd: modePath,
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
env: {
|
||||
...process.env,
|
||||
PORT: String(SHARED_PORT),
|
||||
},
|
||||
});
|
||||
|
||||
currentMode = mode;
|
||||
@@ -126,37 +123,6 @@ async function startMode(mode: string): Promise<boolean> {
|
||||
// Initialize app
|
||||
const app = new Hono();
|
||||
|
||||
// Health check
|
||||
app.get('/health', (c) => {
|
||||
return c.json({ status: 'ok', orchestratorPort: ORCHESTRATOR_PORT, sharedPort: SHARED_PORT });
|
||||
});
|
||||
|
||||
// Get current mode
|
||||
app.get('/api/mode', (c) => {
|
||||
return c.json({ currentMode, availableModes: ['Mode1Test', 'Mode2Test'] });
|
||||
});
|
||||
|
||||
// Switch mode (with graceful restart)
|
||||
app.post('/api/mode/switch/:mode', async (c) => {
|
||||
const newMode = c.req.param('mode');
|
||||
const validModes = ['Mode1Test', 'Mode2Test'];
|
||||
|
||||
if (!validModes.includes(newMode)) {
|
||||
return c.json({ error: 'Invalid mode', availableModes: validModes }, 400);
|
||||
}
|
||||
|
||||
if (newMode === currentMode) {
|
||||
return c.json({ message: 'Already in this mode', currentMode });
|
||||
}
|
||||
|
||||
const success = await startMode(newMode);
|
||||
if (success) {
|
||||
return c.json({ message: 'Mode switched successfully', currentMode: newMode });
|
||||
} else {
|
||||
return c.json({ error: 'Failed to switch mode' }, 500);
|
||||
}
|
||||
});
|
||||
|
||||
// Startup message
|
||||
console.log(`
|
||||
================================================================================
|
||||
|
||||
Reference in New Issue
Block a user