The API(ary) journey
So... I made an API.
Javascript...
Oh Javascript... hauning me for ages and it so happens that it is not as hard as I thought! Yeah, I might have only used like, 0.1% of it, but it was worth it :)
What does it do?
For now, the API only allows one kind of request (or two if you count the else), and that is "/byebye-forcedownload". Why such an specific name? Well, in college we use Moodle, a very common thing to do in this kinds of environments, besides, I believe they self-host it, which is a very neat thing to be quite honest.
Anyways, they upload some files over there, like exams, tests, homework and whatnot, and it's mostly fine... except for that ?forcedownload=1 that some teachers add to the links! It drives me nuts! I just wanted to check my grade, not download the whole .pdf into my computer involuntarily... So that's basically what it does! It receives an URL, checks if it has the forcedownload flag, and if it does, it changes the 1 to a 0, returning a URL that I can finally use without worrying about changing it.
How do I use it?
ShareX! (or a curl request when I'm in Fedora). Pretty useful!
![ShareX custom uploader settings depicting the settings for the API](https://blog.intron014.com/content/images/2023/05/image-5.png)
I have it in a Cloudflare Workers so I don't need to have it in my server, where I have to rely on Contabo, I'd pretty much rather rely on Cloudflare's infraestructure. It's pretty easy to be honest, I really thought having an API of your own was going to be a pain in the butt, but hey! It wasn't!
![A graph showing the usage of the Workers instance](https://blog.intron014.com/content/images/2023/05/image-3.png)
Anyways... That's pretty much it! It's not as exciting as getting locked out of Portainer, but it's something I wanted to shout to the world...