Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Explode Build Test

on:
push:
branches: [ "master" ]
branches: [ "v3" ]
pull_request:
branches: [ "master" ]
branches: [ "v3" ]

permissions:
contents: read
Expand All @@ -15,18 +15,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build -x test
run: ./gradlew build -x test
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Explode
path: |
Expand Down
11 changes: 11 additions & 0 deletions DEV_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@

### 数据提供 Labyrinth

## Artifacts

The final JARs you can get from this project are:

- explode-all-(version).jar
- explode-all-(version)-all.jar
- explode-proxy-(version).jar
- explode-proxy-(version)-all.jar

For server deploying, use explode-all-(version)-all.jar, and run it with
`java -cp explode-all-(version)-ALL.jar explode2.booster.BoosterMainKt`
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Or join our [Discord](https://discord.gg/BS5UZnsvVZ) server for English support.
There is no well-documented code nor a helpful documentation to set up and use, so you need to figure it out by yourself
or simply contact the contributors for help.

Maybe you can refer to DEV_README.md?

### Env Vars

*DB_URL*: The connection string to the database.
2 changes: 1 addition & 1 deletion booster/src/main/kotlin/explode2/booster/MainLogics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object MainLogics : KoinComponent {
// output Maze provider info
gqlLogger.info("Using Maze: ${Colors.TianYi}${MazeProvider.getProvider().javaClass.canonicalName}")

val welcome = listOf("❄", "❤", "\uD83D\uDCE2", "\uD83D\uDCE3")
val welcome = listOf("❄", "❤", "\uD83D\uDCE2", "\uD83D\uDCE3", "氦")
val playground = Application::class.java.classLoader.getResource("graphql-playground/index.html")?.readText()
?.replace(
"\$BACKEND_URL\$",
Expand Down
6 changes: 6 additions & 0 deletions booster/src/main/kotlin/explode2/booster/graphql/BasicMaze.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,25 @@ object BasicMaze : ExplodeQuery, ExplodeMutation, MazeProvider {

val u = env.getUser()

// category mapping
val cate = when {
isHidden == 1 -> SearchCategory.HIDDEN
isOfficial == 1 -> SearchCategory.OFFICIAL
isRanked == 1 -> SearchCategory.RANKED
isRanked == -1 -> SearchCategory.UNRANKED
else -> SearchCategory.ALL
}

// sort type mapping
// see ExplodeX/labyrinth/src/main/kotlin/explode2/labyrinth/SearchEnums.kt for details
val sort = when {
playCountOrder == -1 -> SearchSort.DESCENDING_BY_PLAY_COUNT
publishTimeOrder == -1 -> SearchSort.DESCENDING_BY_PUBLISH_TIME
publishTimeOrder == 1 -> SearchSort.ASCENDING_BY_PUBLISH_TIME
else -> boom("invalid ordering")
}

// return result
return songRepo.searchSongSets(
musicTitle,
cate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ data class RefreshingRankingList(
lastUpdateTime = LocalDateTime.now()
}

// fix hardcoded 24 hours refreshing
fun get(): List<PlayRecordWithRankModel> {
val lastUpdateTime = lastUpdateTime
if(
lastUpdateTime == null ||
lastUpdateTime + 24.hours.toJavaDuration() <= LocalDateTime.now() ||
lastUpdateTime + expireHours.hours.toJavaDuration() <= LocalDateTime.now() ||
cache == null
) {
update()
Expand All @@ -45,11 +46,12 @@ data class RefreshingRankingList(
return get().drop(skip).take(limit)
}

// fix hardcoded 24 hours refreshing
fun get(playerId: String): PlayRecordWithRankModel? {
val lastUpdateTime = lastUpdateTime
if(
lastUpdateTime == null ||
lastUpdateTime + 24.hours.toJavaDuration() <= LocalDateTime.now() ||
lastUpdateTime + expireHours.hours.toJavaDuration() <= LocalDateTime.now() ||
cache == null
) {
update()
Expand Down
1 change: 1 addition & 0 deletions booster/src/main/kotlin/goodbird/GoodBirdOracle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import kotlin.math.pow
* 来自某位 `一般路过鸟` 的神谕。
*
* 我们只需要铭记这位好鸟,不必知晓他的真实身份。如果你知道,也请你保密。
* i.e. the R calculation logic
*/
object GoodBirdOracle {

Expand Down
3 changes: 2 additions & 1 deletion explode-all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}

// It's explode v3 now
group = "explode"
version = "1.0"
version = "3.0.3"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion explode-proxy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "explode"
version = "1.0"
version = "3.0.3"

repositories {
mavenCentral()
Expand Down
1 change: 1 addition & 0 deletions gateau/src/main/kotlin/explode2/gateau/SongState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package explode2.gateau

/* The interface of how we parse the set entries of the database. */
interface SongState {

var category: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,15 @@ class MongoManager(private val provider: LabyrinthMongoBuilder = LabyrinthMongoB

// 排序顺序
when(sortBy) {
null, SearchSort.DESCENDING_BY_PUBLISH_TIME -> {
null,
// Descending by time
SearchSort.DESCENDING_BY_PUBLISH_TIME -> {
pipeline += sort(descending(MongoSongSet::publishTime, MongoSongSet::musicName, MongoSongSet::id))
}

// Ascending by time (Updated 2026.6.2)
SearchSort.ASCENDING_BY_PUBLISH_TIME -> {
pipeline += sort(ascending(MongoSongSet::publishTime, MongoSongSet::musicName, MongoSongSet::id))
}
// FIXME: 修复性能问题
SearchSort.DESCENDING_BY_PLAY_COUNT -> {
// 添加游玩次数查询
Expand Down
4 changes: 3 additions & 1 deletion labyrinth/src/main/kotlin/explode2/labyrinth/SearchEnums.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ enum class SearchCategory {
HIDDEN, OFFICIAL, RANKED, UNRANKED, REVIEW, ALL
}

// Update 2026.6.2: added ASCENDING_BY_PUBLISH_TIME
enum class SearchSort {
DESCENDING_BY_PLAY_COUNT,
DESCENDING_BY_PUBLISH_TIME
DESCENDING_BY_PUBLISH_TIME,
ASCENDING_BY_PUBLISH_TIME
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include("labyrinth")
include("labyrinth-mongodb")
include("booster")
include("resource")
include("booster-maintain")
// includePlugin("maintain") // useless
include("gatekeeper")
include("explode-all")
include("explode-proxy")
Expand Down
6 changes: 5 additions & 1 deletion src/main/kotlin/explode2/tests/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fun main(skip: Int = 0, limit: Int = 9) {

val matchingName = ""
val matchingCategory = SearchCategory.ALL
val sortBy = SearchSort.DESCENDING_BY_PUBLISH_TIME
val sortBy = SearchSort.ASCENDING_BY_PUBLISH_TIME

class SongSetWithCharts(val charts: List<MongoSongChart>)
class SongSetWithPlayCount(val playCount: Int)
Expand Down Expand Up @@ -176,6 +176,10 @@ fun main(skip: Int = 0, limit: Int = 9) {
pipeline += sort(descending(MongoSongSet::publishTime, MongoSongSet::musicName, MongoSongSet::id))
}

SearchSort.ASCENDING_BY_PUBLISH_TIME -> {
pipeline += sort(ascending(MongoSongSet::publishTime, MongoSongSet::musicName, MongoSongSet::id))
}

// FIXME: 修复性能问题
SearchSort.DESCENDING_BY_PLAY_COUNT -> {
// 添加游玩次数查询
Expand Down
Loading