summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/web/feed.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-09-18 03:27:08 +0900
committerGitHub <noreply@github.com>2022-09-18 03:27:08 +0900
commitb75184ec8e3436200bacdcd832e3324702553d20 (patch)
tree8b7e316f29e95df921db57289c8b8da476d18f07 /packages/backend/src/server/web/feed.ts
parentUpdate ROADMAP.md (diff)
downloadmisskey-b75184ec8e3436200bacdcd832e3324702553d20.tar.gz
misskey-b75184ec8e3436200bacdcd832e3324702553d20.tar.bz2
misskey-b75184ec8e3436200bacdcd832e3324702553d20.zip
なんかもうめっちゃ変えた
Diffstat (limited to 'packages/backend/src/server/web/feed.ts')
-rw-r--r--packages/backend/src/server/web/feed.ts58
1 files changed, 0 insertions, 58 deletions
diff --git a/packages/backend/src/server/web/feed.ts b/packages/backend/src/server/web/feed.ts
deleted file mode 100644
index 4abe2885cf..0000000000
--- a/packages/backend/src/server/web/feed.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { Feed } from 'feed';
-import { In, IsNull } from 'typeorm';
-import config from '@/config/index.js';
-import { User } from '@/models/entities/user.js';
-import { Notes, DriveFiles, UserProfiles, Users } from '@/models/index.js';
-
-export default async function(user: User) {
- const author = {
- link: `${config.url}/@${user.username}`,
- name: user.name || user.username,
- };
-
- const profile = await UserProfiles.findOneByOrFail({ userId: user.id });
-
- const notes = await Notes.find({
- where: {
- userId: user.id,
- renoteId: IsNull(),
- visibility: In(['public', 'home']),
- },
- order: { createdAt: -1 },
- take: 20,
- });
-
- const feed = new Feed({
- id: author.link,
- title: `${author.name} (@${user.username}@${config.host})`,
- updated: notes[0].createdAt,
- generator: 'Misskey',
- description: `${user.notesCount} Notes, ${profile.ffVisibility === 'public' ? user.followingCount : '?'} Following, ${profile.ffVisibility === 'public' ? user.followersCount : '?'} Followers${profile.description ? ` · ${profile.description}` : ''}`,
- link: author.link,
- image: await Users.getAvatarUrl(user),
- feedLinks: {
- json: `${author.link}.json`,
- atom: `${author.link}.atom`,
- },
- author,
- copyright: user.name || user.username,
- });
-
- for (const note of notes) {
- const files = note.fileIds.length > 0 ? await DriveFiles.findBy({
- id: In(note.fileIds),
- }) : [];
- const file = files.find(file => file.type.startsWith('image/'));
-
- feed.addItem({
- title: `New note by ${author.name}`,
- link: `${config.url}/notes/${note.id}`,
- date: note.createdAt,
- description: note.cw || undefined,
- content: note.text || undefined,
- image: file ? DriveFiles.getPublicUrl(file) || undefined : undefined,
- });
- }
-
- return feed;
-}