Compare commits

..

No commits in common. "044c8c0ce57e55953fae8c2795ef404abe994bee" and "e691aedc73884ca6bea304e05f968f0d4c6e0c03" have entirely different histories.

7 changed files with 58 additions and 38 deletions

View File

@ -244,25 +244,25 @@
<div class="descriptions-container"> <div class="descriptions-container">
<div <div
v-if="descriptions.length > 0" v-if="actor.descriptions && actor.descriptions.length > 0"
class="descriptions" class="descriptions"
> >
<p <p
v-for="description in descriptions" v-for="description in actor.descriptions"
:key="`description-${description.entity.id}`" :key="`description-${description.entity.id}`"
class="description" class="description"
> >
{{ description.text }} {{ description.text }}
<a :href="`/${description.entity.type}/${description.entity.slug}`"> <a :href="`/${description.entity.type}/${description.entity.slug}`">
<img <img
v-if="description.entity.type === 'network' || !description.entity.parent || description.entity.isIndependent" v-if="description.entity.type === 'network' || !description.entity.parent || description.entity.independent"
:src="`/logos/${description.entity.slug}/thumbs/network.png`" :src="`/img/logos/${description.entity.slug}/thumbs/network.png`"
class="description-logo" class="description-logo"
> >
<img <img
v-else v-else
:src="`/logos/${description.entity.parent.slug}/thumbs/${description.entity.slug}.png`" :src="`/img/logos/${description.entity.parent.slug}/thumbs/${description.entity.slug}.png`"
class="description-logo" class="description-logo"
> >
</a> </a>
@ -325,13 +325,6 @@ const showExpand = [
'waist', 'waist',
'weight', 'weight',
].some((attribute) => !!props.actor[attribute]); ].some((attribute) => !!props.actor[attribute]);
const descriptions = Object.values(Object.fromEntries(props.actor.profiles
.filter((profile) => !!profile.description)
.map((profile) => [profile.descriptionHash, {
text: profile.description,
entity: profile.entity,
}])));
</script> </script>
<style> <style>

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "traxxx-web", "name": "traxxx-web",
"version": "0.23.10", "version": "0.23.9",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "0.23.10", "version": "0.23.9",
"dependencies": { "dependencies": {
"@brillout/json-serializer": "^0.5.8", "@brillout/json-serializer": "^0.5.8",
"@dicebear/collection": "^7.0.5", "@dicebear/collection": "^7.0.5",

View File

@ -77,5 +77,5 @@
"postcss-custom-media": "^10.0.2", "postcss-custom-media": "^10.0.2",
"postcss-nesting": "^12.0.2" "postcss-nesting": "^12.0.2"
}, },
"version": "0.23.10" "version": "0.23.9"
} }

View File

@ -72,12 +72,13 @@ const pageContext = inject('pageContext');
const { pageProps } = pageContext; const { pageProps } = pageContext;
const { actor } = pageProps; const { actor } = pageProps;
const photos = actor.profiles const photos = [
.filter((profile) => !!profile.avatar) actor.avatar && {
.map((profile) => ({ ...actor.avatar,
...profile.avatar, isAvatar: true,
isAvatar: profile.avatar.id === actor.avatar.id, },
})); ...actor.photos,
].filter(Boolean);
</script> </script>
<style scoped> <style scoped>

View File

@ -6,8 +6,6 @@ import { knexOwner as knex, knexManticore } from './knex.js';
import { utilsApi } from './manticore.js'; import { utilsApi } from './manticore.js';
import { HttpError } from './errors.js'; import { HttpError } from './errors.js';
import { fetchCountriesByAlpha2 } from './countries.js'; import { fetchCountriesByAlpha2 } from './countries.js';
import { curateEntity } from './entities.js';
import { curateMedia } from './media.js';
import { curateStash } from './stashes.js'; import { curateStash } from './stashes.js';
import escape from '../utils/escape-manticore.js'; import escape from '../utils/escape-manticore.js';
import slugify from '../utils/slugify.js'; import slugify from '../utils/slugify.js';
@ -55,13 +53,25 @@ export function curateActor(actor, context = {}) {
alias: actor.residence_country_alias, alias: actor.residence_country_alias,
}, },
}, },
avatar: curateMedia(actor.avatar), avatar: actor.avatar && {
profiles: context.profiles?.map((profile) => ({ id: actor.avatar.id,
id: profile.id, path: actor.avatar.path,
description: profile.description, thumbnail: actor.avatar.thumbnail,
descriptionHash: profile.description_hash, lazy: actor.avatar.lazy,
entity: curateEntity({ ...profile.entity, parent: profile.parent_entity }), width: actor.avatar.width,
avatar: curateMedia(profile.avatar), height: actor.avatar.height,
isS3: actor.avatar.is_s3,
credit: actor.avatar.credit,
},
photos: context.photos?.map((photo) => ({
id: photo.id,
path: photo.path,
thumbnail: photo.thumbnail,
lazy: photo.lazy,
width: photo.width,
height: photo.height,
isS3: photo.is_s3,
credit: photo.credit,
})), })),
createdAt: actor.created_at, createdAt: actor.created_at,
updatedAt: actor.updated_at, updatedAt: actor.updated_at,
@ -99,7 +109,7 @@ export function sortActorsByGender(actors, context = {}) {
} }
export async function fetchActorsById(actorIds, options = {}, reqUser) { export async function fetchActorsById(actorIds, options = {}, reqUser) {
const [actors, profiles, stashes] = await Promise.all([ const [actors, photos, stashes] = await Promise.all([
knex('actors') knex('actors')
.select( .select(
'actors.*', 'actors.*',
@ -119,13 +129,13 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
} }
}), }),
knex('actors_profiles') knex('actors_profiles')
.select('actors_profiles.*', knex.raw('row_to_json(entities) as entity'), knex.raw('row_to_json(parents) as parent_entity'), knex.raw('row_to_json(media) as avatar')) .select('actors_profiles.actor_id', 'media.*')
.leftJoin('actors', 'actors.id', 'actors_profiles.actor_id') .leftJoin('actors', 'actors.id', 'actors_profiles.actor_id')
.leftJoin('entities', 'entities.id', 'actors_profiles.entity_id')
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
.leftJoin('media', 'media.id', 'actors_profiles.avatar_media_id') .leftJoin('media', 'media.id', 'actors_profiles.avatar_media_id')
.whereIn('actor_id', actorIds) .whereIn('actor_id', actorIds)
.groupBy('actors_profiles.id', 'entities.id', 'parents.id', 'media.id'), .whereNotNull('actors_profiles.avatar_media_id')
.whereNot('actors_profiles.avatar_media_id', knex.raw('actors.avatar_media_id')) // don't include main avatar as photo
.groupBy('actors_profiles.actor_id', 'media.id', 'media.hash'),
reqUser reqUser
? knex('stashes_actors') ? knex('stashes_actors')
.leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id') .leftJoin('stashes', 'stashes.id', 'stashes_actors.stash_id')
@ -151,7 +161,7 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
return curateActor(actor, { return curateActor(actor, {
stashes: stashes.filter((stash) => stash.actor_id === actor.id), stashes: stashes.filter((stash) => stash.actor_id === actor.id),
profiles: profiles.filter((profile) => profile.actor_id === actor.id), photos: photos.filter((photo) => photo.actor_id === actor.id),
append: options.append, append: options.append,
}); });
}).filter(Boolean); }).filter(Boolean);

View File

@ -11,6 +11,5 @@ export function curateMedia(media) {
isS3: media.is_s3, isS3: media.is_s3,
width: media.width, width: media.width,
height: media.height, height: media.height,
index: media.index,
}; };
} }

View File

@ -8,10 +8,27 @@ import { fetchActorsById, curateActor, sortActorsByGender } from './actors.js';
import { fetchTagsById } from './tags.js'; import { fetchTagsById } from './tags.js';
import { fetchEntitiesById } from './entities.js'; import { fetchEntitiesById } from './entities.js';
import { curateStash } from './stashes.js'; import { curateStash } from './stashes.js';
import { curateMedia } from './media.js';
import escape from '../utils/escape-manticore.js'; import escape from '../utils/escape-manticore.js';
import promiseProps from '../utils/promise-props.js'; import promiseProps from '../utils/promise-props.js';
function curateMedia(media) {
if (!media) {
return null;
}
return {
id: media.id,
path: media.path,
thumbnail: media.thumbnail,
lazy: media.lazy,
hash: media.hash,
isS3: media.is_s3,
width: media.width,
height: media.height,
index: media.index,
};
}
function curateScene(rawScene, assets) { function curateScene(rawScene, assets) {
if (!rawScene) { if (!rawScene) {
return null; return null;