fedimbed: still spoiler sensitive text content with no cw (cohost)
This commit is contained in:
parent
77c73e814a
commit
61e8b573b1
1 changed files with 12 additions and 4 deletions
|
@ -183,7 +183,8 @@ async function processUrl(msg, url, spoiler = false) {
|
||||||
timestamp,
|
timestamp,
|
||||||
title,
|
title,
|
||||||
poll,
|
poll,
|
||||||
emotes = [];
|
emotes = [],
|
||||||
|
sensitive = false;
|
||||||
|
|
||||||
// Fetch post
|
// Fetch post
|
||||||
let rawPostData;
|
let rawPostData;
|
||||||
|
@ -374,6 +375,7 @@ async function processUrl(msg, url, spoiler = false) {
|
||||||
emotes = postData2.emojis
|
emotes = postData2.emojis
|
||||||
.filter((x) => !x.name.endsWith("@."))
|
.filter((x) => !x.name.endsWith("@."))
|
||||||
.map((x) => ({name: `:${x.name}:`, url: x.url}));
|
.map((x) => ({name: `:${x.name}:`, url: x.url}));
|
||||||
|
sensitive = postData2.sensitive;
|
||||||
|
|
||||||
const attachments = postData2.media_attachments ?? postData2.files;
|
const attachments = postData2.media_attachments ?? postData2.files;
|
||||||
if (attachments) {
|
if (attachments) {
|
||||||
|
@ -470,6 +472,7 @@ 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;
|
||||||
|
sensitive = postData.sensitive;
|
||||||
|
|
||||||
if (postData.tag) {
|
if (postData.tag) {
|
||||||
let tag = postData.tag;
|
let tag = postData.tag;
|
||||||
|
@ -676,13 +679,18 @@ async function processUrl(msg, url, spoiler = false) {
|
||||||
let desc = "";
|
let desc = "";
|
||||||
let MAX_LENGTH = 3999;
|
let MAX_LENGTH = 3999;
|
||||||
if (
|
if (
|
||||||
cw != "" &&
|
(cw != "" || sensitive) &&
|
||||||
images.length == 0 &&
|
images.length == 0 &&
|
||||||
videos.length == 0 &&
|
videos.length == 0 &&
|
||||||
audios.length == 0
|
audios.length == 0
|
||||||
) {
|
) {
|
||||||
desc += "\u26a0 " + cw + "\n\n||" + content + "||";
|
desc += "||" + content + "||";
|
||||||
MAX_LENGTH -= 8 - cw.length;
|
MAX_LENGTH -= 4;
|
||||||
|
|
||||||
|
if (cw != "") {
|
||||||
|
desc = "\u26a0 " + cw + "\n\n" + desc;
|
||||||
|
MAX_LENGTH -= 4 - cw.length;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
desc = content;
|
desc = content;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue