Merge branch 'communities-oo' into staging
This commit is contained in:
commit
0ece81afff
5 changed files with 67 additions and 32 deletions
|
@ -932,7 +932,6 @@ define([
|
||||||
waitFor.abort();
|
waitFor.abort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.warn('BAR');
|
|
||||||
href = url;
|
href = url;
|
||||||
setTimeout(w);
|
setTimeout(w);
|
||||||
});
|
});
|
||||||
|
@ -1077,12 +1076,17 @@ define([
|
||||||
var makeBurnAfterReadingUrl = function (common, href, channel, cb) {
|
var makeBurnAfterReadingUrl = function (common, href, channel, cb) {
|
||||||
var keyPair = Hash.generateSignPair();
|
var keyPair = Hash.generateSignPair();
|
||||||
var parsed = Hash.parsePadUrl(href);
|
var parsed = Hash.parsePadUrl(href);
|
||||||
console.error(href, parsed);
|
|
||||||
var newHref = parsed.getUrl({
|
var newHref = parsed.getUrl({
|
||||||
ownerKey: keyPair.safeSignKey
|
ownerKey: keyPair.safeSignKey
|
||||||
});
|
});
|
||||||
var sframeChan = common.getSframeChannel();
|
var sframeChan = common.getSframeChannel();
|
||||||
|
var rtChannel;
|
||||||
NThen(function (waitFor) {
|
NThen(function (waitFor) {
|
||||||
|
if (parsed.type !== "sheet") { return; }
|
||||||
|
common.getPadAttribute('rtChannel', waitFor(function (err, chan) {
|
||||||
|
rtChannel = chan;
|
||||||
|
}));
|
||||||
|
}).nThen(function (waitFor) {
|
||||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||||
channel: channel,
|
channel: channel,
|
||||||
command: 'ADD_OWNERS',
|
command: 'ADD_OWNERS',
|
||||||
|
@ -1093,6 +1097,17 @@ define([
|
||||||
UI.warn(Messages.error);
|
UI.warn(Messages.error);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
if (rtChannel) {
|
||||||
|
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||||
|
channel: rtChannel,
|
||||||
|
command: 'ADD_OWNERS',
|
||||||
|
value: [keyPair.validateKey]
|
||||||
|
}, waitFor(function (err) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
}).nThen(function () {
|
}).nThen(function () {
|
||||||
cb(newHref);
|
cb(newHref);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1140,6 +1140,9 @@ define([
|
||||||
if (ext === "bin") {
|
if (ext === "bin") {
|
||||||
return void importFile(content);
|
return void importFile(content);
|
||||||
}
|
}
|
||||||
|
if (typeof(Atomics) === "undefined") {
|
||||||
|
return void UI.alert(Messages.oo_invalidFormat);
|
||||||
|
}
|
||||||
var div = h('div.cp-oo-x2tXls', [
|
var div = h('div.cp-oo-x2tXls', [
|
||||||
h('span.fa.fa-spin.fa-spinner'),
|
h('span.fa.fa-spin.fa-spinner'),
|
||||||
h('span', Messages.oo_importInProgress)
|
h('span', Messages.oo_importInProgress)
|
||||||
|
@ -1340,7 +1343,11 @@ define([
|
||||||
var $exportXLSX = common.createButton('export', true, {}, exportXLSXFile);
|
var $exportXLSX = common.createButton('export', true, {}, exportXLSXFile);
|
||||||
$exportXLSX.appendTo($rightside);
|
$exportXLSX.appendTo($rightside);
|
||||||
|
|
||||||
var $importXLSX = common.createButton('import', true, { accept: [".bin", ".ods", ".xlsx"], binary : ["ods", "xlsx"] }, importXLSXFile);
|
var accept = [".bin", ".ods", ".xlsx"];
|
||||||
|
if (typeof(Atomics) === "undefined") {
|
||||||
|
accept = ['.bin'];
|
||||||
|
}
|
||||||
|
var $importXLSX = common.createButton('import', true, { accept: accept, binary : ["ods", "xlsx"] }, importXLSXFile);
|
||||||
$importXLSX.appendTo($rightside);
|
$importXLSX.appendTo($rightside);
|
||||||
|
|
||||||
if (common.isLoggedIn()) {
|
if (common.isLoggedIn()) {
|
||||||
|
@ -1395,6 +1402,10 @@ define([
|
||||||
Title.updateTitle(Title.defaultTitle);
|
Title.updateTitle(Title.defaultTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (metadataMgr.getPrivateData().burnAfterReading && content && content.channel) {
|
||||||
|
sframeChan.event('EV_BURN_PAD', content.channel);
|
||||||
|
}
|
||||||
|
|
||||||
openRtChannel(function () {
|
openRtChannel(function () {
|
||||||
setMyId();
|
setMyId();
|
||||||
oldHashes = JSON.parse(JSON.stringify(content.hashes));
|
oldHashes = JSON.parse(JSON.stringify(content.hashes));
|
||||||
|
|
|
@ -64,8 +64,8 @@ define([
|
||||||
var owners, expire;
|
var owners, expire;
|
||||||
nThen(function (waitFor) {
|
nThen(function (waitFor) {
|
||||||
if (Utils.rtConfig) {
|
if (Utils.rtConfig) {
|
||||||
owners = Utils.rtConfig.owners;
|
owners = Utils.Util.find(Utils.rtConfig, ['metadata', 'owners']);
|
||||||
expire = Utils.rtConfig.expire;
|
expire = Utils.Util.find(Utils.rtConfig, ['metadata', 'expire']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Cryptpad.getPadAttribute('owners', waitFor(function (err, res) {
|
Cryptpad.getPadAttribute('owners', waitFor(function (err, res) {
|
||||||
|
|
|
@ -520,6 +520,33 @@ define([
|
||||||
sframeChan.on('Q_SET_PAD_METADATA', function (data, cb) {
|
sframeChan.on('Q_SET_PAD_METADATA', function (data, cb) {
|
||||||
Cryptpad.setPadMetadata(data, cb);
|
Cryptpad.setPadMetadata(data, cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sframeChan.on('Q_GET_PAD_ATTRIBUTE', function (data, cb) {
|
||||||
|
var href;
|
||||||
|
if (readOnly && hashes.editHash) {
|
||||||
|
// If we have a stronger hash, use it for pad attributes
|
||||||
|
href = window.location.pathname + '#' + hashes.editHash;
|
||||||
|
}
|
||||||
|
if (data.href) { href = data.href; }
|
||||||
|
Cryptpad.getPadAttribute(data.key, function (e, data) {
|
||||||
|
cb({
|
||||||
|
error: e,
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}, href);
|
||||||
|
});
|
||||||
|
sframeChan.on('Q_SET_PAD_ATTRIBUTE', function (data, cb) {
|
||||||
|
var href;
|
||||||
|
if (readOnly && hashes.editHash) {
|
||||||
|
// If we have a stronger hash, use it for pad attributes
|
||||||
|
href = window.location.pathname + '#' + hashes.editHash;
|
||||||
|
}
|
||||||
|
if (data.href) { href = data.href; }
|
||||||
|
Cryptpad.setPadAttribute(data.key, data.value, function (e) {
|
||||||
|
cb({error:e});
|
||||||
|
}, href);
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
addCommonRpc(sframeChan);
|
addCommonRpc(sframeChan);
|
||||||
|
|
||||||
|
@ -749,32 +776,6 @@ define([
|
||||||
});
|
});
|
||||||
|
|
||||||
// Store
|
// Store
|
||||||
sframeChan.on('Q_GET_PAD_ATTRIBUTE', function (data, cb) {
|
|
||||||
var href;
|
|
||||||
if (readOnly && hashes.editHash) {
|
|
||||||
// If we have a stronger hash, use it for pad attributes
|
|
||||||
href = window.location.pathname + '#' + hashes.editHash;
|
|
||||||
}
|
|
||||||
if (data.href) { href = data.href; }
|
|
||||||
Cryptpad.getPadAttribute(data.key, function (e, data) {
|
|
||||||
cb({
|
|
||||||
error: e,
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}, href);
|
|
||||||
});
|
|
||||||
sframeChan.on('Q_SET_PAD_ATTRIBUTE', function (data, cb) {
|
|
||||||
var href;
|
|
||||||
if (readOnly && hashes.editHash) {
|
|
||||||
// If we have a stronger hash, use it for pad attributes
|
|
||||||
href = window.location.pathname + '#' + hashes.editHash;
|
|
||||||
}
|
|
||||||
if (data.href) { href = data.href; }
|
|
||||||
Cryptpad.setPadAttribute(data.key, data.value, function (e) {
|
|
||||||
cb({error:e});
|
|
||||||
}, href);
|
|
||||||
});
|
|
||||||
|
|
||||||
sframeChan.on('Q_DRIVE_GETDELETED', function (data, cb) {
|
sframeChan.on('Q_DRIVE_GETDELETED', function (data, cb) {
|
||||||
Cryptpad.getDeletedPads(data, function (err, obj) {
|
Cryptpad.getDeletedPads(data, function (err, obj) {
|
||||||
if (err) { return void console.error(err); }
|
if (err) { return void console.error(err); }
|
||||||
|
@ -1183,6 +1184,14 @@ define([
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sframeChan.on('EV_BURN_PAD', function (channel) {
|
||||||
|
if (!burnAfterReading) { return; }
|
||||||
|
Cryptpad.burnPad({
|
||||||
|
channel: channel,
|
||||||
|
ownerKey: burnAfterReading
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (cfg.messaging) {
|
if (cfg.messaging) {
|
||||||
Notifier.getPermission();
|
Notifier.getPermission();
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ define([
|
||||||
key: key,
|
key: key,
|
||||||
href: href
|
href: href
|
||||||
}, function (err, res) {
|
}, function (err, res) {
|
||||||
cb (err || res.error, res.data);
|
cb(err || res.error, res && res.data);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
funcs.setPadAttribute = function (key, value, cb, href) {
|
funcs.setPadAttribute = function (key, value, cb, href) {
|
||||||
|
|
Loading…
Reference in a new issue