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
5e9d6c3d
Commit
5e9d6c3d
authored
Aug 23, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into converse-omemo
parents
62cecbec
9f8d30dd
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
151 additions
and
134 deletions
+151
-134
CHANGES.md
CHANGES.md
+1
-0
dist/converse.js
dist/converse.js
+51
-25
docs/source/configuration.rst
docs/source/configuration.rst
+52
-80
spec/login.js
spec/login.js
+6
-6
src/converse-bookmarks.js
src/converse-bookmarks.js
+2
-2
src/converse-chatboxes.js
src/converse-chatboxes.js
+1
-1
src/converse-chatview.js
src/converse-chatview.js
+1
-3
src/converse-controlbox.js
src/converse-controlbox.js
+2
-2
src/converse-core.js
src/converse-core.js
+21
-5
src/converse-disco.js
src/converse-disco.js
+1
-1
src/converse-minimize.js
src/converse-minimize.js
+6
-2
src/converse-muc-views.js
src/converse-muc-views.js
+1
-1
src/converse-roomslist.js
src/converse-roomslist.js
+2
-2
src/converse-roster.js
src/converse-roster.js
+1
-1
src/converse-vcard.js
src/converse-vcard.js
+2
-2
src/templates/login_panel.html
src/templates/login_panel.html
+1
-1
No files found.
CHANGES.md
View file @
5e9d6c3d
...
@@ -53,6 +53,7 @@
...
@@ -53,6 +53,7 @@
## Configuration changes
## Configuration changes
-
Removed the
`storage`
configuration setting, use
[
trusted
](
https://conversejs.org/docs/html/configurations.html#trusted
)
instead.
-
Removed the
`use_vcards`
configuration setting, instead VCards are always used.
-
Removed the
`use_vcards`
configuration setting, instead VCards are always used.
-
Removed the
`xhr_custom_status`
and
`xhr_custom_status_url`
configuration
-
Removed the
`xhr_custom_status`
and
`xhr_custom_status_url`
configuration
settings. If you relied on these settings, you can instead listen for the
settings. If you relied on these settings, you can instead listen for the
...
...
dist/converse.js
View file @
5e9d6c3d
...
@@ -62074,7 +62074,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -62074,7 +62074,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
this.on('remove', this.markRoomAsUnbookmarked, this);
this.on('remove', this.markRoomAsUnbookmarked, this);
this.on('remove', this.sendBookmarkStanza, this);
this.on('remove', this.sendBookmarkStanza, this);
const storage = _converse.
session
.get('storage'),
const storage = _converse.
config
.get('storage'),
cache_key = `converse.room-bookmarks${_converse.bare_jid}`;
cache_key = `converse.room-bookmarks${_converse.bare_jid}`;
this.fetched_flag = b64_sha1(cache_key + 'fetched');
this.fetched_flag = b64_sha1(cache_key + 'fetched');
...
@@ -62286,7 +62286,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -62286,7 +62286,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
_converse.chatboxes.on('remove', this.renderBookmarkListElement, this);
_converse.chatboxes.on('remove', this.renderBookmarkListElement, this);
const storage = _converse.
session
.get('storage'),
const storage = _converse.
config
.get('storage'),
id = b64_sha1(`converse.room-bookmarks${_converse.bare_jid}-list-model`);
id = b64_sha1(`converse.room-bookmarks${_converse.bare_jid}-list-model`);
this.list_model = new _converse.BookmarksList({
this.list_model = new _converse.BookmarksList({
...
@@ -62826,7 +62826,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -62826,7 +62826,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
this.messages = new _converse.Messages();
this.messages = new _converse.Messages();
const storage = _converse.
session
.get('storage');
const storage = _converse.
config
.get('storage');
this.messages.browserStorage = new Backbone.BrowserStorage[storage](b64_sha1(`converse.messages${this.get('jid')}${_converse.bare_jid}`));
this.messages.browserStorage = new Backbone.BrowserStorage[storage](b64_sha1(`converse.messages${this.get('jid')}${_converse.bare_jid}`));
this.messages.chatbox = this;
this.messages.chatbox = this;
...
@@ -63796,10 +63796,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -63796,10 +63796,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'current_category': 'people',
'current_category': 'people',
'current_skintone': '',
'current_skintone': '',
'scroll_position': 0
'scroll_position': 0
},
}
initialize() {}
});
});
_converse.EmojiPickerView = Backbone.VDOMView.extend({
_converse.EmojiPickerView = Backbone.VDOMView.extend({
className: 'emoji-picker-container',
className: 'emoji-picker-container',
...
@@ -64756,7 +64753,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -64756,7 +64753,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
createEmojiPicker() {
createEmojiPicker() {
if (_.isUndefined(_converse.emojipicker)) {
if (_.isUndefined(_converse.emojipicker)) {
const storage = _converse.
session
.get('storage'),
const storage = _converse.
config
.get('storage'),
id = `converse.emoji-${_converse.bare_jid}`;
id = `converse.emoji-${_converse.bare_jid}`;
_converse.emojipicker = new _converse.EmojiPicker({
_converse.emojipicker = new _converse.EmojiPicker({
...
@@ -65531,7 +65528,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -65531,7 +65528,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
const form_data = new FormData(ev.target);
const form_data = new FormData(ev.target);
_converse.
session
.save({
_converse.
config
.save({
'trusted': form_data.get('trusted') && true || false,
'trusted': form_data.get('trusted') && true || false,
'storage': form_data.get('trusted') ? 'local' : 'session'
'storage': form_data.get('trusted') ? 'local' : 'session'
});
});
...
@@ -65662,7 +65659,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -65662,7 +65659,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
});
});
_converse.on('clearSession', () => {
_converse.on('clearSession', () => {
if (_converse.
session
.get('trusted')) {
if (_converse.
config
.get('trusted')) {
const chatboxes = _.get(_converse, 'chatboxes', null);
const chatboxes = _.get(_converse, 'chatboxes', null);
if (!_.isNil(chatboxes)) {
if (!_.isNil(chatboxes)) {
...
@@ -66029,6 +66026,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -66029,6 +66026,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
_converse.tearDown();
_converse.tearDown();
delete _converse.config;
_converse.initClientConfig();
_converse.off();
_converse.off();
}
}
...
@@ -66387,13 +66388,30 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -66387,13 +66388,30 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
}
};
};
this.initSession = function () {
this.initClientConfig = function () {
const id = b64_sha1('converse.bosh-session');
/* The client config refers to configuration of the client which is
_converse.session = new Backbone.Model({
* independent of any particular user.
* What this means is that config values need to persist across
* user sessions.
*/
const id = b64_sha1('converse.client-config');
_converse.config = new Backbone.Model({
'id': id,
'id': id,
'trusted': _converse.trusted && true || false,
'trusted': _converse.trusted && true || false,
'storage': _converse.trusted ? 'local' : 'session'
'storage': _converse.trusted ? 'local' : 'session'
});
});
_converse.config.browserStorage = new Backbone.BrowserStorage.session(id);
_converse.config.fetch();
_converse.emit('clientConfigInitialized');
};
this.initSession = function () {
const id = b64_sha1('converse.bosh-session');
_converse.session = new Backbone.Model({
'id': id
});
_converse.session.browserStorage = new Backbone.BrowserStorage.session(id);
_converse.session.browserStorage = new Backbone.BrowserStorage.session(id);
_converse.session.fetch();
_converse.session.fetch();
...
@@ -66402,7 +66420,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -66402,7 +66420,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
};
};
this.clearSession = function () {
this.clearSession = function () {
if (!_converse.
session
.get('trusted')) {
if (!_converse.
config
.get('trusted')) {
window.localStorage.clear();
window.localStorage.clear();
window.sessionStorage.clear();
window.sessionStorage.clear();
} else if (!_.isUndefined(this.session) && this.session.browserStorage) {
} else if (!_.isUndefined(this.session) && this.session.browserStorage) {
...
@@ -66559,6 +66577,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -66559,6 +66577,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
_converse.setUserJID();
_converse.setUserJID();
_converse.initSession();
_converse.enableCarbons();
_converse.enableCarbons();
_converse.initStatus(reconnecting);
_converse.initStatus(reconnecting);
...
@@ -66930,7 +66950,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -66930,7 +66950,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
function finishInitialization() {
function finishInitialization() {
_converse.initPlugins();
_converse.initPlugins();
_converse.init
Session
();
_converse.init
ClientConfig
();
_converse.initConnection();
_converse.initConnection();
...
@@ -67450,7 +67470,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -67450,7 +67470,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}
}
_converse.api.listen.on('se
tUserJID
', initStreamFeatures);
_converse.api.listen.on('se
ssionInitialized
', initStreamFeatures);
_converse.api.listen.on('reconnected', initializeDisco);
_converse.api.listen.on('reconnected', initializeDisco);
...
@@ -69777,7 +69797,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -69777,7 +69797,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
},
},
initToggle() {
initToggle() {
const storage = _converse.
session
.get('storage'),
const storage = _converse.
config
.get('storage'),
id = b64_sha1(`converse.minchatstoggle${_converse.bare_jid}`);
id = b64_sha1(`converse.minchatstoggle${_converse.bare_jid}`);
this.toggleview = new _converse.MinimizedChatsToggleView({
this.toggleview = new _converse.MinimizedChatsToggleView({
...
@@ -69785,7 +69805,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -69785,7 +69805,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'id': id
'id': id
})
})
});
});
try {
this.toggleview.model.browserStorage = new Backbone.BrowserStorage[storage](id);
this.toggleview.model.browserStorage = new Backbone.BrowserStorage[storage](id);
} catch (e) {
debugger;
}
this.toggleview.model.fetch();
this.toggleview.model.fetch();
},
},
...
@@ -70139,7 +70165,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -70139,7 +70165,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'model': new (_converse.RoomsPanelModel.extend({
'model': new (_converse.RoomsPanelModel.extend({
'id': b64_sha1(`converse.roomspanel${_converse.bare_jid}`),
'id': b64_sha1(`converse.roomspanel${_converse.bare_jid}`),
// Required by sessionStorage
// Required by sessionStorage
'browserStorage': new Backbone.BrowserStorage[_converse.
session
.get('storage')](b64_sha1(`converse.roomspanel${_converse.bare_jid}`))
'browserStorage': new Backbone.BrowserStorage[_converse.
config
.get('storage')](b64_sha1(`converse.roomspanel${_converse.bare_jid}`))
}))()
}))()
});
});
this.roomspanel.model.fetch();
this.roomspanel.model.fetch();
...
@@ -76557,7 +76583,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -76557,7 +76583,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
this.model.on('add', this.showOrHide, this);
this.model.on('add', this.showOrHide, this);
this.model.on('remove', this.showOrHide, this);
this.model.on('remove', this.showOrHide, this);
const storage = _converse.
session
.get('storage'),
const storage = _converse.
config
.get('storage'),
id = b64_sha1(`converse.roomslist${_converse.bare_jid}`);
id = b64_sha1(`converse.roomslist${_converse.bare_jid}`);
this.list_model = new _converse.RoomsList({
this.list_model = new _converse.RoomsList({
...
@@ -76668,7 +76694,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -76668,7 +76694,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
});
});
const initRoomsListView = function initRoomsListView() {
const initRoomsListView = function initRoomsListView() {
const storage = _converse.
session
.get('storage'),
const storage = _converse.
config
.get('storage'),
id = b64_sha1(`converse.open-rooms-{_converse.bare_jid}`),
id = b64_sha1(`converse.open-rooms-{_converse.bare_jid}`),
model = new _converse.OpenRooms();
model = new _converse.OpenRooms();
...
@@ -76773,7 +76799,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -76773,7 +76799,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
/* Initialize the Bakcbone collections that represent the contats
/* Initialize the Bakcbone collections that represent the contats
* roster and the roster groups.
* roster and the roster groups.
*/
*/
const storage = _converse.
session
.get('storage');
const storage = _converse.
config
.get('storage');
_converse.roster = new _converse.RosterContacts();
_converse.roster = new _converse.RosterContacts();
_converse.roster.browserStorage = new Backbone.BrowserStorage[storage](b64_sha1(`converse.contacts-${_converse.bare_jid}`));
_converse.roster.browserStorage = new Backbone.BrowserStorage[storage](b64_sha1(`converse.contacts-${_converse.bare_jid}`));
...
@@ -79124,12 +79150,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -79124,12 +79150,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
_converse.initVCardCollection = function () {
_converse.initVCardCollection = function () {
_converse.vcards = new _converse.VCards();
_converse.vcards = new _converse.VCards();
const id = b64_sha1(`converse.vcards`);
const id = b64_sha1(`converse.vcards`);
_converse.vcards.browserStorage = new Backbone.BrowserStorage[_converse.
session
.get('storage')](id);
_converse.vcards.browserStorage = new Backbone.BrowserStorage[_converse.
config
.get('storage')](id);
_converse.vcards.fetch();
_converse.vcards.fetch();
};
};
_converse.api.listen.on('se
tUserJID
', _converse.initVCardCollection);
_converse.api.listen.on('se
ssionInitialized
', _converse.initVCardCollection);
_converse.on('addClientFeatures', () => {
_converse.on('addClientFeatures', () => {
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
...
@@ -81156,7 +81182,7 @@ __e(o.__('password')) +
...
@@ -81156,7 +81182,7 @@ __e(o.__('password')) +
'">\n </div>\n ';
'">\n </div>\n ';
} ;
} ;
__p += '\n <div class="form-group form-check">\n <input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ';
__p += '\n <div class="form-group form-check">\n <input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ';
if (o._converse.
session
.get('trusted')) { ;
if (o._converse.
config
.get('trusted')) { ;
__p += ' checked="checked" ';
__p += ' checked="checked" ';
} ;
} ;
__p += '>\n <label for="converse-login-trusted" class="form-check-label">' +
__p += '>\n <label for="converse-login-trusted" class="form-check-label">' +
docs/source/configuration.rst
View file @
5e9d6c3d
This diff is collapsed.
Click to expand it.
spec/login.js
View file @
5e9d6c3d
...
@@ -29,15 +29,15 @@
...
@@ -29,15 +29,15 @@
spyOn
(
cbview
.
loginpanel
,
'
connect
'
);
spyOn
(
cbview
.
loginpanel
,
'
connect
'
);
cbview
.
delegateEvents
();
cbview
.
delegateEvents
();
expect
(
_converse
.
session
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
expect
(
_converse
.
config
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
session
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
expect
(
_converse
.
config
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
expect
(
cbview
.
loginpanel
.
connect
).
toHaveBeenCalled
();
expect
(
cbview
.
loginpanel
.
connect
).
toHaveBeenCalled
();
checkbox
.
click
();
checkbox
.
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
session
.
get
(
'
storage
'
)).
toBe
(
'
session
'
);
expect
(
_converse
.
config
.
get
(
'
storage
'
)).
toBe
(
'
session
'
);
done
();
done
();
});
});
}));
}));
...
@@ -67,14 +67,14 @@
...
@@ -67,14 +67,14 @@
spyOn
(
cbview
.
loginpanel
,
'
connect
'
);
spyOn
(
cbview
.
loginpanel
,
'
connect
'
);
expect
(
_converse
.
session
.
get
(
'
storage
'
)).
toBe
(
'
session
'
);
expect
(
_converse
.
config
.
get
(
'
storage
'
)).
toBe
(
'
session
'
);
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
session
.
get
(
'
storage
'
)).
toBe
(
'
session
'
);
expect
(
_converse
.
config
.
get
(
'
storage
'
)).
toBe
(
'
session
'
);
expect
(
cbview
.
loginpanel
.
connect
).
toHaveBeenCalled
();
expect
(
cbview
.
loginpanel
.
connect
).
toHaveBeenCalled
();
checkbox
.
click
();
checkbox
.
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
session
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
expect
(
_converse
.
config
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
done
();
done
();
});
});
}));
}));
...
...
src/converse-bookmarks.js
View file @
5e9d6c3d
...
@@ -250,7 +250,7 @@
...
@@ -250,7 +250,7 @@
this
.
on
(
'
remove
'
,
this
.
markRoomAsUnbookmarked
,
this
);
this
.
on
(
'
remove
'
,
this
.
markRoomAsUnbookmarked
,
this
);
this
.
on
(
'
remove
'
,
this
.
sendBookmarkStanza
,
this
);
this
.
on
(
'
remove
'
,
this
.
sendBookmarkStanza
,
this
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
cache_key
=
`converse.room-bookmarks
${
_converse
.
bare_jid
}
`
;
cache_key
=
`converse.room-bookmarks
${
_converse
.
bare_jid
}
`
;
this
.
fetched_flag
=
b64_sha1
(
cache_key
+
'
fetched
'
);
this
.
fetched_flag
=
b64_sha1
(
cache_key
+
'
fetched
'
);
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
cache_key
));
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
cache_key
));
...
@@ -444,7 +444,7 @@
...
@@ -444,7 +444,7 @@
_converse
.
chatboxes
.
on
(
'
add
'
,
this
.
renderBookmarkListElement
,
this
);
_converse
.
chatboxes
.
on
(
'
add
'
,
this
.
renderBookmarkListElement
,
this
);
_converse
.
chatboxes
.
on
(
'
remove
'
,
this
.
renderBookmarkListElement
,
this
);
_converse
.
chatboxes
.
on
(
'
remove
'
,
this
.
renderBookmarkListElement
,
this
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.room-bookmarks
${
_converse
.
bare_jid
}
-list-model`
);
id
=
b64_sha1
(
`converse.room-bookmarks
${
_converse
.
bare_jid
}
-list-model`
);
this
.
list_model
=
new
_converse
.
BookmarksList
({
'
id
'
:
id
});
this
.
list_model
=
new
_converse
.
BookmarksList
({
'
id
'
:
id
});
this
.
list_model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
this
.
list_model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
...
...
src/converse-chatboxes.js
View file @
5e9d6c3d
...
@@ -258,7 +258,7 @@
...
@@ -258,7 +258,7 @@
this
.
addRelatedContact
(
_converse
.
roster
.
findWhere
({
'
jid
'
:
this
.
get
(
'
jid
'
)}));
this
.
addRelatedContact
(
_converse
.
roster
.
findWhere
({
'
jid
'
:
this
.
get
(
'
jid
'
)}));
});
});
this
.
messages
=
new
_converse
.
Messages
();
this
.
messages
=
new
_converse
.
Messages
();
const
storage
=
_converse
.
session
.
get
(
'
storage
'
);
const
storage
=
_converse
.
config
.
get
(
'
storage
'
);
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
`converse.messages
${
this
.
get
(
'
jid
'
)}${
_converse
.
bare_jid
}
`
));
b64_sha1
(
`converse.messages
${
this
.
get
(
'
jid
'
)}${
_converse
.
bare_jid
}
`
));
this
.
messages
.
chatbox
=
this
;
this
.
messages
.
chatbox
=
this
;
...
...
src/converse-chatview.js
View file @
5e9d6c3d
...
@@ -123,8 +123,6 @@
...
@@ -123,8 +123,6 @@
'
current_category
'
:
'
people
'
,
'
current_category
'
:
'
people
'
,
'
current_skintone
'
:
''
,
'
current_skintone
'
:
''
,
'
scroll_position
'
:
0
'
scroll_position
'
:
0
},
initialize
()
{
}
}
});
});
...
@@ -1056,7 +1054,7 @@
...
@@ -1056,7 +1054,7 @@
createEmojiPicker
()
{
createEmojiPicker
()
{
if
(
_
.
isUndefined
(
_converse
.
emojipicker
))
{
if
(
_
.
isUndefined
(
_converse
.
emojipicker
))
{
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
`converse.emoji-
${
_converse
.
bare_jid
}
`
;
id
=
`converse.emoji-
${
_converse
.
bare_jid
}
`
;
_converse
.
emojipicker
=
new
_converse
.
EmojiPicker
({
'
id
'
:
id
});
_converse
.
emojipicker
=
new
_converse
.
EmojiPicker
({
'
id
'
:
id
});
_converse
.
emojipicker
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
_converse
.
emojipicker
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
...
...
src/converse-controlbox.js
View file @
5e9d6c3d
...
@@ -466,7 +466,7 @@
...
@@ -466,7 +466,7 @@
if
(
!
this
.
validate
())
{
return
;
}
if
(
!
this
.
validate
())
{
return
;
}
const
form_data
=
new
FormData
(
ev
.
target
);
const
form_data
=
new
FormData
(
ev
.
target
);
_converse
.
session
.
save
({
_converse
.
config
.
save
({
'
trusted
'
:
form_data
.
get
(
'
trusted
'
)
&&
true
||
false
,
'
trusted
'
:
form_data
.
get
(
'
trusted
'
)
&&
true
||
false
,
'
storage
'
:
form_data
.
get
(
'
trusted
'
)
?
'
local
'
:
'
session
'
'
storage
'
:
form_data
.
get
(
'
trusted
'
)
?
'
local
'
:
'
session
'
});
});
...
@@ -585,7 +585,7 @@
...
@@ -585,7 +585,7 @@
});
});
_converse
.
on
(
'
clearSession
'
,
()
=>
{
_converse
.
on
(
'
clearSession
'
,
()
=>
{
if
(
_converse
.
session
.
get
(
'
trusted
'
))
{
if
(
_converse
.
config
.
get
(
'
trusted
'
))
{
const
chatboxes
=
_
.
get
(
_converse
,
'
chatboxes
'
,
null
);
const
chatboxes
=
_
.
get
(
_converse
,
'
chatboxes
'
,
null
);
if
(
!
_
.
isNil
(
chatboxes
))
{
if
(
!
_
.
isNil
(
chatboxes
))
{
const
controlbox
=
chatboxes
.
get
(
'
controlbox
'
);
const
controlbox
=
chatboxes
.
get
(
'
controlbox
'
);
...
...
src/converse-core.js
View file @
5e9d6c3d
...
@@ -344,6 +344,8 @@
...
@@ -344,6 +344,8 @@
_converse
.
connection
.
reset
();
_converse
.
connection
.
reset
();
_converse
.
stopListening
();
_converse
.
stopListening
();
_converse
.
tearDown
();
_converse
.
tearDown
();
delete
_converse
.
config
;
_converse
.
initClientConfig
();
_converse
.
off
();
_converse
.
off
();
}
}
...
@@ -659,20 +661,33 @@
...
@@ -659,20 +661,33 @@
}
}
}
}
this
.
initSession
=
function
()
{
this
.
initClientConfig
=
function
()
{
const
id
=
b64_sha1
(
'
converse.bosh-session
'
);
/* The client config refers to configuration of the client which is
_converse
.
session
=
new
Backbone
.
Model
({
* independent of any particular user.
* What this means is that config values need to persist across
* user sessions.
*/
const
id
=
b64_sha1
(
'
converse.client-config
'
);
_converse
.
config
=
new
Backbone
.
Model
({
'
id
'
:
id
,
'
id
'
:
id
,
'
trusted
'
:
_converse
.
trusted
&&
true
||
false
,
'
trusted
'
:
_converse
.
trusted
&&
true
||
false
,
'
storage
'
:
_converse
.
trusted
?
'
local
'
:
'
session
'
'
storage
'
:
_converse
.
trusted
?
'
local
'
:
'
session
'
});
});
_converse
.
config
.
browserStorage
=
new
Backbone
.
BrowserStorage
.
session
(
id
);
_converse
.
config
.
fetch
();
_converse
.
emit
(
'
clientConfigInitialized
'
);
};
this
.
initSession
=
function
()
{
const
id
=
b64_sha1
(
'
converse.bosh-session
'
);
_converse
.
session
=
new
Backbone
.
Model
({
'
id
'
:
id
});
_converse
.
session
.
browserStorage
=
new
Backbone
.
BrowserStorage
.
session
(
id
);
_converse
.
session
.
browserStorage
=
new
Backbone
.
BrowserStorage
.
session
(
id
);
_converse
.
session
.
fetch
();
_converse
.
session
.
fetch
();
_converse
.
emit
(
'
sessionInitialized
'
);
_converse
.
emit
(
'
sessionInitialized
'
);
};
};
this
.
clearSession
=
function
()
{
this
.
clearSession
=
function
()
{
if
(
!
_converse
.
session
.
get
(
'
trusted
'
))
{
if
(
!
_converse
.
config
.
get
(
'
trusted
'
))
{
window
.
localStorage
.
clear
();
window
.
localStorage
.
clear
();
window
.
sessionStorage
.
clear
();
window
.
sessionStorage
.
clear
();
}
else
if
(
!
_
.
isUndefined
(
this
.
session
)
&&
this
.
session
.
browserStorage
)
{
}
else
if
(
!
_
.
isUndefined
(
this
.
session
)
&&
this
.
session
.
browserStorage
)
{
...
@@ -806,6 +821,7 @@
...
@@ -806,6 +821,7 @@
*/
*/
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
_converse
.
setUserJID
();
_converse
.
setUserJID
();
_converse
.
initSession
();
_converse
.
enableCarbons
();
_converse
.
enableCarbons
();
_converse
.
initStatus
(
reconnecting
)
_converse
.
initStatus
(
reconnecting
)
};
};
...
@@ -1170,7 +1186,7 @@
...
@@ -1170,7 +1186,7 @@
function
finishInitialization
()
{
function
finishInitialization
()
{
_converse
.
initPlugins
();
_converse
.
initPlugins
();
_converse
.
init
Session
();
_converse
.
init
ClientConfig
();
_converse
.
initConnection
();
_converse
.
initConnection
();
_converse
.
setUpXMLLogging
();
_converse
.
setUpXMLLogging
();
_converse
.
logIn
();
_converse
.
logIn
();
...
...
src/converse-disco.js
View file @
5e9d6c3d
...
@@ -267,7 +267,7 @@
...
@@ -267,7 +267,7 @@
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
_converse
.
api
.
listen
.
on
(
'
se
tUserJID
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
se
ssionInitialized
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
initializeDisco
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
initializeDisco
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
initializeDisco
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
initializeDisco
);
...
...
src/converse-minimize.js
View file @
5e9d6c3d
...
@@ -423,12 +423,16 @@
...
@@ -423,12 +423,16 @@
},
},
initToggle
()
{
initToggle
()
{
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.minchatstoggle
${
_converse
.
bare_jid
}
`
);
id
=
b64_sha1
(
`converse.minchatstoggle
${
_converse
.
bare_jid
}
`
);
this
.
toggleview
=
new
_converse
.
MinimizedChatsToggleView
({
this
.
toggleview
=
new
_converse
.
MinimizedChatsToggleView
({
'
model
'
:
new
_converse
.
MinimizedChatsToggle
({
'
id
'
:
id
})
'
model
'
:
new
_converse
.
MinimizedChatsToggle
({
'
id
'
:
id
})
});
});
try
{
this
.
toggleview
.
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
this
.
toggleview
.
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
}
catch
(
e
)
{
debugger
;
}
this
.
toggleview
.
model
.
fetch
();
this
.
toggleview
.
model
.
fetch
();
},
},
...
...
src/converse-muc-views.js
View file @
5e9d6c3d
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
this
.
roomspanel
=
new
_converse
.
RoomsPanel
({
this
.
roomspanel
=
new
_converse
.
RoomsPanel
({
'
model
'
:
new
(
_converse
.
RoomsPanelModel
.
extend
({
'
model
'
:
new
(
_converse
.
RoomsPanelModel
.
extend
({
'
id
'
:
b64_sha1
(
`converse.roomspanel
${
_converse
.
bare_jid
}
`
),
// Required by sessionStorage
'
id
'
:
b64_sha1
(
`converse.roomspanel
${
_converse
.
bare_jid
}
`
),
// Required by sessionStorage
'
browserStorage
'
:
new
Backbone
.
BrowserStorage
[
_converse
.
session
.
get
(
'
storage
'
)](
'
browserStorage
'
:
new
Backbone
.
BrowserStorage
[
_converse
.
config
.
get
(
'
storage
'
)](
b64_sha1
(
`converse.roomspanel
${
_converse
.
bare_jid
}
`
))
b64_sha1
(
`converse.roomspanel
${
_converse
.
bare_jid
}
`
))
}))()
}))()
});
});
...
...
src/converse-roomslist.js
View file @
5e9d6c3d
...
@@ -168,7 +168,7 @@
...
@@ -168,7 +168,7 @@
this
.
model
.
on
(
'
add
'
,
this
.
showOrHide
,
this
);
this
.
model
.
on
(
'
add
'
,
this
.
showOrHide
,
this
);
this
.
model
.
on
(
'
remove
'
,
this
.
showOrHide
,
this
);
this
.
model
.
on
(
'
remove
'
,
this
.
showOrHide
,
this
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.roomslist
${
_converse
.
bare_jid
}
`
);
id
=
b64_sha1
(
`converse.roomslist
${
_converse
.
bare_jid
}
`
);
this
.
list_model
=
new
_converse
.
RoomsList
({
'
id
'
:
id
});
this
.
list_model
=
new
_converse
.
RoomsList
({
'
id
'
:
id
});
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
});
});
const
initRoomsListView
=
function
()
{
const
initRoomsListView
=
function
()
{
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.open-rooms-{_converse.bare_jid}`
),
id
=
b64_sha1
(
`converse.open-rooms-{_converse.bare_jid}`
),
model
=
new
_converse
.
OpenRooms
();
model
=
new
_converse
.
OpenRooms
();
...
...
src/converse-roster.js
View file @
5e9d6c3d
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
/* Initialize the Bakcbone collections that represent the contats
/* Initialize the Bakcbone collections that represent the contats
* roster and the roster groups.
* roster and the roster groups.
*/
*/
const
storage
=
_converse
.
session
.
get
(
'
storage
'
);
const
storage
=
_converse
.
config
.
get
(
'
storage
'
);
_converse
.
roster
=
new
_converse
.
RosterContacts
();
_converse
.
roster
=
new
_converse
.
RosterContacts
();
_converse
.
roster
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
_converse
.
roster
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
`converse.contacts-
${
_converse
.
bare_jid
}
`
));
b64_sha1
(
`converse.contacts-
${
_converse
.
bare_jid
}
`
));
...
...
src/converse-vcard.js
View file @
5e9d6c3d
...
@@ -132,10 +132,10 @@
...
@@ -132,10 +132,10 @@
_converse
.
initVCardCollection
=
function
()
{
_converse
.
initVCardCollection
=
function
()
{
_converse
.
vcards
=
new
_converse
.
VCards
();
_converse
.
vcards
=
new
_converse
.
VCards
();
const
id
=
b64_sha1
(
`converse.vcards`
);
const
id
=
b64_sha1
(
`converse.vcards`
);
_converse
.
vcards
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
session
.
get
(
'
storage
'
)](
id
);
_converse
.
vcards
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
config
.
get
(
'
storage
'
)](
id
);
_converse
.
vcards
.
fetch
();
_converse
.
vcards
.
fetch
();
}
}
_converse
.
api
.
listen
.
on
(
'
se
tUserJID
'
,
_converse
.
initVCardCollection
);
_converse
.
api
.
listen
.
on
(
'
se
ssionInitialized
'
,
_converse
.
initVCardCollection
);
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
...
...
src/templates/login_panel.html
View file @
5e9d6c3d
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</div>
</div>
{[ } ]}
{[ } ]}
<div
class=
"form-group form-check"
>
<div
class=
"form-group form-check"
>
<input
id=
"converse-login-trusted"
type=
"checkbox"
class=
"form-check-input"
name=
"trusted"
{[
if
(
o
.
_converse
.
session
.
get
('
trusted
'))
{
]}
checked=
"checked"
{[
}
]}
>
<input
id=
"converse-login-trusted"
type=
"checkbox"
class=
"form-check-input"
name=
"trusted"
{[
if
(
o
.
_converse
.
config
.
get
('
trusted
'))
{
]}
checked=
"checked"
{[
}
]}
>
<label
for=
"converse-login-trusted"
class=
"form-check-label"
>
{{{o.__('This is a trusted device')}}}
</label>
<label
for=
"converse-login-trusted"
class=
"form-check-label"
>
{{{o.__('This is a trusted device')}}}
</label>
<i
class=
"fa fa-info-circle"
data-toggle=
"popover"
<i
class=
"fa fa-info-circle"
data-toggle=
"popover"
data-title=
"Trusted device?"
data-title=
"Trusted device?"
...
...
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