mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Add Home button to dashboard linking to landing page
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
fdf1cf7084
commit
babdd4af5d
4 files changed
+33
-11
No files matched your search
@@ -48,6 +48,13 @@ const distDashboard = path.join(DIST_DIR, 'dashboard');
|
|||||||
fs.mkdirSync(distDashboard, { recursive: true });
|
fs.mkdirSync(distDashboard, { recursive: true });
|
||||||
fs.cpSync(DASHBOARD_SRC, 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/
|
// 3. Copy docs/ -> dist/src/docs/
|
||||||
const distDocs = path.join(DIST_DIR, 'src', 'docs');
|
const distDocs = path.join(DIST_DIR, 'src', 'docs');
|
||||||
fs.mkdirSync(distDocs, { recursive: true });
|
fs.mkdirSync(distDocs, { recursive: true });
|
||||||
|
|||||||
+19
-11
@@ -14,18 +14,26 @@
|
|||||||
<div role="main" class="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
|
<div role="main" class="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<header class="mb-8">
|
<header class="mb-8">
|
||||||
<div class="flex items-center gap-3 mb-2">
|
<div class="flex items-center justify-between mb-2">
|
||||||
<img src="../assets/logo.svg" alt="TORCH Logo" width="32" height="32">
|
<div class="flex items-center gap-3">
|
||||||
<h1 class="text-2xl font-semibold text-text-strong">
|
<img src="../assets/logo.svg" alt="TORCH Logo" width="32" height="32">
|
||||||
TORCH Agent Dashboard
|
<h1 class="text-2xl font-semibold text-text-strong">
|
||||||
</h1>
|
TORCH Agent Dashboard
|
||||||
<span
|
</h1>
|
||||||
id="connectionStatus"
|
<span
|
||||||
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"
|
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…
|
||||||
|
</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>
|
Home
|
||||||
Connecting…
|
</a>
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="text-muted text-sm max-w-prose">
|
<p class="text-muted text-sm max-w-prose">
|
||||||
Live view of
|
Live view of
|
||||||
|
|||||||
@@ -160,8 +160,10 @@ export async function cmdDashboard(port = DEFAULT_DASHBOARD_PORT, host = '127.0.
|
|||||||
// Security check: restrict access to allowed paths
|
// Security check: restrict access to allowed paths
|
||||||
const allowedPaths = [
|
const allowedPaths = [
|
||||||
path.join(packageRoot, 'dashboard'),
|
path.join(packageRoot, 'dashboard'),
|
||||||
|
path.join(packageRoot, 'landing'),
|
||||||
path.join(packageRoot, 'assets'),
|
path.join(packageRoot, 'assets'),
|
||||||
path.join(packageRoot, 'src', 'docs'),
|
path.join(packageRoot, 'src', 'docs'),
|
||||||
|
path.join(packageRoot, 'src', 'prompts'),
|
||||||
path.join(packageRoot, 'src', 'constants.mjs'),
|
path.join(packageRoot, 'src', 'constants.mjs'),
|
||||||
path.join(packageRoot, 'torch-config.json')
|
path.join(packageRoot, 'torch-config.json')
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ test('Dashboard File Access Security', async (t) => {
|
|||||||
assert.strictEqual(res.statusCode, 200);
|
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 () => {
|
await t.test('blocks access to package.json', async () => {
|
||||||
const res = await get('/package.json');
|
const res = await get('/package.json');
|
||||||
assert.strictEqual(res.statusCode, 403);
|
assert.strictEqual(res.statusCode, 403);
|
||||||
|
|||||||
Reference in new issue
Block a user