diff --git a/assets/components/tags/tile.vue b/assets/components/tags/tile.vue index 9bcd30aa..ada2ad25 100644 --- a/assets/components/tags/tile.vue +++ b/assets/components/tags/tile.vue @@ -47,6 +47,7 @@ > diff --git a/assets/js/main.js b/assets/js/main.js index 2b57093e..d29b58a4 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -24,13 +24,41 @@ async function init() { const app = createApp(Container); const events = mitt(); - function getPath(media, type, options) { - const path = (store.state.ui.sfw && media.assetPath) - || (media.isS3 && config.media.s3Path) - || (options?.local && config.media.assetPath) - || config.media.mediaPath; + function getBasePath(media, type, options) { + if (store.state.ui.sfw) { + return config.media.assetPath; + } - const filename = type && !options?.original ? media[type] : media.path; + if (media.isS3) { + return config.media.s3Path; + } + + if (options?.local) { + return config.media.assetPath; + } + + return config.media.mediaPath; + } + + function getFilename(media, type, options) { + if (store.state.ui.sfw && type && !options?.original) { + return media.sfw[type]; + } + + if (store.state.ui.sfw) { + return media.sfw.path; + } + + if (type && !options?.original) { + return media[type]; + } + + return media.path; + } + + function getPath(media, type, options) { + const path = getBasePath(media, type, options); + const filename = getFilename(media, type, options); return `${path}/${filename}`; }