more optimizations, remove WTVIRC for now, upgrade test.js
This commit is contained in:
@@ -4,7 +4,7 @@ const action = request_headers.query.action;
|
||||
|
||||
let address_book = null
|
||||
address_book = session_data.getSessionData("address_book")
|
||||
if (address_book == null) {
|
||||
if (address_book === null) {
|
||||
session_data.setSessionData("address_book", [])
|
||||
address_book = [];
|
||||
}
|
||||
@@ -625,9 +625,9 @@ text="E7CE4A"
|
||||
font=proportional
|
||||
name="nickname"
|
||||
value="`;
|
||||
if (action == 'editfromheader') {
|
||||
if (action === 'editfromheader') {
|
||||
data += request_headers.query.nickname
|
||||
} else if (action == 'edit' && request_headers.query.id) {
|
||||
} else if (action === 'edit' && request_headers.query.id) {
|
||||
data += address_book[request_headers.query.id].name
|
||||
}
|
||||
data += `"
|
||||
@@ -652,9 +652,9 @@ font=proportional
|
||||
nosoftbreaks nohardbreaks
|
||||
name="address"
|
||||
value="`;
|
||||
if (action == 'editfromheader') {
|
||||
if (action === 'editfromheader') {
|
||||
data += request_headers.query.address
|
||||
} else if (action == 'edit' && request_headers.query.id) {
|
||||
} else if (action === 'edit' && request_headers.query.id) {
|
||||
data += address_book[request_headers.query.id].address
|
||||
}
|
||||
data += `"
|
||||
@@ -784,7 +784,7 @@ Location: wtv-mail:/addressbook`;
|
||||
break;
|
||||
|
||||
case "discard":
|
||||
if (address_book.length == 1) {
|
||||
if (address_book.length === 1) {
|
||||
address_book = []
|
||||
} else {
|
||||
address_book.splice(request_headers.query.id, 1)
|
||||
|
||||
@@ -8,7 +8,7 @@ minisrv-no-mail-count: true`;
|
||||
|
||||
const address_book = session_data.getSessionData("address_book")
|
||||
|
||||
if (session_data.getSessionData("address_book") != null) {
|
||||
if (session_data.getSessionData("address_book") !== null) {
|
||||
data = ``
|
||||
for (let i = 0; i < address_book.length; i++) {
|
||||
data += address_book[i].name + '\0' + address_book[i].address + '\0'
|
||||
|
||||
@@ -2,8 +2,8 @@ const minisrv_service_file = true;
|
||||
|
||||
let errpage, message;
|
||||
const messageid = request_headers.query.message_id;
|
||||
const attachment_id = request_headers.query.attachment_id;
|
||||
if (!attachment_id && attachment_id != 0) errpage = wtvshared.doErrorPage(400, "Attachment ID required.");
|
||||
const attachment_id = parseInt(request_headers.query.attachment_id);
|
||||
if (!attachment_id && attachment_id !== 0) errpage = wtvshared.doErrorPage(400, "Attachment ID required.");
|
||||
else {
|
||||
message = session_data.mailstore.getMessageByID(messageid);
|
||||
if (!message) errpage = wtvshared.doErrorPage(400, "Invalid Message ID");
|
||||
|
||||
@@ -58,14 +58,14 @@ if (!intro_seen && !request_headers.query.intro_seen) {
|
||||
const total_unread_message_count = session_data.mailstore.countUnreadMessages(mailbox);
|
||||
|
||||
let message_list_string = null;
|
||||
if (total_message_count == 0) {
|
||||
if (total_message_count === 0) {
|
||||
message_list_string = "No new mail messages for ";
|
||||
} else {
|
||||
if (total_unread_message_count > 0) {
|
||||
message_list_string = total_unread_message_count + " new mail message" + ((total_message_count != 1) ? 's' : '');
|
||||
if (total_message_count - total_unread_message_count > 0) message_list_string += ", " + (total_message_count - total_unread_message_count) + " mail message" + (((total_message_count - total_unread_message_count) != 1) ? 's' : '') + " for ";
|
||||
} else {
|
||||
message_list_string = total_message_count + " mail message" + ((total_message_count != 1) ? 's' : '') + " for ";
|
||||
message_list_string = total_unread_message_count + " new mail message" + ((total_message_count !== 1) ? 's' : '');
|
||||
if (total_message_count - total_unread_message_count > 0) message_list_string += ", " + (total_message_count - total_unread_message_count) + " mail message" + (((total_message_count - total_unread_message_count) !== 1) ? 's' : '') + " for ";
|
||||
} else {
|
||||
message_list_string = total_message_count + " mail message" + ((total_message_count !== 1) ? 's' : '') + " for ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ ${username}@${minisrv_config.config.service_name}
|
||||
`;
|
||||
Object.keys(message_list).forEach(function (k) {
|
||||
const message = message_list[k];
|
||||
if (typeof message.subject == "object" && message.subject) message.subject = wtvshared.decodeBufferText(message.subject);
|
||||
if (typeof message.subject === "object" && message.subject) message.subject = wtvshared.decodeBufferText(message.subject);
|
||||
message.known_sender = session_data.isAddressInAddressBook(message.from_addr);
|
||||
let message_font_open = "<font color=#7A9FCC>";
|
||||
let message_font_close = "</font>";
|
||||
@@ -319,7 +319,7 @@ ${message_font_close}
|
||||
});
|
||||
} else {
|
||||
data += `
|
||||
<font sizerange=medium> No ${(mailbox_name == "Inbox") ? `new e-mail messages for<table cellspacing=0 cellpadding=0 border=0>
|
||||
<font sizerange=medium> No ${(mailbox_name === "Inbox") ? `new e-mail messages for<table cellspacing=0 cellpadding=0 border=0>
|
||||
<TR><TD maxlines="1">
|
||||
${username}@${minisrv_config.config.service_name}
|
||||
</TD></TR>
|
||||
|
||||
@@ -47,7 +47,7 @@ Content-type: text/html`;
|
||||
}
|
||||
if (message.signature) message_colors = session_data.mailstore.getSignatureColors(message.signature);
|
||||
|
||||
if (typeof message.subject == "object" && message.subject) message.subject = wtvshared.decodeBufferText(message.subject);
|
||||
if (typeof message.subject === "object" && message.subject) message.subject = wtvshared.decodeBufferText(message.subject);
|
||||
data = `<wtvnoscript>
|
||||
<sendpanel
|
||||
action = "wtv-mail:/sendmail?message_forward_id=14&mailbox_name=inbox"
|
||||
@@ -243,7 +243,7 @@ E-mail message
|
||||
From:
|
||||
<td width=10>
|
||||
<td>`;
|
||||
if (message.from_name != message.from_addr) {
|
||||
if (message.from_name !== message.from_addr) {
|
||||
data += `${wtvshared.htmlEntitize(message.from_addr)} <a href="client:showalert?sound=none&message=To%20add%20%3Cblackface%3E${encodeURIComponent(encodeURIComponent(message.from_name))}%3C%2Fblackface%3E%20to%20your%20Address%20book,%20choose%20%3Cb%3EAdd%3C%2Fb%3E.&buttonlabel2=Cancel&buttonaction2=client:donothing&buttonlabel1=Add&buttonaction1=wtv-mail:/addressbook%3Faction%3Deditfromheader%26noresponse%3Dtrue%26nickname%3D${encodeURIComponent(encodeURIComponent(message.from_name))}%26address%3D${encodeURIComponent(encodeURIComponent(message.from_addr))}%26new_address%3Dtrue">(${wtvshared.htmlEntitize(message.from_name)})</a>`;
|
||||
} else {
|
||||
data += `${wtvshared.htmlEntitize(message.from_addr)}`;
|
||||
|
||||
@@ -7,7 +7,7 @@ const intro_seen = session_data.mailstore.checkMailIntroSeen();
|
||||
if (!intro_seen && !request_headers.query.intro_seen) {
|
||||
// user is trying to bypass the intro screen
|
||||
headers = "300 OK\nLocation: wtv-mail:/DiplomaMail?came-from=" + encodeURIComponent(request_headers.request_url);
|
||||
} else if (request_headers.query.clear == "true") {
|
||||
} else if (request_headers.query.clear === "true") {
|
||||
let gourl;
|
||||
if (request_headers.Referer)
|
||||
gourl = request_headers.Referer.replace(/[\?\&]clear\=true/, '');
|
||||
@@ -105,8 +105,8 @@ Location: ${gourl}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (request_headers.query.togglesign == "true") no_signature = false;
|
||||
if (request_headers.query.togglesign == "false") no_signature = true;
|
||||
if (request_headers.query.togglesign === "true") no_signature = false;
|
||||
if (request_headers.query.togglesign === "false") no_signature = true;
|
||||
|
||||
if (mail_draft_attachments) {
|
||||
if (mail_draft_attachments.message_snapshot_data) message_snapshot_data = mail_draft_attachments.message_snapshot_data;
|
||||
@@ -136,10 +136,10 @@ Content-Type: audio/wav`;
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
|
||||
if ((typeof request_headers.query.sendoff !== 'undefined' && request_headers.query.sendoff != false) || request_headers.query.saveoff || request_headers.query.get_snap || request_headers.query.get_gab) {
|
||||
if ((typeof request_headers.query.sendoff !== 'undefined' && request_headers.query.sendoff !== false) || request_headers.query.saveoff || request_headers.query.get_snap || request_headers.query.get_gab) {
|
||||
let from_addr = address;
|
||||
const signature = session_data.getSessionData("subscriber_signature") || null;
|
||||
if (typeof request_headers.query.sendoff !== 'undefined' && request_headers.query.sendoff != false) {
|
||||
if (typeof request_headers.query.sendoff !== 'undefined' && request_headers.query.sendoff !== false) {
|
||||
const attachments = [];
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ Content-Type: audio/wav`;
|
||||
'mime': 'image/jpeg',
|
||||
'filename': 'snapshot.jpg'
|
||||
}
|
||||
if (typeof message_snapshot_data == "object") {
|
||||
if (typeof message_snapshot_data === "object") {
|
||||
attachment.content = new Buffer.from(message_snapshot_data).toString('base64');
|
||||
attachment.is_base64 = true;
|
||||
} else
|
||||
@@ -163,7 +163,7 @@ Content-Type: audio/wav`;
|
||||
'filename': 'voicemail.wav'
|
||||
}
|
||||
|
||||
if (typeof message_voicemail_data == "object") {
|
||||
if (typeof message_voicemail_data === "object") {
|
||||
attachment.content = new Buffer.from(message_voicemail_data).toString('base64');
|
||||
attachment.is_base64 = true;
|
||||
} else
|
||||
@@ -196,7 +196,7 @@ Content-Type: audio/wav`;
|
||||
wtvnews.initializeUsenet(service_config.upstream_address, service_config.upstream_port, service_config.upstream_tls || null);
|
||||
}
|
||||
from_addr = userdisplayname + " <" + from_addr + ">";
|
||||
if (signature && signature != "" && !no_signature) {
|
||||
if (signature && signature !== "" && !no_signature) {
|
||||
if (signature.indexOf('<html>') >= 0) {
|
||||
attachments.push({
|
||||
"mime": 'text/html',
|
||||
@@ -299,13 +299,13 @@ wtv-expire-all: wtv-mail:/sendmail`;
|
||||
headers = `200 OK
|
||||
Content-type: text/html`;
|
||||
mail_draft_data = session_data.getSessionData((newsgroup) ? "usenet_draft_attachments" : "mail_draft_attachments") || {};
|
||||
if (request_headers.query.snapping == "false") {
|
||||
if (request_headers.query.snapping === "false") {
|
||||
headers += "\nwtv-expire-all: cache:snapshot.jpg";
|
||||
if (mail_draft_data.message_snapshot_data) mail_draft_data.message_snapshot_data = null;
|
||||
session_data.setSessionData((newsgroup) ? "usenet_draft_attachments" : "mail_draft_attachments", mail_draft_data);
|
||||
}
|
||||
|
||||
if (request_headers.query.gabbing == "false") {
|
||||
if (request_headers.query.gabbing === "false") {
|
||||
headers += "\nwtv-expire-all: cache:voicemail.wav";
|
||||
if (mail_draft_data.message_voicemail_data) mail_draft_data.message_voicemail_data = null;
|
||||
session_data.setSessionData((newsgroup) ? "usenet_draft_attachments" : "mail_draft_attachments", mail_draft_data);
|
||||
@@ -617,7 +617,7 @@ link=${message_colors.link}
|
||||
vlink=${message_colors.vlink}
|
||||
vspace=0
|
||||
hspace=0>`;
|
||||
if (session_data.getSessionData("subscriber_signature") && session_data.getSessionData("subscriber_signature") != "" && !no_signature) {
|
||||
if (session_data.getSessionData("subscriber_signature") && session_data.getSessionData("subscriber_signature") !== "" && !no_signature) {
|
||||
data += wtvshared.sanitizeSignature(session_data.getSessionData("subscriber_signature"));
|
||||
}
|
||||
if (msg_url) {
|
||||
@@ -642,7 +642,7 @@ Included Page: <a href="${msg_url}">${wtvshared.htmlEntitize(msg_url_title).repl
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=305 valign=top>`;
|
||||
if (!session_data.getSessionData("subscriber_signature") || session_data.getSessionData("subscriber_signature") == "") {
|
||||
if (!session_data.getSessionData("subscriber_signature") || session_data.getSessionData("subscriber_signature") === "") {
|
||||
data += `<input type = hidden name = "togglesign" value = "false"> <td abswidth=13 > `;
|
||||
} else if (no_signature) {
|
||||
data += `<a href="javascript:Signing('true')">
|
||||
|
||||
@@ -15,7 +15,7 @@ const ok = '1';
|
||||
if (request_headers.query.address) {
|
||||
const address_split = request_headers.query.address.split("@");
|
||||
const domain = address_split[1];
|
||||
if (domain != "escargot.chat" && domain != "escargot.live") data = fail
|
||||
if (domain !== "escargot.chat" && domain !== "escargot.live") data = fail
|
||||
else data = ok;
|
||||
} else {
|
||||
data = fail;
|
||||
|
||||
Reference in New Issue
Block a user