Compare commits
No commits in common. "2fa48abb62c17c0b9f1e7fb124eecf3a412dbd02" and "c1c58f659d43c52e9d308eda449193c38a045ed4" have entirely different histories.
2fa48abb62
...
c1c58f659d
|
|
@ -42,13 +42,13 @@
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
v-if="actor.avatar"
|
v-if="actor.avatar"
|
||||||
:href="getPath(actor.avatar)"
|
:href="`/media/${actor.avatar.path}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="avatar-link"
|
class="avatar-link"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="getPath(actor.avatar, 'thumbnail')"
|
:src="sfw ? `/img/${actor.avatar.sfw.thumbnail}` : `/media/${actor.avatar.thumbnail}`"
|
||||||
:title="actor.avatar.credit && `© ${actor.avatar.credit}`"
|
:title="actor.avatar.credit && `© ${actor.avatar.credit}`"
|
||||||
class="avatar"
|
class="avatar"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
v-if="actor.avatar"
|
v-if="actor.avatar"
|
||||||
:href="getPath(actor.avatar)"
|
:href="`/media/${actor.avatar.path}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="avatar-link photo-link"
|
class="avatar-link photo-link"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="getPath(actor.avatar, 'thumbnail')"
|
:src="sfw ? `/img/${actor.avatar.sfw.thumbnail}` : `/media/${actor.avatar.thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(actor.avatar, 'lazy') }"
|
:style="{ 'background-image': sfw ? `/img/${actor.avatar.sfw.lazy}` : `/media/${actor.avatar.lazy}` }"
|
||||||
:title="actor.avatar.credit && `© ${actor.avatar.credit}`"
|
:title="actor.avatar.credit && `© ${actor.avatar.credit}`"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="avatar photo"
|
class="avatar photo"
|
||||||
|
|
@ -26,14 +26,14 @@
|
||||||
<a
|
<a
|
||||||
v-for="photo in photos"
|
v-for="photo in photos"
|
||||||
:key="`photo-${photo.id}`"
|
:key="`photo-${photo.id}`"
|
||||||
:href="getPath(photo)"
|
:href="`/media/${photo.path}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="photo-link"
|
class="photo-link"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="getPath(photo, 'thumbnail')"
|
:src="sfw ? `/img/${photo.sfw.thumbnail}` : `/media/${photo.thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(photo, 'lazy') }"
|
:style="{ 'background-image': sfw ? `/img/${photo.sfw.lazy}` : `/media/${photo.lazy}` }"
|
||||||
:title="`© ${photo.credit || photo.entity.name}`"
|
:title="`© ${photo.credit || photo.entity.name}`"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="photo"
|
class="photo"
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@
|
||||||
<div class="avatar-container">
|
<div class="avatar-container">
|
||||||
<img
|
<img
|
||||||
v-if="actor.avatar"
|
v-if="actor.avatar"
|
||||||
:src="getPath(actor.avatar, 'thumbnail')"
|
:src="sfw ? `/img/${actor.avatar.sfw.thumbnail}` : `/media/${actor.avatar.thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(actor.avatar, 'lazy') }"
|
:style="{ 'background-image': sfw ? `url(/img/${actor.avatar.sfw.lazy})`: `url(/img/${actor.avatar.lazy})` }"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="avatar"
|
class="avatar"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@
|
||||||
class="item-container"
|
class="item-container"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
:href="getPath(item, null, { local })"
|
:href="`${path}/${item.path}`"
|
||||||
class="item-link"
|
class="item-link"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="getPath(item, 'thumbnail', { local })"
|
:src="`${path}/${item.thumbnail}`"
|
||||||
:title="item.title"
|
:title="item.title"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="item image"
|
class="item image"
|
||||||
|
|
@ -63,9 +63,9 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
local: {
|
path: {
|
||||||
type: Boolean,
|
type: String,
|
||||||
default: false,
|
default: '/media',
|
||||||
},
|
},
|
||||||
portrait: {
|
portrait: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
<img
|
<img
|
||||||
v-else-if="release.teaser && /^image\//.test(release.teaser.mime)"
|
v-else-if="release.teaser && /^image\//.test(release.teaser.mime)"
|
||||||
:src="getPath(release.teaser, 'thumbnail', { original: true })"
|
:src="sfw ? `/img/${release.teaser.sfw.thumbnail}` : `/media/${release.teaser.path}`"
|
||||||
:alt="release.title"
|
:alt="release.title"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="item trailer"
|
class="item trailer"
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
<a
|
<a
|
||||||
v-if="release.poster"
|
v-if="release.poster"
|
||||||
v-tooltip="'View poster'"
|
v-tooltip="'View poster'"
|
||||||
:href="`${config.media.mediaPath}/${release.poster.path}`"
|
:href="`/media/${release.poster.path}`"
|
||||||
:class="{ playing }"
|
:class="{ playing }"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
|
@ -59,13 +59,13 @@
|
||||||
<a
|
<a
|
||||||
v-for="cover in release.covers"
|
v-for="cover in release.covers"
|
||||||
:key="`cover-${cover.id}`"
|
:key="`cover-${cover.id}`"
|
||||||
:href="getPath(cover)"
|
:href="`/media/${cover.path}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="getPath(cover, 'thumbnail')"
|
:src="`/media/${cover.thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(cover, 'lazy') }"
|
:style="{ 'background-image': sfw ? `url(/media/${cover.sfw.lazy})` : `url(/media/${cover.lazy})` }"
|
||||||
class="item cover"
|
class="item cover"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
@load="$emit('load', $event)"
|
@load="$emit('load', $event)"
|
||||||
|
|
@ -79,15 +79,15 @@
|
||||||
class="item-container"
|
class="item-container"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
:href="getPath(photo)"
|
:href="`/media/${photo.path}`"
|
||||||
:class="{ sfw }"
|
:class="{ sfw }"
|
||||||
class="item-link"
|
class="item-link"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="getPath(photo, 'thumbnail')"
|
:src="sfw ? `/img/${photo.sfw.thumbnail}` : `/media/${photo.thumbnail}`"
|
||||||
:style="{ 'background-image': getPath(photo, 'lazy') }"
|
:style="{ 'background-image': sfw ? `url(/img/${photo.sfw.lazy})` : `url(/media/${photo.lazy})` }"
|
||||||
:alt="`Photo ${photo.index + 1}`"
|
:alt="`Photo ${photo.index + 1}`"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="item"
|
class="item"
|
||||||
|
|
@ -115,15 +115,15 @@ function sfw() {
|
||||||
|
|
||||||
function poster() {
|
function poster() {
|
||||||
if (this.release.poster) {
|
if (this.release.poster) {
|
||||||
return this.getPath(this.release.poster, 'thumbnail');
|
return this.sfw ? `/img/${this.release.poster.sfw.thumbnail}` : `/media/${this.release.poster.thumbnail}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.release.covers?.length > 0) {
|
if (this.release.covers?.length > 0) {
|
||||||
return this.getPath(this.release.covers[0], 'thumbnail');
|
return this.sfw ? `/img/${this.release.covers[0].sfw.path}` : `/media/${this.release.covers[0].path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.photos?.length > 0) {
|
if (this.photos?.length > 0) {
|
||||||
return this.getPath(this.release.photos[0], 'thumbnail');
|
return this.sfw ? `/img/${this.photos[0].sfw.thumbnail}` : `/media/${this.photos[0].thumbnail}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="movie.covers[0]"
|
v-if="movie.covers[0]"
|
||||||
:src="getPath(movie.covers[0], 'thumbnail')"
|
:src="sfw ? `/img/${movie.covers[0].sfw.thumbnail}` : `/media/${movie.covers[0].thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(movie.covers[0], 'lazy') }"
|
:style="{ 'background-image': sfw ? `/img/${movie.covers[0].sfw.lazy}` : `/media/${movie.covers[0].lazy }` }"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
>
|
>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
v-if="showAlbum"
|
v-if="showAlbum"
|
||||||
:items="[release.poster, ...release.photos]"
|
:items="[release.poster, ...release.photos]"
|
||||||
:title="release.title"
|
:title="release.title"
|
||||||
:path="config.media.mediaPath"
|
|
||||||
@close="$router.go(-1)"
|
@close="$router.go(-1)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -84,7 +83,7 @@
|
||||||
<span class="movie-title">{{ movie.title }}</span>
|
<span class="movie-title">{{ movie.title }}</span>
|
||||||
<img
|
<img
|
||||||
v-if="movie.covers.length > 0"
|
v-if="movie.covers.length > 0"
|
||||||
:src="getPath(movie.covers[0], 'thumbnail')"
|
:src="`/media/${movie.covers[0].thumbnail}`"
|
||||||
class="movie-cover"
|
class="movie-cover"
|
||||||
>
|
>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="release.poster"
|
v-if="release.poster"
|
||||||
:src="getPath(release.poster, 'thumbnail')"
|
:src="sfw ? `/img/${release.poster.sfw.thumbnail}` : `/media/${release.poster.thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(release.poster, 'lazy') }"
|
:style="{ 'background-image': sfw ? `/img/${release.poster.sfw.lazy}` : `/media/${release.poster.lazy}` }"
|
||||||
:alt="release.title"
|
:alt="release.title"
|
||||||
class="thumbnail"
|
class="thumbnail"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
<img
|
<img
|
||||||
v-else-if="release.photos && release.photos.length > 0"
|
v-else-if="release.photos && release.photos.length > 0"
|
||||||
:src="getPath(release.photos[0], 'thumbnail')"
|
:src="sfw ? `/img/${release.photos[0].sfw.thumbnail}` : `/media/${release.photos[0].thumbnail}`"
|
||||||
:style="{ 'background-image': getBgPath(release.photos[0], 'lazy') } "
|
:style="{ 'background-image': sfw ? `/img/${release.photos[0].sfw.lazy}` : `/media/${release.photos[0].lazy}` }"
|
||||||
:alt="release.title"
|
:alt="release.title"
|
||||||
class="thumbnail"
|
class="thumbnail"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
|
@ -130,6 +130,10 @@
|
||||||
<script>
|
<script>
|
||||||
import Details from './tile-details.vue';
|
import Details from './tile-details.vue';
|
||||||
|
|
||||||
|
function sfw() {
|
||||||
|
return this.$store.state.ui.sfw;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Details,
|
Details,
|
||||||
|
|
@ -140,6 +144,9 @@ export default {
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
sfw,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
v-if="showAlbum"
|
v-if="showAlbum"
|
||||||
:items="[tag.poster, ...tag.photos]"
|
:items="[tag.poster, ...tag.photos]"
|
||||||
:title="tag.name"
|
:title="tag.name"
|
||||||
:local="true"
|
path="/img"
|
||||||
class="portrait"
|
class="portrait"
|
||||||
@close="$router.go(-1)"
|
@close="$router.go(-1)"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
@pause="$emit('pause')"
|
@pause="$emit('pause')"
|
||||||
>
|
>
|
||||||
<source
|
<source
|
||||||
:src="getPath(video)"
|
:src="`/media/${video.path}`"
|
||||||
type="video/mp4"
|
type="video/mp4"
|
||||||
>
|
>
|
||||||
</video>
|
</video>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ $breakpoint4: 1500px;
|
||||||
--text-contrast: #fff;
|
--text-contrast: #fff;
|
||||||
|
|
||||||
--background: var(--background-light);
|
--background: var(--background-light);
|
||||||
--background-dim: #f5f5f5;
|
--background-dim: #fafafa;
|
||||||
--background-soft: #fdfdfd;
|
--background-soft: #fdfdfd;
|
||||||
|
|
||||||
--profile: #222;
|
--profile: #222;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ function initActorActions(store, router) {
|
||||||
hash
|
hash
|
||||||
comment
|
comment
|
||||||
credit
|
credit
|
||||||
isS3
|
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
thumbnail
|
thumbnail
|
||||||
|
|
@ -119,7 +118,6 @@ function initActorActions(store, router) {
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
hash
|
hash
|
||||||
isS3
|
|
||||||
comment
|
comment
|
||||||
credit
|
credit
|
||||||
entropy
|
entropy
|
||||||
|
|
@ -322,7 +320,6 @@ function initActorActions(store, router) {
|
||||||
lazy
|
lazy
|
||||||
comment
|
comment
|
||||||
credit
|
credit
|
||||||
isS3
|
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
thumbnail
|
thumbnail
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,6 @@ export default {
|
||||||
api: {
|
api: {
|
||||||
url: `${window.location.origin}/api`,
|
url: `${window.location.origin}/api`,
|
||||||
},
|
},
|
||||||
media: {
|
|
||||||
assetPath: '/img',
|
|
||||||
mediaPath: '/media',
|
|
||||||
s3Path: 'https://s3.wasabisys.com',
|
|
||||||
},
|
|
||||||
showDisclaimer: false,
|
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!',
|
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: [
|
selectableTags: [
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ const releasePosterFragment = `
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
comment
|
comment
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
|
|
@ -121,7 +120,6 @@ const releaseCoversFragment = `
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
comment
|
comment
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
|
|
@ -142,7 +140,6 @@ const releasePhotosFragment = `
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
comment
|
comment
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
|
|
@ -163,7 +160,6 @@ const releaseTrailerFragment = `
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
mime
|
mime
|
||||||
isS3
|
|
||||||
isVr
|
isVr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -177,7 +173,6 @@ const releaseTeaserFragment = `
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
mime
|
mime
|
||||||
isS3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
@ -315,7 +310,6 @@ const releaseFragment = `
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
comment
|
comment
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,6 @@ async function init() {
|
||||||
const app = createApp(Container);
|
const app = createApp(Container);
|
||||||
const events = mitt();
|
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);
|
initUiObservers(store, router);
|
||||||
|
|
||||||
if (window.env.sfw) {
|
if (window.env.sfw) {
|
||||||
|
|
@ -75,8 +64,6 @@ async function init() {
|
||||||
formatDuration,
|
formatDuration,
|
||||||
isAfter: (dateA, dateB) => dayjs(dateA).isAfter(dateB),
|
isAfter: (dateA, dateB) => dayjs(dateA).isAfter(dateB),
|
||||||
isBefore: (dateA, dateB) => dayjs(dateA).isBefore(dateB),
|
isBefore: (dateA, dateB) => dayjs(dateA).isBefore(dateB),
|
||||||
getPath,
|
|
||||||
getBgPath: (media, type) => `url(${getPath(media, type)})`,
|
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ function initReleasesActions(store, router) {
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
path
|
path
|
||||||
|
|
@ -158,16 +157,6 @@ function initReleasesActions(store, router) {
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
posters: moviesPosterByMovieId {
|
|
||||||
media {
|
|
||||||
id
|
|
||||||
path
|
|
||||||
thumbnail
|
|
||||||
lazy
|
|
||||||
isS3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
covers: moviesCovers {
|
covers: moviesCovers {
|
||||||
|
|
@ -176,14 +165,12 @@ function initReleasesActions(store, router) {
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trailer: moviesTrailerByMovieId {
|
trailer: moviesTrailerByMovieId {
|
||||||
media {
|
media {
|
||||||
id
|
id
|
||||||
path
|
path
|
||||||
isS3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scenes: moviesScenes {
|
scenes: moviesScenes {
|
||||||
|
|
@ -202,7 +189,6 @@ function initReleasesActions(store, router) {
|
||||||
path
|
path
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
|
||||||
comment
|
comment
|
||||||
sfw: sfwMedia {
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,10 @@ const storedBatch = localStorage.getItem('batch');
|
||||||
const storedSfw = localStorage.getItem('sfw');
|
const storedSfw = localStorage.getItem('sfw');
|
||||||
const storedTheme = localStorage.getItem('theme');
|
const storedTheme = localStorage.getItem('theme');
|
||||||
|
|
||||||
const deviceTheme = window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
tagFilter: storedTagFilter ? storedTagFilter.split(',') : [],
|
tagFilter: storedTagFilter ? storedTagFilter.split(',') : [],
|
||||||
range: 'latest',
|
range: 'latest',
|
||||||
batch: storedBatch || 'all',
|
batch: storedBatch || 'all',
|
||||||
sfw: storedSfw === 'true' || false,
|
sfw: storedSfw === 'true' || false,
|
||||||
theme: storedTheme || deviceTheme,
|
theme: storedTheme || 'light',
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,6 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
s3: {
|
|
||||||
enabled: false,
|
|
||||||
bucket: 'traxxx',
|
|
||||||
accessKey: 'ABCDEFGHIJ1234567890',
|
|
||||||
secretKey: 'abcdefghijklmnopqrstuvwxyz1234567890ABCD',
|
|
||||||
},
|
|
||||||
exclude: {
|
exclude: {
|
||||||
channels: [
|
channels: [
|
||||||
// 21sextreme, no longer updated
|
// 21sextreme, no longer updated
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ exports.up = knex => Promise.resolve()
|
||||||
table.integer('index');
|
table.integer('index');
|
||||||
table.text('mime');
|
table.text('mime');
|
||||||
|
|
||||||
table.boolean('is_s3')
|
|
||||||
.defaultTo(false);
|
|
||||||
|
|
||||||
table.text('hash');
|
table.text('hash');
|
||||||
|
|
||||||
table.bigInteger('size', 12);
|
table.bigInteger('size', 12);
|
||||||
|
|
@ -901,7 +898,7 @@ exports.up = knex => Promise.resolve()
|
||||||
.references('id')
|
.references('id')
|
||||||
.inTable('media');
|
.inTable('media');
|
||||||
|
|
||||||
table.unique('movie_id');
|
table.unique(['movie_id', 'media_id']);
|
||||||
}))
|
}))
|
||||||
.then(() => knex.schema.createTable('clips', (table) => {
|
.then(() => knex.schema.createTable('clips', (table) => {
|
||||||
table.increments('id', 16);
|
table.increments('id', 16);
|
||||||
|
|
@ -1023,17 +1020,17 @@ exports.up = knex => Promise.resolve()
|
||||||
CREATE FUNCTION search_entities(search text) RETURNS SETOF entities AS $$
|
CREATE FUNCTION search_entities(search text) RETURNS SETOF entities AS $$
|
||||||
SELECT * FROM entities
|
SELECT * FROM entities
|
||||||
WHERE
|
WHERE
|
||||||
name ILIKE ('%' || TRIM(search) || '%') OR
|
name ILIKE ('%' || search || '%') OR
|
||||||
slug ILIKE ('%' || TRIM(search) || '%') OR
|
slug ILIKE ('%' || search || '%') OR
|
||||||
array_to_string(alias, '') ILIKE ('%' || TRIM(search) || '%') OR
|
array_to_string(alias, '') ILIKE ('%' || search || '%') OR
|
||||||
replace(array_to_string(alias, ''), ' ', '') ILIKE ('%' || TRIM(search) || '%') OR
|
replace(array_to_string(alias, ''), ' ', '') ILIKE ('%' || search || '%') OR
|
||||||
url ILIKE ('%' || search || '%')
|
url ILIKE ('%' || search || '%')
|
||||||
$$ LANGUAGE SQL STABLE;
|
$$ LANGUAGE SQL STABLE;
|
||||||
|
|
||||||
CREATE FUNCTION search_actors(search text, min_length numeric DEFAULT 2) RETURNS SETOF actors AS $$
|
CREATE FUNCTION search_actors(search text, min_length numeric DEFAULT 2) RETURNS SETOF actors AS $$
|
||||||
SELECT * FROM actors
|
SELECT * FROM actors
|
||||||
WHERE length(search) >= min_length
|
WHERE length(search) >= min_length
|
||||||
AND name ILIKE ('%' || TRIM(search) || '%')
|
AND name ILIKE ('%' || search || '%')
|
||||||
$$ LANGUAGE SQL STABLE;
|
$$ LANGUAGE SQL STABLE;
|
||||||
|
|
||||||
CREATE FUNCTION actors_tags(actor actors, selectable_tags text[]) RETURNS SETOF tags AS $$
|
CREATE FUNCTION actors_tags(actor actors, selectable_tags text[]) RETURNS SETOF tags AS $$
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.173.0",
|
"version": "1.172.3",
|
||||||
"description": "All the latest porn releases in one place",
|
"description": "All the latest porn releases in one place",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -74,7 +74,6 @@
|
||||||
"@tensorflow/tfjs-node": "^1.5.2",
|
"@tensorflow/tfjs-node": "^1.5.2",
|
||||||
"@thependulum/bhttp": "^1.2.6",
|
"@thependulum/bhttp": "^1.2.6",
|
||||||
"acorn": "^8.0.4",
|
"acorn": "^8.0.4",
|
||||||
"aws-sdk": "^2.847.0",
|
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"bhttp": "^1.2.6",
|
"bhttp": "^1.2.6",
|
||||||
"blake2": "^4.0.0",
|
"blake2": "^4.0.0",
|
||||||
|
|
|
||||||
156
src/media.js
156
src/media.js
|
|
@ -14,7 +14,6 @@ const ffmpeg = require('fluent-ffmpeg');
|
||||||
const sharp = require('sharp');
|
const sharp = require('sharp');
|
||||||
const blake2 = require('blake2');
|
const blake2 = require('blake2');
|
||||||
const taskQueue = require('promise-task-queue');
|
const taskQueue = require('promise-task-queue');
|
||||||
const AWS = require('aws-sdk');
|
|
||||||
|
|
||||||
const logger = require('./logger')(__filename);
|
const logger = require('./logger')(__filename);
|
||||||
const argv = require('./argv');
|
const argv = require('./argv');
|
||||||
|
|
@ -26,17 +25,6 @@ const { get } = require('./utils/qu');
|
||||||
const pipeline = util.promisify(stream.pipeline);
|
const pipeline = util.promisify(stream.pipeline);
|
||||||
const streamQueue = taskQueue();
|
const streamQueue = taskQueue();
|
||||||
|
|
||||||
const endpoint = new AWS.Endpoint('s3.eu-central-1.wasabisys.com');
|
|
||||||
|
|
||||||
const s3 = new AWS.S3({
|
|
||||||
// region: 'eu-central-1',
|
|
||||||
endpoint,
|
|
||||||
credentials: {
|
|
||||||
accessKeyId: config.s3.accessKey,
|
|
||||||
secretAccessKey: config.s3.secretKey,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
function sampleMedias(medias, limit = argv.mediaLimit, preferLast = true) {
|
function sampleMedias(medias, limit = argv.mediaLimit, preferLast = true) {
|
||||||
// limit media sets, use extras as fallbacks
|
// limit media sets, use extras as fallbacks
|
||||||
if (medias.length <= limit) {
|
if (medias.length <= limit) {
|
||||||
|
|
@ -315,68 +303,14 @@ async function extractSource(baseSource, { existingExtractMediaByUrl }) {
|
||||||
throw new Error(`Could not extract source from ${baseSource.url}: ${res.status}`);
|
throw new Error(`Could not extract source from ${baseSource.url}: ${res.status}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function storeS3Object(filepath, media) {
|
|
||||||
const fullFilepath = path.join(config.media.path, filepath);
|
|
||||||
const file = fs.createReadStream(fullFilepath);
|
|
||||||
|
|
||||||
const status = await s3.upload({
|
|
||||||
Bucket: config.s3.bucket,
|
|
||||||
Body: file,
|
|
||||||
Key: filepath,
|
|
||||||
ContentType: media.meta.mimetype,
|
|
||||||
}).promise();
|
|
||||||
|
|
||||||
await fsPromises.unlink(fullFilepath);
|
|
||||||
|
|
||||||
logger.silly(`Uploaded '${media.id}' from ${media.src} to S3 bucket '${status.Bucket}' at ${status.Location}`);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeImage(image, media, info, filepath, isProcessed) {
|
|
||||||
if (isProcessed && info.pages) {
|
|
||||||
// convert animated image to WebP and write to permanent location
|
|
||||||
await image
|
|
||||||
.webp()
|
|
||||||
.toFile(path.join(config.media.path, filepath));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isProcessed) {
|
|
||||||
// convert to JPEG and write to permanent location
|
|
||||||
await image
|
|
||||||
.jpeg()
|
|
||||||
.toFile(path.join(config.media.path, filepath));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeThumbnail(image, thumbpath) {
|
|
||||||
return image
|
|
||||||
.resize({
|
|
||||||
height: config.media.thumbnailSize,
|
|
||||||
withoutEnlargement: true,
|
|
||||||
})
|
|
||||||
.jpeg({ quality: config.media.thumbnailQuality })
|
|
||||||
.toFile(path.join(config.media.path, thumbpath));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeLazy(image, lazypath) {
|
|
||||||
return image
|
|
||||||
.resize({
|
|
||||||
height: config.media.lazySize,
|
|
||||||
withoutEnlargement: true,
|
|
||||||
})
|
|
||||||
.jpeg({ quality: config.media.lazyQuality })
|
|
||||||
.toFile(path.join(config.media.path, lazypath));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function storeImageFile(media, hashDir, hashSubDir, filename, filedir, filepath, options) {
|
async function storeImageFile(media, hashDir, hashSubDir, filename, filedir, filepath, options) {
|
||||||
logger.silly(`Storing permanent media files for ${media.id} from ${media.src} at ${filepath}`);
|
logger.silly(`Storing permanent media files for ${media.id} from ${media.src} at ${filepath}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const thumbdir = config.s3.enabled ? path.join(media.role, 'thumbs') : path.join(media.role, 'thumbs', hashDir, hashSubDir);
|
const thumbdir = path.join(media.role, 'thumbs', hashDir, hashSubDir);
|
||||||
const thumbpath = path.join(thumbdir, filename);
|
const thumbpath = path.join(thumbdir, filename);
|
||||||
|
|
||||||
const lazydir = config.s3.enabled ? path.join(media.role, 'lazy') : path.join(media.role, 'lazy', hashDir, hashSubDir);
|
const lazydir = path.join(media.role, 'lazy', hashDir, hashSubDir);
|
||||||
const lazypath = path.join(lazydir, filename);
|
const lazypath = path.join(lazydir, filename);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|
@ -409,28 +343,46 @@ async function storeImageFile(media, hashDir, hashSubDir, filename, filedir, fil
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isProcessed) {
|
||||||
|
if (info.pages) {
|
||||||
|
// convert animated image to WebP and write to permanent location
|
||||||
|
await image
|
||||||
|
.webp()
|
||||||
|
.toFile(path.join(config.media.path, filepath));
|
||||||
|
} else {
|
||||||
|
// convert to JPEG and write to permanent location
|
||||||
|
await image
|
||||||
|
.jpeg()
|
||||||
|
.toFile(path.join(config.media.path, filepath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate thumbnail and lazy
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
writeImage(image, media, info, filepath, isProcessed),
|
image
|
||||||
writeThumbnail(image, thumbpath),
|
.resize({
|
||||||
writeLazy(image, lazypath),
|
height: config.media.thumbnailSize,
|
||||||
|
withoutEnlargement: true,
|
||||||
|
})
|
||||||
|
.jpeg({ quality: config.media.thumbnailQuality })
|
||||||
|
.toFile(path.join(config.media.path, thumbpath)),
|
||||||
|
image
|
||||||
|
.resize({
|
||||||
|
height: config.media.lazySize,
|
||||||
|
withoutEnlargement: true,
|
||||||
|
})
|
||||||
|
.jpeg({ quality: config.media.lazyQuality })
|
||||||
|
.toFile(path.join(config.media.path, lazypath)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (isProcessed) {
|
if (isProcessed) {
|
||||||
// file already stored, remove temporary file
|
// remove temp file
|
||||||
await fsPromises.unlink(media.file.path);
|
await fsPromises.unlink(media.file.path);
|
||||||
} else {
|
} else {
|
||||||
// image not processed, simply move temporary file to final location
|
// move temp file to permanent location
|
||||||
await fsPromises.rename(media.file.path, path.join(config.media.path, filepath));
|
await fsPromises.rename(media.file.path, path.join(config.media.path, filepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.s3.enabled) {
|
|
||||||
await Promise.all([
|
|
||||||
storeS3Object(filepath, media),
|
|
||||||
storeS3Object(thumbpath, media),
|
|
||||||
storeS3Object(lazypath, media),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.silly(`Stored thumbnail, lazy and permanent media file for ${media.id} from ${media.src} at ${filepath}`);
|
logger.silly(`Stored thumbnail, lazy and permanent media file for ${media.id} from ${media.src} at ${filepath}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -461,13 +413,13 @@ async function storeFile(media, options) {
|
||||||
try {
|
try {
|
||||||
const hashDir = media.meta.hash.slice(0, 2);
|
const hashDir = media.meta.hash.slice(0, 2);
|
||||||
const hashSubDir = media.meta.hash.slice(2, 4);
|
const hashSubDir = media.meta.hash.slice(2, 4);
|
||||||
const hashFilename = config.s3.enabled ? media.meta.hash : media.meta.hash.slice(4);
|
const hashFilename = media.meta.hash.slice(4);
|
||||||
|
|
||||||
const filename = media.quality
|
const filename = media.quality
|
||||||
? `${hashFilename}_${media.quality}.${media.meta.extension}`
|
? `${hashFilename}_${media.quality}.${media.meta.extension}`
|
||||||
: `${hashFilename}.${media.meta.extension}`;
|
: `${hashFilename}.${media.meta.extension}`;
|
||||||
|
|
||||||
const filedir = config.s3.enabled ? media.role : path.join(media.role, hashDir, hashSubDir);
|
const filedir = path.join(media.role, hashDir, hashSubDir);
|
||||||
const filepath = path.join(filedir, filename);
|
const filepath = path.join(filedir, filename);
|
||||||
|
|
||||||
if (argv.force) {
|
if (argv.force) {
|
||||||
|
|
@ -495,11 +447,6 @@ async function storeFile(media, options) {
|
||||||
// move temp file to permanent location
|
// move temp file to permanent location
|
||||||
await fsPromises.rename(media.file.path, path.join(config.media.path, filepath));
|
await fsPromises.rename(media.file.path, path.join(config.media.path, filepath));
|
||||||
|
|
||||||
if (config.s3.enabled) {
|
|
||||||
// upload the file to S3 storage, will remove original
|
|
||||||
await storeS3Object(filepath, media);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.silly(`Stored permanent media file for ${media.id} from ${media.src} at ${filepath}`);
|
logger.silly(`Stored permanent media file for ${media.id} from ${media.src} at ${filepath}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -574,6 +521,7 @@ async function fetchSource(source, baseMedia) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const tempFilePath = path.join(config.media.path, 'temp', `${baseMedia.id}`);
|
const tempFilePath = path.join(config.media.path, 'temp', `${baseMedia.id}`);
|
||||||
|
|
||||||
const tempFileTarget = fs.createWriteStream(tempFilePath);
|
const tempFileTarget = fs.createWriteStream(tempFilePath);
|
||||||
const hashStream = new stream.PassThrough();
|
const hashStream = new stream.PassThrough();
|
||||||
let size = 0;
|
let size = 0;
|
||||||
|
|
@ -700,7 +648,6 @@ function curateMediaEntry(media, index) {
|
||||||
path: media.file.path,
|
path: media.file.path,
|
||||||
thumbnail: media.file.thumbnail,
|
thumbnail: media.file.thumbnail,
|
||||||
lazy: media.file.lazy,
|
lazy: media.file.lazy,
|
||||||
is_s3: config.s3.enabled,
|
|
||||||
index,
|
index,
|
||||||
mime: media.meta.mimetype,
|
mime: media.meta.mimetype,
|
||||||
hash: media.meta.hash,
|
hash: media.meta.hash,
|
||||||
|
|
@ -869,29 +816,6 @@ async function associateAvatars(profiles) {
|
||||||
return profilesWithAvatarIds;
|
return profilesWithAvatarIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteS3Objects(media) {
|
|
||||||
const objects = media
|
|
||||||
.map(item => [
|
|
||||||
{ Key: item.path },
|
|
||||||
{ Key: item.thumbnail },
|
|
||||||
{ Key: item.lazy },
|
|
||||||
])
|
|
||||||
.flat()
|
|
||||||
.filter(item => item.Key);
|
|
||||||
|
|
||||||
const status = await s3.deleteObjects({
|
|
||||||
Bucket: config.s3.bucket,
|
|
||||||
Delete: {
|
|
||||||
Objects: objects,
|
|
||||||
Quiet: false,
|
|
||||||
},
|
|
||||||
}).promise();
|
|
||||||
|
|
||||||
logger.info(`Removed ${status.Deleted.length} media files from S3 bucket '${config.s3.bucket}', ${status.Errors.length} errors`);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function flushOrphanedMedia() {
|
async function flushOrphanedMedia() {
|
||||||
const orphanedMedia = await knex('media')
|
const orphanedMedia = await knex('media')
|
||||||
.where('is_sfw', false)
|
.where('is_sfw', false)
|
||||||
|
|
@ -919,10 +843,10 @@ async function flushOrphanedMedia() {
|
||||||
)
|
)
|
||||||
.whereRaw('associations.media_id = media.id'),
|
.whereRaw('associations.media_id = media.id'),
|
||||||
)
|
)
|
||||||
.returning(['media.id', 'media.is_s3', 'media.path', 'media.thumbnail', 'media.lazy'])
|
.returning(['media.path', 'media.thumbnail', 'media.lazy'])
|
||||||
.delete();
|
.delete();
|
||||||
|
|
||||||
await Promise.all(orphanedMedia.filter(media => !media.is_s3).map(media => Promise.all([
|
await Promise.all(orphanedMedia.map(media => Promise.all([
|
||||||
media.path && fsPromises.unlink(path.join(config.media.path, media.path)).catch(() => { /* probably file not found */ }),
|
media.path && fsPromises.unlink(path.join(config.media.path, media.path)).catch(() => { /* probably file not found */ }),
|
||||||
media.thumbnail && fsPromises.unlink(path.join(config.media.path, media.thumbnail)).catch(() => { /* probably file not found */ }),
|
media.thumbnail && fsPromises.unlink(path.join(config.media.path, media.thumbnail)).catch(() => { /* probably file not found */ }),
|
||||||
media.lazy && fsPromises.unlink(path.join(config.media.path, media.lazy)).catch(() => { /* probably file not found */ }),
|
media.lazy && fsPromises.unlink(path.join(config.media.path, media.lazy)).catch(() => { /* probably file not found */ }),
|
||||||
|
|
@ -930,10 +854,6 @@ async function flushOrphanedMedia() {
|
||||||
|
|
||||||
logger.info(`Removed ${orphanedMedia.length} media files from database and storage`);
|
logger.info(`Removed ${orphanedMedia.length} media files from database and storage`);
|
||||||
|
|
||||||
if (config.s3.enabled) {
|
|
||||||
await deleteS3Objects(orphanedMedia.filter(media => media.is_s3));
|
|
||||||
}
|
|
||||||
|
|
||||||
await fsPromises.rmdir(path.join(config.media.path, 'temp'), { recursive: true });
|
await fsPromises.rmdir(path.join(config.media.path, 'temp'), { recursive: true });
|
||||||
|
|
||||||
logger.info('Cleared temporary media directory');
|
logger.info('Cleared temporary media directory');
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,8 @@ function scrapeAll(html, site, networkUrl, hasTeaser = true) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(release);
|
||||||
|
|
||||||
return release;
|
return release;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@ const { cookieToData } = require('../utils/cookies');
|
||||||
|
|
||||||
function getThumbs(scene) {
|
function getThumbs(scene) {
|
||||||
if (scene.images.poster) {
|
if (scene.images.poster) {
|
||||||
return Object.values(scene.images.poster) // can be { 0: {}, 1: {}, ... } instead of array
|
return scene.images.poster.map(image => image.xl.url);
|
||||||
.filter(img => typeof img === 'object') // remove alternateText property
|
|
||||||
.map(image => image.xl.url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene.images.card_main_rect) {
|
if (scene.images.card_main_rect) {
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const config = require('config');
|
|
||||||
const AWS = require('aws-sdk');
|
|
||||||
const fs = require('fs');
|
|
||||||
const nanoid = require('nanoid');
|
|
||||||
|
|
||||||
async function init() {
|
|
||||||
const filepath = './public/img/sfw/animals/j0iiByCxGfA.jpeg';
|
|
||||||
const endpoint = new AWS.Endpoint('s3.wasabisys.com');
|
|
||||||
|
|
||||||
const s3 = new AWS.S3({
|
|
||||||
// region: 'eu-central-1',
|
|
||||||
endpoint,
|
|
||||||
credentials: {
|
|
||||||
accessKeyId: config.s3.accessKey,
|
|
||||||
secretAccessKey: config.s3.secretKey,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = await s3.listBuckets().promise();
|
|
||||||
const file = fs.createReadStream(filepath);
|
|
||||||
const key = `img/${nanoid()}.jpg`;
|
|
||||||
|
|
||||||
const status = await s3.upload({
|
|
||||||
Bucket: config.s3.bucket,
|
|
||||||
Body: file,
|
|
||||||
Key: key,
|
|
||||||
ContentType: 'image/jpeg',
|
|
||||||
}).promise();
|
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
console.log(status);
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const http = require('./http');
|
const bhttp = require('bhttp');
|
||||||
|
|
||||||
const sleep = 5000;
|
const sleep = 5000;
|
||||||
const timeout = 1000;
|
const timeout = 1000;
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
try {
|
try {
|
||||||
const res = await http.get(`https://httpstat.us/200?sleep=${sleep}`, {
|
const res = await bhttp.get(`https://httpstat.us/200?sleep=${sleep}`, {
|
||||||
timeout,
|
responseTimeout: timeout,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(res.statusCode);
|
console.log(res.statusCode);
|
||||||
|
|
@ -17,4 +17,15 @@ async function init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
/home/pendulum/projectx/node_modules/bhttp/lib/bhttp.js:159
|
||||||
|
err.response = response;
|
||||||
|
^
|
||||||
|
|
||||||
|
TypeError: Cannot assign to read only property 'response' of object '[object Object]'
|
||||||
|
at addErrorData (/home/pendulum/projectx/node_modules/bhttp/lib/bhttp.js:159:16)
|
||||||
|
at Timeout.timeoutHandler [as _onTimeout] (/home/pendulum/projectx/node_modules/bhttp/lib/bhttp.js:525:27)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue