* chore(deps-dev): bump eslint-plugin-unicorn from 64.0.0 to 65.0.0 Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 64.0.0 to 65.0.0. - [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases) - [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v64.0.0...v65.0.0) --- updated-dependencies: - dependency-name: eslint-plugin-unicorn dependency-version: 65.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix: no-array-from-fill * fix: unicorn-js/no-duplicate-set-values * fix: no-this-outside-of-class * fix: no-unnecessary-nested-ternary * fix: prefer-array-last-methods * fix: prefer-queue-microtask * fix: prefer-split-limit * fix: no-array-from-fill * fix: no-unused-array-method-return * fix: prefer-single-call * fix: prefer-includes-over-repeated-comparisons * fix: consistent-compound-words * fix: prefer-includes-over-repeated-comparisons * chore: add eslint-plugin-unicorn v65 recommended preset * fix: correct duration parsing logic in parseDuration function * fix: update oxlint-disable --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tony <TonyRL@users.noreply.github.com>
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import type { Route } from '@/types';
|
|
import { parseDate } from '@/utils/parse-date';
|
|
|
|
import { baseUrl, getAccountByUsername, getTimelineByAccountId, parseDescription } from './utils';
|
|
|
|
export const route: Route = {
|
|
path: '/user/:username',
|
|
categories: ['social-media'],
|
|
example: '/fansly/user/AeriGoMoo',
|
|
parameters: { username: 'User ID' },
|
|
features: {
|
|
requireConfig: false,
|
|
requirePuppeteer: false,
|
|
antiCrawler: false,
|
|
supportBT: false,
|
|
supportPodcast: false,
|
|
supportScihub: false,
|
|
nsfw: true,
|
|
},
|
|
radar: [
|
|
{
|
|
source: ['fansly.com/:username/posts', 'fansly.com/:username/media'],
|
|
},
|
|
],
|
|
name: 'User Timeline',
|
|
maintainers: ['TonyRL'],
|
|
handler,
|
|
};
|
|
|
|
async function handler(ctx) {
|
|
const username = ctx.req.param('username');
|
|
|
|
const account = await getAccountByUsername(username);
|
|
const timeline = await getTimelineByAccountId(account.id);
|
|
|
|
const items = timeline.posts.map((post) => ({
|
|
title: post.content.split('\n', 1)[0],
|
|
description: parseDescription(post, timeline),
|
|
pubDate: parseDate(post.createdAt, 'X'),
|
|
link: `${baseUrl}/post/${post.id}`,
|
|
author: `${account.displayName ?? account.username} (@${account.username})`,
|
|
}));
|
|
|
|
return {
|
|
title: `${account.displayName ?? account.username} (@${account.username}) - Fansly`,
|
|
link: `${baseUrl}/${account.username}`,
|
|
description: account.about.replaceAll('\n', ' '),
|
|
image: account.banner.locations[0].location,
|
|
icon: account.avatar.locations[0].location,
|
|
logo: account.avatar.locations[0].location,
|
|
language: 'en',
|
|
allowEmpty: true,
|
|
item: items,
|
|
};
|
|
}
|