|
|
|
@ -8,8 +8,17 @@ export class MastodonHandler extends Mastodon{
|
|
|
|
|
console.log(resp.data);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
postMedia(status, mediaPath){
|
|
|
|
|
postMedia(status, mediaPath, retry, onError){
|
|
|
|
|
this.post('media', { file: fs.createReadStream(mediaPath) }).then(resp => {
|
|
|
|
|
if (retry <= 0){
|
|
|
|
|
onError();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!resp.data.id){
|
|
|
|
|
this.postMedia(status, mediaPath, --retry);
|
|
|
|
|
console.log("issue while uploading, retry")
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let id = resp.data.id;
|
|
|
|
|
console.log("media uploaded => ");
|
|
|
|
|
console.log(resp.data);
|
|
|
|
|