mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Merge branch logout into 5.4-rc
This commit is contained in:
commit
111d1fee17
@ -389,6 +389,9 @@ define([
|
||||
cb();
|
||||
});
|
||||
};
|
||||
common.stopWorker = function () {
|
||||
postMessage('STOPWORKER', null, function () {});
|
||||
};
|
||||
common.logoutFromAll = function (cb) {
|
||||
var token = Math.floor(Math.random()*Number.MAX_SAFE_INTEGER);
|
||||
localStorage.setItem(Constants.tokenKey, token);
|
||||
|
||||
@ -19,6 +19,7 @@ define([
|
||||
if (q === 'CONNECT') { return; }
|
||||
if (q === 'JOIN_PAD') { return; }
|
||||
if (q === 'SEND_PAD_MSG') { return; }
|
||||
if (q === 'STOPWORKER') { return; }
|
||||
chan.on(q, function (data, cb) {
|
||||
try {
|
||||
Rpc.queries[q](clientId, data, cb);
|
||||
@ -29,6 +30,9 @@ define([
|
||||
}
|
||||
});
|
||||
});
|
||||
chan.on('STOPWORKER', function (data, cb) {
|
||||
cb();
|
||||
});
|
||||
chan.on('CONNECT', function (cfg, cb) {
|
||||
// load Store here, with cfg, and pass a "query" (chan.query)
|
||||
// cId is a clientId used in ServiceWorker or SharedWorker
|
||||
|
||||
@ -53,6 +53,7 @@ var init = function (client, cb) {
|
||||
if (q === 'CONNECT') { return; }
|
||||
if (q === 'JOIN_PAD') { return; }
|
||||
if (q === 'SEND_PAD_MSG') { return; }
|
||||
if (q === 'STOPWORKER') { return; }
|
||||
chan.on(q, function (data, cb) {
|
||||
try {
|
||||
Rpc.queries[q](clientId, data, cb);
|
||||
@ -71,6 +72,10 @@ var init = function (client, cb) {
|
||||
}
|
||||
});
|
||||
});
|
||||
chan.on('STOPWORKER', function (data, cb) {
|
||||
console.error('ICI');
|
||||
self.close();
|
||||
});
|
||||
chan.on('CONNECT', function (cfg, cb) {
|
||||
debug('SharedW connecting to store...');
|
||||
/*
|
||||
|
||||
@ -1343,11 +1343,15 @@ define([
|
||||
});
|
||||
|
||||
sframeChan.on('Q_LOGOUT', function (data, cb) {
|
||||
Cryptpad.stopWorker();
|
||||
Utils.LocalStore.logout(cb);
|
||||
});
|
||||
|
||||
sframeChan.on('Q_LOGOUT_EVERYWHERE', function (data, cb) {
|
||||
Cryptpad.logoutFromAll(Utils.Util.bake(Utils.LocalStore.logout, cb));
|
||||
Cryptpad.logoutFromAll(Utils.Util.bake(Utils.LocalStore.logout, function () {
|
||||
Cryptpad.stopWorker();
|
||||
cb();
|
||||
}));
|
||||
});
|
||||
|
||||
sframeChan.on('EV_NOTIFY', function (data) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user