Skip to content

Commit

Permalink
feat: external
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Jun 2, 2023
1 parent 1191964 commit d47f08f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/kotlin/xyz/cssxsh/arknights/bilibili/VideoDataHolder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ public class VideoDataHolder(override val folder: File, override val ignore: sus

private val AcceptAllCookiesStorage.container: MutableList<Cookie> by reflect()

private val external: File by lazy {
File(
System.getProperty(
"xyz.cssxsh.arknights.bilibili.external",
"data/xyz.cssxsh.mirai.plugin.bilibili-helper"
)
)
}

private val salt: String
get() = kotlin.run {
val file = File("data/xyz.cssxsh.mirai.plugin.bilibili-helper/salt.txt")
val file = external.resolve("salt.txt")
if (file.exists()) {
file.readText()
} else {
Expand All @@ -39,7 +48,7 @@ public class VideoDataHolder(override val folder: File, override val ignore: sus

init {
http.launch {
val cookies = with(File("data/xyz.cssxsh.mirai.plugin.bilibili-helper/cookies.json")) {
val cookies = with(external.resolve("cookies.json")) {
if (exists().not()) return@with emptyList()
Json.decodeFromString<List<EditThisCookie>>(readText().ifBlank { "[]" })
.map { it.toCookie() }
Expand Down

0 comments on commit d47f08f

Please sign in to comment.