From 3207bedb4b3edd62c98667fe6ebd0c75216e6418 Mon Sep 17 00:00:00 2001 From: zanhesl <48605213+zanhesl@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:42:00 +0300 Subject: [PATCH] Images archiving fixes (#1147) * List of archived server * Images src replace to archive * Replace images in all code * Fix srcNew --- components/imagegallery/templates/image.html | 4 ++-- components/wallet/index.js | 2 +- js/functions.js | 15 +++++++++++++-- js/vendor/imagesloaded.pkgd.js | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/imagegallery/templates/image.html b/components/imagegallery/templates/image.html index 29a49128ba..78d13fba91 100644 --- a/components/imagegallery/templates/image.html +++ b/components/imagegallery/templates/image.html @@ -5,8 +5,8 @@ var src = image.csrc || image.src; - if (src && src.indexOf('peertube') == -1) - src = src.replace('bastyon.com:8092', 'pocketnet.app:8092').replace('test.', '') + if (src && src.indexOf('peertube') == -1) + src = replaceArchiveInImage(src) %> diff --git a/components/wallet/index.js b/components/wallet/index.js index bfb2448a4d..3c5170f0ed 100644 --- a/components/wallet/index.js +++ b/components/wallet/index.js @@ -109,7 +109,7 @@ var wallet = (function(){ defaultValueTemplate : function(d, f, g, firstdef){ if(_.isObject(d)){ - var img = d.image ? d.image.replace('bastyon.com:8092', 'pocketnet.app:8092').replace('test.pocketnet', 'pocketnet') : null + var img = d.image ? replaceArchiveInImage(d.image) : null var h = '' diff --git a/js/functions.js b/js/functions.js index 489733d3d4..5d09b24e12 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1788,7 +1788,8 @@ bgImagesClApply = function (el, src) { bgImagesClApplyTemplate = function (src) { - src = (src || "").replace('bastyon.com:8092', 'pocketnet.app:8092').replace('test.pocketnet', 'pocketnet') + src = (src || ""); + src = replaceArchiveInImage(src); app.platform.archivedServers.map(server => { if (src.includes(server)) src = src.replace(server, 'peertube.archive.pocketnet.app'); @@ -9577,7 +9578,7 @@ edjsHTML = function () { if (t.withBorder) cl.push('withBorder') if (t.stretched) cl.push('stretched') - var src = (t.file && t.file.url ? t.file.url : t.file).replace('bastyon.com:8092', 'pocketnet.app:8092').replace('test.pocketnet', 'pocketnet') + var src = replaceArchiveInImage(t.file && t.file.url ? t.file.url : t.file) return '