fedimbed: autospoiler if sensitive

This commit is contained in:
Cynthia Foxwell 2023-07-28 10:34:15 -06:00
parent beeee91e2e
commit 0936ce6937

View file

@ -293,6 +293,10 @@ async function processUrl(msg, url, spoiler = false) {
avatar: postData2.account?.avatar ?? postData2.user?.avatarUrl, avatar: postData2.account?.avatar ?? postData2.user?.avatarUrl,
}; };
timestamp = postData2.created_at ?? postData2.createdAt; timestamp = postData2.created_at ?? postData2.createdAt;
if (!spoiler && postData2.sensitive) {
spoiler = true;
}
const attachments = postData2.media_attachments ?? postData2.files; const attachments = postData2.media_attachments ?? postData2.files;
if (attachments) { if (attachments) {
for (const attachment of attachments) { for (const attachment of attachments) {
@ -349,6 +353,9 @@ async function processUrl(msg, url, spoiler = false) {
postData._misskey_content ?? postData.source?.content ?? postData.content; postData._misskey_content ?? postData.source?.content ?? postData.content;
cw = postData.summary; cw = postData.summary;
timestamp = postData.published; timestamp = postData.published;
if (!spoiler && postData.sensitive) {
spoiler = true;
}
// NB: gts doesnt send singular attachments as areay // NB: gts doesnt send singular attachments as areay
const attachments = Array.isArray(postData.attachment) const attachments = Array.isArray(postData.attachment)