File tree Expand file tree Collapse file tree 3 files changed +14
-21
lines changed
src/main/kotlin/app/revanced/api/configuration Expand file tree Collapse file tree 3 files changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -10,5 +10,8 @@ contributors-repositories = [
1010 " revanced-manager" ,
1111]
1212api-version = 1
13- cors = { host = " *.revanced.app" , sub-domains = [] }
14- endpoint = " https://api.revanced.app"
13+ cors-allowed-hosts = [
14+ " revanced.app" ,
15+ " *.revanced.app"
16+ ]
17+ endpoint = " https://api.revanced.app"
Original file line number Diff line number Diff line change @@ -13,10 +13,12 @@ fun Application.configureHTTP() {
1313 val configurationRepository = get<ConfigurationRepository >()
1414
1515 install(CORS ) {
16- allowHost(
17- host = configurationRepository.cors.host,
18- subDomains = configurationRepository.cors.subDomains,
19- )
16+ configurationRepository.corsAllowedHosts.forEach { host ->
17+ allowHost(
18+ host = host,
19+ schemes = listOf (" http" , " https" )
20+ )
21+ }
2022 }
2123
2224 install(RateLimit ) {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import java.io.File
1919 * @property integrations The source of the integrations.
2020 * @property contributorsRepositoryNames The names of the repositories to get contributors from.
2121 * @property apiVersion The version to use for the API.
22- * @property cors The CORS configuration .
22+ * @property corsAllowedHosts The hosts allowed to make requests to the API .
2323 * @property endpoint The endpoint of the API.
2424 */
2525@Serializable
@@ -31,7 +31,8 @@ internal class ConfigurationRepository(
3131 val contributorsRepositoryNames : Set <String >,
3232 @SerialName(" api-version" )
3333 val apiVersion : Int = 1 ,
34- val cors : Cors ,
34+ @SerialName(" cors-allowed-hosts" )
35+ val corsAllowedHosts : Set <String >,
3536 val endpoint : String ,
3637) {
3738 /* *
@@ -61,19 +62,6 @@ internal class ConfigurationRepository(
6162 @SerialName(" public-key-file" )
6263 val publicKeyFile : File ,
6364 )
64-
65- /* *
66- * The CORS configuration.
67- *
68- * @property host The host of the API to configure CORS.
69- * @property subDomains The subdomains to allow for CORS.
70- */
71- @Serializable
72- internal class Cors (
73- val host : String ,
74- @SerialName(" sub-domains" )
75- val subDomains : List <String >,
76- )
7765}
7866
7967private object RegexSerializer : KSerializer<Regex> {
You can’t perform that action at this time.
0 commit comments