mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 04:34:15 -04:00
(calendar) fix bluesky bot uploading an empty stream
This commit is contained in:
parent
18ffa6dedd
commit
423cc9fb83
@ -31,6 +31,7 @@ const publishers = {
|
|||||||
|
|
||||||
return tweetResponse.id_str;
|
return tweetResponse.id_str;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -50,6 +51,7 @@ const publishers = {
|
|||||||
console.log(mediaResponse);
|
console.log(mediaResponse);
|
||||||
mediaIds.push(mediaResponse.data.id);
|
mediaIds.push(mediaResponse.data.id);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,6 +67,7 @@ const publishers = {
|
|||||||
console.log(tweetResponse.data);
|
console.log(tweetResponse.data);
|
||||||
return tweetResponse.data.id;
|
return tweetResponse.data.id;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -82,6 +85,7 @@ const publishers = {
|
|||||||
console.log(uploadResponse);
|
console.log(uploadResponse);
|
||||||
media.push(uploadResponse.data.blob);
|
media.push(uploadResponse.data.blob);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,6 +121,7 @@ const publishers = {
|
|||||||
cid: postResponse.cid,
|
cid: postResponse.cid,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -146,16 +151,18 @@ const lastPostId = {};
|
|||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), { encoding: 'binary' });
|
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), { encoding: 'binary' });
|
||||||
let imageStream = null;
|
|
||||||
try {
|
|
||||||
imageStream = fs.createReadStream(imageTmpPath);
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
for (const publisher of process.argv[3].split(',')) {
|
for (const publisher of process.argv[3].split(',')) {
|
||||||
if (!publisher) {
|
if (!publisher) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
console.log(`Publishing: ${publisher}`);
|
console.log(`Publishing: ${publisher}`);
|
||||||
|
|
||||||
|
let imageStream = null;
|
||||||
|
try {
|
||||||
|
imageStream = fs.createReadStream(imageTmpPath);
|
||||||
|
} catch {}
|
||||||
|
|
||||||
const postId = await publishers[publisher](
|
const postId = await publishers[publisher](
|
||||||
message,
|
message,
|
||||||
imageStream,
|
imageStream,
|
||||||
@ -170,6 +177,7 @@ const lastPostId = {};
|
|||||||
lastPostId[publisher] = postId;
|
lastPostId[publisher] = postId;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user