hylyh / node-mastodon Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ttezel/twit
Mastodon API Client for node
Home Page: https://www.npmjs.com/package/mastodon
License: Other
This project forked from ttezel/twit
Mastodon API Client for node
Home Page: https://www.npmjs.com/package/mastodon
License: Other
Would be great if we could pass custom headers. For example, 'Idempotency-Key' for statuses.
Perhaps this would be possible if we pass path
as an object i.e.
{ path: 'statuses', headers: { 'Idempotency-Key': '<whatever>' } }
for some reason ~70% of the time i submit a media post, i get a missing image as the result.
my code
if (!is.bad(img)) {
console.log(`file exists: ${fs.existsSync(img)}`)
const res = await M.post('media', {
file: fs.createReadStream(img)
})
console.log(JSON.stringify(res.data))
out.push(res.data.id)
}
the result
stream: ./img/upload_wikimedia_org_wikipedia_commons_5_5d_Pan-bagnat_1_jpg.jpg
file exists: true
result: {"id":"72087","type":"unknown","url":"https://bofa.lol/files/original/missing.png","preview_url":"https://bofa.lol/files/small/missing.png","remote_url":null,"text_url":"https://bofa.lol/media/xgv6Lhvuj4gzXWcY3w4","meta":null,"description":null}
I get an image that is invalid every time I upload through the API, but looks to be fine on my computer. I'm using Pleroma for my instance, and the following code to upload my image.
event.api.post('media',{
file: fs.createReadStream("./tmp.png")
}).then(resp => {
console.log(resp.data.id + " " + resp.data.url)
}).catch(err => {
console.log("[ERROR]\t" + err.message);
});
Here's one of the resulting uploads: https://lasershark.army/media/348b4ea0-9858-4b61-a205-04f7ebcb132d/tmp.png
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.