-
Notifications
You must be signed in to change notification settings - Fork 19
/
setup.js
48 lines (42 loc) · 1.45 KB
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* global api */
await import('./app/converse-plugins/desktop-credentials.js')
await import('./app/converse-plugins/desktop-trayicon.js')
await import('./app/converse-plugins/desktop-settings.js')
const getCredentials = (await import('./app/credentials.js')).getCredentials;
let websocket_url, bosh_service_url;
const { connectionManager, login, password } = await getCredentials();
const priority = await api.settings.get('priority') || 0;
const omemo_default = await api.settings.get('omemo_default') || false;
if (connectionManager?.startsWith('ws')) {
websocket_url = connectionManager
} else if (connectionManager?.startsWith('http')) {
bosh_service_url = connectionManager
}
converse.plugins.add('converse-debug', {
initialize () {
const { _converse } = this;
window._converse = _converse;
}
});
converse.initialize({
assets_path: './node_modules/converse.js/dist/',
auto_login: login && password,
bosh_service_url,
i18n: navigator.language,
jid: login,
loglevel: 'debug',
muc_respect_autojoin: true,
muc_show_logs_before_join: true,
password,
play_sounds: false,
priority,
prune_messages_above: 250,
theme: 'concord',
view_mode: 'fullscreen',
websocket_url,
whitelisted_plugins: ['converse-debug', 'converse-desktop-credentials', 'converse-desktop-trayicon', 'converse-desktop-settings'],
omemo_default
}).catch((reason) => {
console.log(reason);
api.app.quit();
});