Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
Last active February 25, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrueBrain/22ad7babbc474a57fa8618a681d704b6 to your computer and use it in GitHub Desktop.
Save TrueBrain/22ad7babbc474a57fa8618a681d704b6 to your computer and use it in GitHub Desktop.
Bat shit crazy BaNaNaS idea
github.com/OpenTTD/BaNaNaS
Repository full with meta data
First level folders are the type (AI, Base Graphics, ..)
In these folders are folders with the IDs (in hex) of the uploads.
In there are "branches"; currently unused, but in there is for now a single .ini file.
These ini files are like described in https://github.com/OpenTTD/musa/blob/master/example.ini
They describe the current (latest) upload
Possibly a few references extra to find the file back on the CDN, but those are minor details
For example: MD5 + ID of upload should be in there too
MD5s will be encrypted, to avoid people finding the old MD5s of an ID. ottd_content and frontend are the only ones that needs to be able to decrypt it.
Repository admins can make any change needed
Also contains a blacklist, to avoid uploading certain IDs and MD5s (encrypted too, to avoid making it very easy for people to avoid the blacklist)
A bot will, after any change, update some administrative files
Per user there will be a small list with all the .ini files he/she has access to
A simple file for ottd_content to parse (it needs to know things like "tags" etc)
cdn.openttd.org/BaNaNaS
Storage full with the binaries
First level folder are the type
Second level is the ID (in hex)
In there are all the uploads, based on the MD5
No listing of files on the CDN
bananas.openttd.org
Public listing of all binaries (bit like now, but without the "downloads" column)
More information available, everything in the .ini files
Can decrypt the MD5s to generate URLs
API to serve all the information
Javascript to load everything dynamic
So no static HTML pages per entry (decreases complexity)
Manager-only part, login via GitHub
Small API backend that gives you back the ini files you have access to
Full javascript, you can edit/create an .ini file
Upload binaries via tus/tusd, directly to S3 (based on ID + MD5)
On submit, DorpsGek will make a commit in github.com/OpenTTD/BaNaNaS to update the latest state
ottd_content
The server OpenTTD clients connect to (custom protocol)
Fetches a state-file from github.com/OpenTTD/BaNaNaS, and decrypts the MD5s in there
Returns "content_id" to refer to objects to download
Clients will contact balancer for downloads
ottd_content contains fallback method if HTTP doesn't work, to serve files over this custom protocol
balancer
The server OpenTTD clients connec to in order to fetch files via HTTP
Client makes a POST with all the ids it wants to download, and expects a list of http links in return
Fetches a state-file from github.com/OpenTTD/BaNaNaS, and decrypts the MD5s in there
musa
A CLI upload tool for BaNaNaS
Currently needs musad to run on the server in order to work
New version should simply wrap around the API
GitHub authentication might be the most trickest part
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment