fix/optimize wtv-news, wtv-proxy, wtv-register, wtv-search, wtv-setup, wtv-star
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
var minisrv_service_file = true;
|
||||
const minisrv_service_file = true;
|
||||
request_is_async = true;
|
||||
|
||||
var request_is_async = true;
|
||||
var errpage = null;
|
||||
var group = request_headers.query.group;
|
||||
var article = request_headers.query.article;
|
||||
var attachment_id = parseInt(request_headers.query.attachment_id);
|
||||
if ((!attachment_id && attachment_id != 0) || !group || !article) {
|
||||
let errpage = null;
|
||||
const group = request_headers.query.group;
|
||||
const attachment_id = parseInt(request_headers.query.attachment_id);
|
||||
if ((!attachment_id && attachment_id != 0) || !group || !request_headers.query.article) {
|
||||
errpage = wtvshared.doErrorPage(400, "Attachment ID required.");
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
} else {
|
||||
const wtvnews = new WTVNews(minisrv_config, service_name);
|
||||
var service_config = minisrv_config.services[service_name];
|
||||
const service_config = minisrv_config.services[service_name];
|
||||
if (service_config.local_nntp_port && wtvnewsserver) {
|
||||
var tls_options = {
|
||||
const tls_options = {
|
||||
ca: this.wtvshared.getServiceDep('wtv-news/localserver_ca.pem'),
|
||||
key: this.wtvshared.getServiceDep('wtv-news/localserver_key.pem'),
|
||||
cert: this.wtvshared.getServiceDep('wtv-news/localserver_cert.pem'),
|
||||
@@ -28,17 +27,17 @@ if ((!attachment_id && attachment_id != 0) || !group || !article) {
|
||||
else
|
||||
wtvnews.initializeUsenet(service_config.upstream_address, service_config.upstream_port, service_config.upstream_tls || null);
|
||||
}
|
||||
var article = parseInt(article);
|
||||
const article = parseInt(request_headers.query.article);
|
||||
wtvnews.connectUsenet().then(() => {
|
||||
wtvnews.selectGroup(group).then((response) => {
|
||||
wtvnews.getArticle(article).then((response) => {
|
||||
wtvnews.quitUsenet();
|
||||
if (response.code == 220) {
|
||||
var message_data = wtvnews.parseAttachments(response);
|
||||
const message_data = wtvnews.parseAttachments(response);
|
||||
if (message_data.attachments) {
|
||||
if (attachment_id < message_data.attachments.length) {
|
||||
var attachment = message_data.attachments[attachment_id];
|
||||
var encoding = attachment.content_encoding.toLowerCase()
|
||||
const attachment = message_data.attachments[attachment_id];
|
||||
const encoding = attachment.content_encoding.toLowerCase()
|
||||
if (encoding == 'base64') {
|
||||
data = Buffer.from(attachment.data, encoding);
|
||||
headers = "200 OK\n"
|
||||
|
||||
Reference in New Issue
Block a user