more tweaks
This commit is contained in:
@@ -2167,7 +2167,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
async function cleanupSocket(socket) {
|
||||
try {
|
||||
if (socket_sessions[socket.id]) {
|
||||
if (!minisrv_config.config.debug_flags.quiet) console.debug('* Cleaning up disconnected socket', socket.id, `(${socket_sessions[socket.id].socket_total_read || 0} bytes read, ${socket_sessions[socket.id].socket_total_written || 0} bytes written)`);
|
||||
if (!minisrv_config.config.debug_flags.quiet) console.debug(' * Cleaning up disconnected socket', socket.id, `(${socket_sessions[socket.id].socket_total_read || 0} bytes read, ${socket_sessions[socket.id].socket_total_written || 0} bytes written)`);
|
||||
delete socket_sessions[socket.id];
|
||||
}
|
||||
if (socket.ssid) {
|
||||
@@ -2433,8 +2433,6 @@ process.on('uncaughtException', function (err) {
|
||||
console.error((err && err.stack) ? err.stack : err);
|
||||
});
|
||||
|
||||
var initstring = '';
|
||||
var initstring_pc = '';
|
||||
ports.sort();
|
||||
pc_ports.sort();
|
||||
|
||||
@@ -2445,7 +2443,6 @@ bind_ports.every(function (v) {
|
||||
try {
|
||||
var server = net.createServer(handleSocket);
|
||||
server.listen(v, minisrv_config.config.bind_ip);
|
||||
initstring += v + ", ";
|
||||
return true;
|
||||
} catch (e) {
|
||||
throw ("Could not bind to port", v, "on", minisrv_config.config.bind_ip, e.toString());
|
||||
@@ -2481,8 +2478,7 @@ pc_bind_ports.every(function (v) {
|
||||
}
|
||||
|
||||
service_handler.createServer(server_opts, server).listen(v, minisrv_config.config.bind_ip);
|
||||
initstring_pc += v + ", ";
|
||||
|
||||
|
||||
server.get('*', (req, res) => {
|
||||
var ssl = (req.socket.ssl) ? true : false;
|
||||
var service_name = getServiceByPort(v);
|
||||
@@ -2599,11 +2595,9 @@ Content-type: text/html`;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (initstring.length > 0) initstring = initstring.substring(0, initstring.length - 2);
|
||||
if (initstring_pc.length > 0) initstring_pc = initstring_pc.substring(0, initstring_pc.length - 2);
|
||||
|
||||
if (initstring.length > 0) console.log(" * Started WTVP Server on port(s) " + initstring + "...")
|
||||
if (initstring_pc.length > 0) console.log(" * Started HTTP Server on port(s) " + initstring_pc + "...")
|
||||
if (bind_ports.length > 0) console.log(` * Started WTVP Server on port${bind_ports.length != 1 ? "s" : ""} ` + bind_ports.join(", ") + "...");
|
||||
if (pc_bind_ports.length > 0) console.log(` * Started HTTP Server on port${pc_bind_ports.length != 1 ? "s" : ""} ` + pc_bind_ports.join(", ") + "...");
|
||||
|
||||
var listening_ip_string = (minisrv_config.config.bind_ip != "0.0.0.0") ? "IP: " + minisrv_config.config.bind_ip : "all interfaces";
|
||||
console.log(" * Listening on", listening_ip_string, "~", "Service IP:", service_ip);
|
||||
@@ -3,7 +3,7 @@
|
||||
<title>Web Search Proxy</title>
|
||||
</head>
|
||||
<body bgcolor="#191919" text="#44cc55" link="36d5ff" vlink="36d5ff">
|
||||
<form method="POST" action="wtv-search:/search">
|
||||
<form method="POST" action="{{ service_name }}:/search">
|
||||
<label for="q">Query:</label>
|
||||
<input type="text" id="q" name="q" value="{{ request_headers.query.q }}" size=30>
|
||||
<select name="categories">
|
||||
|
||||
@@ -96,7 +96,7 @@ function process(data) {
|
||||
}
|
||||
result.encodedurl = encodeURIComponent(result.url);
|
||||
if (result.thumbnail_src) {
|
||||
result.thumbnail_src = "wtv-search:/imgproxy?url=" + encodeURIComponent(result.thumbnail_src);
|
||||
result.thumbnail_src = service_name + "/imgproxy?url=" + encodeURIComponent(result.thumbnail_src);
|
||||
}
|
||||
|
||||
content.push(result);
|
||||
@@ -110,6 +110,6 @@ function process(data) {
|
||||
function finishPage(content) {
|
||||
const headers = `200 OK\nContent-Type: text/html`;
|
||||
nunjucks.configure({ autoescape: true });
|
||||
const data = nunjucks.render(wtvshared.getServiceDep('wtv-search/results.njk', true), { content, request_headers });
|
||||
const data = nunjucks.render(wtvshared.getServiceDep('wtv-search/results.njk', true), { content, request_headers, service_name });
|
||||
sendToClient(socket, headers, data);
|
||||
}
|
||||
Reference in New Issue
Block a user