Added georestriction with SFW mode.

This commit is contained in:
2026-02-04 05:39:14 +01:00
parent ce107e6b65
commit 1a84f899e7
35 changed files with 777 additions and 112 deletions

View File

@@ -1,12 +1,9 @@
// import config from 'config';
import { pageContext } from '../renderer/usePageContext.js';
function getBasePath(media, type, options) {
/*
if (store.state.ui.sfw) {
return config.media.assetPath;
function getBasePath(media, options) {
if (pageContext.restriction) {
return pageContext.env.media.assetPath;
}
*/
if (media.isS3) {
return options.s3Path;
@@ -20,15 +17,13 @@ function getBasePath(media, type, options) {
}
function getFilename(media, type, options) {
/*
if (store.state.ui.sfw && type && !options?.original) {
return media.sfw[type];
if (pageContext.restriction && type && !options?.original) {
return media.sfw?.[type];
}
if (store.state.ui.sfw) {
return media.sfw.path;
if (pageContext.restriction) {
return media.sfw?.path;
}
*/
if (type && !options?.original) {
return media[type];
@@ -42,7 +37,7 @@ export default function getPath(media, type, options) {
return null;
}
const path = getBasePath(media, type, { ...pageContext.env.media, ...options });
const path = getBasePath(media, { ...pageContext.env.media, ...options });
const filename = getFilename(media, type, { ...pageContext.env.media, ...options });
return `${path}/${filename}`;