Spaces:
Sleeping
Sleeping
feat: remap dashboard to root path and propagate search parameters across UI requests
Browse files- README.md +3 -4
- health-server.js +11 -5
- start.sh +2 -2
README.md
CHANGED
|
@@ -5,7 +5,6 @@ colorFrom: blue
|
|
| 5 |
colorTo: purple
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7861
|
| 8 |
-
base_path: /dashboard
|
| 9 |
pinned: true
|
| 10 |
license: mit
|
| 11 |
---
|
|
@@ -82,7 +81,7 @@ That's it! The Space will build the container and start up automatically. You ca
|
|
| 82 |
|
| 83 |
### Step 4: Monitor & Manage
|
| 84 |
|
| 85 |
-
HuggingClaw features a built-in dashboard at `/
|
| 86 |
|
| 87 |
- **Uptime:** Real-time uptime monitoring.
|
| 88 |
- **Sync Status:** Visual indicators for workspace backup operations.
|
|
@@ -136,7 +135,7 @@ Do **not** use the `Read-only API key` or a `Monitor-specific API key`.
|
|
| 136 |
|
| 137 |
Setup:
|
| 138 |
|
| 139 |
-
1. Open `/
|
| 140 |
2. Find **Keep Space Awake**.
|
| 141 |
3. Paste your UptimeRobot **Main API key**.
|
| 142 |
4. Click **Create Monitor**.
|
|
@@ -277,7 +276,7 @@ HuggingClaw/
|
|
| 277 |
- **Missing secrets:** Ensure `LLM_API_KEY`, `LLM_MODEL`, and `GATEWAY_TOKEN` are set in your Space **Settings β Secrets**.
|
| 278 |
- **Telegram bot issues:** Verify your `TELEGRAM_BOT_TOKEN`. Check Space logs for lines like `π± Enabling Telegram`.
|
| 279 |
- **Backup restore failing:** Make sure `HF_USERNAME` and `HF_TOKEN` are correct (token needs write access to your Dataset).
|
| 280 |
-
- **Space keeps sleeping:** Open `/
|
| 281 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
| 282 |
- **Control UI says too many failed authentication attempts:** Wait for the retry window to expire, then open the Space in an incognito window or clear site storage for your Space before logging in again with `GATEWAY_TOKEN`.
|
| 283 |
- **WhatsApp lost its session after restart:** Make sure `HF_USERNAME` and `HF_TOKEN` are configured so the hidden session backup can be restored on boot.
|
|
|
|
| 5 |
colorTo: purple
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7861
|
|
|
|
| 8 |
pinned: true
|
| 9 |
license: mit
|
| 10 |
---
|
|
|
|
| 81 |
|
| 82 |
### Step 4: Monitor & Manage
|
| 83 |
|
| 84 |
+
HuggingClaw features a built-in dashboard at `/` (with `/dashboard` kept as an alias) to track:
|
| 85 |
|
| 86 |
- **Uptime:** Real-time uptime monitoring.
|
| 87 |
- **Sync Status:** Visual indicators for workspace backup operations.
|
|
|
|
| 135 |
|
| 136 |
Setup:
|
| 137 |
|
| 138 |
+
1. Open `/`.
|
| 139 |
2. Find **Keep Space Awake**.
|
| 140 |
3. Paste your UptimeRobot **Main API key**.
|
| 141 |
4. Click **Create Monitor**.
|
|
|
|
| 276 |
- **Missing secrets:** Ensure `LLM_API_KEY`, `LLM_MODEL`, and `GATEWAY_TOKEN` are set in your Space **Settings β Secrets**.
|
| 277 |
- **Telegram bot issues:** Verify your `TELEGRAM_BOT_TOKEN`. Check Space logs for lines like `π± Enabling Telegram`.
|
| 278 |
- **Backup restore failing:** Make sure `HF_USERNAME` and `HF_TOKEN` are correct (token needs write access to your Dataset).
|
| 279 |
+
- **Space keeps sleeping:** Open `/` and use `Keep Space Awake` to create the external monitor.
|
| 280 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
| 281 |
- **Control UI says too many failed authentication attempts:** Wait for the retry window to expire, then open the Space in an incognito window or clear site storage for your Space before logging in again with `GATEWAY_TOKEN`.
|
| 282 |
- **WhatsApp lost its session after restart:** Make sure `HF_USERNAME` and `HF_TOKEN` are configured so the hidden session backup can be restored on boot.
|
health-server.js
CHANGED
|
@@ -31,7 +31,7 @@ function parseRequestUrl(url) {
|
|
| 31 |
}
|
| 32 |
|
| 33 |
function isDashboardRoute(pathname) {
|
| 34 |
-
return pathname === DASHBOARD_BASE || pathname === `${DASHBOARD_BASE}/`;
|
| 35 |
}
|
| 36 |
|
| 37 |
function isDashboardScopedPath(pathname, suffix) {
|
|
@@ -577,13 +577,19 @@ function renderDashboard(initialData) {
|
|
| 577 |
|
| 578 |
<script>
|
| 579 |
function getDashboardBase() {
|
| 580 |
-
const pathname = window.location.pathname || '
|
|
|
|
|
|
|
| 581 |
return pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
|
| 582 |
}
|
| 583 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
async function updateStats() {
|
| 585 |
try {
|
| 586 |
-
const res = await fetch(getDashboardBase() + '/status');
|
| 587 |
const data = await res.json();
|
| 588 |
|
| 589 |
document.getElementById('model-id').textContent = data.model;
|
|
@@ -673,7 +679,7 @@ function renderDashboard(initialData) {
|
|
| 673 |
result.textContent = '';
|
| 674 |
|
| 675 |
try {
|
| 676 |
-
const res = await fetch(getDashboardBase() + '/uptimerobot/setup', {
|
| 677 |
method: 'POST',
|
| 678 |
headers: { 'Content-Type': 'application/json' },
|
| 679 |
body: JSON.stringify({ apiKey })
|
|
@@ -704,7 +710,7 @@ function renderDashboard(initialData) {
|
|
| 704 |
updateStats();
|
| 705 |
setInterval(updateStats, 10000);
|
| 706 |
restoreMonitorUiState();
|
| 707 |
-
document.getElementById('control-ui-link').setAttribute('href', getDashboardBase() + '/app/');
|
| 708 |
document.getElementById('uptimerobot-btn').addEventListener('click', setupUptimeRobot);
|
| 709 |
document.getElementById('uptimerobot-toggle').addEventListener('click', toggleMonitorSetup);
|
| 710 |
</script>
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
function isDashboardRoute(pathname) {
|
| 34 |
+
return pathname === "/" || pathname === DASHBOARD_BASE || pathname === `${DASHBOARD_BASE}/`;
|
| 35 |
}
|
| 36 |
|
| 37 |
function isDashboardScopedPath(pathname, suffix) {
|
|
|
|
| 577 |
|
| 578 |
<script>
|
| 579 |
function getDashboardBase() {
|
| 580 |
+
const pathname = window.location.pathname || '/';
|
| 581 |
+
if (pathname === '/' || pathname === '') return '';
|
| 582 |
+
if (pathname === '${DASHBOARD_BASE}' || pathname === '${DASHBOARD_BASE}/') return '${DASHBOARD_BASE}';
|
| 583 |
return pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
|
| 584 |
}
|
| 585 |
|
| 586 |
+
function getCurrentSearch() {
|
| 587 |
+
return window.location.search || '';
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
async function updateStats() {
|
| 591 |
try {
|
| 592 |
+
const res = await fetch(getDashboardBase() + '/status' + getCurrentSearch());
|
| 593 |
const data = await res.json();
|
| 594 |
|
| 595 |
document.getElementById('model-id').textContent = data.model;
|
|
|
|
| 679 |
result.textContent = '';
|
| 680 |
|
| 681 |
try {
|
| 682 |
+
const res = await fetch(getDashboardBase() + '/uptimerobot/setup' + getCurrentSearch(), {
|
| 683 |
method: 'POST',
|
| 684 |
headers: { 'Content-Type': 'application/json' },
|
| 685 |
body: JSON.stringify({ apiKey })
|
|
|
|
| 710 |
updateStats();
|
| 711 |
setInterval(updateStats, 10000);
|
| 712 |
restoreMonitorUiState();
|
| 713 |
+
document.getElementById('control-ui-link').setAttribute('href', getDashboardBase() + '/app/' + getCurrentSearch());
|
| 714 |
document.getElementById('uptimerobot-btn').addEventListener('click', setupUptimeRobot);
|
| 715 |
document.getElementById('uptimerobot-toggle').addEventListener('click', toggleMonitorSetup);
|
| 716 |
</script>
|
start.sh
CHANGED
|
@@ -332,8 +332,8 @@ else
|
|
| 332 |
printf " β %-40s β\n" "Auth: π token"
|
| 333 |
fi
|
| 334 |
if [ -n "$SPACE_HOST" ]; then
|
| 335 |
-
printf " β %-40s β\n" "Control UI: https://${SPACE_HOST}"
|
| 336 |
-
printf " β %-40s β\n" "Dashboard: https://${SPACE_HOST}
|
| 337 |
fi
|
| 338 |
SYNC_STATUS="β disabled"
|
| 339 |
if [ -n "$HF_USERNAME" ] && [ -n "$HF_TOKEN" ]; then
|
|
|
|
| 332 |
printf " β %-40s β\n" "Auth: π token"
|
| 333 |
fi
|
| 334 |
if [ -n "$SPACE_HOST" ]; then
|
| 335 |
+
printf " β %-40s β\n" "Control UI: https://${SPACE_HOST}/app"
|
| 336 |
+
printf " β %-40s β\n" "Dashboard: https://${SPACE_HOST}"
|
| 337 |
fi
|
| 338 |
SYNC_STATUS="β disabled"
|
| 339 |
if [ -n "$HF_USERNAME" ] && [ -n "$HF_TOKEN" ]; then
|