Fixed SFW determination in image path function.

This commit is contained in:
DebaucheryLibrarian 2021-03-07 20:00:57 +01:00
parent 44523609c1
commit f91437e03c
2 changed files with 35 additions and 6 deletions

View File

@ -47,6 +47,7 @@
> >
<Logo <Logo
v-if="!sfw"
:photo="tag.poster" :photo="tag.poster"
favicon favicon
/> />

View File

@ -24,13 +24,41 @@ async function init() {
const app = createApp(Container); const app = createApp(Container);
const events = mitt(); const events = mitt();
function getPath(media, type, options) { function getBasePath(media, type, options) {
const path = (store.state.ui.sfw && media.assetPath) if (store.state.ui.sfw) {
|| (media.isS3 && config.media.s3Path) return config.media.assetPath;
|| (options?.local && config.media.assetPath) }
|| config.media.mediaPath;
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}`; return `${path}/${filename}`;
} }