Added S3 support for media files. Fixed MindGeek scraper for new poster data structure.

This commit is contained in:
DebaucheryLibrarian
2021-02-22 02:33:39 +01:00
parent 9a65d8c0eb
commit 37e39dc1ec
17 changed files with 152 additions and 79 deletions

View File

@@ -89,6 +89,7 @@ function initActorActions(store, router) {
hash
comment
credit
isS3
sfw: sfwMedia {
id
thumbnail
@@ -118,6 +119,7 @@ function initActorActions(store, router) {
thumbnail
lazy
hash
isS3
comment
credit
entropy
@@ -320,6 +322,7 @@ function initActorActions(store, router) {
lazy
comment
credit
isS3
sfw: sfwMedia {
id
thumbnail

View File

@@ -2,6 +2,11 @@ export default {
api: {
url: `${window.location.origin}/api`,
},
media: {
assetPath: '/img',
mediaPath: '/media',
s3Path: 'https://s3.eu-central-1.wasabisys.com/traxxx',
},
showDisclaimer: false,
disclaimer: 'This site is in early development, and content may occasionally disappear. Please stay tuned, you will be able to use traxxx to its full potential in the near future!',
selectableTags: [

View File

@@ -100,6 +100,7 @@ const releasePosterFragment = `
path
thumbnail
lazy
isS3
comment
sfw: sfwMedia {
id
@@ -120,6 +121,7 @@ const releaseCoversFragment = `
path
thumbnail
lazy
isS3
comment
sfw: sfwMedia {
id
@@ -140,6 +142,7 @@ const releasePhotosFragment = `
path
thumbnail
lazy
isS3
comment
sfw: sfwMedia {
id
@@ -160,6 +163,7 @@ const releaseTrailerFragment = `
path
thumbnail
mime
isS3
isVr
}
}
@@ -173,6 +177,7 @@ const releaseTeaserFragment = `
path
thumbnail
mime
isS3
}
}
`;

View File

@@ -24,6 +24,17 @@ 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;
const filename = type && !options?.original ? media[type] : media.path;
return `${path}/${filename}`;
}
initUiObservers(store, router);
if (window.env.sfw) {
@@ -64,6 +75,8 @@ async function init() {
formatDuration,
isAfter: (dateA, dateB) => dayjs(dateA).isAfter(dateB),
isBefore: (dateA, dateB) => dayjs(dateA).isBefore(dateB),
getPath,
getBgPath: (media, type) => `url(${getPath(media, type)})`,
},
beforeCreate() {
this.uid = uid;

View File

@@ -3,10 +3,12 @@ const storedBatch = localStorage.getItem('batch');
const storedSfw = localStorage.getItem('sfw');
const storedTheme = localStorage.getItem('theme');
const deviceTheme = window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
export default {
tagFilter: storedTagFilter ? storedTagFilter.split(',') : [],
range: 'latest',
batch: storedBatch || 'all',
sfw: storedSfw === 'true' || false,
theme: storedTheme || 'light',
theme: storedTheme || deviceTheme,
};