Compare commits

...

11 Commits

Author SHA1 Message Date
1374f90397 1.3.3 2026-02-07 17:19:22 +01:00
33733720c5 Added avatar credit exclusion to profile interpolation. 2026-02-07 17:19:20 +01:00
ec4b15ce33 1.3.2 2026-01-09 02:09:21 +01:00
3f6f3ed038 Removed slugify. 2026-01-09 02:09:19 +01:00
ee23dc0358 1.3.1 2026-01-09 01:51:47 +01:00
b2305966ed Using CommonJS for slugify. 2026-01-09 01:51:45 +01:00
0c9917fc27 1.3.0 2026-01-09 01:49:37 +01:00
fda6f5cb93 Added slugify. 2026-01-09 01:49:28 +01:00
c45852d693 Added twitter.com to socials hostname index. 2025-12-28 05:59:14 +01:00
4b90a5feec 1.2.10 2025-12-28 05:37:27 +01:00
b9ee4e1c90 Added socials config. 2025-12-28 05:37:21 +01:00
3 changed files with 42 additions and 5 deletions

View File

@@ -164,14 +164,14 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {}
profile.avatar_media_id = actorProfiles
.map((actorProfile) => actorProfile.avatar)
.filter((avatar) => avatar && (avatar.entropy === null || avatar.entropy > 5.5))
.filter((avatar) => avatar && (avatar.entropy === null || avatar.entropy > 5.5) && !options.avoidAvatarCredits?.includes(avatar.credit) && !options.excludeAvatarCredits?.includes(avatar.credit))
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
if (!profile.avatar_media_id) {
// try to settle for low quality avatar
profile.avatar_media_id = actorProfiles
.map((actorProfile) => actorProfile.avatar)
.filter((avatar) => avatar)
.filter((avatar) => !!avatar && !options?.excludeAvatarCredits?.includes(avatar.credit))
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
}
@@ -222,3 +222,40 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {}
await context.knex.schema.refreshMaterializedView('actors_meta');
}
}
export const socials = {
urls: {
cashapp: 'https://cash.app/${handle}', // eslint-disable-line no-template-curly-in-string
fansly: 'https://fansly.com/{handle}',
instagram: 'https://www.instagram.com/{handle}',
linktree: 'https://linktr.ee/{handle}',
loyalfans: 'https://www.loyalfans.com/{handle}',
manyvids: 'https://{handle}.manyvids.com',
onlyfans: 'https://onlyfans.com/{handle}',
pornhub: 'https://www.pornhub.com/model/{handle}',
reddit: 'https://www.reddit.com/u/{handle}',
twitter: 'https://x.com/{handle}',
},
prefix: {
default: '@',
cashapp: '$',
reddit: 'u/',
},
};
export const platformsByHostname = {
...Object.fromEntries(Object.entries(socials.urls).map(([platform, url]) => {
const { hostname, pathname } = new URL(url);
return [hostname, {
platform,
pathname: decodeURIComponent(pathname),
url,
}];
})),
'twitter.com': {
platform: 'twitter',
pathname: '/{handle}',
url: 'https://twitter.com/{handle}',
},
};

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "traxxx-utils",
"version": "1.2.9",
"version": "1.3.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "traxxx-utils",
"version": "1.2.9",
"version": "1.3.3",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.25.7",

View File

@@ -1,6 +1,6 @@
{
"name": "traxxx-common",
"version": "1.2.9",
"version": "1.3.3",
"description": "Common utilities for traxxx core and web.",
"main": "src/app.js",
"scripts": {