|
|
@ -288,31 +288,30 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var newHref;
|
|
|
|
var newHref;
|
|
|
|
nThen(function (w) {
|
|
|
|
nThen(function (w) {
|
|
|
|
if (!parsed.hashData.key && parsed.hashData.channel) {
|
|
|
|
if (parsed.hashData.key || !parsed.hashData.channel) { return; }
|
|
|
|
var edit = parsed.hashData.mode === 'edit';
|
|
|
|
var edit = parsed.hashData.mode === 'edit';
|
|
|
|
Cryptpad.getPadDataFromChannel({
|
|
|
|
Cryptpad.getPadDataFromChannel({
|
|
|
|
channel: parsed.hashData.channel,
|
|
|
|
channel: parsed.hashData.channel,
|
|
|
|
edit: edit,
|
|
|
|
edit: edit,
|
|
|
|
file: parsed.hashData.type === 'file'
|
|
|
|
file: parsed.hashData.type === 'file'
|
|
|
|
}, w(function (err, res) {
|
|
|
|
}, w(function (err, res) {
|
|
|
|
// Error while getting data? abort
|
|
|
|
// Error while getting data? abort
|
|
|
|
if (err || !res || res.error) {
|
|
|
|
if (err || !res || res.error) {
|
|
|
|
w.abort();
|
|
|
|
w.abort();
|
|
|
|
return void noPadData(err || (!res ? 'EINVAL' : res.error));
|
|
|
|
return void noPadData(err || (!res ? 'EINVAL' : res.error));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// No data found? abort
|
|
|
|
// No data found? abort
|
|
|
|
if (!Object.keys(res).length) {
|
|
|
|
if (!Object.keys(res).length) {
|
|
|
|
w.abort();
|
|
|
|
w.abort();
|
|
|
|
return void noPadData('NO_RESULT');
|
|
|
|
return void noPadData('NO_RESULT');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Data found but weaker? warn
|
|
|
|
// Data found but weaker? warn
|
|
|
|
if (edit && !res.href) {
|
|
|
|
if (edit && !res.href) {
|
|
|
|
newHref = res.roHref;
|
|
|
|
newHref = res.roHref;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// We have good data, keep the hash in memory
|
|
|
|
// We have good data, keep the hash in memory
|
|
|
|
newHref = edit ? res.href : (res.roHref || res.href);
|
|
|
|
newHref = edit ? res.href : (res.roHref || res.href);
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
}).nThen(function (w) {
|
|
|
|
}).nThen(function (w) {
|
|
|
|
if (newHref) {
|
|
|
|
if (newHref) {
|
|
|
|
// Get the options (embed, present, etc.) of the hidden hash
|
|
|
|
// Get the options (embed, present, etc.) of the hidden hash
|
|
|
|