Spaces:
Running
Running
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>
- 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 |
-
//
|
| 26 |
-
//
|
| 27 |
-
const
|
| 28 |
-
process.env.HUGGINGCLAW_JUPYTER_ENABLED ||
|
| 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" : ""}<
|
| 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.
|
| 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" });
|