Upload files to "app/converse-plugins"

This commit is contained in:
Admin 2025-05-16 11:34:15 -07:00
parent e6ab3af9fc
commit a989a9bc98
3 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,23 @@
converse.plugins.add('converse-desktop-credentials', {
async initialize () {
const { _converse } = this;
const { api } = _converse;
const credentials = await import('../credentials.js');
api.listen.on('afterResourceBinding', () => {
if (_converse.connection.pass) {
credentials.addCredentials(
_converse.connection.service,
_converse.bare_jid,
_converse.connection.pass
).catch((reason) => {
console.log(reason);
});
}
});
api.listen.on('logout', () => {
credentials.getCredentials().then((result) => credentials.removeCredentials(result.login));
});
}
});

View File

@ -0,0 +1,12 @@
/* global api */
converse.plugins.add('converse-desktop-settings', {
initialize () {
const { _converse } = this;
api.settings.changed(function (key, newValue) {
if (['omemo_default'].indexOf(key) !== -1) {
_converse.api.settings.set(key, newValue);
}
});
}
});

View File

@ -0,0 +1,24 @@
/* global api */
converse.plugins.add('converse-desktop-trayicon', {
initialize () {
const { _converse } = this;
let envelopeIsShowing = false;
async function hideEnvelope () {
if (envelopeIsShowing) {
await api.trayService.hideEnvelope();
envelopeIsShowing = false;
}
}
window.addEventListener('focus', hideEnvelope);
_converse.api.listen.on('chatBoxInitialized', hideEnvelope);
_converse.api.listen.on('chatBoxFocused', hideEnvelope);
_converse.api.listen.on('messageNotification', async () => {
await api.trayService.showEnvelope();
envelopeIsShowing = true;
});
}
});