Delete httpd.js.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4709 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-12-30 19:47:36 +00:00
parent 4f3f4295ea
commit 0dcc879eb1
5 changed files with 29 additions and 611 deletions

View File

@ -2,7 +2,6 @@ import * as app from './app.js';
import * as auth from './auth.js';
import * as form from './form.js';
import * as http from './http.js';
import * as httpd from './httpd.js';
let gProcessIndex = 0;
let gProcesses = {};
@ -952,10 +951,9 @@ 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) {
httpd.all("/login", auth.handler);
httpd.registerSocketHandler("/app/socket", app.socket);
httpd.all("", function(request, response) {
let match;
if (request.uri === "/" || request.uri === "") {
try {
@ -1005,9 +1003,17 @@ loadSettings().then(function() {
return response.end(data);
}
});
httpd_impl.start(tildefriends.http_port);
let port = httpd.start(tildefriends.http_port);
if (tildefriends.args.out_http_port_file) {
print("Writing the port file.");
File.writeFile(tildefriends.args.out_http_port_file, port.toString() + '\n').then(function(r) {
print("Wrote the port file:", tildefriends.args.out_http_port_file, r);
}).catch(function() {
print("Failed to write the port file.");
});
}
if (tildefriends.args.httpdc && tildefriends.https_port) {
if (tildefriends.https_port) {
async function start_tls() {
const kCertificatePath = "data/httpd/certificate.pem";
const kPrivateKeyPath = "data/httpd/privatekey.pem";
@ -1016,7 +1022,7 @@ loadSettings().then(function() {
let context = new TlsContext();
context.setPrivateKey(privateKey);
context.setCertificate(certificate);
httpd_impl.start(tildefriends.https_port, context);
httpd.start(tildefriends.https_port, context);
}
start_tls();
}