Onboarding was dead in three layers:
- The OnboardingAdmin screen was only reachable from a route block in App.tsx
that has been commented out, so it never rendered. Its ServerTypeCard carried
accountMode ('organization' | 'single'), inherited from the codebase this was
based on and meaningless for a single-user platform.
- Two /onboarding-complete endpoints, one public and one protected, that no
frontend code called. Both read a server_config key that was never written, so
both answered false while the app's own path defaulted to true.
- HomeScreen gated on settings.onboarding.complete to show a welcome panel, and
seedHomeDir created an Onboarding folder from DATA_PATH/Onboarding and
/Onboarding_Admin — neither seed directory exists, so it only ever produced an
empty folder.
Also drops the onboarding key from UserSettings and the now-empty home-header
panel from the default home layout.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import { createRouter } from '../../create-router';
|
|
import { readdirSync, existsSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { readServerSettings, writeServerSettings } from 'officerdb';
|
|
import { claudeCodeRouter } from './claude-code';
|
|
import { chatProvidersRouter } from './chat-providers';
|
|
import { applicationsRouter } from './applications';
|
|
import { smtpRouter } from './smtp';
|
|
import { ttsRouter } from './tts';
|
|
import { sttRouter } from './stt';
|
|
import { ocrRouter } from './ocr';
|
|
|
|
export const serverSettingsRouter = createRouter();
|
|
|
|
serverSettingsRouter.route('/claude-code', claudeCodeRouter);
|
|
serverSettingsRouter.route('/chat-providers', chatProvidersRouter);
|
|
serverSettingsRouter.route('/applications', applicationsRouter);
|
|
serverSettingsRouter.route('/smtp', smtpRouter);
|
|
serverSettingsRouter.route('/tts', ttsRouter);
|
|
serverSettingsRouter.route('/stt', sttRouter);
|
|
serverSettingsRouter.route('/ocr', ocrRouter);
|
|
|
|
export { readServerSettings as readSettings };
|
|
|
|
serverSettingsRouter.get('/settings', async (ctx) => {
|
|
return ctx.json(await readServerSettings());
|
|
});
|
|
|
|
serverSettingsRouter.put('/', async (ctx) => {
|
|
const body = await ctx.req.json();
|
|
const settings = await readServerSettings();
|
|
const updated = { ...settings, ...body };
|
|
await writeServerSettings(updated);
|
|
return ctx.json(updated);
|
|
});
|
|
|
|
serverSettingsRouter.get('/plugins', async (ctx) => {
|
|
const pluginsDir = join(import.meta.dir, '../../../workspaces/plugins');
|
|
const settings = await readServerSettings();
|
|
const pluginSettings: Record<string, boolean> = (settings.plugins as Record<string, boolean>) ?? {};
|
|
|
|
const plugins: { id: string; name: string; description: string; enabled: boolean }[] = [];
|
|
|
|
if (!existsSync(pluginsDir)) return ctx.json(plugins);
|
|
|
|
const dirs = readdirSync(pluginsDir, { withFileTypes: true }).filter((d) => d.isDirectory());
|
|
|
|
for (const dir of dirs) {
|
|
const hasServer = existsSync(join(pluginsDir, dir.name, 'server', 'index.ts'));
|
|
const hasClient = existsSync(join(pluginsDir, dir.name, 'client', 'index.ts'));
|
|
if (!hasServer && !hasClient) continue;
|
|
|
|
const mainIndex = join(pluginsDir, dir.name, 'index.ts');
|
|
if (!existsSync(mainIndex)) continue;
|
|
|
|
const mod = await import(mainIndex);
|
|
const meta = mod.plugin ?? { id: dir.name, name: dir.name, description: '' };
|
|
plugins.push({
|
|
id: meta.id,
|
|
name: meta.name,
|
|
description: meta.description,
|
|
enabled: pluginSettings[meta.id] !== false,
|
|
});
|
|
}
|
|
|
|
return ctx.json(plugins);
|
|
});
|