-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 更改配置文档文件名 2. 添加代理端资源获取 3. 修复代理端错误
- Loading branch information
Showing
17 changed files
with
247 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 35 additions & 1 deletion
36
booster-resource/src/main/kotlin/explode2/booster/resource/ResourceProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,45 @@ | ||
package explode2.booster.resource | ||
|
||
interface ResourceProvider { | ||
sealed interface ResourceProvider { | ||
fun getMusic(id: String, token: String?): Any | ||
fun getPreviewMusic(id: String, token: String?): Any | ||
fun getCoverPicture(id: String, token: String?): Any | ||
fun getStoreCoverPicture(id: String, token: String?): Any | ||
fun getChartXML(cid: String, sid: String, token: String?): Any | ||
fun getUserAvatar(id: String, token: String?): Any | ||
} | ||
|
||
interface ByteArrayResourceProvider : ResourceProvider { | ||
override fun getMusic(id: String, token: String?): ByteArray | ||
override fun getPreviewMusic(id: String, token: String?): ByteArray | ||
override fun getCoverPicture(id: String, token: String?): ByteArray | ||
override fun getStoreCoverPicture(id: String, token: String?): ByteArray | ||
override fun getChartXML(cid: String, sid: String, token: String?): ByteArray | ||
override fun getUserAvatar(id: String, token: String?): ByteArray | ||
} | ||
|
||
interface RedirectResourceProvider : ResourceProvider { | ||
override fun getMusic(id: String, token: String?): String | ||
override fun getPreviewMusic(id: String, token: String?): String | ||
override fun getCoverPicture(id: String, token: String?): String | ||
override fun getStoreCoverPicture(id: String, token: String?): String | ||
override fun getChartXML(cid: String, sid: String, token: String?): String | ||
override fun getUserAvatar(id: String, token: String?): String | ||
} | ||
|
||
interface SimpleResourceProvider : ByteArrayResourceProvider { | ||
|
||
fun getMusic(id: String): ByteArray | ||
fun getPreviewMusic(id: String): ByteArray | ||
fun getCoverPicture(id: String): ByteArray | ||
fun getStoreCoverPicture(id: String): ByteArray | ||
fun getChartXML(cid: String, sid: String): ByteArray | ||
fun getUserAvatar(id: String): ByteArray | ||
|
||
override fun getMusic(id: String, token: String?): ByteArray = getMusic(id) | ||
override fun getPreviewMusic(id: String, token: String?): ByteArray = getPreviewMusic(id) | ||
override fun getCoverPicture(id: String, token: String?): ByteArray = getCoverPicture(id) | ||
override fun getStoreCoverPicture(id: String, token: String?): ByteArray = getStoreCoverPicture(id) | ||
override fun getChartXML(cid: String, sid: String, token: String?): ByteArray = getChartXML(cid, sid) | ||
override fun getUserAvatar(id: String, token: String?): ByteArray = getUserAvatar(id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
booster/src/main/kotlin/explode2/booster/util/SafeOperations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
package explode2.booster.util | ||
|
||
import java.util.stream.Stream | ||
|
||
fun <T> Iterable<T>.forEachExceptional(block: (T) -> Unit, exceptional: (T, exception: Throwable) -> Unit) { | ||
this.forEach { el -> | ||
el.runCatching(block).onFailure { exceptional(el, it) } | ||
} | ||
} | ||
|
||
fun <T, R> Iterable<T>.mapExceptional(block: (T) -> R, exceptional: (T, exception: Throwable) -> Unit): List<R> { | ||
val wrappedBlock = { el: T -> el.runCatching(block).onFailure { exceptional(el, it) }.getOrNull() } | ||
return this.mapNotNull(wrappedBlock) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
java | ||
kotlin("jvm") version "1.7.20" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.