fix/optimize wtv-news, wtv-proxy, wtv-register, wtv-search, wtv-setup, wtv-star
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
minisrv_service_file = true;
|
||||
const minisrv_service_file = true;
|
||||
request_is_async = true;
|
||||
|
||||
const proxyUrl = minisrv_config.services[service_name].wrp_url;
|
||||
let proxyUrl = minisrv_config.services[service_name].wrp_url;
|
||||
if (!proxyUrl.endsWith('/')) {
|
||||
proxyUrl += '/';
|
||||
}
|
||||
|
||||
// Remove 'service_name:/' from the start of request_url
|
||||
let forwardPath = request_headers.request_url
|
||||
const forwardPath = request_headers.request_url
|
||||
.replace(new RegExp(`^${service_name}:\\/`), '');
|
||||
|
||||
// Build the full URL to forward to
|
||||
@@ -24,12 +24,12 @@ lib.get(targetUrl, (res) => {
|
||||
headers += `Content-Type: ${res.headers['content-type']}\n`;
|
||||
}
|
||||
|
||||
let data = [];
|
||||
const data = [];
|
||||
res.on('data', chunk => data.push(chunk));
|
||||
res.on('end', () => {
|
||||
sendToClient(socket, headers, Buffer.concat(data));
|
||||
});
|
||||
}).on('error', err => {
|
||||
var errpage = WTVShared.doErrorPage(400, 'Error fetching image', err.message);
|
||||
const errpage = wtvshared.doErrorPage(400, 'Error fetching image', err.message);
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
});
|
||||
Reference in New Issue
Block a user