Compare commits
No commits in common. "687964cb26d8f33e83a47d409afea991f2704a24" and "899873d651a34df1cd3ee755457b5fafcbcce125" have entirely different histories.
687964cb26
...
899873d651
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx-web",
|
"name": "traxxx-web",
|
||||||
"version": "0.11.3",
|
"version": "0.11.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "0.11.3",
|
"version": "0.11.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@brillout/json-serializer": "^0.5.8",
|
"@brillout/json-serializer": "^0.5.8",
|
||||||
"@dicebear/collection": "^7.0.5",
|
"@dicebear/collection": "^7.0.5",
|
||||||
|
|
|
@ -70,5 +70,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.11.3"
|
"version": "0.11.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ 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 { curateStash } from './stashes.js';
|
import { curateStash } from './stashes.js';
|
||||||
import slugify from '../utils/slugify.js';
|
|
||||||
|
|
||||||
export function curateActor(actor, context = {}) {
|
export function curateActor(actor, context = {}) {
|
||||||
return {
|
return {
|
||||||
|
@ -65,7 +64,7 @@ export function curateActor(actor, context = {}) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sortActorsByGender(actors, context = {}) {
|
export function sortActorsByGender(actors) {
|
||||||
if (!actors) {
|
if (!actors) {
|
||||||
return actors;
|
return actors;
|
||||||
}
|
}
|
||||||
|
@ -73,20 +72,7 @@ export function sortActorsByGender(actors, context = {}) {
|
||||||
const alphaActors = actors.sort((actorA, actorB) => actorA.name.localeCompare(actorB.name, 'en'));
|
const alphaActors = actors.sort((actorA, actorB) => actorA.name.localeCompare(actorB.name, 'en'));
|
||||||
const genderActors = ['transsexual', 'female', 'male', undefined, null].flatMap((gender) => alphaActors.filter((actor) => actor.gender === gender));
|
const genderActors = ['transsexual', 'female', 'male', undefined, null].flatMap((gender) => alphaActors.filter((actor) => actor.gender === gender));
|
||||||
|
|
||||||
const titleSlug = slugify(context.title);
|
return genderActors;
|
||||||
const titleActors = titleSlug ? genderActors.sort((actorA, actorB) => {
|
|
||||||
if (titleSlug.includes(actorA.slug) && !titleSlug.includes(actorB.slug)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (titleSlug.includes(actorB.slug) && !titleSlug.includes(actorA.slug)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}) : alphaActors;
|
|
||||||
|
|
||||||
return titleActors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ function curateScene(rawScene, assets) {
|
||||||
actors: sortActorsByGender(assets.actors.map((actor) => curateActor(actor, {
|
actors: sortActorsByGender(assets.actors.map((actor) => curateActor(actor, {
|
||||||
sceneDate: rawScene.effective_date,
|
sceneDate: rawScene.effective_date,
|
||||||
stashes: assets.actorStashes,
|
stashes: assets.actorStashes,
|
||||||
})), { title: rawScene.title }),
|
}))),
|
||||||
directors: assets.directors.map((director) => ({
|
directors: assets.directors.map((director) => ({
|
||||||
id: director.id,
|
id: director.id,
|
||||||
slug: director.slug,
|
slug: director.slug,
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
const substitutes = {
|
|
||||||
à: 'a',
|
|
||||||
á: 'a',
|
|
||||||
ä: 'a',
|
|
||||||
å: 'a',
|
|
||||||
ã: 'a',
|
|
||||||
æ: 'ae',
|
|
||||||
ç: 'c',
|
|
||||||
è: 'e',
|
|
||||||
é: 'e',
|
|
||||||
ë: 'e',
|
|
||||||
ẽ: 'e',
|
|
||||||
ì: 'i',
|
|
||||||
í: 'i',
|
|
||||||
ï: 'i',
|
|
||||||
ĩ: 'i',
|
|
||||||
ǹ: 'n',
|
|
||||||
ń: 'n',
|
|
||||||
ñ: 'n',
|
|
||||||
ò: 'o',
|
|
||||||
ó: 'o',
|
|
||||||
ö: 'o',
|
|
||||||
õ: 'o',
|
|
||||||
ø: 'o',
|
|
||||||
œ: 'oe',
|
|
||||||
ß: 'ss',
|
|
||||||
ù: 'u',
|
|
||||||
ú: 'u',
|
|
||||||
ü: 'u',
|
|
||||||
ũ: 'u',
|
|
||||||
ỳ: 'y',
|
|
||||||
ý: 'y',
|
|
||||||
ÿ: 'y',
|
|
||||||
ỹ: 'y',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function slugify(strings, delimiter = '-', {
|
|
||||||
encode = false,
|
|
||||||
removeAccents = true,
|
|
||||||
removePunctuation = false,
|
|
||||||
limit = 1000,
|
|
||||||
} = {}) {
|
|
||||||
if (!strings || (typeof strings !== 'string' && !Array.isArray(strings))) {
|
|
||||||
return strings;
|
|
||||||
}
|
|
||||||
|
|
||||||
const slugComponents = []
|
|
||||||
.concat(strings)
|
|
||||||
.filter(Boolean)
|
|
||||||
.flatMap((string) => string
|
|
||||||
.trim()
|
|
||||||
.toLowerCase()
|
|
||||||
.replace(removePunctuation && /[.,:;'"_-]/g, '')
|
|
||||||
.match(/[A-Za-zÀ-ÖØ-öø-ÿ0-9]+/g));
|
|
||||||
|
|
||||||
if (!slugComponents) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const slug = slugComponents.reduce((acc, component, index) => {
|
|
||||||
const accSlug = `${acc}${index > 0 ? delimiter : ''}${component}`;
|
|
||||||
|
|
||||||
if (accSlug.length < limit) {
|
|
||||||
if (removeAccents) {
|
|
||||||
return accSlug.replace(/[à-ÿ]/g, (match) => substitutes[match] || '');
|
|
||||||
}
|
|
||||||
|
|
||||||
return accSlug;
|
|
||||||
}
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, '');
|
|
||||||
|
|
||||||
return encode ? encodeURI(slug) : slug;
|
|
||||||
}
|
|
Loading…
Reference in New Issue