Merge branch 'soon' into staging

This commit is contained in:
ansuz 2021-08-10 19:51:28 +05:30
commit 2a8c70598b
13 changed files with 70 additions and 23 deletions

View File

@ -463,6 +463,7 @@ define([
var proceed = function (result) {
hashing = false;
if (test && typeof test === "function" && test()) { return; }
LocalStore.clearLoginToken();
Realtime.whenRealtimeSyncs(result.realtime, function () {
Exports.redirect();
});

View File

@ -54,7 +54,8 @@ Channel.clearOwnedChannel = function (Env, safeKey, channelId, cb, Server) {
});
};
var archiveOwnedChannel = function (Env, safeKey, channelId, _cb, Server) {
var archiveOwnedChannel = function (Env, safeKey, channelId, __cb, Server) {
var _cb = Util.once(Util.mkAsync(__cb));
var unsafeKey = Util.unescapeKeyCharacters(safeKey);
nThen(function (w) {
// confirm that the channel exists before worrying about whether
@ -160,7 +161,10 @@ Channel.trimHistory = function (Env, safeKey, data, cb) {
nThen(function (w) {
Metadata.getMetadataRaw(Env, channelId, w(function (err, metadata) {
if (err) { return void cb(err); }
if (err) {
w.abort();
return void cb(err);
}
if (!Core.hasOwners(metadata)) {
w.abort();
return void cb('E_NO_OWNERS');
@ -173,6 +177,11 @@ Channel.trimHistory = function (Env, safeKey, data, cb) {
}));
}).nThen(function () {
Env.msgStore.trimChannel(channelId, hash, function (err) {
Env.Log.info('HK_TRIM_HISTORY', {
unsafeKey: unsafeKey,
channelId: channelId,
status: err? String(err): 'SUCCESS',
});
if (err) { return void cb(err); }
// clear historyKeeper's cache for this channel
Env.historyKeeper.channelClose(channelId);

View File

@ -88,11 +88,10 @@ html, body {
.cp-notice-browser, .cp-notice-details, .cp-notice-other {
font-size: 70%;
}
.underline { text-decoration: underline; }
.cp-app-checkup-version, .cp-app-checkup-browser {
text-decoration: underline;
.underline;
}
iframe {
display: none;
}

View File

@ -14,6 +14,25 @@ define([
return false;
};
var OS_HINTS = {
"Win": "Windows",
"Mac": "MacOS",
"X11": "UNIX",
"Linux": "Linux",
};
Tools.guessOS = function () {
var result = "UNKNOWN";
if (!window.navigator || !window.navigator.appVersion) { return result; }
result = window.navigator.appVersion;
console.log(result);
Object.keys(OS_HINTS).some(function (key) {
if (result.indexOf(key) === -1) { return; }
result = OS_HINTS[key]; // else
return true;
});
return result;
};
Tools.isSafari = function () {
return navigator.vendor.match(/apple/i);

View File

@ -932,7 +932,9 @@ define([
return h('p.cp-notice-browser', [
"You appear to be using a ",
h('span.cp-app-checkup-browser', name),
' browser to view this page.',
' browser on ',
h('span.underline', Tools.guessOS()),
' to view this page.',
]);
};

View File

@ -1,3 +0,0 @@
// Fix for noscript bugs when caching iframe content.
// Caution, this file will get cached, you must change the name if you change it.
document.getElementById('pad-iframe').setAttribute('src', 'inner.html?cb=' + (+new Date()));

View File

@ -82,6 +82,10 @@ define([
} catch (err) { return; }
};
LocalStore.clearLoginToken = function () {
localStorage.removeItem(Constants.loginToken);
};
LocalStore.setDriveRedirectPreference = function (bool) {
localStorage.setItem(Constants.redirectToDriveKey, Boolean(bool));
};

View File

@ -1167,6 +1167,13 @@ define([
Store
*/
var excludeInvalidIdentifiers = function (result) {
return result.filter(function (channel) {
if (typeof(channel) !== 'string') { return; }
return [32, 48].indexOf(channel.length) !== -1;
});
};
// Get the list of channels filtered by a type (expirable channels, owned channels, pin list)
var getChannelsList = function (Env, type) {
var result = [];
@ -1228,8 +1235,8 @@ define([
}
};
if (type === 'owned' && !Env.edPublic) { return result; }
if (type === 'pin' && !Env.edPublic) { return result; }
if (type === 'owned' && !Env.edPublic) { return excludeInvalidIdentifiers(result); }
if (type === 'pin' && !Env.edPublic) { return excludeInvalidIdentifiers(result); }
// Get the list of user objects
var userObjects = _getUserObjects(Env);
@ -1256,10 +1263,7 @@ define([
Array.prototype.push.apply(result, sfChannels);
}
return result.filter(function (channel) {
if (typeof(channel) !== 'string') { return; }
return [32, 48].indexOf(channel.length) !== -1;
});
return excludeInvalidIdentifiers(result);
};
var addPad = function (Env, path, pad, cb) {

View File

@ -1379,5 +1379,8 @@
"fm_link_name_placeholder": "Mein Link",
"fm_link_url": "URL",
"fm_link_type": "Link",
"fm_link_new": "Neuer Link"
"fm_link_new": "Neuer Link",
"form_totalResponses": "Antworten insgesamt: {0}",
"ui_expand": "Ausklappen",
"ui_collapse": "Einklappen"
}

View File

@ -1379,5 +1379,8 @@
"fm_link_name_placeholder": "あなたのリンク",
"fm_link_warning": "注意URLが200字を超えています",
"fm_link_invalid": "URLが無効です",
"form_answerAs": "名前を記入してください"
"form_answerAs": "名前を記入してください",
"form_totalResponses": "回答数:{0}",
"ui_expand": "広げる",
"ui_collapse": "折りたたむ"
}

View File

@ -542,12 +542,12 @@ define([
}
// Owned drive
if (data.state === true) {
sframeChan.query('Q_SETTINGS_LOGOUT', null, function() {});
UI.alert(Messages.settings_deleted, function() {
common.gotoURL('/');
return void sframeChan.query('Q_SETTINGS_LOGOUT_PROPERLY', null, function() {
UI.alert(Messages.settings_deleted, function() {
common.gotoURL('/');
});
spinner.done();
});
spinner.done();
return;
}
// Not owned drive
var msg = h('div.cp-app-settings-delete-alert', [

View File

@ -57,6 +57,10 @@ define([
});
});
});
sframeChan.on('Q_SETTINGS_LOGOUT_PROPERLY', function (data, cb) {
Utils.LocalStore.clearLoginToken();
cb();
});
sframeChan.on('Q_SETTINGS_DRIVE_RESET', function (data, cb) {
Cryptpad.resetDrive(cb);
});

View File

@ -39,7 +39,9 @@ define([
var teams = privateData.teams || {};
if (!ctx.isAdmin) {
data.sender.userAgent = window.navigator && window.navigator.userAgent;
data.sender.userAgent = Util.find(window, ['navigator', 'userAgent']);
data.sender.vendor = Util.find(window, ['navigator', 'vendor']);
data.sender.appVersion = Util.find(window, ['navigator', 'appVersion']);
data.sender.blockLocation = privateData.blockLocation || '';
data.sender.teams = Object.keys(teams).map(function (key) {
var team = teams[key];