// import config from 'config'; import { pageContext } from '../renderer/usePageContext.js'; function getBasePath(media, type, options) { /* if (store.state.ui.sfw) { return config.media.assetPath; } */ if (media.isS3) { return options.s3Path; } if (options?.local) { return options.assetPath; } return options.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; } export default function getPath(media, type, options) { if (!media) { return null; } const path = getBasePath(media, type, { ...pageContext.env.media, ...options }); const filename = getFilename(media, type, { ...pageContext.env.media, ...options }); return `${path}/${filename}`; }