forked from cory/tildefriends
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:
22
core/core.js
22
core/core.js
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user