|
|
@ -1478,13 +1478,24 @@ define([
|
|
|
|
return 'thumbnail-' + parsed.type + '-' + channel;
|
|
|
|
return 'thumbnail-' + parsed.type + '-' + channel;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
sframeChan.on('Q_CREATE_TEMPLATES', function (type, cb) {
|
|
|
|
sframeChan.on('Q_CREATE_TEMPLATES', function (type, cb) {
|
|
|
|
|
|
|
|
var templates;
|
|
|
|
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
|
|
|
|
var next = waitFor();
|
|
|
|
|
|
|
|
require([
|
|
|
|
|
|
|
|
'/'+type+'/templates.js'
|
|
|
|
|
|
|
|
], function (Templates) {
|
|
|
|
|
|
|
|
templates = Templates;
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
|
|
|
}, function () {
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
Cryptpad.getSecureFilesList({
|
|
|
|
Cryptpad.getSecureFilesList({
|
|
|
|
types: [type],
|
|
|
|
types: [type],
|
|
|
|
where: ['template']
|
|
|
|
where: ['template']
|
|
|
|
}, function (err, data) {
|
|
|
|
}, function (err, data) {
|
|
|
|
// NOTE: Never return data directly!
|
|
|
|
// NOTE: Never return data directly!
|
|
|
|
if (err) { return void cb({error: err}); }
|
|
|
|
if (err) { return void cb({error: err}); }
|
|
|
|
|
|
|
|
|
|
|
|
var res = [];
|
|
|
|
var res = [];
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
Object.keys(data).map(function (el) {
|
|
|
|
Object.keys(data).map(function (el) {
|
|
|
@ -1499,10 +1510,16 @@ define([
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
if (Array.isArray(templates)) {
|
|
|
|
|
|
|
|
templates.forEach(function (obj) {
|
|
|
|
|
|
|
|
res.push(obj);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
cb({data: res});
|
|
|
|
cb({data: res});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
sframeChan.on('Q_GET_FILE_THUMBNAIL', function (data, cb) {
|
|
|
|
sframeChan.on('Q_GET_FILE_THUMBNAIL', function (data, cb) {
|
|
|
|
if (!Cryptpad.fromFileData || !Cryptpad.fromFileData.href) {
|
|
|
|
if (!Cryptpad.fromFileData || !Cryptpad.fromFileData.href) {
|
|
|
@ -1892,6 +1909,7 @@ define([
|
|
|
|
Utils.rtConfig = rtConfig;
|
|
|
|
Utils.rtConfig = rtConfig;
|
|
|
|
var templatePw;
|
|
|
|
var templatePw;
|
|
|
|
nThen(function(waitFor) {
|
|
|
|
nThen(function(waitFor) {
|
|
|
|
|
|
|
|
if (data.templateContent) { return; }
|
|
|
|
if (data.templateId) {
|
|
|
|
if (data.templateId) {
|
|
|
|
if (data.templateId === -1) {
|
|
|
|
if (data.templateId === -1) {
|
|
|
|
isTemplate = true;
|
|
|
|
isTemplate = true;
|
|
|
@ -1905,6 +1923,14 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
var cryptputCfg = $.extend(true, {}, rtConfig, {password: password});
|
|
|
|
var cryptputCfg = $.extend(true, {}, rtConfig, {password: password});
|
|
|
|
|
|
|
|
if (data.templateContent) {
|
|
|
|
|
|
|
|
Cryptget.put(currentPad.hash, JSON.stringify(data.templateContent), function () {
|
|
|
|
|
|
|
|
console.error(arguments);
|
|
|
|
|
|
|
|
startRealtime();
|
|
|
|
|
|
|
|
cb();
|
|
|
|
|
|
|
|
}, cryptputCfg);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (data.template) {
|
|
|
|
if (data.template) {
|
|
|
|
// Start OO with a template...
|
|
|
|
// Start OO with a template...
|
|
|
|
// Cryptget and give href, password and content to inner
|
|
|
|
// Cryptget and give href, password and content to inner
|
|
|
|