Skip to content

Commit 19f3bb1

Browse files
improvement
1 parent e3a0a4f commit 19f3bb1

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
working-directory: ${{ github.workspace }}/src
5151
env:
5252
DUBBINDO_PASSWORD: ${{ secrets.DUBBINDO_PASS }}
53+
DUBBINDO_USERNAME: ${{ secrets.DUBBINDO_USER }}
5354
run: |
5455
chmod +x gradlew
5556
./gradlew make makePluginsJson

DubbindoProvider/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ android {
3737
defaultConfig {
3838
val githubPassword = System.getenv("DUBBINDO_PASSWORD") ?: ""
3939
buildConfigField("String", "DUBBINDO_PASSWORD", "\"$githubPassword\"")
40+
41+
val githubUsername = System.getenv("DUBBINDO_USERNAME") ?: ""
42+
buildConfigField("String", "DUBBINDO_USERNAME", "\"$githubUsername\"")
4043
}
4144
}

DubbindoProvider/src/main/kotlin/com/dubbindo/DubbindoProvider.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ class DubbindoProvider : MainAPI() {
2626
TvType.Anime,
2727
)
2828

29-
private val USERNAME = "HatsuneMikuUwU"
29+
private val USERNAME = BuildConfig.DUBBINDO_USERNAME
3030
private val PASSWORD = BuildConfig.DUBBINDO_PASSWORD
3131

3232
private var sessionCookie = ""
3333

34+
private val subscribedChannelIds = mutableSetOf<String>()
35+
3436
private val baseHeaders get() = mapOf(
3537
"User-Agent" to "Mozilla/5.0 (Linux; Android 10; Mobile) AppleWebKit/537.36 Chrome/124.0 Mobile Safari/537.36",
3638
"Referer" to "$mainUrl/"
@@ -100,6 +102,8 @@ class DubbindoProvider : MainAPI() {
100102

101103
if (channelId.isBlank()) return false
102104

105+
if (channelId in subscribedChannelIds) return true
106+
103107
val mainSession = document
104108
.selectFirst("input.main_session")?.attr("value")?.trim()
105109
.orEmpty()
@@ -122,6 +126,8 @@ class DubbindoProvider : MainAPI() {
122126

123127
if (!resp.isSuccessful) return false
124128

129+
subscribedChannelIds.add(channelId)
130+
125131
val muteUrl = if (mainSession.isNotBlank())
126132
"$mainUrl/aj/user/notify?hash=$mainSession"
127133
else

0 commit comments

Comments
 (0)