only embed signature if its html, otherwise just write it

This commit is contained in:
zefie
2022-02-10 21:44:01 -05:00
parent 56e8fdd215
commit 51a0576a3e
3 changed files with 12 additions and 3 deletions

View File

@@ -292,8 +292,12 @@ ${html_entities.encode((message.subject) ? message.subject : '(No subject)')}
data += ` data += `
${html_entities.encode(message.body).replace("\n", "<br>")} ${html_entities.encode(message.body).replace("\n", "<br>")}
<br> <br>
${(message.signature) ? '<embed src="wtv-mail:/get-signature?message_id='+messageid+'">' : ''} <br>`;
<p> if (message.signature) {
if (wtvshared.isHTML(message.signature)) data += `<embed src="wtv-mail:/get-signature?message_id='+messageid+'">`;
else data += message.signature;
}
data += `<p>
<p> <p>
</table> </table>
</table> </table>

View File

@@ -412,7 +412,8 @@ vlink=#62B362
vspace=0 vspace=0
hspace=0>`; hspace=0>`;
if (ssid_sessions[socket.ssid].getSessionData("subscriber_signature") && ssid_sessions[socket.ssid].getSessionData("subscriber_signature") != "" && !no_signature) { if (ssid_sessions[socket.ssid].getSessionData("subscriber_signature") && ssid_sessions[socket.ssid].getSessionData("subscriber_signature") != "" && !no_signature) {
data += `<embed src="wtv-mail:/get-signature" transparent>`; if (wtvshared.isHTML(ssid_sessions[socket.ssid].getSessionData("subscriber_signature"))) data += `<embed src="wtv-mail:/get-signature" transparent>`;
else data += ssid_sessions[socket.ssid].getSessionData("subscriber_signature");
} }
data += ` data += `
<td abswidth=2 bgcolor=#000000> <td abswidth=2 bgcolor=#000000>

View File

@@ -30,6 +30,10 @@ class WTVShared {
return true; return true;
} }
isHTML(str) {
return /<\s*([^ >]+)[^>]*>.*?<\s*\/\s*\1\s*>/.test(str);
}
returnAbsolutePath(check_path) { returnAbsolutePath(check_path) {
if (check_path.substring(0, 1) != this.path.sep && check_path.substring(1, 1) != ":") { if (check_path.substring(0, 1) != this.path.sep && check_path.substring(1, 1) != ":") {
// non-absolute path, so use current directory as base // non-absolute path, so use current directory as base