Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
337e2675
Commit
337e2675
authored
Mar 31, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't trigger `OMEMOInitialized` if something went wrong.
parent
dd0c0b6c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
11 deletions
+26
-11
dist/converse.js
dist/converse.js
+15
-5
src/converse-omemo.js
src/converse-omemo.js
+11
-6
No files found.
dist/converse.js
View file @
337e2675
...
@@ -57001,13 +57001,13 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -57001,13 +57001,13 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
this.fetch({
this.fetch({
'success': () => {
'success': () => {
if (!_converse.omemo_store.get('device_id')) {
if (!_converse.omemo_store.get('device_id')) {
this.generateBundle().then(resolve).catch(re
solve
);
this.generateBundle().then(resolve).catch(re
ject
);
} else {
} else {
resolve();
resolve();
}
}
},
},
'error': () => {
'error': () => {
this.generateBundle().then(resolve).catch(re
solve
);
this.generateBundle().then(resolve).catch(re
ject
);
}
}
});
});
});
});
...
@@ -57350,15 +57350,25 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -57350,15 +57350,25 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
id = `converse.devicelists-${_converse.bare_jid}`;
id = `converse.devicelists-${_converse.bare_jid}`;
_converse.devicelists.browserStorage = new Backbone.BrowserStorage[storage](id);
_converse.devicelists.browserStorage = new Backbone.BrowserStorage[storage](id);
try {
await fetchOwnDevices();
await fetchOwnDevices();
await restoreOMEMOSession();
await restoreOMEMOSession();
await _converse.omemo_store.publishBundle();
await _converse.omemo_store.publishBundle();
} catch (e) {
_converse.log("Could not initialize OMEMO support", Strophe.LogLevel.ERROR);
_converse.log(e, Strophe.LogLevel.ERROR);
return;
}
/**
/**
* Triggered once OMEMO support has been initialized
* Triggered once OMEMO support has been initialized
* @event _converse#OMEMOInitialized
* @event _converse#OMEMOInitialized
* @example _converse.api.listen.on('OMEMOInitialized', () => { ... });
* @example _converse.api.listen.on('OMEMOInitialized', () => { ... });
*/
*/
_converse.api.trigger('OMEMOInitialized');
_converse.api.trigger('OMEMOInitialized');
}
}
src/converse-omemo.js
View file @
337e2675
...
@@ -844,7 +844,6 @@ converse.plugins.add('converse-omemo', {
...
@@ -844,7 +844,6 @@ converse.plugins.add('converse-omemo', {
* generated integer between 1 and 2^31 - 1.
* generated integer between 1 and 2^31 - 1.
*/
*/
const
identity_keypair
=
await
libsignal
.
KeyHelper
.
generateIdentityKeyPair
();
const
identity_keypair
=
await
libsignal
.
KeyHelper
.
generateIdentityKeyPair
();
const
bundle
=
{},
const
bundle
=
{},
identity_key
=
u
.
arrayBufferToBase64
(
identity_keypair
.
pubKey
),
identity_key
=
u
.
arrayBufferToBase64
(
identity_keypair
.
pubKey
),
device_id
=
generateDeviceID
();
device_id
=
generateDeviceID
();
...
@@ -882,13 +881,13 @@ converse.plugins.add('converse-omemo', {
...
@@ -882,13 +881,13 @@ converse.plugins.add('converse-omemo', {
this
.
fetch
({
this
.
fetch
({
'
success
'
:
()
=>
{
'
success
'
:
()
=>
{
if
(
!
_converse
.
omemo_store
.
get
(
'
device_id
'
))
{
if
(
!
_converse
.
omemo_store
.
get
(
'
device_id
'
))
{
this
.
generateBundle
().
then
(
resolve
).
catch
(
re
solve
);
this
.
generateBundle
().
then
(
resolve
).
catch
(
re
ject
);
}
else
{
}
else
{
resolve
();
resolve
();
}
}
},
},
'
error
'
:
()
=>
{
'
error
'
:
()
=>
{
this
.
generateBundle
().
then
(
resolve
).
catch
(
re
solve
);
this
.
generateBundle
().
then
(
resolve
).
catch
(
re
ject
);
}
}
});
});
});
});
...
@@ -1160,9 +1159,15 @@ converse.plugins.add('converse-omemo', {
...
@@ -1160,9 +1159,15 @@ converse.plugins.add('converse-omemo', {
id
=
`converse.devicelists-
${
_converse
.
bare_jid
}
`
;
id
=
`converse.devicelists-
${
_converse
.
bare_jid
}
`
;
_converse
.
devicelists
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
_converse
.
devicelists
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
try
{
await
fetchOwnDevices
();
await
fetchOwnDevices
();
await
restoreOMEMOSession
();
await
restoreOMEMOSession
();
await
_converse
.
omemo_store
.
publishBundle
();
await
_converse
.
omemo_store
.
publishBundle
();
}
catch
(
e
)
{
_converse
.
log
(
"
Could not initialize OMEMO support
"
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
return
;
}
/**
/**
* Triggered once OMEMO support has been initialized
* Triggered once OMEMO support has been initialized
* @event _converse#OMEMOInitialized
* @event _converse#OMEMOInitialized
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment