mirror of
https://github.com/ReVanced/revanced-api.git
synced 2026-01-12 06:16:19 +00:00
Compare commits
6 Commits
v1.0.0-dev
...
v1.0.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f754ebb25c | ||
|
|
19ebc827bf | ||
|
|
e92fbdf1f4 | ||
|
|
7e99e49af2 | ||
|
|
8f77736a69 | ||
|
|
2ed4cf3b40 |
@@ -1,7 +1,5 @@
|
||||
# Optional token for API calls to the backend
|
||||
BACKEND_API_TOKEN=
|
||||
# A URL to the old API to proxy for migration purposes
|
||||
OLD_API_URL=
|
||||
|
||||
# Database connection details
|
||||
DB_URL=jdbc:h2:./persistence/revanced-api
|
||||
|
||||
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,24 @@
|
||||
# [1.0.0-dev.4](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2024-07-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* List more repository contributors ([19ebc82](https://github.com/ReVanced/revanced-api/commit/19ebc827bfb54a597dd06f9d99bdc820ee9977ee))
|
||||
|
||||
# [1.0.0-dev.3](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.2...v1.0.0-dev.3) (2024-07-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Move old API endpoint configuration from env to configuration file ([7e99e49](https://github.com/ReVanced/revanced-api/commit/7e99e49af202c4ec0a0d7e61dd0182dd2097e867))
|
||||
|
||||
# [1.0.0-dev.2](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.1...v1.0.0-dev.2) (2024-07-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Configure CORS correctly ([2ed4cf3](https://github.com/ReVanced/revanced-api/commit/2ed4cf3b40caeb6181d068d411344e6732000f22))
|
||||
|
||||
# 1.0.0-dev.1 (2024-07-10)
|
||||
|
||||
|
||||
|
||||
@@ -10,5 +10,9 @@ contributors-repositories = [
|
||||
"revanced-manager",
|
||||
]
|
||||
api-version = 1
|
||||
cors = { host = "*.revanced.app", sub-domains = [] }
|
||||
endpoint = "https://api.revanced.app"
|
||||
cors-allowed-hosts = [
|
||||
"revanced.app",
|
||||
"*.revanced.app"
|
||||
]
|
||||
endpoint = "https://api.revanced.app"
|
||||
old-api-endpoint = "https://old-api.revanced.app"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
organization = "revanced"
|
||||
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "key.asc" }
|
||||
integrations = { repository = "revanced-integrations", asset-regex = "apk$", signature-asset-regex = "asc$", public-key-file = "key.asc" }
|
||||
contributors-repositories = [
|
||||
"revanced-patcher",
|
||||
"revanced-patches",
|
||||
"revanced-integrations",
|
||||
"revanced-website",
|
||||
"revanced-cli",
|
||||
"revanced-manager",
|
||||
]
|
||||
api-version = 1
|
||||
cors = { host = "*.127.0.0.1:8888", sub-domains = [] }
|
||||
endpoint = "http://127.0.0.1:8888/"
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 1.0.0-dev.1
|
||||
version = 1.0.0-dev.4
|
||||
|
||||
@@ -123,10 +123,11 @@ fun Application.configureDependencies(
|
||||
AuthService(issuer, validityInMin, jwtSecret, authSHA256DigestString)
|
||||
}
|
||||
single {
|
||||
val configuration = get<ConfigurationRepository>()
|
||||
|
||||
OldApiService(
|
||||
get {
|
||||
val defaultRequestUri = get<Dotenv>()["OLD_API_URL"]
|
||||
parameterArrayOf(defaultRequestUri)
|
||||
parameterArrayOf(configuration.oldApiEndpoint)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -13,10 +13,12 @@ fun Application.configureHTTP() {
|
||||
val configurationRepository = get<ConfigurationRepository>()
|
||||
|
||||
install(CORS) {
|
||||
allowHost(
|
||||
host = configurationRepository.cors.host,
|
||||
subDomains = configurationRepository.cors.subDomains,
|
||||
)
|
||||
configurationRepository.corsAllowedHosts.forEach { host ->
|
||||
allowHost(
|
||||
host = host,
|
||||
schemes = listOf("http", "https")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
install(RateLimit) {
|
||||
|
||||
@@ -19,8 +19,9 @@ import java.io.File
|
||||
* @property integrations The source of the integrations.
|
||||
* @property contributorsRepositoryNames The names of the repositories to get contributors from.
|
||||
* @property apiVersion The version to use for the API.
|
||||
* @property cors The CORS configuration.
|
||||
* @property corsAllowedHosts The hosts allowed to make requests to the API.
|
||||
* @property endpoint The endpoint of the API.
|
||||
* @property oldApiEndpoint The endpoint of the old API to proxy requests to.
|
||||
*/
|
||||
@Serializable
|
||||
internal class ConfigurationRepository(
|
||||
@@ -31,8 +32,11 @@ internal class ConfigurationRepository(
|
||||
val contributorsRepositoryNames: Set<String>,
|
||||
@SerialName("api-version")
|
||||
val apiVersion: Int = 1,
|
||||
val cors: Cors,
|
||||
@SerialName("cors-allowed-hosts")
|
||||
val corsAllowedHosts: Set<String>,
|
||||
val endpoint: String,
|
||||
@SerialName("old-api-endpoint")
|
||||
val oldApiEndpoint: String,
|
||||
) {
|
||||
/**
|
||||
* An asset configuration.
|
||||
@@ -61,19 +65,6 @@ internal class ConfigurationRepository(
|
||||
@SerialName("public-key-file")
|
||||
val publicKeyFile: File,
|
||||
)
|
||||
|
||||
/**
|
||||
* The CORS configuration.
|
||||
*
|
||||
* @property host The host of the API to configure CORS.
|
||||
* @property subDomains The subdomains to allow for CORS.
|
||||
*/
|
||||
@Serializable
|
||||
internal class Cors(
|
||||
val host: String,
|
||||
@SerialName("sub-domains")
|
||||
val subDomains: List<String>,
|
||||
)
|
||||
}
|
||||
|
||||
private object RegexSerializer : KSerializer<Regex> {
|
||||
|
||||
@@ -16,6 +16,7 @@ import kotlinx.coroutines.*
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.datetime.TimeZone
|
||||
import kotlinx.datetime.toLocalDateTime
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
class GitHubBackendRepository(client: HttpClient) : BackendRepository(client) {
|
||||
@@ -191,10 +192,9 @@ class Organization {
|
||||
|
||||
class Repository {
|
||||
@Resource("/repos/{owner}/{repo}/contributors")
|
||||
class Contributors(val owner: String, val repo: String)
|
||||
class Contributors(val owner: String, val repo: String, @SerialName("per_page") val perPage: Int = 100)
|
||||
|
||||
@Resource("/repos/{owner}/{repo}/releases")
|
||||
class Releases(val owner: String, val repo: String) {
|
||||
class Releases {
|
||||
@Resource("/repos/{owner}/{repo}/releases/tags/{tag}")
|
||||
class Tag(val owner: String, val repo: String, val tag: String)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user