Skip to content

Commit 0a0e002

Browse files
feat: Convert ReVanced API from a Ktor server to serverless (#211)
Co-Authored-By: oSumAtrIX <johan.melkonyan1@web.de>
1 parent 458ec40 commit 0a0e002

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2992
-10674
lines changed

.editorconfig

Lines changed: 0 additions & 3 deletions
This file was deleted.

.env.example

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# Optional token for API calls to the backend
2-
BACKEND_API_TOKEN=
1+
API_TOKEN=
32

4-
# Database connection details
5-
DB_URL=jdbc:h2:./persistence/revanced-api
6-
DB_USER=
7-
DB_PASSWORD=
3+
GITHUB_TOKEN=
84

9-
# Digest auth to issue JWT tokens in the format SHA256("username:ReVanced:password")
10-
AUTH_SHA256_DIGEST=
5+
ORGANIZATION=revanced
116

12-
# JWT configuration for authenticated API endpoints
13-
JWT_SECRET=
14-
JWT_ISSUER=
15-
JWT_VALIDITY_IN_MIN=
7+
PATCHES_REPO=revanced-patches
8+
PATCHES_ASSET_REGEX=rvp$
9+
PATCHES_SIGNATURE_ASSET_REGEX=asc$
10+
PATCHES_PUBLIC_KEY_FILE=keys
1611

17-
# Logging level for the application
18-
LOG_LEVEL=INFO
12+
MANAGER_REPO=revanced-manager
13+
MANAGER_ASSET_REGEX=apk$
14+
MANAGER_DOWNLOADERS_REPO=revanced-manager-downloaders
15+
MANAGER_DOWNLOADERS_ASSET_REGEX=apk$
16+
17+
CONTRIBUTORS_REPOS=revanced-patcher:ReVanced Patcher,revanced-patches:ReVanced Patches,revanced-website:ReVanced Website,revanced-cli:ReVanced CLI,revanced-manager:ReVanced Manager
18+
19+
API_VERSION=5

.gitattributes

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 🐞 Bug report
22
description: Report a bug or an issue.
3-
title: 'bug: '
4-
labels: ['Bug report']
3+
title: "bug: "
4+
labels: ["Bug report"]
55
body:
66
- type: markdown
77
attributes:
@@ -81,11 +81,10 @@ body:
8181
- Add steps to reproduce the bug if possible (Step 1. ... Step 2. ...)
8282
- Add images and videos if possible
8383
validations:
84-
required: true
84+
required: true
8585
- type: textarea
8686
attributes:
8787
label: Error logs
88-
description: Exceptions can be captured by running `logcat | grep AndroidRuntime` in a shell.
8988
render: shell
9089
- type: textarea
9190
attributes:

.github/workflows/build_pull_request.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- dev
9+
10+
jobs:
11+
deploy:
12+
name: Deploy
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- name: Cache dependencies
20+
uses: actions/cache@v4
21+
with:
22+
path: "**/node_modules"
23+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
24+
restore-keys: ${{ runner.os }}-bun-
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "lts/*"
30+
31+
- name: Setup Bun
32+
uses: oven-sh/setup-bun@v2
33+
34+
- name: Install dependencies
35+
run: bun i --frozen-lockfile
36+
37+
- name: Publish
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: bunx semantic-release
41+
42+
- name: Deploy
43+
id: deploy
44+
uses: cloudflare/wrangler-action@v3
45+
with:
46+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
47+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
48+
preCommands: bun run db:migration:apply --remote
49+
command: deploy
50+
secrets: |
51+
API_TOKEN
52+
GITHUB_TOKEN
53+
ORGANIZATION
54+
PATCHES_REPO
55+
PATCHES_ASSET_REGEX
56+
PATCHES_SIGNATURE_ASSET_REGEX
57+
PATCHES_PUBLIC_KEY_FILE
58+
MANAGER_REPO
59+
MANAGER_ASSET_REGEX
60+
MANAGER_DOWNLOADERS_REPO
61+
MANAGER_DOWNLOADERS_ASSET_REGEX
62+
CONTRIBUTORS_REPOS
63+
API_VERSION
64+
env:
65+
API_TOKEN: ${{ secrets.API_TOKEN }}
66+
GITHUB_TOKEN: ${{ secrets.READ_REPOSITORIES_GITHUB_TOKEN }}
67+
ORGANIZATION: ${{ vars.ORGANIZATION }}
68+
PATCHES_REPO: ${{ vars.PATCHES_REPO }}
69+
PATCHES_ASSET_REGEX: ${{ vars.PATCHES_ASSET_REGEX }}
70+
PATCHES_SIGNATURE_ASSET_REGEX: ${{ vars.PATCHES_SIGNATURE_ASSET_REGEX }}
71+
PATCHES_PUBLIC_KEY_FILE: ${{ vars.PATCHES_PUBLIC_KEY_FILE }}
72+
MANAGER_REPO: ${{ vars.MANAGER_REPO }}
73+
MANAGER_ASSET_REGEX: ${{ vars.MANAGER_ASSET_REGEX }}
74+
MANAGER_DOWNLOADERS_REPO: ${{ vars.MANAGER_DOWNLOADERS_REPO }}
75+
MANAGER_DOWNLOADERS_ASSET_REGEX: ${{ vars.MANAGER_DOWNLOADERS_ASSET_REGEX }}
76+
CONTRIBUTORS_REPOS: ${{ vars.CONTRIBUTORS_REPOS }}
77+
API_VERSION: ${{ vars.API_VERSION }}

.github/workflows/release.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,6 @@
1-
.gradle
2-
build/
3-
!gradle/wrapper/gradle-wrapper.jar
4-
!**/src/main/**/build/
5-
!**/src/test/**/build/
6-
7-
### STS ###
8-
.apt_generated
9-
.classpath
10-
.factorypath
11-
.project
12-
.settings
13-
.springBeans
14-
.sts4-cache
15-
bin/
16-
!**/src/main/**/bin/
17-
!**/src/test/**/bin/
18-
19-
### IntelliJ IDEA ###
20-
.idea
21-
*.iws
22-
*.iml
23-
*.ipr
24-
out/
25-
!**/src/main/**/out/
26-
!**/src/test/**/out/
27-
28-
### NetBeans ###
29-
/nbproject/private/
30-
/nbbuild/
31-
/dist/
32-
/nbdist/
33-
/.nb-gradle/
34-
35-
### VS Code ###
361
.vscode/
37-
38-
### Project ###
39-
.env
40-
persistence/
41-
configuration.toml
42-
docker-compose.yml
43-
patches-public-key.asc
442
node_modules/
45-
static/
46-
about.json
3+
.wrangler/
4+
.dev.vars
5+
.env
6+
about.json

.releaserc

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,20 @@
1616
],
1717
"@semantic-release/release-notes-generator",
1818
"@semantic-release/changelog",
19-
"gradle-semantic-release-plugin",
2019
[
21-
"@semantic-release/git",
20+
"@semantic-release/npm",
2221
{
23-
"assets": [
24-
"CHANGELOG.md",
25-
"gradle.properties"
26-
],
27-
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
22+
"npmPublish": false
2823
}
2924
],
3025
[
31-
"@semantic-release/github",
26+
"@semantic-release/git",
3227
{
3328
"assets": [
34-
{
35-
"path": "build/libs/*"
36-
}
37-
],
38-
"successComment": false
39-
}
40-
],
41-
[
42-
"@codedependant/semantic-release-docker",
43-
{
44-
"dockerImage": "revanced-api",
45-
"dockerTags": [
46-
"{{#if prerelease.[0]}}dev{{else}}main{{/if}}",
47-
"{{#unless prerelease.[0]}}latest{{/unless}}",
48-
"{{version}}"
49-
],
50-
"dockerRegistry": "ghcr.io",
51-
"dockerProject": "revanced",
52-
"dockerPlatform": [
53-
"linux/amd64",
54-
"linux/arm64"
29+
"CHANGELOG.md",
30+
"package.json"
5531
],
56-
"dockerArgs": {
57-
"GITHUB_ACTOR": null,
58-
"GITHUB_TOKEN": null,
59-
}
32+
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
6033
}
6134
],
6235
[

Dockerfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)