From d26554a141e88c19db443647b2d9360dcc316e64 Mon Sep 17 00:00:00 2001 From: AXIS5hacker Date: Tue, 2 Jun 2026 13:10:41 +0800 Subject: [PATCH 1/3] added plugin distribution --- .github/workflows/gradle.yml | 3 ++- DEV_README.md | 8 +++++++- booster-plugins/maintain/build.gradle.kts | 2 +- .../explode2/booster/maintain/MaintainPlugin.kt | 7 +++++-- .../kotlin/explode2/booster/graphql/BasicMaze.kt | 6 ++++-- .../explode2/booster/graphql/GraphQLServer.kt | 4 +++- build.gradle.kts | 13 +++++++++++++ 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8bf1867..fa83c74 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - name: Build with Gradle - run: ./gradlew build -x test + run: ./gradlew build -x test --info 2>&1 | grep -E "jvmTarget|sourceCompatibility|targetCompatibility" - name: Upload Artifacts uses: actions/upload-artifact@v4 with: @@ -32,3 +32,4 @@ jobs: path: | explode-all/build/libs/ explode-proxy/build/libs/ + plugins/ diff --git a/DEV_README.md b/DEV_README.md index 73a06fa..d602904 100644 --- a/DEV_README.md +++ b/DEV_README.md @@ -22,6 +22,12 @@ The final JARs you can get from this project are: - explode-all-(version)-all.jar - explode-proxy-(version).jar - explode-proxy-(version)-all.jar +- plugins/\*.jar For server deploying, use explode-all-(version)-all.jar, and run it with - `java -cp explode-all-(version)-ALL.jar explode2.booster.BoosterMainKt` + `java -cp explode-all-(version)-ALL.jar explode2.booster.BoosterMainKt`. + +Btw the plugins are stored in the "plugins" folder. You need to put the +"plugins" folder under the same directory as the main server JAR in order +to load all plugin JARs. + diff --git a/booster-plugins/maintain/build.gradle.kts b/booster-plugins/maintain/build.gradle.kts index f5ea62e..3c31f1c 100644 --- a/booster-plugins/maintain/build.gradle.kts +++ b/booster-plugins/maintain/build.gradle.kts @@ -3,7 +3,7 @@ plugins { } group = "explode" -version = "1.0-SNAPSHOT" +version = "1.0.1" repositories { mavenCentral() diff --git a/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt b/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt index 42001cd..b2d7a8c 100644 --- a/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt +++ b/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt @@ -11,7 +11,7 @@ import org.greenrobot.eventbus.Subscribe class MaintainPlugin : BoosterPlugin { override val id: String = "maintain" - override val version: String = "1.0.0" + override val version: String = "1.0.1" init { subscribeEvents() @@ -19,9 +19,12 @@ class MaintainPlugin : BoosterPlugin { @Subscribe fun onKtorModule(e: KtorModuleEvent) = e.configure { + resp = listOf("Maintain 7716 is now not working at server.", + "Welcome to Dynamite Explode!") + routing { get("/") { - call.respondText("Maintain 7716 is now not working at server.") + call.respondText(resp.random()) } } } diff --git a/booster/src/main/kotlin/explode2/booster/graphql/BasicMaze.kt b/booster/src/main/kotlin/explode2/booster/graphql/BasicMaze.kt index c6e4e7b..646a364 100644 --- a/booster/src/main/kotlin/explode2/booster/graphql/BasicMaze.kt +++ b/booster/src/main/kotlin/explode2/booster/graphql/BasicMaze.kt @@ -217,7 +217,8 @@ object BasicMaze : ExplodeQuery, ExplodeMutation, MazeProvider { // 因为 refreshSet 导致的奇怪请求,直接返回空即可 if(isOfficial == null) return listOf() - val u = env.getUser() + // added login requirement (2026.6.2) + val u = env.getUser().baah("Authentication required") // category mapping val cate = when { @@ -273,7 +274,8 @@ object BasicMaze : ExplodeQuery, ExplodeMutation, MazeProvider { } override suspend fun setById(env: DataFetchingEnvironment, _id: String?): SetModel { - val u = env.getUser() + // added login requirement (2026.6.2) + val u = env.getUser().baah("Authentication required") return songRepo.getSongSetById(_id.baah("invalid id")).baah("set not found").tunerize(u) } diff --git a/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt b/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt index 570558b..0c951fd 100644 --- a/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt +++ b/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt @@ -41,7 +41,9 @@ val graphQLServer = GraphQLServer( Companion.getProvider().query, Companion.getProvider().mutation, { it.receiveText() }, - { mapOf("token" to (it.request.header("x-soudayo") ?: "trash-potato-server")) } + { mapOf("token" to it.request.header("x-soudayo")) } + // { mapOf("token" to (it.request.header("x-soudayo") ?: "trash-potato-server")) } + // no more default x-soudayo value ) class GraphQLServer( diff --git a/build.gradle.kts b/build.gradle.kts index 60fbfc6..5484681 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -61,8 +61,21 @@ allprojects { } } + // Set java and kotlin jvm to 11 + java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + tasks.withType { + kotlinOptions { + jvmTarget = "11" + } + } + tasks.withType { options.encoding = "UTF-8" + options.release.set(11) } tasks.withType { From 691160c0dccbd502be750567113616e6ea49e3ba Mon Sep 17 00:00:00 2001 From: AXIS5hacker Date: Tue, 2 Jun 2026 13:16:38 +0800 Subject: [PATCH 2/3] updated jvm version to 17, update x-soudayo verification, workflow artifact update --- .github/workflows/gradle.yml | 17 ++-- DEV_README.md | 87 +++++++++++++++++++ .../booster/maintain/MaintainPlugin.kt | 4 +- .../explode2/booster/graphql/GraphQLServer.kt | 17 +++- build.gradle.kts | 14 +-- 5 files changed, 123 insertions(+), 16 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fa83c74..2138fc8 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,15 +16,20 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - - name: Build with Gradle - run: ./gradlew build -x test --info 2>&1 | grep -E "jvmTarget|sourceCompatibility|targetCompatibility" + - name: Build with Gradle and Check JVM target version + run: | + ./gradlew build -x test 2>&1 | tee build.log + BUILD_EXIT_CODE=${PIPESTATUS[0]} + ./gradlew properties 2>&1 | grep -i "java\|jvm" + cat build.log || echo "Build log not available" + exit $BUILD_EXIT_CODE - name: Upload Artifacts uses: actions/upload-artifact@v4 with: @@ -32,4 +37,6 @@ jobs: path: | explode-all/build/libs/ explode-proxy/build/libs/ - plugins/ + booster-plugins/maintain/build/libs/ + booster-plugins/aliyun-oss-resource/build/libs/ + booster-plugins/url-redirect-resource/build/libs/ diff --git a/DEV_README.md b/DEV_README.md index d602904..7b497a8 100644 --- a/DEV_README.md +++ b/DEV_README.md @@ -31,3 +31,90 @@ Btw the plugins are stored in the "plugins" folder. You need to put the "plugins" folder under the same directory as the main server JAR in order to load all plugin JARs. +## Bomb API + +根请求地址与配置有关,默认模板为 `bomb/v{version}`,支持两个变量 `{version}` 是大版本号,目前是 2,`{version_patch}` 是小版本号,目前是 0。 + +随意最最最默认的情况是 `http://localhost:10443/bomb/v2` + +### 用户相关 + +#### GET /user/me 获取自己 + +需要登录 + +```json +{"success":true,"data":{"id":"3fc753db-f5c3-4089-8163-51eb8b37c77a","username":"Taskeren","coin":10,"diamond":0,"pptime":"2022-10-06T11:16:04.943Z","reviewer":false,"bought_sets":["7mscbkbzzwo7dnje6o93pyxn","h381k5vz12pldemmk548psl9","n7era7tdc895yms24gdsb9my","rz9vw2uhlcxdi4t9j6urlgw7"],"r":0,"highest_golden_medal":0}} +``` + +#### GET /user/{id} 获取用户 + +```json +{"success":true,"data":{"id":"3fc753db-f5c3-4089-8163-51eb8b37c77a","username":"Taskeren","coin":10,"diamond":0,"pptime":"2022-10-06T11:16:04.943Z","reviewer":false,"bought_sets":["7mscbkbzzwo7dnje6o93pyxn","h381k5vz12pldemmk548psl9","n7era7tdc895yms24gdsb9my","rz9vw2uhlcxdi4t9j6urlgw7"],"r":391,"highest_golden_medal":0}} +``` + +#### GET /user/{id}/best 获取最好成绩 + +默认依照 R 排序 + +```json +{"success":true,"data":[{"id":"e577720d-fcd7-44e1-bd9f-d5d7896bd605","player_id":"3fc753db-f5c3-4089-8163-51eb8b37c77a","chart_id":"ZwyQjZxkzLJbQFF8fv7rYCMD","perfect":104,"good":5,"miss":1197,"score":76906,"upload_time":"2022-10-16T08:21:36.207Z","r":391}]} +``` + +使用分数排序 `?by=score` + +```json +{"success":true,"data":[{"id":"2ae222e9-8bc7-4c40-a4ed-2f32683203a0","player_id":"3fc753db-f5c3-4089-8163-51eb8b37c77a","chart_id":"ZwyQjZxkzLJbQFF8fv7rYCMD","perfect":304,"good":5,"miss":1197,"score":96906,"upload_time":"2022-10-16T08:38:16.207Z","r":129}]} +``` + +#### GET /user/{id}/last 获取最近成绩 + +返回格式和获取最好成绩相同 + +#### PATCH /user/{id}/username + +负载 + +```json +{ + "password": "******", + "newUsername": "Taskeren-3" +} +``` + +返回 + +```json +{"success":true,"data":[{"id":"2ae222e9-8bc7-4c40-a4ed-2f32683203a0","player_id":"3fc753db-f5c3-4089-8163-51eb8b37c77a","chart_id":"ZwyQjZxkzLJbQFF8fv7rYCMD","perfect":304,"good":5,"miss":1197,"score":96906,"upload_time":"2022-10-16T08:38:16.207Z","r":129}]} +``` + +#### PATCH /user/{id}/password + +负载 + +```json +{ + "oldPassword": "******", + "newPassword": "************" +} +``` + +返回 + +```json +{"success":true,"data":[{"id":"2ae222e9-8bc7-4c40-a4ed-2f32683203a0","player_id":"3fc753db-f5c3-4089-8163-51eb8b37c77a","chart_id":"ZwyQjZxkzLJbQFF8fv7rYCMD","perfect":304,"good":5,"miss":1197,"score":96906,"upload_time":"2022-10-16T08:38:16.207Z","r":129}]} +``` + +### 曲目和谱面相关 + +#### GET /set/{id} 获取曲目信息 + +```json +{"success":true,"data":{"id":"rz9vw2uhlcxdi4t9j6urlgw7","music_name":"TestMusic","music_composer":"Me","introduction":"","coin_price":0,"noter_name":"NoterName","child_charts":["QLi2mcC76xK9aZ8bwFDyUBCE"],"play_count":0,"publish_time":"2022-10-06T11:16:02.478Z","category":0,"hidden":false,"reviewing":false}} +``` + +#### GET /chart/{id} 获取谱面信息 + +```json +{"success":true,"data":{"id":"QLi2mcC76xK9aZ8bwFDyUBCE","difficulty_class":5,"difficulty_value":15}} +``` \ No newline at end of file diff --git a/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt b/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt index b2d7a8c..f9de3b6 100644 --- a/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt +++ b/booster-plugins/maintain/src/main/kotlin/explode2/booster/maintain/MaintainPlugin.kt @@ -19,8 +19,8 @@ class MaintainPlugin : BoosterPlugin { @Subscribe fun onKtorModule(e: KtorModuleEvent) = e.configure { - resp = listOf("Maintain 7716 is now not working at server.", - "Welcome to Dynamite Explode!") + val resp = listOf("Maintain 7716 is now not working at server.", + "Welcome to Dynamite Explode!") routing { get("/") { diff --git a/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt b/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt index 0c951fd..bd25978 100644 --- a/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt +++ b/booster/src/main/kotlin/explode2/booster/graphql/GraphQLServer.kt @@ -26,6 +26,8 @@ import graphql.scalars.ExtendedScalars import graphql.schema.GraphQLType import io.ktor.server.application.* import io.ktor.server.request.* +import io.ktor.server.response.* +import io.ktor.http.HttpStatusCode import org.slf4j.LoggerFactory import org.slf4j.MarkerFactory import java.io.IOException @@ -41,9 +43,18 @@ val graphQLServer = GraphQLServer( Companion.getProvider().query, Companion.getProvider().mutation, { it.receiveText() }, - { mapOf("token" to it.request.header("x-soudayo")) } - // { mapOf("token" to (it.request.header("x-soudayo") ?: "trash-potato-server")) } - // no more default x-soudayo value + { call -> + val header = call.request.header("x-soudayo") + if(header == null) { + emptyMap() + } else { + if(header.isBlank()) { + call.respond(HttpStatusCode.BadRequest, "x-soudayo header must not be empty") + throw IOException("Invalid x-soudayo header: empty") + } + mapOf("token" to header) + } + } ) class GraphQLServer( diff --git a/build.gradle.kts b/build.gradle.kts index 5484681..70868cd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -61,21 +61,23 @@ allprojects { } } - // Set java and kotlin jvm to 11 - java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + // Set java and kotlin jvm to 17 + plugins.withType { + java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } } tasks.withType { kotlinOptions { - jvmTarget = "11" + jvmTarget = "17" } } tasks.withType { options.encoding = "UTF-8" - options.release.set(11) + options.release.set(17) } tasks.withType { From 9d2c63d890e69a7908933cd6d0f84ecdf086752e Mon Sep 17 00:00:00 2001 From: AXIS5hacker Date: Tue, 2 Jun 2026 14:55:59 +0800 Subject: [PATCH 3/3] codacy fix --- DEV_README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DEV_README.md b/DEV_README.md index 7b497a8..58bd76a 100644 --- a/DEV_README.md +++ b/DEV_README.md @@ -27,13 +27,14 @@ The final JARs you can get from this project are: For server deploying, use explode-all-(version)-all.jar, and run it with `java -cp explode-all-(version)-ALL.jar explode2.booster.BoosterMainKt`. -Btw the plugins are stored in the "plugins" folder. You need to put the +Btw the plugins are stored in the "plugins" folder. You need to put the "plugins" folder under the same directory as the main server JAR in order to load all plugin JARs. ## Bomb API -根请求地址与配置有关,默认模板为 `bomb/v{version}`,支持两个变量 `{version}` 是大版本号,目前是 2,`{version_patch}` 是小版本号,目前是 0。 +根请求地址与配置有关,默认模板为 `bomb/v{version}`,支持两个变量 `{version}` 是大版本号,目前是 2, +`{version_patch}` 是小版本号,目前是 0。 随意最最最默认的情况是 `http://localhost:10443/bomb/v2` @@ -117,4 +118,4 @@ to load all plugin JARs. ```json {"success":true,"data":{"id":"QLi2mcC76xK9aZ8bwFDyUBCE","difficulty_class":5,"difficulty_value":15}} -``` \ No newline at end of file +```