mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
* feat(route): add misskey featured notes * fix note.art Co-authored-by: TonyRL <TonyRL@users.noreply.github.com> --------- Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
32 lines
977 B
JavaScript
32 lines
977 B
JavaScript
const { art } = require('@/utils/render');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
const path = require('path');
|
|
|
|
const allowSiteList = ['misskey.io', 'madost.one', 'mk.nixnet.social'];
|
|
|
|
// docs on: https://misskey-hub.net/docs/api/entity/note.html
|
|
const parseNotes = (data, site) =>
|
|
data.map((item) => {
|
|
const host = item.user.host === null ? site : item.user.host;
|
|
const author = `${item.user.name} (@${item.user.username}@${host})`;
|
|
const description = art(path.join(__dirname, 'templates/note.art'), {
|
|
text: item.text,
|
|
files: item.files,
|
|
});
|
|
const title = `${author}: "${description}"`;
|
|
const link = `https://${host}/notes/${item.id}`;
|
|
const pubDate = parseDate(item.createdAt);
|
|
return {
|
|
title,
|
|
description,
|
|
pubDate,
|
|
link,
|
|
author,
|
|
};
|
|
});
|
|
|
|
module.exports = {
|
|
parseNotes,
|
|
allowSiteList,
|
|
};
|