Merge pull request #360 from PR0M3TH3AN/add-dashboard-home-button-16801596229675926990

Add Home button to dashboard linking to landing page
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-19 23:11:21 -05:00
commit f5d52bd13c
4 files changed
+33 -11

No files matched your search

+7
View File
@@ -48,6 +48,13 @@ const distDashboard = path.join(DIST_DIR, 'dashboard');
fs.mkdirSync(distDashboard, { recursive: true });
fs.cpSync(DASHBOARD_SRC, distDashboard, { recursive: true });
// Patch dashboard/index.html to point to correct landing page in production build
// In dev, ../landing/ works. In dist, ../ works (since landing becomes index.html at root).
const dashboardIndex = path.join(distDashboard, 'index.html');
let dashboardHtml = fs.readFileSync(dashboardIndex, 'utf8');
dashboardHtml = dashboardHtml.replace(/href="\.\.\/landing\/"/g, 'href="../"');
fs.writeFileSync(dashboardIndex, dashboardHtml);
// 3. Copy docs/ -> dist/src/docs/
const distDocs = path.join(DIST_DIR, 'src', 'docs');
fs.mkdirSync(distDocs, { recursive: true });
+19 -11
View File
@@ -14,18 +14,26 @@
<div role="main" class="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
<!-- Header -->
<header class="mb-8">
<div class="flex items-center gap-3 mb-2">
<img src="../assets/logo.svg" alt="TORCH Logo" width="32" height="32">
<h1 class="text-2xl font-semibold text-text-strong">
TORCH Agent Dashboard
</h1>
<span
id="connectionStatus"
class="inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium bg-surface-alt text-muted"
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-3">
<img src="../assets/logo.svg" alt="TORCH Logo" width="32" height="32">
<h1 class="text-2xl font-semibold text-text-strong">
TORCH Agent Dashboard
</h1>
<span
id="connectionStatus"
class="inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium bg-surface-alt text-muted"
>
<span class="pulse-dot bg-muted"></span>
Connecting&hellip;
</span>
</div>
<a
href="../landing/"
class="rounded-md bg-surface border border-border px-3 py-1.5 text-sm font-medium text-text hover:bg-surface-alt focus:outline-none focus:ring-2 focus:ring-accent transition-colors"
>
<span class="pulse-dot bg-muted"></span>
Connecting&hellip;
</span>
Home
</a>
</div>
<p class="text-muted text-sm max-w-prose">
Live view of
+2
View File
@@ -160,8 +160,10 @@ export async function cmdDashboard(port = DEFAULT_DASHBOARD_PORT, host = '127.0.
// Security check: restrict access to allowed paths
const allowedPaths = [
path.join(packageRoot, 'dashboard'),
path.join(packageRoot, 'landing'),
path.join(packageRoot, 'assets'),
path.join(packageRoot, 'src', 'docs'),
path.join(packageRoot, 'src', 'prompts'),
path.join(packageRoot, 'src', 'constants.mjs'),
path.join(packageRoot, 'torch-config.json')
];
+5
View File
@@ -43,6 +43,11 @@ test('Dashboard File Access Security', async (t) => {
assert.strictEqual(res.statusCode, 200);
});
await t.test('allows access to landing page', async () => {
const res = await get('/landing/index.html');
assert.strictEqual(res.statusCode, 200);
});
await t.test('blocks access to package.json', async () => {
const res = await get('/package.json');
assert.strictEqual(res.statusCode, 403);