Compare commits

..
18 Commits
Author SHA1 Message Date
DebaucheryLibrarian 10ac366e87 0.57.25 2026-09-22 02:22:21 +02:00
DebaucheryLibrarian a5e06b51ea Fixed scene serie poster curation and tile display. 2026-09-22 02:22:19 +02:00
DebaucheryLibrarian b3dcb65871 0.57.24 2026-09-22 00:54:23 +02:00
DebaucheryLibrarian 4527bf2495 Fixed alerts cron never initializing due missing config. 2026-09-22 00:54:22 +02:00
DebaucheryLibrarian 6c0e4d5456 0.57.23 2026-09-20 19:11:32 +02:00
DebaucheryLibrarian 8dd136446d Changed Chapter GraphQL type to accommodate video-type chapters without a starting time. 2026-09-20 19:11:30 +02:00
DebaucheryLibrarian 1cc94d665a 0.57.22 2026-09-18 23:25:51 +02:00
DebaucheryLibrarian a9d9b7623d Added actor date of birth and death precision. 2026-09-18 23:25:49 +02:00
DebaucheryLibrarian 83c0f1e4c6 0.57.21 2026-09-18 16:11:29 +02:00
DebaucheryLibrarian 64b92536d5 Fixed dark theme text color for revision count. 2026-09-18 16:11:27 +02:00
DebaucheryLibrarian cea5b98bda 0.57.20 2026-09-18 03:37:06 +02:00
DebaucheryLibrarian 411cde7cf9 Extended revision pagination to scene and actor pages, fixes 'revisions' label without count. 2026-09-18 03:37:03 +02:00
DebaucheryLibrarian 73d65ae873 0.57.19 2026-09-18 03:31:32 +02:00
DebaucheryLibrarian b5e9886b9b Added pagination and total to revisions. 2026-09-18 03:31:28 +02:00
DebaucheryLibrarian cd10f14285 0.57.18 2026-09-17 02:17:34 +02:00
DebaucheryLibrarian 514ed235a4 Added a default og:description. 2026-09-17 02:17:32 +02:00
DebaucheryLibrarian 00c6d17aaa 0.57.17 2026-09-17 01:17:06 +02:00
DebaucheryLibrarian de0b1c2baf Added scene chapters to GraphQL. Verifying API credential types. 2026-09-17 01:17:03 +02:00
24 changed files with 218 additions and 40 deletions
+1 -1
Submodule common updated: ec0812ad9d...7df69021ea
+18 -7
View File
@@ -135,13 +135,18 @@ const aliases = Object
<dfn class="bio-label"><Icon icon="cake" />Date of birth</dfn> <dfn class="bio-label"><Icon icon="cake" />Date of birth</dfn>
<span class="birthdate"> <span class="birthdate">
<span class="birthdate-long">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMMM d, yyyy' : 'MMMM d') }}</span> <template v-if="actor.dateOfBirthPrecision === 'day'">
<span class="birthdate-short">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMM d, yyyy' : 'MMM d') }}</span> <span class="birthdate-long">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMMM d, yyyy' : 'MMMM d') }}</span>
<span class="birthdate-short">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMM d, yyyy' : 'MMM d') }}</span>
</template>
<span v-else-if="actor.dateOfBirthPrecision === 'month'">{{ formatDate(actor.dateOfBirth, 'MMMM, yyyy') }}</span>
<span v-else-if="actor.dateOfBirth.getFullYear() > 1">{{ formatDate(actor.dateOfBirth, 'yyyy') }}</span>
<span <span
v-if="!actor.dateOfDeath && actor.dateOfBirth.getFullYear() > 1" v-if="!actor.dateOfDeath && actor.dateOfBirth.getFullYear() > 1"
class="age" class="age"
>{{ actor.ageFromBirth }}</span> ><template v-if="actor.ageFromBirthIsApproximate">~</template>{{ actor.ageFromBirth }}</span>
</span> </span>
</li> </li>
@@ -163,10 +168,16 @@ const aliases = Object
> >
<dfn class="bio-label"><Icon icon="tombstone" />Date of death</dfn> <dfn class="bio-label"><Icon icon="tombstone" />Date of death</dfn>
<span class="birthdate">{{ formatDate(actor.dateOfDeath, 'MMMM d, yyyy') }}<span <span class="birthdate">
v-if="actor.ageAtDeath" <span v-if="actor.dateOfDeathPrecision === 'day'">{{ formatDate(actor.dateOfDeath, 'MMMM d, yyyy') }}</span>
class="age" <span v-else-if="actor.dateOfDeathPrecision === 'month'">{{ formatDate(actor.dateOfDeath, 'MMMM, yyyy') }}</span>
>{{ actor.ageAtDeath }}</span></span> <span v-else>{{ formatDate(actor.dateOfDeath, 'yyyy') }}</span>
<span
v-if="actor.ageAtDeath"
class="age"
><template v-if="actor.ageAtDeathIsApproximate">~</template>{{ actor.ageAtDeath }}</span>
</span>
</li> </li>
<li <li
+39 -6
View File
@@ -5,8 +5,10 @@ import { computed, inject, ref } from 'vue';
import Avatar from '#/components/edit/avatar.vue'; import Avatar from '#/components/edit/avatar.vue';
import Socials from '#/components/edit/revision-socials.vue'; import Socials from '#/components/edit/revision-socials.vue';
import Checkbox from '#/components/form/checkbox.vue'; import Checkbox from '#/components/form/checkbox.vue';
import Pagination from '#/components/pagination/pagination.vue';
import { get, post } from '#/src/api.js'; import { get, post } from '#/src/api.js';
import navigate from '#/src/navigate.js';
import { formatDuration } from '#/utils/format.js'; import { formatDuration } from '#/utils/format.js';
defineProps({ defineProps({
@@ -31,10 +33,14 @@ const moviesById = computed(() => Object.fromEntries(movies.value.map((movie) =>
const avatarsById = computed(() => Object.fromEntries(avatars.value.map((avatar) => [avatar.id, avatar]))); const avatarsById = computed(() => Object.fromEntries(avatars.value.map((avatar) => [avatar.id, avatar])));
const feedbacks = ref({}); const feedbacks = ref({});
const showReviewed = ref(false); const showReviewed = ref(Object.hasOwn(pageContext.urlParsed.search, 'final'));
const reviewedRevisions = ref(new Set()); const reviewedRevisions = ref(new Set());
const expanded = ref(new Set()); const expanded = ref(new Set());
const total = ref(pageContext.pageProps.revisionTotal);
const page = Number(pageContext.routeParams.page) || 1;
const limit = Number(pageContext.urlParsed.search.limit) || 100;
const mappedKeys = { const mappedKeys = {
actors: actorsById, actors: actorsById,
// tags: tagsById, // tags: tagsById,
@@ -163,7 +169,8 @@ const curatedRevisions = computed(() => revisions.value.map((revision) => {
async function reloadRevisions() { async function reloadRevisions() {
const updatedRevisions = await get(`/revisions/${domain}`, { const updatedRevisions = await get(`/revisions/${domain}`, {
isFinalized: showReviewed.value ? undefined : false, isFinalized: showReviewed.value ? undefined : false,
limit: 50, page,
limit,
}); });
actors.value = updatedRevisions.actors; actors.value = updatedRevisions.actors;
@@ -171,6 +178,14 @@ async function reloadRevisions() {
movies.value = updatedRevisions.movies; movies.value = updatedRevisions.movies;
avatars.value = updatedRevisions.avatars; avatars.value = updatedRevisions.avatars;
revisions.value = updatedRevisions.revisions; revisions.value = updatedRevisions.revisions;
total.value = updatedRevisions.total;
navigate(pageContext.urlParsed.pathname, {
...pageContext.urlParsed.search,
final: showReviewed.value || undefined,
}, {
redirect: false,
});
} }
async function reviewRevision(revision, isApproved) { async function reviewRevision(revision, isApproved) {
@@ -208,10 +223,15 @@ async function banEditor(revision) {
<template> <template>
<div class="page"> <div class="page">
<div <div
v-if="context === 'admin'"
class="revs-header" class="revs-header"
> >
<span
v-if="typeof total === 'number'"
class="revs-total"
>{{ total }} revisions</span>
<Checkbox <Checkbox
v-if="context === 'admin'"
label="Show finalized" label="Show finalized"
:checked="showReviewed" :checked="showReviewed"
@change="(checked) => { showReviewed = checked; reloadRevisions(); }" @change="(checked) => { showReviewed = checked; reloadRevisions(); }"
@@ -388,13 +408,12 @@ async function banEditor(revision) {
class="rev-compact" class="rev-compact"
@click="expanded.add(rev.id)" @click="expanded.add(rev.id)"
> >
<span class="rev-scene nolink noshrink"><template v-if="context !== 'scene' && context !== 'actor'">{{ rev.sceneId || rev.actorId }}</template>@{{ rev.hash.slice(0, 6) }}</span> <span class="rev-scene nolink noshrink"><template v-if="context !== 'scene' && context !== 'actor'">{{ rev.sceneId || rev.actorId }}</template>@{{ rev.hash.slice(0, 6) }}</span>
<span <span
v-if="context !== 'scene'" v-if="context !== 'scene'"
class="rev-title nolink ellipsis" class="rev-title nolink ellipsis"
>{{ rev.base.title }}</span> >{{ rev.base.title || rev.base.name }}</span>
<span class="rev-summary"> <span class="rev-summary">
<span class="summary-deltas ellipsis">{{ rev.deltas.map((delta) => delta.key).join(', ') }}</span> <span class="summary-deltas ellipsis">{{ rev.deltas.map((delta) => delta.key).join(', ') }}</span>
@@ -431,6 +450,13 @@ async function banEditor(revision) {
</div> </div>
</li> </li>
</ul> </ul>
<Pagination
v-if="total"
:total="total"
:page="page"
:limit="limit"
/>
</div> </div>
</template> </template>
@@ -443,13 +469,20 @@ async function banEditor(revision) {
.revs-header { .revs-header {
display: flex; display: flex;
margin-bottom: 1rem; justify-content: space-between;
box-sizing: border-box;
padding: .5rem .5rem .75rem .5rem;
width: 100%;
.check-container { .check-container {
display: inline-flex; display: inline-flex;
} }
} }
.revs-total {
color: var(--glass-strong-10);
}
.revs { .revs {
width: 100%; width: 100%;
flex-grow: 1; flex-grow: 1;
+4
View File
@@ -13,6 +13,10 @@ const props = defineProps({
type: Number, type: Number,
default: null, default: null,
}, },
limit: {
type: Number,
default: null,
},
redirect: { redirect: {
type: Boolean, type: Boolean,
default: true, default: true,
+18 -2
View File
@@ -10,7 +10,10 @@ defineProps({
</script> </script>
<template> <template>
<div class="serie-tile"> <div
class="serie-tile"
:class="{ noposter: !serie.poster }"
>
<a <a
v-if="serie.poster" v-if="serie.poster"
:href="`/serie/${serie.id}/${serie.slug}`" :href="`/serie/${serie.id}/${serie.slug}`"
@@ -39,8 +42,8 @@ defineProps({
flex-direction: column; flex-direction: column;
box-shadow: 0 0 3px var(--shadow-weak-30); box-shadow: 0 0 3px var(--shadow-weak-30);
border-radius: .25rem; border-radius: .25rem;
overflow: hidden;
background: var(--background-base); background: var(--background-base);
overflow: hidden;
&:hover { &:hover {
box-shadow: 0 0 3px var(--shadow-weak-20); box-shadow: 0 0 3px var(--shadow-weak-20);
@@ -53,6 +56,19 @@ defineProps({
&.unstashed { &.unstashed {
opacity: .5; opacity: .5;
} }
&.noposter {
background: none;
box-shadow: none;
.title {
padding: 0;
&:hover {
color: var(--primary);
}
}
}
} }
.poster-container { .poster-container {
+1
View File
@@ -206,6 +206,7 @@ module.exports = {
crontab: '*/10 * * * *', // every 10 minutes crontab: '*/10 * * * *', // every 10 minutes
}, },
alerts: { alerts: {
enabled: true,
crontab: '*/10 * * * *', // every 10 minutes crontab: '*/10 * * * *', // every 10 minutes
seenExpiry: 30, // days seenExpiry: 30, // days
finalExpiry: 365, // days finalExpiry: 365, // days
+2 -2
View File
@@ -1,11 +1,11 @@
{ {
"name": "traxxx-web", "name": "traxxx-web",
"version": "0.57.16", "version": "0.57.25",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "0.57.16", "version": "0.57.25",
"dependencies": { "dependencies": {
"@brillout/json-serializer": "^0.5.25", "@brillout/json-serializer": "^0.5.25",
"@dicebear/collection": "7.0.5", "@dicebear/collection": "7.0.5",
+1 -1
View File
@@ -92,7 +92,7 @@
"overrides": { "overrides": {
"vite": "$vite" "vite": "$vite"
}, },
"version": "0.57.16", "version": "0.57.25",
"imports": { "imports": {
"#/*": "./*.js" "#/*": "./*.js"
}, },
@@ -5,11 +5,13 @@ export async function onBeforeRender(pageContext) {
const { const {
revisions, revisions,
total: revisionTotal,
avatars, avatars,
} = await fetchActorRevisions(null, { } = await fetchActorRevisions(null, {
actorId: actor.id, actorId: actor.id,
isFinalized: true, isFinalized: true,
limit: 100, limit: Number(pageContext.urlParsed.search.limit) || 100,
page: Number(pageContext.routeParams.page) || 1,
}, pageContext.user); }, pageContext.user);
return { return {
@@ -18,6 +20,7 @@ export async function onBeforeRender(pageContext) {
pageProps: { pageProps: {
actor, actor,
revisions, revisions,
revisionTotal,
avatars, avatars,
}, },
}, },
+45 -6
View File
@@ -52,9 +52,12 @@ const fields = computed(() => [
key: 'dateOfBirth', key: 'dateOfBirth',
label: 'date of birth', label: 'date of birth',
type: 'date', type: 'date',
value: actor.value?.dateOfBirth value: {
? format(actor.value.dateOfBirth, 'yyyy-MM-dd') date: actor.value?.dateOfBirth
: null, ? format(actor.value.dateOfBirth, 'yyyy-MM-dd')
: null,
precision: actor.value.dateOfBirthPrecision,
},
inline: true, inline: true,
}, },
{ {
@@ -212,9 +215,12 @@ const fields = computed(() => [
key: 'dateOfDeath', key: 'dateOfDeath',
label: 'date of death', label: 'date of death',
type: 'date', type: 'date',
value: actor.value?.dateOfDeath value: {
? format(actor.value.dateOfDeath, 'yyyy-MM-dd') date: actor.value?.dateOfDeath
: null, ? format(actor.value.dateOfDeath, 'yyyy-MM-dd')
: null,
precision: actor.value.dateOfDeathPrecision,
},
}, },
{ {
key: 'allowGlobalMatch', key: 'allowGlobalMatch',
@@ -270,6 +276,14 @@ const keyMap = {
country: 'residenceCountry', country: 'residenceCountry',
place: 'residencePlace', place: 'residencePlace',
}, },
dateOfBirth: {
date: 'dateOfBirth',
precision: 'dateOfBirthPrecision',
},
dateOfDeath: {
date: 'dateOfDeath',
precision: 'dateOfDeathPrecision',
},
tattoos: { tattoos: {
has: 'hasTattoos', has: 'hasTattoos',
description: 'tattoos', description: 'tattoos',
@@ -501,6 +515,7 @@ async function submit() {
>{{ item.unit }} >{{ item.unit }}
</template> </template>
<!--
<input <input
v-if="item.type === 'date'" v-if="item.type === 'date'"
v-model="edits[item.key]" v-model="edits[item.key]"
@@ -508,6 +523,30 @@ async function submit() {
class="date input" class="date input"
:disabled="!editing.has(item.key)" :disabled="!editing.has(item.key)"
> >
-->
<div
v-if="item.type === 'date'"
class="date"
>
<input
v-model="edits[item.key].date"
type="date"
class="date input"
:disabled="!editing.has(item.key)"
>
<select
v-if="item.value.precision"
v-model="edits[item.key].precision"
class="input"
:disabled="!editing.has(item.key)"
>
<option value="day">Day</option>
<option value="month">Month</option>
<option value="year">Year</option>
</select>
</div>
<select <select
v-if="item.type === 'select'" v-if="item.type === 'select'"
@@ -10,10 +10,12 @@ export async function onBeforeRender(pageContext) {
const { const {
revisions, revisions,
total: revisionTotal,
avatars, avatars,
} = await fetchActorRevisions(null, { } = await fetchActorRevisions(null, {
isFinalized: false, isFinalized: Object.hasOwn(pageContext.urlParsed.search, 'final'),
limit: 50, limit: Number(pageContext.urlParsed.search.limit) || 100,
page: Number(pageContext.routeParams.page) || 1,
}, pageContext.user); }, pageContext.user);
return { return {
@@ -21,6 +23,7 @@ export async function onBeforeRender(pageContext) {
title: pageContext.routeParams.section, title: pageContext.routeParams.section,
pageProps: { pageProps: {
revisions, revisions,
revisionTotal,
avatars, avatars,
}, },
}, },
+3 -1
View File
@@ -1,6 +1,6 @@
import { match } from 'path-to-regexp'; import { match } from 'path-to-regexp';
const path = '/admin/:section/:domain(actors)'; const path = '/admin/:section/:domain(actors)/:page?';
const urlMatch = match(path, { decode: decodeURIComponent }); const urlMatch = match(path, { decode: decodeURIComponent });
export default (pageContext) => { export default (pageContext) => {
@@ -11,6 +11,8 @@ export default (pageContext) => {
routeParams: { routeParams: {
section: matched.params.section, section: matched.params.section,
domain: matched.params.domain, domain: matched.params.domain,
page: matched.params.page || '1',
path,
}, },
}; };
} }
@@ -10,12 +10,14 @@ export async function onBeforeRender(pageContext) {
const { const {
revisions, revisions,
total: revisionTotal,
actors, actors,
tags, tags,
movies, movies,
} = await fetchSceneRevisions(null, { } = await fetchSceneRevisions(null, {
isFinalized: false, isFinalized: Object.hasOwn(pageContext.urlParsed.search, 'final'),
limit: 50, limit: Number(pageContext.urlParsed.search.limit) || 100,
page: Number(pageContext.routeParams.page) || 1,
}, pageContext.user); }, pageContext.user);
return { return {
@@ -23,6 +25,7 @@ export async function onBeforeRender(pageContext) {
title: pageContext.routeParams.section, title: pageContext.routeParams.section,
pageProps: { pageProps: {
revisions, revisions,
revisionTotal,
actors, actors,
tags, tags,
movies, movies,
+3 -1
View File
@@ -1,6 +1,6 @@
import { match } from 'path-to-regexp'; import { match } from 'path-to-regexp';
const path = '/admin/:section/:domain(scenes)'; const path = '/admin/:section/:domain(scenes)/:page?';
const urlMatch = match(path, { decode: decodeURIComponent }); const urlMatch = match(path, { decode: decodeURIComponent });
export default (pageContext) => { export default (pageContext) => {
@@ -11,6 +11,8 @@ export default (pageContext) => {
routeParams: { routeParams: {
section: matched.params.section, section: matched.params.section,
domain: matched.params.domain, domain: matched.params.domain,
page: matched.params.page || '1',
path,
}, },
}; };
} }
@@ -10,13 +10,15 @@ export async function onBeforeRender(pageContext) {
const { const {
revisions, revisions,
total: revisionTotal,
actors, actors,
tags, tags,
movies, movies,
} = await fetchSceneRevisions(null, { } = await fetchSceneRevisions(null, {
sceneId: scene.id, sceneId: scene.id,
isFinalized: true, isFinalized: true,
limit: 100, limit: Number(pageContext.urlParsed.search.limit) || 100,
page: Number(pageContext.routeParams.page) || 1,
}, pageContext.user); }, pageContext.user);
return { return {
@@ -25,6 +27,7 @@ export async function onBeforeRender(pageContext) {
pageProps: { pageProps: {
scene, scene,
revisions, revisions,
revisionTotal,
actors, actors,
tags, tags,
movies, movies,
+6 -2
View File
@@ -15,14 +15,16 @@ async function fetchRevisions(pageContext) {
if (pageContext.routeParams.section === 'revisions' && pageContext.routeParams.domain === 'scenes') { if (pageContext.routeParams.section === 'revisions' && pageContext.routeParams.domain === 'scenes') {
return fetchSceneRevisions(null, { return fetchSceneRevisions(null, {
userId: pageContext.user.id, userId: pageContext.user.id,
limit: 100, limit: Number(pageContext.urlParsed.search.limit) || 100,
page: Number(pageContext.routeParams.page) || 1,
}, pageContext.user); }, pageContext.user);
} }
if (pageContext.routeParams.section === 'revisions' && pageContext.routeParams.domain === 'actors') { if (pageContext.routeParams.section === 'revisions' && pageContext.routeParams.domain === 'actors') {
return fetchActorRevisions(null, { return fetchActorRevisions(null, {
userId: pageContext.user.id, userId: pageContext.user.id,
limit: 100, limit: Number(pageContext.urlParsed.search.limit) || 100,
page: Number(pageContext.routeParams.page) || 1,
}, pageContext.user); }, pageContext.user);
} }
@@ -47,6 +49,7 @@ export async function onBeforeRender(pageContext) {
const { const {
revisions, revisions,
total: revisionTotal,
actors, actors,
tags, tags,
movies, movies,
@@ -63,6 +66,7 @@ export async function onBeforeRender(pageContext) {
stashes, stashes,
alerts, alerts,
revisions, revisions,
revisionTotal,
keys, keys,
actors, actors,
tags, tags,
+3 -1
View File
@@ -1,7 +1,7 @@
import { match } from 'path-to-regexp'; import { match } from 'path-to-regexp';
import { redirect } from 'vike/abort'; import { redirect } from 'vike/abort';
const path = '/user/:username/:section?/:domain?'; const path = '/user/:username/:section?/:domain?/:page?';
const urlMatch = match(path, { decode: decodeURIComponent }); const urlMatch = match(path, { decode: decodeURIComponent });
export default (pageContext) => { export default (pageContext) => {
@@ -18,6 +18,8 @@ export default (pageContext) => {
username: matched.params.username, username: matched.params.username,
section: matched.params.section || '', section: matched.params.section || '',
domain: matched.params.domain || '', domain: matched.params.domain || '',
page: matched.params.page || '1',
path,
}, },
}; };
} }
+1 -1
View File
@@ -67,7 +67,7 @@ async function onRenderHtml(pageContext) {
<meta name="theme-color" content="#f65596"> <meta name="theme-color" content="#f65596">
<meta property="og:title" content="traxxx" /> <meta property="og:title" content="traxxx" />
<meta property="og:image" content="https://traxxx.me/img/og_logo.png" /> <meta property="og:description" content="${pageContext.description || 'Never miss new adult videos with traxxx'}" />
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,interactive-widget=resizes-content" /> <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,interactive-widget=resizes-content" />
+30
View File
@@ -32,7 +32,9 @@ const mj = new MerkleJson();
const keyMap = { const keyMap = {
avatar: 'avatar_media_id', avatar: 'avatar_media_id',
dateOfBirth: 'date_of_birth', dateOfBirth: 'date_of_birth',
dateOfBirthPrecision: 'date_of_birth_precision',
dateOfDeath: 'date_of_death', dateOfDeath: 'date_of_death',
dateOfDeathPrecision: 'date_of_death_precision',
originCountry: 'birth_country_alpha2', originCountry: 'birth_country_alpha2',
originState: 'birth_state', originState: 'birth_state',
originCity: 'birth_city', originCity: 'birth_city',
@@ -62,6 +64,24 @@ const keyMap = {
const socialsOrder = ['onlyfans', 'fansly', 'twitter', 'instagram', 'loyalfans', 'manyvids', 'pornhub', 'linktree', null]; const socialsOrder = ['onlyfans', 'fansly', 'twitter', 'instagram', 'loyalfans', 'manyvids', 'pornhub', 'linktree', null];
// with month (but not day) precision on either side, the age is still certain unless both dates fall in the same month,
// since only then could the unknown day(s) put the birthday on either side of the reference date
function isAgeApproximate(baseDate, basePrecision, referenceDate, referencePrecision = 'day') {
if (!baseDate || !referenceDate) {
return false;
}
if (basePrecision === 'year' || referencePrecision === 'year') {
return true;
}
if (basePrecision === 'day' && referencePrecision === 'day') {
return false;
}
return baseDate.getMonth() === referenceDate.getMonth();
}
export function curateActor(actor, context = {}) { export function curateActor(actor, context = {}) {
if (!actor) { if (!actor) {
return null; return null;
@@ -97,14 +117,20 @@ export function curateActor(actor, context = {}) {
ageFromBirth: actor.date_of_birth && actor.date_of_birth.getFullYear() > 1 ageFromBirth: actor.date_of_birth && actor.date_of_birth.getFullYear() > 1
? differenceInYears(Date.now(), actor.date_of_birth) ? differenceInYears(Date.now(), actor.date_of_birth)
: null, : null,
ageFromBirthIsApproximate: actor.date_of_birth_precision !== 'day'
&& isAgeApproximate(actor.date_of_birth, actor.date_of_birth_precision, new Date()),
ageAtDeath: actor.date_of_birth && actor.date_of_death && actor.date_of_birth.getFullYear() > 1 ageAtDeath: actor.date_of_birth && actor.date_of_death && actor.date_of_birth.getFullYear() > 1
? differenceInYears(actor.date_of_death, actor.date_of_birth) ? differenceInYears(actor.date_of_death, actor.date_of_birth)
: null, : null,
ageAtDeathIsApproximate: (actor.date_of_birth_precision !== 'day' || actor.date_of_death_precision !== 'day')
&& isAgeApproximate(actor.date_of_birth, actor.date_of_birth_precision, actor.date_of_death, actor.date_of_death_precision),
ageThen: context.sceneDate && actor.date_of_birth && actor.date_of_birth.getFullYear() > 1 ageThen: context.sceneDate && actor.date_of_birth && actor.date_of_birth.getFullYear() > 1
? differenceInYears(context.sceneDate, actor.date_of_birth) ? differenceInYears(context.sceneDate, actor.date_of_birth)
: null, : null,
dateOfBirth: actor.date_of_birth, dateOfBirth: actor.date_of_birth,
dateOfBirthPrecision: actor.date_of_birth_precision,
dateOfDeath: actor.date_of_death, dateOfDeath: actor.date_of_death,
dateOfDeathPrecision: actor.date_of_death_precision,
bust: actor.bust, bust: actor.bust,
cup: actor.cup, cup: actor.cup,
waist: actor.waist, waist: actor.waist,
@@ -1059,6 +1085,7 @@ export async function fetchActorRevisions(revisionId, filters = {}, reqUser) {
'actors_revisions.*', 'actors_revisions.*',
'users.username as username', 'users.username as username',
'reviewers.username as reviewer_username', 'reviewers.username as reviewer_username',
knex.raw('count(*) over() as total'),
) )
.leftJoin('users', 'users.id', 'actors_revisions.user_id') .leftJoin('users', 'users.id', 'actors_revisions.user_id')
.leftJoin('users as reviewers', 'reviewers.id', 'actors_revisions.reviewed_by') .leftJoin('users as reviewers', 'reviewers.id', 'actors_revisions.reviewed_by')
@@ -1105,6 +1132,7 @@ export async function fetchActorRevisions(revisionId, filters = {}, reqUser) {
return { return {
revisions: curatedRevisions, revisions: curatedRevisions,
revision: revisionId && curatedRevisions.find((revision) => revision.id === revisionId), revision: revisionId && curatedRevisions.find((revision) => revision.id === revisionId),
total: Number(revisions[0]?.total) || 0,
avatars, avatars,
}; };
} }
@@ -1183,7 +1211,9 @@ async function applyActorRevision(revisionIds, reqUser) {
'gender', 'gender',
'avatar', 'avatar',
'dateOfBirth', 'dateOfBirth',
'dateOfBirthPrecision',
'dateOfDeath', 'dateOfDeath',
'dateOfDeathPrecision',
'originCountry', 'originCountry',
'originState', 'originState',
'originCity', 'originCity',
+8
View File
@@ -628,6 +628,14 @@ export async function verifyKey(userId, key, req) {
throw new HttpError('The API credentials are not provided.', 401); throw new HttpError('The API credentials are not provided.', 401);
} }
if (typeof userId !== 'number') {
throw new HttpError('User ID is not a number', 400);
}
if (typeof key !== 'string') {
throw new HttpError('Key is not a string', 400);
}
const hashedKey = (await scrypt(key, '', 64)).toString('hex'); // salt redundant for randomly generated key const hashedKey = (await scrypt(key, '', 64)).toString('hex'); // salt redundant for randomly generated key
const storedKey = await knex('users_keys') const storedKey = await knex('users_keys')
+3 -1
View File
@@ -127,7 +127,7 @@ function curateScene(rawScene, assets, reqUser, context) {
title: serie.title, title: serie.title,
poster: context.restriction poster: context.restriction
? null ? null
: (serie.serie_poster, { type: 'poster' }), : curateMedia(serie.serie_poster, { type: 'poster' }),
})), })),
poster: curateMedia(assets.poster, { type: 'poster' }), poster: curateMedia(assets.poster, { type: 'poster' }),
photos: assets.photos?.map((photo) => curateMedia(photo, { type: 'photo' })) || [], photos: assets.photos?.map((photo) => curateMedia(photo, { type: 'photo' })) || [],
@@ -766,6 +766,7 @@ export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
'scenes_revisions.*', 'scenes_revisions.*',
'users.username as username', 'users.username as username',
'reviewers.username as reviewer_username', 'reviewers.username as reviewer_username',
knexOwner.raw('count(*) over() as total'),
) )
.leftJoin('users', 'users.id', 'scenes_revisions.user_id') .leftJoin('users', 'users.id', 'scenes_revisions.user_id')
.leftJoin('users as reviewers', 'reviewers.id', 'scenes_revisions.reviewed_by') .leftJoin('users as reviewers', 'reviewers.id', 'scenes_revisions.reviewed_by')
@@ -824,6 +825,7 @@ export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
return { return {
revisions: curatedRevisions, revisions: curatedRevisions,
revision: revisionId && curatedRevisions.find((revision) => revision.id === revisionId), revision: revisionId && curatedRevisions.find((revision) => revision.id === revisionId),
total: Number(revisions[0]?.total) || 0,
actors, actors,
tags, tags,
movies, movies,
+1 -1
View File
@@ -112,7 +112,7 @@ export async function graphqlApi(req, res) {
return; return;
} }
await verifyKey(req.headers['api-user'], req.headers['api-key'], req); await verifyKey(Number(req.headers['api-user']), req.headers['api-key'], req);
req.user = { req.user = {
id: Number(req.headers['api-user']), id: Number(req.headers['api-user']),
+12
View File
@@ -131,6 +131,7 @@ export const scenesSchema = `
network: Entity network: Entity
actors: [Actor!]! actors: [Actor!]!
tags: [Tag!]! tags: [Tag!]!
chapters: [Chapter!]!
poster: Media poster: Media
trailer: Media trailer: Media
photos: [Media!]! photos: [Media!]!
@@ -160,6 +161,17 @@ export const scenesSchema = `
size: Int size: Int
createdAt: Int createdAt: Int
} }
type Chapter {
id: Int!
time: Int
tags: [Tag!]!
date: Date
duration: Int
description: String
title: String
poster: Media
}
`; `;
function getScope(query) { function getScope(query) {
+1 -1
View File
@@ -119,7 +119,7 @@ export default async function initServer() {
router.use('/api/{*splat}', async (req, _res, next) => { router.use('/api/{*splat}', async (req, _res, next) => {
if (req.headers['api-user']) { if (req.headers['api-user']) {
req.user = await verifyKey(req.headers['api-user'], req.headers['api-key'], req); req.user = await verifyKey(Number(req.headers['api-user']), req.headers['api-key'], req);
} }
next(); next();