Spaces:
Running
Running
Merge branch 'main' into edit
Browse files- health-server.js +5 -1
health-server.js
CHANGED
|
@@ -704,6 +704,10 @@ const server = http.createServer(async (req, res) => {
|
|
| 704 |
}
|
| 705 |
|
| 706 |
if (pathname === "/env-builder.js") {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
try {
|
| 708 |
const js = fs.readFileSync(require("path").join(__dirname, "env-builder.js"), "utf8");
|
| 709 |
res.writeHead(200, { "Content-Type": "application/javascript", "Cache-Control": "no-store" });
|
|
@@ -732,7 +736,7 @@ const server = http.createServer(async (req, res) => {
|
|
| 732 |
if (pathname === JUPYTER_BASE || pathname.startsWith(JUPYTER_BASE + "/")) {
|
| 733 |
if (!JUPYTER_ENABLED) {
|
| 734 |
res.writeHead(404, { "Content-Type": "application/json" });
|
| 735 |
-
return res.end(JSON.stringify({ status: "disabled", message: "JupyterLab terminal is disabled.
|
| 736 |
}
|
| 737 |
if (isDirectHfSpaceRequest) {
|
| 738 |
res.writeHead(200, { "Content-Type": "text/html" });
|
|
|
|
| 704 |
}
|
| 705 |
|
| 706 |
if (pathname === "/env-builder.js") {
|
| 707 |
+
if (!isEnvBuilderAuthed(req)) {
|
| 708 |
+
res.writeHead(401, { "Content-Type": "text/plain" });
|
| 709 |
+
return res.end("Unauthorized");
|
| 710 |
+
}
|
| 711 |
try {
|
| 712 |
const js = fs.readFileSync(require("path").join(__dirname, "env-builder.js"), "utf8");
|
| 713 |
res.writeHead(200, { "Content-Type": "application/javascript", "Cache-Control": "no-store" });
|
|
|
|
| 736 |
if (pathname === JUPYTER_BASE || pathname.startsWith(JUPYTER_BASE + "/")) {
|
| 737 |
if (!JUPYTER_ENABLED) {
|
| 738 |
res.writeHead(404, { "Content-Type": "application/json" });
|
| 739 |
+
return res.end(JSON.stringify({ status: "disabled", message: "JupyterLab terminal is disabled. Remove DEV_MODE=false to re-enable." }));
|
| 740 |
}
|
| 741 |
if (isDirectHfSpaceRequest) {
|
| 742 |
res.writeHead(200, { "Content-Type": "text/html" });
|