Compare commits
No commits in common. "83d362144126af14a5f3066c4804fc15440ce5ea" and "36a8adbd8c463d8507ac6f9d64a3773f494ee019" have entirely different histories.
83d3621441
...
36a8adbd8c
|
@ -50,20 +50,6 @@
|
||||||
icon="question2"
|
icon="question2"
|
||||||
/>
|
/>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Icon
|
|
||||||
v-show="me && isStashed"
|
|
||||||
icon="heart7"
|
|
||||||
class="stash stashed noselect"
|
|
||||||
@click="unstashScene"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Icon
|
|
||||||
v-show="me && !isStashed"
|
|
||||||
icon="heart8"
|
|
||||||
class="stash unstashed noselect"
|
|
||||||
@click="stashScene"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row associations">
|
<div class="row associations">
|
||||||
|
@ -237,7 +223,7 @@ import Actor from '../actors/tile.vue';
|
||||||
import Releases from './releases.vue';
|
import Releases from './releases.vue';
|
||||||
import Scroll from '../scroll/scroll.vue';
|
import Scroll from '../scroll/scroll.vue';
|
||||||
|
|
||||||
async function fetchRelease(scroll = true) {
|
async function fetchRelease() {
|
||||||
if (this.$route.name === 'scene') {
|
if (this.$route.name === 'scene') {
|
||||||
this.release = await this.$store.dispatch('fetchReleaseById', this.$route.params.releaseId);
|
this.release = await this.$store.dispatch('fetchReleaseById', this.$route.params.releaseId);
|
||||||
}
|
}
|
||||||
|
@ -246,37 +232,11 @@ async function fetchRelease(scroll = true) {
|
||||||
this.release = await this.$store.dispatch('fetchMovieById', this.$route.params.releaseId);
|
this.release = await this.$store.dispatch('fetchMovieById', this.$route.params.releaseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scroll && this.$refs.content) {
|
if (this.$refs.content) {
|
||||||
this.$refs.content.scrollTop = 0;
|
this.$refs.content.scrollTop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stashScene() {
|
|
||||||
this.$store.dispatch('stashScene', {
|
|
||||||
sceneId: this.release.id,
|
|
||||||
stashId: this.$store.getters.favorites.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.fetchRelease(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function unstashScene() {
|
|
||||||
this.$store.dispatch('unstashScene', {
|
|
||||||
sceneId: this.release.id,
|
|
||||||
stashId: this.$store.getters.favorites.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.fetchRelease(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function me() {
|
|
||||||
return this.$store.state.auth.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isStashed() {
|
|
||||||
return this.release.stashes?.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function bannerBackground() {
|
function bannerBackground() {
|
||||||
return (this.release.poster && this.getBgPath(this.release.poster, 'thumbnail'))
|
return (this.release.poster && this.getBgPath(this.release.poster, 'thumbnail'))
|
||||||
|| (this.release.covers.length > 0 && this.getBgPath(this.release.covers[0], 'thumbnail'));
|
|| (this.release.covers.length > 0 && this.getBgPath(this.release.covers[0], 'thumbnail'));
|
||||||
|
@ -311,8 +271,6 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
pageTitle,
|
pageTitle,
|
||||||
bannerBackground,
|
bannerBackground,
|
||||||
isStashed,
|
|
||||||
me,
|
|
||||||
showAlbum,
|
showAlbum,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -321,8 +279,6 @@ export default {
|
||||||
mounted: fetchRelease,
|
mounted: fetchRelease,
|
||||||
methods: {
|
methods: {
|
||||||
fetchRelease,
|
fetchRelease,
|
||||||
stashScene,
|
|
||||||
unstashScene,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -397,22 +353,6 @@ export default {
|
||||||
color: var(--shadow);
|
color: var(--shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stash.icon {
|
|
||||||
width: 1.5rem;
|
|
||||||
height: 1.5rem;
|
|
||||||
padding: 0 1rem;
|
|
||||||
fill: var(--darken);
|
|
||||||
|
|
||||||
&.stashed {
|
|
||||||
fill: var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
fill: var(--primary);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-toggle {
|
.album-toggle {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
|
|
@ -346,21 +346,6 @@ const releaseFragment = `
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stashes: stashesScenesBySceneId(
|
|
||||||
filter: {
|
|
||||||
stash: {
|
|
||||||
userId: {
|
|
||||||
equalTo: $userId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) @include(if: $hasAuth) {
|
|
||||||
stash {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
@ -37,17 +37,11 @@ function initReleasesActions(store, router) {
|
||||||
// const release = await get(`/releases/${releaseId}`);
|
// const release = await get(`/releases/${releaseId}`);
|
||||||
|
|
||||||
const { release } = await graphql(`
|
const { release } = await graphql(`
|
||||||
query Release(
|
query Release($releaseId:Int!) {
|
||||||
$releaseId: Int!
|
|
||||||
$hasAuth: Boolean!
|
|
||||||
$userId: Int
|
|
||||||
) {
|
|
||||||
${releaseFragment}
|
${releaseFragment}
|
||||||
}
|
}
|
||||||
`, {
|
`, {
|
||||||
releaseId: Number(releaseId),
|
releaseId: Number(releaseId),
|
||||||
hasAuth: !!store.state.auth.user,
|
|
||||||
userId: store.state.auth.user?.id,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!release) {
|
if (!release) {
|
||||||
|
|
|
@ -9,19 +9,9 @@ function initStashesActions(_store, _router) {
|
||||||
await del(`/stashes/${stashId}/actors/${actorId}`);
|
await del(`/stashes/${stashId}/actors/${actorId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stashScene(context, { sceneId, stashId }) {
|
|
||||||
await post(`/stashes/${stashId}/scenes`, { sceneId });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function unstashScene(context, { sceneId, stashId }) {
|
|
||||||
await del(`/stashes/${stashId}/scenes/${sceneId}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stashActor,
|
stashActor,
|
||||||
stashScene,
|
|
||||||
unstashActor,
|
unstashActor,
|
||||||
unstashScene,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import { graphql } from '../api';
|
import { graphql } from '../api';
|
||||||
import { releaseFields } from '../fragments';
|
|
||||||
import { curateUser } from '../curate';
|
|
||||||
|
|
||||||
function initUsersActions(_store, _router) {
|
function initUsersActions(_store, _router) {
|
||||||
async function fetchUser(context, username) {
|
async function fetchUser(context, username) {
|
||||||
|
@ -45,7 +43,45 @@ function initUsersActions(_store, _router) {
|
||||||
scenes: stashesScenes {
|
scenes: stashesScenes {
|
||||||
comment
|
comment
|
||||||
scene {
|
scene {
|
||||||
${releaseFields}
|
id
|
||||||
|
title
|
||||||
|
slug
|
||||||
|
url
|
||||||
|
date
|
||||||
|
actors: releasesActors {
|
||||||
|
actor {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tags: releasesTags {
|
||||||
|
tag {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entity {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
independent
|
||||||
|
parent {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
independent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
poster: releasesPosterByReleaseId {
|
||||||
|
media {
|
||||||
|
path
|
||||||
|
thumbnail
|
||||||
|
lazy
|
||||||
|
isS3
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +91,7 @@ function initUsersActions(_store, _router) {
|
||||||
username,
|
username,
|
||||||
});
|
});
|
||||||
|
|
||||||
return curateUser(user);
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1328,6 +1328,7 @@ exports.up = knex => Promise.resolve()
|
||||||
));
|
));
|
||||||
`, {
|
`, {
|
||||||
visitor: knex.raw(config.database.query.user),
|
visitor: knex.raw(config.database.query.user),
|
||||||
|
password: knex.raw(config.database.query.password),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
// VIEWS AND COMMENTS
|
// VIEWS AND COMMENTS
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.186.0",
|
"version": "1.185.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "1.186.0",
|
"version": "1.185.1",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@casl/ability": "^5.2.2",
|
"@casl/ability": "^5.2.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.186.0",
|
"version": "1.185.1",
|
||||||
"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": {
|
||||||
|
|
|
@ -21,7 +21,7 @@ function logActive() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
log();
|
log();
|
||||||
logActive();
|
logActive();
|
||||||
}, argv.logActive || 60000);
|
}, 600000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
|
|
@ -48,31 +48,19 @@ async function stashScene(sceneId, stashId, sessionUser) {
|
||||||
await knex('stashes_scenes')
|
await knex('stashes_scenes')
|
||||||
.insert({
|
.insert({
|
||||||
stash_id: stash.id,
|
stash_id: stash.id,
|
||||||
scene_id: sceneId,
|
actor_id: sceneId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unstashActor(actorId, stashId, sessionUser) {
|
async function unstashActor(actorId, stashId, sessionUser) {
|
||||||
await knex
|
await knex
|
||||||
.from('stashes_actors AS deletable')
|
.from('stashes_actors')
|
||||||
.where('deletable.actor_id', actorId)
|
.whereIn('stashes_actors.id', knex('stashes_actors')
|
||||||
.where('deletable.stash_id', stashId)
|
.select('stashes_actors.id')
|
||||||
.whereExists(knex('stashes_actors') // verify user owns this stash
|
|
||||||
.leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id')
|
.leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id')
|
||||||
.where('stashes_actors.stash_id', knex.raw('deletable.stash_id'))
|
.where('stashes.user_id', sessionUser.id) // verify user owns this stash
|
||||||
.where('stashes.user_id', sessionUser.id))
|
.where('stashes_actors.actor_id', actorId)
|
||||||
.delete();
|
.where('stashes_actors.stash_id', stashId))
|
||||||
}
|
|
||||||
|
|
||||||
async function unstashScene(sceneId, stashId, sessionUser) {
|
|
||||||
await knex
|
|
||||||
.from('stashes_scenes AS deletable')
|
|
||||||
.where('deletable.scene_id', sceneId)
|
|
||||||
.where('deletable.stash_id', stashId)
|
|
||||||
.whereExists(knex('stashes_scenes') // verify user owns this stash
|
|
||||||
.leftJoin('stashes', 'stashes.id', 'stashes_scenes.stash_id')
|
|
||||||
.where('stashes_scenes.stash_id', knex.raw('deletable.stash_id'))
|
|
||||||
.where('stashes.user_id', sessionUser.id))
|
|
||||||
.delete();
|
.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +68,6 @@ module.exports = {
|
||||||
curateStash,
|
curateStash,
|
||||||
stashActor,
|
stashActor,
|
||||||
stashScene,
|
stashScene,
|
||||||
unstashScene,
|
// unstashScene,
|
||||||
unstashActor,
|
unstashActor,
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,9 +80,20 @@ function getLimiter(options = {}, url) {
|
||||||
return limiters[interval][concurrency];
|
return limiters[interval][concurrency];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function request(method = 'get', url, body, requestOptions = {}, limiter) {
|
async function request(method = 'get', url, body, requestOptions = {}, limiter, timeout) {
|
||||||
const http = requestOptions.session || bhttp;
|
const http = requestOptions.session || bhttp;
|
||||||
const options = requestOptions;
|
|
||||||
|
const options = {
|
||||||
|
...defaultOptions,
|
||||||
|
...requestOptions,
|
||||||
|
headers: {
|
||||||
|
...defaultOptions.headers,
|
||||||
|
...requestOptions.headers,
|
||||||
|
},
|
||||||
|
responseTimeout: requestOptions.responseTimeout || requestOptions.timeout || defaultOptions.timeout,
|
||||||
|
stream: !!requestOptions.destination,
|
||||||
|
session: null,
|
||||||
|
};
|
||||||
|
|
||||||
const withProxy = useProxy(url);
|
const withProxy = useProxy(url);
|
||||||
|
|
||||||
|
@ -96,10 +107,8 @@ async function request(method = 'get', url, body, requestOptions = {}, limiter)
|
||||||
? http[method](url, body, options)
|
? http[method](url, body, options)
|
||||||
: http[method](url, options));
|
: http[method](url, options));
|
||||||
|
|
||||||
return res;
|
timeout.cancel();
|
||||||
}
|
|
||||||
|
|
||||||
async function finalizeResult(res, options) {
|
|
||||||
if (options.destination) {
|
if (options.destination) {
|
||||||
// res.on('progress', (bytes, totalBytes) => logger.silly(`Downloaded ${Math.round((bytes / totalBytes) * 100)}% of ${url}`));
|
// res.on('progress', (bytes, totalBytes) => logger.silly(`Downloaded ${Math.round((bytes / totalBytes) * 100)}% of ${url}`));
|
||||||
|
|
||||||
|
@ -131,39 +140,21 @@ async function finalizeResult(res, options) {
|
||||||
|
|
||||||
function getTimeout(options, url) {
|
function getTimeout(options, url) {
|
||||||
return new Promise((resolve, reject, onCancel) => {
|
return new Promise((resolve, reject, onCancel) => {
|
||||||
const timeout = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
reject(new Error(`URL ${url} timed out`));
|
reject(new Error(`URL ${url} timed out`));
|
||||||
}, (options?.timeout || defaultOptions.timeout) + 10000);
|
}, (options?.timeout || defaultOptions.timeout) + 10000);
|
||||||
|
|
||||||
onCancel(() => {
|
onCancel(() => clearTimeout(timeoutId));
|
||||||
clearTimeout(timeout);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function scheduleRequest(method = 'get', url, body, requestOptions = {}) {
|
async function scheduleRequest(method = 'get', url, body, options) {
|
||||||
const options = {
|
|
||||||
...defaultOptions,
|
|
||||||
...requestOptions,
|
|
||||||
headers: {
|
|
||||||
...defaultOptions.headers,
|
|
||||||
...requestOptions.headers,
|
|
||||||
},
|
|
||||||
responseTimeout: requestOptions.responseTimeout || requestOptions.timeout || defaultOptions.timeout,
|
|
||||||
stream: !!requestOptions.destination,
|
|
||||||
session: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
const limiter = getLimiter(options, url);
|
const limiter = getLimiter(options, url);
|
||||||
const timeout = getTimeout(options, url);
|
const timeout = getTimeout(options, url);
|
||||||
|
|
||||||
const result = await limiter.schedule(async () => Promise.race([request(method, url, body, options, limiter), timeout]));
|
const result = await limiter.schedule(() => Promise.race([request(method, url, body, options, limiter, timeout), timeout]));
|
||||||
|
|
||||||
timeout.cancel();
|
return result;
|
||||||
|
|
||||||
const curatedResult = await finalizeResult(result, options);
|
|
||||||
|
|
||||||
return curatedResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get(url, options) {
|
async function get(url, options) {
|
||||||
|
|
Loading…
Reference in New Issue