Some quick http refactors to make websockets less magic.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4705 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-12-30 16:29:16 +00:00
parent d556cbc835
commit b6a3923b27
5 changed files with 77 additions and 70 deletions

View File

@ -954,6 +954,7 @@ function stringResponse(response, data) {
loadSettings().then(function() {
let httpd_impl = (tildefriends.args.httpdc ? httpdc : httpd);
httpd_impl.all("/login", auth.handler);
httpd_impl.registerSocketHandler("/app/socket", app.socket);
httpd_impl.all("", function(request, response) {
let match;
if (request.uri === "/" || request.uri === "") {
@ -1004,7 +1005,6 @@ loadSettings().then(function() {
return response.end(data);
}
});
httpd_impl.registerSocketHandler("/app/socket", app.socket);
httpd_impl.start(tildefriends.http_port);
}).catch(function(error) {
print('Failed to load settings.');