mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
Merge branch 'develop' of codeberg.org:calckey/calckey into develop
This commit is contained in:
commit
e0a9a6e891
@ -81,47 +81,49 @@ export async function importPosts(
|
||||
} else if (parsed instanceof Object) {
|
||||
logger.info("Parsing animal style posts");
|
||||
for (const post of parsed.orderedItems) {
|
||||
try {
|
||||
linenum++;
|
||||
let reply: Note | null = null;
|
||||
if (post.object.inReplyTo != null) {
|
||||
reply = await resolveNote(post.object.inReplyTo);
|
||||
}
|
||||
if (post.directMessage) {
|
||||
continue;
|
||||
}
|
||||
if (job.data.signatureCheck) {
|
||||
if (!post.signature) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let text;
|
||||
async () => {
|
||||
try {
|
||||
text = htmlToMfm(post.object.content, post.object.tag);
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
logger.info(`Posting[${linenum}] ...`);
|
||||
linenum++;
|
||||
let reply: Note | null = null;
|
||||
if (post.object.inReplyTo != null) {
|
||||
reply = await resolveNote(post.object.inReplyTo);
|
||||
}
|
||||
if (post.directMessage) {
|
||||
return;
|
||||
}
|
||||
if (job.data.signatureCheck) {
|
||||
if (!post.signature) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let text;
|
||||
try {
|
||||
text = htmlToMfm(post.object.content, post.object.tag);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
logger.info(`Posting[${linenum}] ...`);
|
||||
|
||||
const note = await create(user, {
|
||||
createdAt: new Date(post.object.published),
|
||||
files: undefined,
|
||||
poll: undefined,
|
||||
text: text || undefined,
|
||||
reply,
|
||||
renote: null,
|
||||
cw: post.sensitive,
|
||||
localOnly: false,
|
||||
visibility: "hidden",
|
||||
visibleUsers: [],
|
||||
channel: null,
|
||||
apMentions: new Array(0),
|
||||
apHashtags: undefined,
|
||||
apEmojis: undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
logger.warn(`Error in line:${linenum} ${e}`);
|
||||
}
|
||||
const note = await create(user, {
|
||||
createdAt: new Date(post.object.published),
|
||||
files: undefined,
|
||||
poll: undefined,
|
||||
text: text || undefined,
|
||||
reply,
|
||||
renote: null,
|
||||
cw: post.sensitive,
|
||||
localOnly: false,
|
||||
visibility: "hidden",
|
||||
visibleUsers: [],
|
||||
channel: null,
|
||||
apMentions: new Array(0),
|
||||
apHashtags: undefined,
|
||||
apEmojis: undefined,
|
||||
});
|
||||
} catch (e) {
|
||||
logger.warn(`Error in line:${linenum} ${e}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user