Using common for socials definitions.

This commit is contained in:
DebaucheryLibrarian 2025-12-28 06:00:46 +01:00
parent 2b338e32eb
commit 8d6da08519
5 changed files with 5 additions and 33 deletions

2
common

@ -1 +1 @@
Subproject commit dc00c3d58af2c23530b8b3cb6704f3860fdd7d0f Subproject commit c45852d6937abe25e1205af0b9b96d49970901c8

View File

@ -67,25 +67,6 @@ module.exports = {
bans: { bans: {
defaultExpiry: 60 * 24 * 3, // in minutes, 3 days defaultExpiry: 60 * 24 * 3, // in minutes, 3 days
}, },
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/',
},
},
apiAccess: { apiAccess: {
graphqlEnabled: true, graphqlEnabled: true,
keySize: 24, // bytes keySize: 24, // bytes

View File

@ -19,7 +19,7 @@ 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';
import { curateRevision } from './revisions.js'; import { curateRevision } from './revisions.js';
import { interpolateProfiles } from '../common/actors.mjs'; // eslint-disable-line import/namespace import { interpolateProfiles, platformsByHostname } from '../common/actors.mjs'; // eslint-disable-line import/namespace
import { resolvePlace } from '../common/geo.mjs'; // eslint-disable-line import/namespace import { resolvePlace } from '../common/geo.mjs'; // eslint-disable-line import/namespace
const logger = initLogger(); const logger = initLogger();
@ -824,16 +824,6 @@ function convertWeight(weight, units) {
return Number(weight) || null; return Number(weight) || null;
} }
const platformsByHostname = Object.fromEntries(Object.entries(config.socials.urls).map(([platform, url]) => {
const { hostname, pathname } = new URL(url);
return [hostname, {
platform,
pathname: decodeURIComponent(pathname),
url,
}];
}));
function curateSocials(socials) { function curateSocials(socials) {
return socials.map((social) => { return socials.map((social) => {
if (!social.handle && !social.url) { if (!social.handle && !social.url) {

View File

@ -4,6 +4,7 @@ import { renderPage } from 'vike/server'; // eslint-disable-line import/extensio
import { fetchUserStashes } from '../stashes.js'; import { fetchUserStashes } from '../stashes.js';
import { fetchUserTemplates } from '../users.js'; import { fetchUserTemplates } from '../users.js';
import { fetchUnseenNotificationsCount } from '../alerts.js'; import { fetchUnseenNotificationsCount } from '../alerts.js';
import { socials } from '../../common/actors.mjs'; // eslint-disable-line import/namespace
export default async function mainHandler(req, res, next) { export default async function mainHandler(req, res, next) {
const [stashes, templates, unseenNotifications] = req.user ? await Promise.all([ const [stashes, templates, unseenNotifications] = req.user ? await Promise.all([
@ -43,7 +44,7 @@ export default async function mainHandler(req, res, next) {
media: config.media, media: config.media,
psa: config.psa, psa: config.psa,
links: config.links, links: config.links,
socials: config.socials, socials,
}, },
meta: { meta: {
now: new Date().toISOString(), now: new Date().toISOString(),

2
static

@ -1 +1 @@
Subproject commit a24825ba1042dabfc488e72e934f08f9f4629000 Subproject commit 475141c733eb1f1a76c179f4f9bbacadbad0186a