Created for storing media in our server as discord recent changes to attachments storage policy affects FiveM servers. I have seen other servers using solutions like Imgur and FiveManage (managed) which for me arent reliable enough.
- Uploads media/images/audio to the cache server and get them deleted after time.
- Works like a webhook so there is no need for reworking old webhook methods.
You can use pm2 or nodemon in case your server crashes somehow and auto-restart it.
40MB is the limit for files even tho you can extend this limit for file extensions.
- Requires NodeJS installed in your server and writing/reading permissions in the upload directory
npm install
npm start app.js
Server has two basic endpoints, you could create one for uploads that you dont want them to expire or whatever needs you have. (MDT or other scripts, requires coding)
Requires multipart requests (by default in FiveM), accepts binary data.
Only requires the image name to be stored in client.
So in very basic terms you would upload to http://127.0.0.1:3000/upload
And retrieve them from http://127.0.0.1:3000/uploads/delete-this.txt being delete-this.txt your stored file.
As this is working as a discord-webhook like replica, we are not able to use Bearers or other kind-of tokens to disallow malicious behaviour (running out-of-space, flood with fake images., etc.), however I recommend you to log the requests in order to grab this behaviour.
If you need help setting up nginx and cloudflare, i will link you one guide:
(docs.nginx.com): Create a Reverse-Proxy using nginx
(rackspace.com): Increase Nginx max file size policy
You have to create your A register on your domain provider, we use cloudflare, so we have it like this.
Here is what my config looks like in nginx. You still need to create the A register in your domain.
You have to append your domain name in server_name
server_name api.jonirulah.net;
And then edit the existing code to send the correct links to your storage
http://127.0.0.1:3000/upload to https://api.jonirulah.net/upload (example)