Redirect localnode to actual hostname (better logged-in behavior) (#1599)

* Redirect localnode to actual hostname (better logged-in behaviour)

* Avoid redirect when boosting
This commit is contained in:
Tim Wilkinson 2024-10-08 20:59:59 -07:00 committed by GitHub
parent 97ee93e8f0
commit e95e4d996d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -427,6 +427,10 @@ global.handle_request = function(env)
else if (secured) {
tpath = `${config.application}/main${env.PATH_INFO}.ut`;
}
else if ((env.HTTP_HOST === "localnode" || env.HTTP_HOST === "localnode.local.mesh") && env.REQUEST_URI == "/a/status" && !env.headers["hx-boosted"]) {
uhttpd.send(`Status: 302 Found\r\nLocation: http://${configuration.getName()}.local.mesh\r\n\r\n`);
return;
}
else {
tpath = `${config.application}/main/${page}.ut`;
if (!pageCache[tpath] && !fs.access(tpath)) {