somratpro Claude Sonnet 4.5 commited on
Commit
5d10651
·
1 Parent(s): 273aafd

fix: default JUPYTER_ENABLED to true, clean up footer

Browse files

- JUPYTER_ENABLED now defaults to true; only disabled when DEV_MODE=false
or HUGGINGCLAW_JUPYTER_ENABLED=false is explicitly set
- Fixes logic bug where HUGGINGCLAW_JUPYTER_ENABLED="false" (truthy string)
short-circuited the GATEWAY_TOKEN fallback check
- Remove Private Space explanation text from dashboard footer

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. health-server.js +7 -6
health-server.js CHANGED
@@ -22,11 +22,12 @@ const JUPYTER_HOST = "127.0.0.1";
22
  const JUPYTER_BASE = normalizeBase(process.env.JUPYTER_BASE, "/terminal");
23
  const GATEWAY_TOKEN = (process.env.GATEWAY_TOKEN || "").trim();
24
  const DEV_MODE_ENABLED = isTrue(process.env.DEV_MODE);
25
- // Auto-enable Jupyter when DEV_MODE=true, HUGGINGCLAW_JUPYTER_ENABLED=true, or GATEWAY_TOKEN is set.
26
- // GATEWAY_TOKEN doubles as JUPYTER_TOKEN in start.sh — no extra secret needed.
27
- const JUPYTER_ENABLED = /^(true|1|yes|on)$/i.test(
28
- process.env.HUGGINGCLAW_JUPYTER_ENABLED || (DEV_MODE_ENABLED ? "true" : GATEWAY_TOKEN ? "true" : "false")
29
  );
 
30
  const startTime = Date.now();
31
  const LLM_MODEL = process.env.LLM_MODEL || "Not Set";
32
  const TELEGRAM_ENABLED = !!process.env.TELEGRAM_BOT_TOKEN;
@@ -243,7 +244,7 @@ function renderDashboard(data) {
243
  <a class="hero-action env" data-space-link="env-builder" href="/env-builder">⚙️ Env Builder →</a>
244
  </div>
245
  <section class="overview">${tilesHtml}</section>
246
- <footer>Built by <a href="https://github.com/somratpro" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:none">@somratpro</a>${JUPYTER_ENABLED ? " · Terminal by JupyterLab" : ""}<br><span>Public Spaces open via <code>.hf.space</code> directly. Private Spaces require the <a href="${HF_SPACE_URL || "#"}" target="_blank" rel="noopener noreferrer" style="color:inherit">Hugging Face App tab</a> for the authenticated session${HF_SPACE_URL ? ` — or share <code>huggingface.co/spaces/${SPACE_ID}</code>` : ""}.</span></footer>
247
  </main>
248
  <script>
249
  document.querySelectorAll('.local-time').forEach(el=>{const d=new Date(el.getAttribute('data-iso'));if(!isNaN(d))el.textContent='At '+d.toLocaleTimeString()});
@@ -481,7 +482,7 @@ const server = http.createServer(async (req, res) => {
481
  if (pathname === JUPYTER_BASE || pathname.startsWith(JUPYTER_BASE + "/")) {
482
  if (!JUPYTER_ENABLED) {
483
  res.writeHead(404, { "Content-Type": "application/json" });
484
- return res.end(JSON.stringify({ status: "disabled", message: "JupyterLab terminal is disabled. Set DEV_MODE=true to enable /terminal/." }));
485
  }
486
  if (isDirectHfSpaceRequest) {
487
  res.writeHead(200, { "Content-Type": "text/html" });
 
22
  const JUPYTER_BASE = normalizeBase(process.env.JUPYTER_BASE, "/terminal");
23
  const GATEWAY_TOKEN = (process.env.GATEWAY_TOKEN || "").trim();
24
  const DEV_MODE_ENABLED = isTrue(process.env.DEV_MODE);
25
+ // Jupyter enabled by default. Only disabled when explicitly set to false via
26
+ // DEV_MODE=false or HUGGINGCLAW_JUPYTER_ENABLED=false.
27
+ const JUPYTER_EXPLICITLY_DISABLED = /^(false|0|no|off)$/i.test(
28
+ String(process.env.HUGGINGCLAW_JUPYTER_ENABLED || process.env.DEV_MODE || "").trim()
29
  );
30
+ const JUPYTER_ENABLED = !JUPYTER_EXPLICITLY_DISABLED;
31
  const startTime = Date.now();
32
  const LLM_MODEL = process.env.LLM_MODEL || "Not Set";
33
  const TELEGRAM_ENABLED = !!process.env.TELEGRAM_BOT_TOKEN;
 
244
  <a class="hero-action env" data-space-link="env-builder" href="/env-builder">⚙️ Env Builder →</a>
245
  </div>
246
  <section class="overview">${tilesHtml}</section>
247
+ <footer>Built by <a href="https://github.com/somratpro" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:none">@somratpro</a>${JUPYTER_ENABLED ? " · Terminal by JupyterLab" : ""}</footer>
248
  </main>
249
  <script>
250
  document.querySelectorAll('.local-time').forEach(el=>{const d=new Date(el.getAttribute('data-iso'));if(!isNaN(d))el.textContent='At '+d.toLocaleTimeString()});
 
482
  if (pathname === JUPYTER_BASE || pathname.startsWith(JUPYTER_BASE + "/")) {
483
  if (!JUPYTER_ENABLED) {
484
  res.writeHead(404, { "Content-Type": "application/json" });
485
+ return res.end(JSON.stringify({ status: "disabled", message: "JupyterLab terminal is disabled. Remove DEV_MODE=false to re-enable." }));
486
  }
487
  if (isDirectHfSpaceRequest) {
488
  res.writeHead(200, { "Content-Type": "text/html" });