pull/1/head
ansuz 4 years ago
parent 760356c4ff
commit 46703d627b

@ -2056,6 +2056,8 @@ define([
}; };
var userHash; var userHash;
console.error("pewpew");
//console.error('pewpew');
Nthen(function (waitFor) { Nthen(function (waitFor) {
if (AppConfig.beforeLogin) { if (AppConfig.beforeLogin) {
@ -2108,6 +2110,7 @@ define([
// FIXME Backward compatibility // FIXME Backward compatibility
if (sessionStorage.newPadFileData) { if (sessionStorage.newPadFileData) {
/*
common.fromFileData = JSON.parse(sessionStorage.newPadFileData); common.fromFileData = JSON.parse(sessionStorage.newPadFileData);
var _parsed1 = Hash.parsePadUrl(common.fromFileData.href); var _parsed1 = Hash.parsePadUrl(common.fromFileData.href);
var _parsed2 = Hash.parsePadUrl(window.location.href); var _parsed2 = Hash.parsePadUrl(window.location.href);
@ -2115,6 +2118,7 @@ define([
if (_parsed1.type !== _parsed2.type) { delete common.fromFileData; } if (_parsed1.type !== _parsed2.type) { delete common.fromFileData; }
} }
delete sessionStorage.newPadFileData; delete sessionStorage.newPadFileData;
*/
} }
if (sessionStorage.newPadPath) { if (sessionStorage.newPadPath) {
@ -2134,11 +2138,12 @@ define([
var postMsg, worker; var postMsg, worker;
var noWorker = AppConfig.disableWorkers || false; var noWorker = AppConfig.disableWorkers || false;
var noSharedWorker = false; var noSharedWorker = false;
if (localStorage.CryptPad_noWorkers) { if (localStorage.CryptPad_noWorkers || true) {
noWorker = localStorage.CryptPad_noWorkers === '1'; noWorker = localStorage.CryptPad_noWorkers === '1';
console.error('WebWorker/SharedWorker state forced to ' + !noWorker); //console.error('WebWorker/SharedWorker state forced to ' + !noWorker);
} }
Nthen(function (waitFor2) { Nthen(function (waitFor2) {
return;
if (Worker) { if (Worker) {
var w = waitFor2(); var w = waitFor2();
try { try {
@ -2161,6 +2166,7 @@ define([
w(); w();
} }
} }
return;
if (typeof(SharedWorker) !== "undefined") { if (typeof(SharedWorker) !== "undefined") {
try { try {
new SharedWorker(''); new SharedWorker('');
@ -2170,6 +2176,18 @@ define([
} }
} }
}).nThen(function (waitFor2) { }).nThen(function (waitFor2) {
// Use the async store in the main thread if workers are not available
require(['/common/outer/noworker.js'], waitFor2(function (NoWorker) {
NoWorker.onMessage(function (data) {
msgEv.fire({data: data});
});
postMsg = function (d) { setTimeout(function () { NoWorker.query(d); }); };
NoWorker.create();
}));
return;
if (!noWorker && !noSharedWorker && typeof(SharedWorker) !== "undefined") { if (!noWorker && !noSharedWorker && typeof(SharedWorker) !== "undefined") {
worker = new SharedWorker('/common/outer/sharedworker.js?' + urlArgs); worker = new SharedWorker('/common/outer/sharedworker.js?' + urlArgs);
worker.onerror = function (e) { worker.onerror = function (e) {
@ -2337,6 +2355,8 @@ define([
} }
if (parsedNew.hashData) { oldHref = newHref; } if (parsedNew.hashData) { oldHref = newHref; }
}; };
/*
// Listen for login/logout in other tabs // Listen for login/logout in other tabs
window.addEventListener('storage', function (e) { window.addEventListener('storage', function (e) {
if (e.key !== Constants.userHashKey) { return; } if (e.key !== Constants.userHashKey) { return; }
@ -2347,7 +2367,7 @@ define([
} else if (o && !n) { } else if (o && !n) {
LocalStore.logout(); LocalStore.logout();
} }
}); });*/
LocalStore.onLogout(function () { LocalStore.onLogout(function () {
console.log('onLogout: disconnect'); console.log('onLogout: disconnect');
postMessage("DISCONNECT"); postMessage("DISCONNECT");
@ -2367,6 +2387,7 @@ define([
common.mergeAnonDrive(waitFor()); common.mergeAnonDrive(waitFor());
} }
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
return;
if (AppConfig.afterLogin) { if (AppConfig.afterLogin) {
AppConfig.afterLogin(common, waitFor()); AppConfig.afterLogin(common, waitFor());
} }

Loading…
Cancel
Save