implement internal shared ROMCache

- make most ROMCache URLS relative
- create wtvshared.htmlEntitize function
- update wtv-mail:/readmail to use wtvshared.htmlEntitize
This commit is contained in:
zefie
2022-02-12 21:45:06 -05:00
parent b124cfa33c
commit 445e28c91a
85 changed files with 319 additions and 221 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

View File

@@ -53,7 +53,7 @@ xnocancel>
<HTML>
<head>
<title>
${html_entities.encode((message.subject) ? message.subject : '(No subject)')}
${(message.subject) ? wtvshared.htmlEntitize(message.subject) : '(No subject)'}
</title>
</head>
<body
@@ -236,9 +236,9 @@ From:
<td width=10>
<td>`;
if (message.from_name != message.from_addr) {
data += `${html_entities.encode(message.from_addr)} <a href="client:showalert?sound=none&message=To%20add%20%3Cblackface%3E${escape(escape(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${escape(escape(message.from_name))}%26address%3D${escape(escape(message.from_addr))}%26new_address%3Dtrue">(${html_entities.encode(message.from_name)})</a>`;
data += `${wtvshared.htmlEntitize(message.from_addr)} <a href="client:showalert?sound=none&message=To%20add%20%3Cblackface%3E${escape(escape(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${escape(escape(message.from_name))}%26address%3D${escape(escape(message.from_addr))}%26new_address%3Dtrue">(${wtvshared.htmlEntitize(message.from_name)})</a>`;
} else {
data += `${html_entities.encode(message.from_addr)}`;
data += `${wtvshared.htmlEntitize(message.from_addr)}`;
}
data += `<tr>
@@ -252,7 +252,7 @@ ${strftime("%a, %b %e, %Y, %I:%M %P", new Date(message.date * 1000))} (UTC)
To:
<td>
<td>
${html_entities.encode(message.to_addr)} ${(html_entities.encode(message.to_name)) ? '(' + html_entities.encode(message.to_name) + ')' : ''}
${wtvshared.htmlEntitize(message.to_addr)} ${(message.to_name) ? '(' + wtvshared.htmlEntitize(message.to_name) + ')' : ''}
<tr>
<td nowrap valign=top>
Subject: <td>
@@ -260,7 +260,7 @@ Subject: <td>
if (typeof message.subject == "object") message.subject = new Buffer.from(message.subject).toString('latin1');
data += `
${html_entities.encode((message.subject) ? message.subject : '(No subject)')}
${(message.subject) ? wtvshared.htmlEntitize(message.subject) : '(No subject)'}
<tr>
<td height=10>
<spacer type=vertical size=10>
@@ -270,22 +270,22 @@ ${html_entities.encode((message.subject) ? message.subject : '(No subject)')}
<tr>
<td width=425>
<p>`;
if (typeof message.body == "object") {
if (typeof message.body === "object" && message.body) {
message.body = wtvshared.decodeBufferText(message.body);
}
data += `
${html_entities.encode(message.body).replace(/\n/gi, "<br>").replace(/\r/gi, "").replace(/&apos;/gi, "'")}
${wtvshared.htmlEntitize(message.body, true)}
<br>
<br>`;
if (message.signature) {
data += ssid_sessions[socket.ssid].mailstore.sanitizeSignature(message.signature);
}
data += `<p>
data += `<p>
`;
if (message.attachments) {
message.attachments.forEach((v, k) => {
if (v) {
console.log("*****************",v['Content-Type']);
console.log("*****************", v['Content-Type']);
switch (v['Content-Type']) {
case "image/jpeg":
data += `<img border=2 src="wtv-mail:/get-attachment?message_id=${messageid}&attachment_id=${k}&wtv-title=Video%20Snapshot" width="380" height="290"><br><br>`;
@@ -293,7 +293,7 @@ data += `<p>
case "audio/wav":
data += `<table href="wtv-mail:/get-attachment?message_id=${messageid}&attachment_id=${k}&wtv-title=Voice%20Mail" width=386 cellspacing=0 cellpadding=0>
<td align=left valign=middle>
<img src="wtv-mail:/ROMCache/FileSound.gif" align=absmiddle>&nbsp;&nbsp;Recording
<img src="ROMCache/FileSound.gif" align=absmiddle>&nbsp;&nbsp;Recording
<td align=right valign=middle>
</table><br><br>
`;
@@ -302,7 +302,7 @@ data += `<p>
}
});
}
data += `<p>
data += `<p>
<p>
</table>
</table>

View File

@@ -71,10 +71,10 @@ Content-Type: audio/wav`;
'noback': true,
}).getURL();
if (request_headers.query.sendoff == "Send" || 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) {
var from_addr = address;
var signature = ssid_sessions[socket.ssid].getSessionData("subscriber_signature") || null;
if (request_headers.query.sendoff == "Send") {
if (typeof request_headers.query.sendoff !== 'undefined' && request_headers.query.sendoff != false) {
var attachments = [];
@@ -459,30 +459,30 @@ USESTYLE NOARGS>
if ((request_headers.query.snapping && request_headers.query.snapping !== 'false') || mail_draft_attachments.message_snapshot_data) {
data += `<tr>
<td absheight="10">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="10">
<img src="ROMCache/Spacer.gif" width="1" height="10">
</td></tr></tbody></table>
<table cellspacing="0" cellpadding="0" bgcolor="#1F2033" background="">
<tbody><tr>
<td rowspan="100" abswidth="10" bgcolor="191919">
<img src="wtv-star:/ROMCache/Spacer.gif" width="10" height="1">
<img src="ROMCache/Spacer.gif" width="10" height="1">
</td><td colspan="9" abswidth="422" valign="bottom">
<img src="wtv-mail:/ROMCache/PaperTopFlat.gif" noprint="" width="422" height="6">
<img src="ROMCache/PaperTopFlat.gif" noprint="" width="422" height="6">
</td></tr><tr>
<td rowspan="100" abswidth="2" absheight="0" bgcolor="313131">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="14" absheight="0">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td colspan="2" abswidth="386">
</td><td rowspan="100" abswidth="14" absheight="0">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="3" absheight="0" bgcolor="0b0b0b">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="1" absheight="0" bgcolor="0f0f0f">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="1" absheight="0" bgcolor="131313">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="1" absheight="0" bgcolor="171717">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td></tr><tr>
<td colspan="2" absheight="15">`;
if (!mail_draft_attachments.message_snapshot_data) {
@@ -502,51 +502,51 @@ USESTYLE NOARGS>
<tbody><tr><td valign="middle">
</td><td valign="middle" align="right">
<a href="javascript:ErasingMedia('snapping')">
&nbsp;Detach&nbsp;<img src="wtv-mail:/ROMCache/RemoveButton.gif" width="25" height="25" align="absmiddle"></a>
&nbsp;Detach&nbsp;<img src="ROMCache/RemoveButton.gif" width="25" height="25" align="absmiddle"></a>
</td></tr></tbody></table>
</td></tr><tr>
<td colspan="2" absheight="8">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="8">
<img src="ROMCache/Spacer.gif" width="1" height="8">
</td></tr></tbody></table>
<table cellspacing="0" cellpadding="0">
<tbody><tr>
<td rowspan="100" abswidth="10">
<img src="wtv-star:/ROMCache/Spacer.gif" width="10" height="2">
<img src="ROMCache/Spacer.gif" width="10" height="2">
</td><td abswidth="422">
<img src="wtv-mail:/ROMCache/PaperBase.gif" noprint="" width="422" height="6">
<img src="ROMCache/PaperBase.gif" noprint="" width="422" height="6">
</td></tr><tr>
<td absheight="6">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="6">
<img src="ROMCache/Spacer.gif" width="1" height="6">
</td></tr>`;
}
if ((request_headers.query.gabbing && request_headers.query.gabbing !== 'false') || mail_draft_attachments.message_voicemail_data) {
data += `<tr>
<td absheight="10">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="10">
<img src="ROMCache/Spacer.gif" width="1" height="10">
</td></tr></tbody></table>
<table cellspacing="0" cellpadding="0" bgcolor="#1F2033" background="">
<tbody><tr>
<td rowspan="100" abswidth="10" bgcolor="191919">
<img src="wtv-star:/ROMCache/Spacer.gif" width="10" height="1">
<img src="ROMCache/Spacer.gif" width="10" height="1">
</td><td colspan="9" abswidth="422" valign="bottom">
<img src="wtv-mail:/ROMCache/PaperTopFlat.gif" noprint="" width="422" height="6">
<img src="ROMCache/PaperTopFlat.gif" noprint="" width="422" height="6">
</td></tr><tr>
<td rowspan="100" abswidth="2" absheight="0" bgcolor="313131">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="14" absheight="0">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td colspan="2" abswidth="386">
</td><td rowspan="100" abswidth="14" absheight="0">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="3" absheight="0" bgcolor="0b0b0b">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="1" absheight="0" bgcolor="0f0f0f">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="1" absheight="0" bgcolor="131313">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td><td rowspan="100" abswidth="1" absheight="0" bgcolor="171717">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="1">
<img src="ROMCache/Spacer.gif" width="1" height="1">
</td></tr><tr>
<td colspan="2" absheight="15">
<input type=file device=audio name=message_voicemail_data
@@ -556,23 +556,23 @@ ${(!mail_draft_attachments.message_voicemail_data) ? '' : '<input type=hidden na
<td colspan="2" align="center">
<table width=386 cellspacing=0 cellpadding=0>
<td align=left valign=middle>
<a href="${(mail_draft_attachments.message_voicemail_data) ? 'wtv-mail:/sendmail?get_gab=true&wtv-title=Voice%20Mail' : 'cache:voicemail.wav'}" id=focus><img src="wtv-mail:/ROMCache/FileSound.gif" align=absmiddle></a>&nbsp;&nbsp;Recording
<a href="${(mail_draft_attachments.message_voicemail_data) ? 'wtv-mail:/sendmail?get_gab=true&wtv-title=Voice%20Mail' : 'cache:voicemail.wav'}" id=focus><img src="ROMCache/FileSound.gif" align=absmiddle></a>&nbsp;&nbsp;Recording
<td align=right valign=middle>
<a href="javascript:ErasingMedia('gabbing')">
&nbsp;Detach&nbsp;<img src="wtv-mail:/ROMCache/RemoveButton.gif" align=absmiddle height=25 width=25></a>
&nbsp;Detach&nbsp;<img src="ROMCache/RemoveButton.gif" align=absmiddle height=25 width=25></a>
</table><tr>
<td colspan="2" absheight="8">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="8">
<img src="ROMCache/Spacer.gif" width="1" height="8">
</td></tr></tbody></table>
<table cellspacing="0" cellpadding="0">
<tbody><tr>
<td rowspan="100" abswidth="10">
<img src="wtv-star:/ROMCache/Spacer.gif" width="10" height="2">
<img src="ROMCache/Spacer.gif" width="10" height="2">
</td><td abswidth="422">
<img src="wtv-mail:/ROMCache/PaperBase.gif" noprint="" width="422" height="6">
<img src="ROMCache/PaperBase.gif" noprint="" width="422" height="6">
</td></tr><tr>
<td absheight="6">
<img src="wtv-star:/ROMCache/Spacer.gif" width="1" height="6">
<img src="ROMCache/Spacer.gif" width="1" height="6">
</td></tr>`;
}