Add setAttribute/getAttribute in secure iframes. Store attributes in settings

This commit is contained in:
yflory
2017-09-06 16:05:20 +02:00
parent fe8b2c2556
commit 04a04aef2b
15 changed files with 168 additions and 108 deletions

View File

@@ -115,7 +115,7 @@ define([
});
sframeChan.on('Q_SETTINGS_SET_DISPLAY_NAME', function (newName, cb) {
Cryptpad.setAttribute('username', newName, function (err) {
Cryptpad.setDisplayName(newName, function (err) {
if (err) {
console.log("Couldn't set username");
console.error(err);
@@ -220,6 +220,20 @@ define([
});
});
sframeChan.on('Q_GET_ATTRIBUTE', function (data, cb) {
Cryptpad.getAttribute(data.key, function (e, data) {
cb({
error: e,
data: data
});
});
});
sframeChan.on('Q_SET_ATTRIBUTE', function (data, cb) {
Cryptpad.setAttribute(data.key, data.value, function (e) {
cb({error:e});
});
});
var onFileUpload = function (sframeChan, data, cb) {
var sendEvent = function (data) {