vietnamese

This commit is contained in:
nnduc
2026-10-24 17:46:20 +07:00
parent 5467b0aa2c
commit a3cf10cb0a
33 changed files with 4306 additions and 94 deletions
+28 -1
View File
@@ -1077,4 +1077,31 @@ ul.list li>div.bubble.file div.file a span.size:after {
100% {
opacity: 0.1;
}
}
}
/* Decrypted OMEMO files (XEP-0454) */
#chat_widget .encrypted_media {
display: block;
max-width: 100%;
}
#chat_widget img.encrypted_media {
max-height: 30rem;
border-radius: 0.5rem;
cursor: pointer;
}
/* Shared files: a header button, in the menu on phones */
#chat_widget .context_menu li.files_menu {
display: none;
}
@media screen and (max-width: 576px) {
#chat_widget header .files_button {
display: none;
}
#chat_widget .context_menu li.files_menu {
display: flex;
}
}
+35 -10
View File
@@ -1178,8 +1178,9 @@ var Chat = {
let refreshP = document.querySelector('#id' + data.id + ' p.encrypted');
if (refreshP) {
if (plaintext) {
let escaped = MovimUtils.linkify(MovimUtils.htmlEscape(plaintext));
refreshP.innerHTML = ChatOmemo.searchEncryptedFile(escaped);
if (!ChatOmemo.renderEncryptedFile(refreshP, plaintext)) {
refreshP.innerHTML = MovimUtils.linkify(MovimUtils.htmlEscape(plaintext));
}
refreshP.classList.remove('encrypted');
} else {
@@ -1381,8 +1382,9 @@ var Chat = {
var messages = document.querySelectorAll('#chat_widget > div ul.conversation div.bubble p');
if (messages.length > counter && counter > 0) {
var p = messages[messages.length - counter];
list.insertBefore(separatorNode, p.parentNode.parentNode.parentNode);
// The row of the message: file and encrypted bubbles nest deeper
var item = messages[messages.length - counter].closest('ul.conversation > li');
if (item && item.parentNode == list) list.insertBefore(separatorNode, item);
}
},
getStickerHtml: function (data) {
@@ -1697,6 +1699,27 @@ var Chat = {
var textarea = document.querySelector('#chat_textarea');
if (textarea) return textarea;
},
// XEP-0454: the aesgcm:// URL (with the key) is sent as an OMEMO message
sendEncryptedFile: function (jid, isMuc, url) {
let counter = document.querySelector('#chat_widget header span.counter');
let mucReceipts = isMuc && counter && counter.dataset.mucreceipts == 'true';
let omemo = ChatOmemo.encrypt(jid, url, isMuc);
if (!omemo) {
Chat.failedMessage();
return;
}
omemo.then(omemoheader => {
let id = omemoheader.id = crypto.randomUUID();
Chat.lastSentUUID = id;
Chat.tempMessages[id] = url;
Chat_ajaxHttpDaemonSendMessage(id, jid, null, isMuc, null, false, mucReceipts, omemoheader)
.then(e => Chat.sentMessage())
.catch(e => Chat.failedMessage());
});
},
isEncrypted: function () {
return (Chat.getTextarea() && Chat.getTextarea().dataset.encryptedstate == 'yes');
},
@@ -1842,12 +1865,14 @@ MovimEvents.registerWindow('loaded', 'chat', () => {
Upload.attach((file) => {
if (['chat', 'space'].includes(MovimUtils.urlParts().page)
&& (typeof (PublishStories) == 'undefined' || PublishStories.main == undefined)) {
Chat_ajaxHttpDaemonSendMessage(
Chat.getTextarea().dataset.jid,
false,
Boolean(Chat.getTextarea().dataset.muc),
file
);
let textarea = Chat.getTextarea();
let isMuc = Boolean(textarea.dataset.muc);
if (file.aesgcm) {
Chat.sendEncryptedFile(textarea.dataset.jid, isMuc, file.aesgcm);
} else {
Chat_ajaxHttpDaemonSendMessage(textarea.dataset.jid, false, isMuc, file);
}
}
});
}