Add previewMode settings to code2
This commit is contained in:
@@ -200,6 +200,21 @@ define([
|
||||
network.sendto(hkn, JSON.stringify(['GET_FULL_HISTORY', secret.channel, secret.keys.validateKey]));
|
||||
});
|
||||
|
||||
sframeChan.on('Q_GET_PAD_ATTRIBUTE', function (data, cb) {
|
||||
Cryptpad.getPadAttribute(data.key, function (e, data) {
|
||||
cb({
|
||||
error: e,
|
||||
data: data
|
||||
});
|
||||
});
|
||||
});
|
||||
sframeChan.on('Q_SET_PAD_ATTRIBUTE', function (data, cb) {
|
||||
Cryptpad.setPadAttribute(data.key, data.value, function (e) {
|
||||
cb({error:e});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
CpNfOuter.start({
|
||||
sframeChan: sframeChan,
|
||||
channel: secret.channel,
|
||||
|
||||
@@ -107,6 +107,22 @@ define([
|
||||
ctx.sframeChan.query('Q_GET_FULL_HISTORY', null, cb);
|
||||
};
|
||||
|
||||
funcs.getPadAttribute = function (key, cb) {
|
||||
ctx.sframeChan.query('Q_GET_PAD_ATTRIBUTE', {
|
||||
key: key
|
||||
}, function (err, res) {
|
||||
cb (err || res.error, res.data);
|
||||
});
|
||||
};
|
||||
funcs.setPadAttribute = function (key, value, cb) {
|
||||
ctx.sframeChan.query('Q_SET_PAD_ATTRIBUTE', {
|
||||
key: key,
|
||||
value: value
|
||||
}, function (err, data) {
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
// Friends
|
||||
var pendingFriends = [];
|
||||
funcs.getPendingFriends = function () {
|
||||
|
||||
@@ -84,4 +84,8 @@ define({
|
||||
|
||||
// Send the new settings to the inner iframe when they are changed in the proxy
|
||||
'EV_SETTINGS_UPDATE': true,
|
||||
|
||||
// Get and set pad attributes stored in the drive from the inner iframe
|
||||
'Q_GET_PAD_ATTRIBUTE': true,
|
||||
'Q_SET_PAD_ATTRIBUTE': true,
|
||||
});
|
||||
|
||||
@@ -146,6 +146,7 @@ define([
|
||||
if (!attr || !attr.trim()) { return void cb("E_INVAL_ATTR"); }
|
||||
var data = getFileData(id);
|
||||
data[attr] = value;
|
||||
cb(null);
|
||||
};
|
||||
|
||||
// PATHS
|
||||
|
||||
Reference in New Issue
Block a user