Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
yflory
2017-12-12 14:45:39 +01:00
6 changed files with 31 additions and 13 deletions

View File

@@ -26,4 +26,5 @@ addons:
sauce_connect: sauce_connect:
username: "cjdelisle" username: "cjdelisle"
access_key: access_key:
secure: "pgGh8YGXLPq6fpdwwK2jnjRtwXPbVWQ/HIFvwX7E6HBpzxxcF2edE8sCdonWW9TP2LQisZFmVLqoSnZWMnjBr2CBAMKMFvaHQDJDQCo4v3BXkID7KgqyKmNcwW+FPfSJ5MxNBro8/GE/awkhZzJLYGUTS5zi/gVuIUwdi6cHI8s=" secure: "pgGh8YGXLPq6fpdwwK2jnjRtwXPbVWQ/HIFvwX7E6HBpzxxcF2edE8sCdonWW9TP2LQisZFmVLqoSnZWMnjBr2CBAMKMFvaHQDJDQCo4v3BXkID7KgqyKmNcwW+FPfSJ5MxNBro8/GE/awkhZzJLYGUTS5zi/gVuIUwdi6cHI8s="i
tunnel_domains: localhost

23
rpc.js
View File

@@ -1057,11 +1057,9 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
} }
}; };
var rpc = function ( var rpc0 = function (ctx, data, respond) {
ctx /*:{ store: Object }*/, if (!Env.msgStore) { Env.msgStore = ctx.store; }
data /*:Array<Array<any>>*/,
respond /*:(?string, ?Array<any>)=>void*/)
{
if (!Array.isArray(data)) { if (!Array.isArray(data)) {
return void respond('INVALID_ARG_FORMAT'); return void respond('INVALID_ARG_FORMAT');
} }
@@ -1140,8 +1138,6 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
Respond('E_ACCESS_DENIED'); Respond('E_ACCESS_DENIED');
}; };
if (!Env.msgStore) { Env.msgStore = ctx.store; }
var handleMessage = function (privileged) { var handleMessage = function (privileged) {
if (config.logRPC) { console.log(msg[0]); } if (config.logRPC) { console.log(msg[0]); }
switch (msg[0]) { switch (msg[0]) {
@@ -1272,6 +1268,19 @@ RPC.create = function (config /*:typeof(ConfigType)*/, cb /*:(?Error, ?Function)
handleMessage(session.privilege); handleMessage(session.privilege);
}; };
var rpc = function (
ctx /*:{ store: Object }*/,
data /*:Array<Array<any>>*/,
respond /*:(?string, ?Array<any>)=>void*/)
{
try {
return rpc0(ctx, data, respond);
} catch (e) {
console.log("Error from RPC with data " + JSON.stringify(data));
console.log(e.stack);
}
};
var updateLimitDaily = function () { var updateLimitDaily = function () {
updateLimits(config, undefined, function (e) { updateLimits(config, undefined, function (e) {
if (e) { if (e) {

View File

@@ -137,7 +137,8 @@ define([
var secret = Hash.parsePadUrl('/pad/#67b8385b07352be53e40746d2be6ccd7XAYSuJYYqa9NfmInyHci7LNy'); var secret = Hash.parsePadUrl('/pad/#67b8385b07352be53e40746d2be6ccd7XAYSuJYYqa9NfmInyHci7LNy');
return cb(secret.hashData.channel === "67b8385b07352be53e40746d2be6ccd7" && return cb(secret.hashData.channel === "67b8385b07352be53e40746d2be6ccd7" &&
secret.hashData.key === "XAYSuJYYqa9NfmInyHci7LNy" && secret.hashData.key === "XAYSuJYYqa9NfmInyHci7LNy" &&
secret.hashData.version === 0); secret.hashData.version === 0 &&
typeof(secret.hashData.getURL) === 'function');
}, "Old hash failed to parse"); }, "Old hash failed to parse");
// make sure version 1 hashes parse correctly // make sure version 1 hashes parse correctly

View File

@@ -4,18 +4,17 @@ define([
'/common/common-util.js', '/common/common-util.js',
'/common/common-hash.js', '/common/common-hash.js',
'/common/common-messaging.js', '/common/common-messaging.js',
'/common/common-realtime.js',
'/common/common-constants.js', '/common/common-constants.js',
'/common/common-feedback.js', '/common/common-feedback.js',
'/common/outer/local-store.js', '/common/outer/local-store.js',
'/common/outer/store-rpc.js', '/common/outer/store-rpc.js',
'/common/pinpad.js',
'/customize/application_config.js', '/customize/application_config.js',
'/bower_components/nthen/index.js', '/bower_components/nthen/index.js',
], function (Config, Messages, Util, Hash, ], function (Config, Messages, Util, Hash,
Messaging, Realtime, Constants, Feedback, LocalStore, AStore, Messaging, Constants, Feedback, LocalStore, AStore,
Pinpad, AppConfig, Nthen) { AppConfig, Nthen) {
/* This file exposes functionality which is specific to Cryptpad, but not to /* This file exposes functionality which is specific to Cryptpad, but not to
any particular pad type. This includes functions for committing metadata any particular pad type. This includes functions for committing metadata

View File

@@ -253,6 +253,13 @@ define([
newContent = normalize(newContent); newContent = normalize(newContent);
contentUpdate(newContent); contentUpdate(newContent);
} else { } else {
if (!cpNfInner.metadataMgr.getPrivateData().isNewFile) {
// We're getting 'new pad' but there is an existing file
// We don't know exactly why this can happen but under no circumstances
// should we overwrite the content, so lets just try again.
common.gotoURL();
return;
}
console.log('updating title'); console.log('updating title');
title.updateTitle(title.defaultTitle); title.updateTitle(title.defaultTitle);
evOnDefaultContentNeeded.fire(); evOnDefaultContentNeeded.fire();

View File

@@ -720,6 +720,7 @@ define([
}; };
var createUnpinnedWarning0 = function (toolbar, config) { var createUnpinnedWarning0 = function (toolbar, config) {
if (true) { return; } // stub this call since it won't make it into the next release
if (Common.isLoggedIn()) { return; } if (Common.isLoggedIn()) { return; }
var pd = config.metadataMgr.getPrivateData(); var pd = config.metadataMgr.getPrivateData();
var o = pd.origin; var o = pd.origin;