Pin images included in the spreadsheets

This commit is contained in:
yflory
2020-01-20 18:05:31 +01:00
parent 7f4dbd3245
commit dbb726e4ce
3 changed files with 52 additions and 1 deletions

View File

@@ -1260,6 +1260,23 @@ define([
return stringify(obj);
};
var pinImages = function () {
if (content.mediasSources) {
var toPin = Object.keys(content.mediasSources || {}).map(function (id) {
var data = content.mediasSources[id] || {};
var src = data.src;
if (!src) { return; }
// Remove trailing slash
if (src.slice(-1) === '/') {
src = src.slice(0, -1);
}
// Extract the channel id from the source href
return src.slice(src.lastIndexOf('/') + 1);
}).filter(Boolean);
sframeChan.query('EV_OO_PIN_IMAGES', toPin);
}
};
APP.getContent = function () { return content; };
APP.onLocal = config.onLocal = function () {
@@ -1269,6 +1286,7 @@ define([
// Update metadata
var content = stringifyInner();
APP.realtime.contentUpdate(content);
pinImages();
};
config.onInit = function (info) {
@@ -1422,6 +1440,7 @@ define([
handleNewLocks(oldLocks, content.locks);
oldLocks = JSON.parse(JSON.stringify(content.locks));
}
pinImages();
};
config.onAbort = function () {