Added S3 support for media files. Fixed MindGeek scraper for new poster data structure.
This commit is contained in:
@@ -42,13 +42,13 @@
|
||||
>
|
||||
<a
|
||||
v-if="actor.avatar"
|
||||
:href="`/media/${actor.avatar.path}`"
|
||||
:href="getPath(actor.avatar)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="avatar-link"
|
||||
>
|
||||
<img
|
||||
:src="sfw ? `/img/${actor.avatar.sfw.thumbnail}` : `/media/${actor.avatar.thumbnail}`"
|
||||
:src="getPath(actor.avatar, 'thumbnail')"
|
||||
:title="actor.avatar.credit && `© ${actor.avatar.credit}`"
|
||||
class="avatar"
|
||||
>
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
>
|
||||
<a
|
||||
v-if="actor.avatar"
|
||||
:href="`/media/${actor.avatar.path}`"
|
||||
:href="getPath(actor.avatar)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="avatar-link photo-link"
|
||||
>
|
||||
<img
|
||||
:src="sfw ? `/img/${actor.avatar.sfw.thumbnail}` : `/media/${actor.avatar.thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `/img/${actor.avatar.sfw.lazy}` : `/media/${actor.avatar.lazy}` }"
|
||||
:src="getPath(actor.avatar, 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(actor.avatar, 'lazy') }"
|
||||
:title="actor.avatar.credit && `© ${actor.avatar.credit}`"
|
||||
loading="lazy"
|
||||
class="avatar photo"
|
||||
@@ -26,14 +26,14 @@
|
||||
<a
|
||||
v-for="photo in photos"
|
||||
:key="`photo-${photo.id}`"
|
||||
:href="`/media/${photo.path}`"
|
||||
:href="getPath(photo)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="photo-link"
|
||||
>
|
||||
<img
|
||||
:src="sfw ? `/img/${photo.sfw.thumbnail}` : `/media/${photo.thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `/img/${photo.sfw.lazy}` : `/media/${photo.lazy}` }"
|
||||
:src="getPath(photo, 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(photo, 'lazy') }"
|
||||
:title="`© ${photo.credit || photo.entity.name}`"
|
||||
loading="lazy"
|
||||
class="photo"
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
<div class="avatar-container">
|
||||
<img
|
||||
v-if="actor.avatar"
|
||||
:src="sfw ? `/img/${actor.avatar.sfw.thumbnail}` : `/media/${actor.avatar.thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `url(/img/${actor.avatar.sfw.lazy})`: `url(/img/${actor.avatar.lazy})` }"
|
||||
:src="getPath(actor.avatar, 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(actor.avatar, 'lazy') }"
|
||||
loading="lazy"
|
||||
class="avatar"
|
||||
>
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
class="item-container"
|
||||
>
|
||||
<a
|
||||
:href="`${path}/${item.path}`"
|
||||
:href="getPath(item, null, { local })"
|
||||
class="item-link"
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
:src="`${path}/${item.thumbnail}`"
|
||||
:src="getPath(item, 'thumbnail', { local })"
|
||||
:title="item.title"
|
||||
loading="lazy"
|
||||
class="item image"
|
||||
@@ -63,9 +63,9 @@ export default {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
default: '/media',
|
||||
local: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
portrait: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<img
|
||||
v-else-if="release.teaser && /^image\//.test(release.teaser.mime)"
|
||||
:src="sfw ? `/img/${release.teaser.sfw.thumbnail}` : `/media/${release.teaser.path}`"
|
||||
:src="getPath(release.teaser, 'thumbnail', { original: true })"
|
||||
:alt="release.title"
|
||||
loading="lazy"
|
||||
class="item trailer"
|
||||
@@ -40,7 +40,7 @@
|
||||
<a
|
||||
v-if="release.poster"
|
||||
v-tooltip="'View poster'"
|
||||
:href="`/media/${release.poster.path}`"
|
||||
:href="`${config.media.mediaPath}/${release.poster.path}`"
|
||||
:class="{ playing }"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
@@ -59,13 +59,13 @@
|
||||
<a
|
||||
v-for="cover in release.covers"
|
||||
:key="`cover-${cover.id}`"
|
||||
:href="`/media/${cover.path}`"
|
||||
:href="`${config.media.mediaPath}/${cover.path}`"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
:src="`/media/${cover.thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `url(/media/${cover.sfw.lazy})` : `url(/media/${cover.lazy})` }"
|
||||
:src="getPath(cover, 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(cover, 'lazy') }"
|
||||
class="item cover"
|
||||
loading="lazy"
|
||||
@load="$emit('load', $event)"
|
||||
@@ -79,15 +79,15 @@
|
||||
class="item-container"
|
||||
>
|
||||
<a
|
||||
:href="`/media/${photo.path}`"
|
||||
:href="getPath(photo)"
|
||||
:class="{ sfw }"
|
||||
class="item-link"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
:src="sfw ? `/img/${photo.sfw.thumbnail}` : `/media/${photo.thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `url(/img/${photo.sfw.lazy})` : `url(/media/${photo.lazy})` }"
|
||||
:src="getPath(photo, 'thumbnail')"
|
||||
:style="{ 'background-image': getPath(photo, 'lazy') }"
|
||||
:alt="`Photo ${photo.index + 1}`"
|
||||
loading="lazy"
|
||||
class="item"
|
||||
@@ -115,15 +115,15 @@ function sfw() {
|
||||
|
||||
function poster() {
|
||||
if (this.release.poster) {
|
||||
return this.sfw ? `/img/${this.release.poster.sfw.thumbnail}` : `/media/${this.release.poster.thumbnail}`;
|
||||
return this.getPath(this.release.poster, 'thumbnail');
|
||||
}
|
||||
|
||||
if (this.release.covers?.length > 0) {
|
||||
return this.sfw ? `/img/${this.release.covers[0].sfw.path}` : `/media/${this.release.covers[0].path}`;
|
||||
return this.getPath(this.release.covers[0], 'thumbnail');
|
||||
}
|
||||
|
||||
if (this.photos?.length > 0) {
|
||||
return this.sfw ? `/img/${this.photos[0].sfw.thumbnail}` : `/media/${this.photos[0].thumbnail}`;
|
||||
return this.getPath(this.release.photos[0], 'thumbnail');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
>
|
||||
<img
|
||||
v-if="movie.covers[0]"
|
||||
:src="sfw ? `/img/${movie.covers[0].sfw.thumbnail}` : `/media/${movie.covers[0].thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `/img/${movie.covers[0].sfw.lazy}` : `/media/${movie.covers[0].lazy }` }"
|
||||
:src="getPath(movie.covers[0], 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(movie.covers[0], 'lazy') }"
|
||||
loading="lazy"
|
||||
>
|
||||
</router-link>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
v-if="showAlbum"
|
||||
:items="[release.poster, ...release.photos]"
|
||||
:title="release.title"
|
||||
:path="config.media.mediaPath"
|
||||
@close="$router.go(-1)"
|
||||
/>
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
>
|
||||
<img
|
||||
v-if="release.poster"
|
||||
:src="sfw ? `/img/${release.poster.sfw.thumbnail}` : `/media/${release.poster.thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `/img/${release.poster.sfw.lazy}` : `/media/${release.poster.lazy}` }"
|
||||
:src="getPath(release.poster, 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(release.poster, 'lazy') }"
|
||||
:alt="release.title"
|
||||
class="thumbnail"
|
||||
loading="lazy"
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
<img
|
||||
v-else-if="release.photos && release.photos.length > 0"
|
||||
:src="sfw ? `/img/${release.photos[0].sfw.thumbnail}` : `/media/${release.photos[0].thumbnail}`"
|
||||
:style="{ 'background-image': sfw ? `/img/${release.photos[0].sfw.lazy}` : `/media/${release.photos[0].lazy}` }"
|
||||
:src="getPath(release.photos[0], 'thumbnail')"
|
||||
:style="{ 'background-image': getBgPath(release.photos[0], 'lazy') } "
|
||||
:alt="release.title"
|
||||
class="thumbnail"
|
||||
loading="lazy"
|
||||
@@ -130,10 +130,6 @@
|
||||
<script>
|
||||
import Details from './tile-details.vue';
|
||||
|
||||
function sfw() {
|
||||
return this.$store.state.ui.sfw;
|
||||
}
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Details,
|
||||
@@ -144,9 +140,6 @@ export default {
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
sfw,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
v-if="showAlbum"
|
||||
:items="[tag.poster, ...tag.photos]"
|
||||
:title="tag.name"
|
||||
path="/img"
|
||||
:local="true"
|
||||
class="portrait"
|
||||
@close="$router.go(-1)"
|
||||
/>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: [
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user