more tweaks

This commit is contained in:
zefie
2025-07-24 09:51:54 -04:00
parent 6ad86178b9
commit d4a8f372bb
3 changed files with 7 additions and 13 deletions

View File

@@ -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,7 +2478,6 @@ 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;
@@ -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);

View File

@@ -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">

View File

@@ -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);
}