mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-15 02:42:45 +08:00
feat: remove old vanilla JS/CSS frontend, make React SPA the sole entry for ccw view
Remove the entire old template-based frontend (~106K lines) and make the React SPA the only way to access the ccw dashboard via `ccw view`. Key changes: - Delete all old frontend files: dashboard-css/ (37 CSS), dashboard-js/ (59 JS), assets/, dashboard.html, and legacy HTML templates - Delete dashboard-generator.ts and dashboard-generator-patch.ts - Simplify server.ts: remove ~234 lines of old frontend code (template constants, MODULE_CSS_FILES/MODULE_FILES arrays, generateServerDashboard(), /assets/* serving) - Rebase React frontend from /react/ to root / (vite.config.ts, react-frontend.ts) - Add /react/* -> /* 301 redirect for backward compatibility - Remove --frontend and --new CLI flags from view and serve commands - Remove generateDashboard export from public API (index.ts) - Simplify serve.ts and view.ts to always use React without conditional branching - Update all affected tests (unit, e2e) for React-only architecture BREAKING CHANGE: --frontend and --new CLI flags removed; generateDashboard export removed from ccw package; /react/ base path changed to /
This commit is contained in:
@@ -135,22 +135,18 @@ async function createServer(initialPath: string): Promise<{ server: http.Server;
|
||||
return { server, baseUrl: `http://127.0.0.1:${port}` };
|
||||
}
|
||||
|
||||
function loadMaskApiKey(): (apiKey: string) => string {
|
||||
const filePath = new URL('../../src/templates/dashboard-js/views/api-settings.js', import.meta.url);
|
||||
const source = readFileSync(filePath, 'utf8');
|
||||
|
||||
const match = source.match(/function\s+maskApiKey\(apiKey\)\s*\{[\s\S]*?\r?\n\}/);
|
||||
if (!match) {
|
||||
throw new Error('maskApiKey function not found in api-settings.js');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-new-func
|
||||
const fn = new Function(`${match[0]}; return maskApiKey;`) as () => (apiKey: string) => string;
|
||||
return fn();
|
||||
/**
|
||||
* maskApiKey - inline implementation (previously extracted from old JS frontend).
|
||||
* Hides raw API keys while keeping env var references readable.
|
||||
*/
|
||||
function maskApiKey(apiKey: string): string {
|
||||
if (!apiKey) return '';
|
||||
if (apiKey.startsWith('${')) return apiKey; // Environment variable
|
||||
if (apiKey.length <= 8) return '***';
|
||||
return apiKey.substring(0, 4) + '...' + apiKey.substring(apiKey.length - 4);
|
||||
}
|
||||
|
||||
describe('security: credential handling', async () => {
|
||||
const maskApiKey = loadMaskApiKey();
|
||||
|
||||
function listFilesRecursive(dirPath: string): string[] {
|
||||
const results: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user