add folder image in config post

This commit is contained in:
Tykayn 2022-12-07 23:26:55 +01:00 committed by tykayn
parent e3b97160a2
commit 656e1e43fd
2 changed files with 3 additions and 1 deletions

View File

@ -55,6 +55,7 @@ ${filteredExcerpt}
.then((res) => {
// suite du poste avec upload d'image
console.log('on envoie le media et l image')
configPost.folder_image = folderBlogPostsPreview;
configPost.image = 'media_post_' + postObject.post_name + '.jpg';
sendPostMastodon(configPost)

View File

@ -25,6 +25,7 @@ export let defaultConfigMasto = {
sensitive: false,
reallySendPost: false,
image: '',
folder_image: 'assets/',
message: "Hey coucou! on est le" + nowDate,
scheduled_at: "",
content_type: "text/markdown"
@ -103,7 +104,7 @@ export default function sendPostMastodon(config) {
var id;
console.log("envoi du média", config.image)
// upload new media
return masto.post('media', {file: fs.createReadStream('assets/' + config.image)})
return masto.post('media', {file: fs.createReadStream(config.folder_image + config.image)})
.then(resp => {
id = resp.data.id;
params.media_ids = [id]