- Generates changelogs automatically from device trees in your org
- Create a changelog-page to telegraph
- Upload builds to your GDrive
- Posts automatically builds with changelogs, device name, rom banner, maintainer name and download link in your telegram channel
- Docker support
- Firebase support
- Checkout SwaggerHUB for requests
Generated log example
- Clone this repo, install requirements and generate Google Drive token:
$ git clone https://github.com/roms-api-backend
$ cd roms-api-backend
$ python3 -m pip install -r requirements.txt
$ python3 starter.py
Click here for more details
Fill up rest of the fields. Meaning of each fields are described below:
- devices_org: This is the name of your github organization.
- github_token: This is your github token.
- drive_id: This is the folder ID of the Google Drive Folder to where you upload your builds.
- firebase_cred_file: This is the path to your firebase credential file.
- firebase_project_id: This the id of your firebase project id, check url after you created a project
- firebase_collection_user: This is the name of the collection for user authentification.
- firebase_collection_admin: This is the name of the collection for admin authentification.
- firebase_rldb: This is the url of your firebase realtime database.
- firebase_rldb_builds_db: This is the collection name where save informations about builds.
- rom_name: This is the name of your rom.
- author_name: This is the author name for telegraph posts.
- rom_pic_url: This the rom banner url
- telegram_token: The telegram bot token that you get from @Bot
- channel_name: This is the name of your telegram channel for example @channel123
- support_group: This is the support group name for example @mrv8x
- devices_url: This is the direct link to your devices.yaml file in your organization
- Visit Firebase Console
- Create a project
- Type in a project name
- Create a Firestore Database and choose Productionmode
- Go to Projectsettings and go to service account, then click on Firebase Admin SDK and create your private key (add it later to roms-api-backend as firebase_credentials.json)
- Create a Realtime Database and choose lockmode
- Copy your database url (in config: firebase_rldb)
- Visit the Google Cloud Console
- Go to the OAuth Consent tab, fill it, and save.
- Go to the Credentials tab and click Create Credentials -> OAuth Client ID
- Choose Desktop and Create.
- Use the download button to download your credentials.
- Move that file to the root of roms-api-backend, and rename it to credentials.json
- Visit Google API page
- Search for Drive and enable it, if it is disabled
- Finally, start roms-api-backend and generate your token.json file for Google Drive:
$ python3 starter.py
- Please execute only after the firebase instance has been created and the config file is complete!
- The return value will be your token, you need this token to upload builds and add other users
$ python3 starter.py DEVICE USERNAME
$ curl -X POST -d \
'{"devices":["YOURDEVICE"],"token":"YOURADMINTOKEN","name":"NEWUSER","admin":"ADMINNAME"}' \
http://GET.YOUROWN.DOMAIN/auth/add_user
Click here for more details
Replace rest of the fields. Meaning of each fields are described below:
- devices: Add one or several devices with their codenames from new user
- token: Admin authentication token
- name: Name from new user
- admin: Name from Admin
- Create in your organization a repository, for example official_devices, and add a devices.yaml file like here with same syntax
- You have to use the predefined fields, otherwise the program may not work.
-
Clone Traefik-Configs and follow the instructions in readme file
-
Create your Google Drive token:
$ python3 starter.py
- Build Docker image:
$ sudo docker build . -t backend
-
Replace your domain name in docker-compose-yml
-
Run the image, if you replaced your domain name in docker-compose.yml:
$ sudo docker-compose up -d
$ python3 -m uvicorn api:app --reload --host 0.0.0.0 (use gunicorn in production)
This is an example for uploading builds. Replace your values with ones written in caps lock.
$ curl -X 'POST' 'https://api.YOUR.DOMAIN/api/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'codename=DEVICENAME'
-F 'version=YOURANDROIDVERSION' \
-F 'username=YOURUSERNAME' \
-F 'file=@PATH/TO/YOUR/BUILD.ZIP;type=text/plain' \
-F 'token=YOURTOKEN' \
Click here for more details
Replace rest of the fields. Meaning of each fields are described below:
- codename: Codename from device, for example violet
- version: Android version, for example eleven-plus
- username: Username
- file: Path to your build, for example $OUT/lineage-18.1-20210413-UNOFFICIAL-billie.zip
- token: Authentication token