somratpro commited on
Commit
a3d9f77
·
1 Parent(s): 70d997a

docs/feat: clarify UptimeRobot limitations for private Spaces and disable setup UI in private views

Browse files
Files changed (2) hide show
  1. README.md +8 -3
  2. health-server.js +45 -30
README.md CHANGED
@@ -60,7 +60,7 @@ Watch a quick walkthrough on YouTube: [Deploying HuggingClaw on HF Spaces](https
60
 
61
  [![Duplicate this Space](https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg)](https://huggingface.co/spaces/somratpro/HuggingClaw?duplicate=true)
62
 
63
- Click the button above to duplicate the template. And set the visibility to **Private** (recommended).
64
 
65
  ### Step 2: Add Your Secrets
66
 
@@ -81,7 +81,7 @@ That's it! The Space will build the container and start up automatically. You ca
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.
@@ -128,7 +128,7 @@ For persistent chat history and configuration, HuggingClaw can sync your workspa
128
 
129
  ## 💓 Staying Alive *(Recommended on Free HF Spaces)*
130
 
131
- Free Hugging Face Spaces can still sleep. HuggingClaw does not rely on internal self-pings anymore. To help keep your Space awake, set up an external UptimeRobot monitor from the dashboard.
132
 
133
  Use the **Main API key** from UptimeRobot.
134
  Do **not** use the `Read-only API key` or a `Monitor-specific API key`.
@@ -148,6 +148,11 @@ What happens next:
148
 
149
  You do **not** need to add this key to Hugging Face Space Secrets.
150
 
 
 
 
 
 
151
  ## 🔔 Webhooks *(Optional)*
152
 
153
  Get notified when your Space restarts or if a backup fails:
 
60
 
61
  [![Duplicate this Space](https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-xl.svg)](https://huggingface.co/spaces/somratpro/HuggingClaw?duplicate=true)
62
 
63
+ Click the button above to duplicate the template.
64
 
65
  ### Step 2: Add Your Secrets
66
 
 
81
 
82
  ### Step 4: Monitor & Manage
83
 
84
+ HuggingClaw features a built-in dashboard to track:
85
 
86
  - **Uptime:** Real-time uptime monitoring.
87
  - **Sync Status:** Visual indicators for workspace backup operations.
 
128
 
129
  ## 💓 Staying Alive *(Recommended on Free HF Spaces)*
130
 
131
+ Free Hugging Face Spaces can still sleep. HuggingClaw does not rely on internal self-pings anymore. To help keep a public Space awake, set up an external UptimeRobot monitor from the dashboard.
132
 
133
  Use the **Main API key** from UptimeRobot.
134
  Do **not** use the `Read-only API key` or a `Monitor-specific API key`.
 
148
 
149
  You do **not** need to add this key to Hugging Face Space Secrets.
150
 
151
+ Note:
152
+
153
+ - This works for **public** Spaces.
154
+ - It does **not** work reliably for **private** Spaces, because external monitors cannot access private HF health URLs.
155
+
156
  ## 🔔 Webhooks *(Optional)*
157
 
158
  Get notified when your Space restarts or if a backup fails:
health-server.js CHANGED
@@ -556,37 +556,42 @@ function renderDashboard(initialData) {
556
 
557
  <div class="stat-card helper-card">
558
  <span class="stat-label">Keep Space Awake</span>
559
- <div class="helper-copy">
560
- If you use a free Hugging Face Space, it can still sleep.
561
- To keep it awake, create an external UptimeRobot monitor here.
562
- Use your <strong>Main API key</strong>.
563
- </div>
564
- <div class="helper-copy">
565
- Do <strong>not</strong> use the Read-only API key or a Monitor-specific API key.
566
- </div>
567
- <div id="uptimerobot-summary" class="helper-summary">
568
- Optional one-time setup. If you already created the monitor before, you do not need to paste the key again.
569
- </div>
570
- <button id="uptimerobot-toggle" class="helper-toggle" type="button">
571
- Set Up Monitor
572
- </button>
573
- <div id="uptimerobot-shell" class="helper-shell hidden">
574
- <div class="helper-row">
575
- <input
576
- id="uptimerobot-key"
577
- class="helper-input"
578
- type="password"
579
- placeholder="Paste your UptimeRobot Main API key"
580
- autocomplete="off"
581
- />
582
- <button id="uptimerobot-btn" class="helper-button" type="button">
583
- Create Monitor
584
- </button>
585
  </div>
586
- <div class="helper-note">
587
- One-time setup. Your key is only used to create the monitor for this Space.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
  </div>
589
  </div>
 
 
 
590
  <div id="uptimerobot-result" class="helper-result"></div>
591
  </div>
592
 
@@ -652,6 +657,11 @@ function renderDashboard(initialData) {
652
 
653
  const monitorStateKey = 'huggingclaw_uptimerobot_setup_v1';
654
 
 
 
 
 
 
655
  function setMonitorUiState(isConfigured) {
656
  const summary = document.getElementById('uptimerobot-summary');
657
  const shell = document.getElementById('uptimerobot-shell');
@@ -731,8 +741,13 @@ function renderDashboard(initialData) {
731
  setInterval(updateStats, 10000);
732
  restoreMonitorUiState();
733
  document.getElementById('control-ui-link').setAttribute('href', getDashboardBase() + '/app/' + getCurrentSearch());
734
- document.getElementById('uptimerobot-btn').addEventListener('click', setupUptimeRobot);
735
- document.getElementById('uptimerobot-toggle').addEventListener('click', toggleMonitorSetup);
 
 
 
 
 
736
  </script>
737
  </body>
738
  </html>
 
556
 
557
  <div class="stat-card helper-card">
558
  <span class="stat-label">Keep Space Awake</span>
559
+ <div id="uptimerobot-public-flow">
560
+ <div class="helper-copy">
561
+ If you use a free Hugging Face Space, it can still sleep.
562
+ To keep it awake, create an external UptimeRobot monitor here.
563
+ Use your <strong>Main API key</strong>.
564
+ </div>
565
+ <div class="helper-copy">
566
+ Do <strong>not</strong> use the Read-only API key or a Monitor-specific API key.
567
+ </div>
568
+ <div id="uptimerobot-summary" class="helper-summary">
569
+ Optional one-time setup. If you already created the monitor before, you do not need to paste the key again.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  </div>
571
+ <button id="uptimerobot-toggle" class="helper-toggle" type="button">
572
+ Set Up Monitor
573
+ </button>
574
+ <div id="uptimerobot-shell" class="helper-shell hidden">
575
+ <div class="helper-row">
576
+ <input
577
+ id="uptimerobot-key"
578
+ class="helper-input"
579
+ type="password"
580
+ placeholder="Paste your UptimeRobot Main API key"
581
+ autocomplete="off"
582
+ />
583
+ <button id="uptimerobot-btn" class="helper-button" type="button">
584
+ Create Monitor
585
+ </button>
586
+ </div>
587
+ <div class="helper-note">
588
+ One-time setup. Your key is only used to create the monitor for this Space.
589
+ </div>
590
  </div>
591
  </div>
592
+ <div id="uptimerobot-private-note" class="helper-summary hidden">
593
+ <strong>Not available on private Spaces.</strong> External monitors like UptimeRobot cannot reliably access a private Hugging Face Space health URL, so this setup only works on public Spaces.
594
+ </div>
595
  <div id="uptimerobot-result" class="helper-result"></div>
596
  </div>
597
 
 
657
 
658
  const monitorStateKey = 'huggingclaw_uptimerobot_setup_v1';
659
 
660
+ function isPrivateSignedView() {
661
+ const params = new URLSearchParams(window.location.search || '');
662
+ return params.has('__sign');
663
+ }
664
+
665
  function setMonitorUiState(isConfigured) {
666
  const summary = document.getElementById('uptimerobot-summary');
667
  const shell = document.getElementById('uptimerobot-shell');
 
741
  setInterval(updateStats, 10000);
742
  restoreMonitorUiState();
743
  document.getElementById('control-ui-link').setAttribute('href', getDashboardBase() + '/app/' + getCurrentSearch());
744
+ if (isPrivateSignedView()) {
745
+ document.getElementById('uptimerobot-public-flow').classList.add('hidden');
746
+ document.getElementById('uptimerobot-private-note').classList.remove('hidden');
747
+ } else {
748
+ document.getElementById('uptimerobot-btn').addEventListener('click', setupUptimeRobot);
749
+ document.getElementById('uptimerobot-toggle').addEventListener('click', toggleMonitorSetup);
750
+ }
751
  </script>
752
  </body>
753
  </html>