Skip to content

Commit

Permalink
update: 更新设置配置文件和网络引擎以支持关注功能。
Browse files Browse the repository at this point in the history
  • Loading branch information
BingZi-233 committed Jan 3, 2024
1 parent 43b674b commit 28c1da2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=online.bingiz.bilibili.video
version=1.3.22
version=1.4.0
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ object SettingConfig {

var cooldown: Long = 60

var needFollow: Boolean = false

@Awake(LifeCycle.ENABLE)
fun registerAutoReload() {
config.onReload { reloadAction() }
Expand All @@ -32,5 +34,7 @@ object SettingConfig {
baffleCache.resetAll()
// 变更缓存时间
baffleCache = Baffle.of(cooldown, TimeUnit.SECONDS)
// 变更是否需要关注
needFollow = config.getBoolean("needFollow")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,18 @@ object NetworkEngine {
player.warningAsLang("CookieNotFound")
return
}
bilibiliAPI.hasFollowing(bvid, sessData).execute().let {
if (it.isSuccessful) {
it.body()?.data?.let {
if (it.card.following.not()) {
player.infoAsLang("GetTripleStatusFailureNotFollowing")
return
}
}
} else {
player.infoAsLang("NetworkRequestFailureCode", it.code())
}
}
bilibiliAPI.hasLike(bvid, sessData).execute().let {
if (it.isSuccessful) {
it.body()?.data?.let { count ->
Expand Down Expand Up @@ -340,4 +352,4 @@ object NetworkEngine {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ interface BilibiliApiDrive {
fun hasFollowing(
@Query("bvid") bvid: String,
@Header("Cookie") sessData: String,
@Header("Cookie") buvid3: String = "buvid3=BUVID3"
// @Header("Cookie") buvid3: String = "buvid3=BUVID3"
): Call<BilibiliResult<FollowingData>>
}
}
3 changes: 2 additions & 1 deletion src/main/resources/lang/zh_CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ GetTripleStatusFailure: "&4&l稿件条件不满足,无法发放奖励。点赞
GetTripleStatusFailureNotLike: "&4&l稿件条件不满足,无法发放奖励。原因:未点赞"
GetTripleStatusFailureNotCoins: "&4&l稿件条件不满足,无法发放奖励。原因:未投币"
GetTripleStatusFailureNotFavoured: "&4&l稿件条件不满足,无法发放奖励。原因:未收藏"
GetTripleStatusFailureNotFollowing: "&4&l稿件条件不满足,无法发放奖励。原因:未关注"
GetTripleStatusError: "&4&l账户状态异常,请过一段时间再次尝试。哔哩哔哩信息:{0}"
GetTripleStatusRepeat: "&4&l你已经领取过奖励了,无法再次领取!"
GetTripleStatusRefuse: "&4&l与Bilibili服务器通信被拒,错误信息:&c&l{0}"
Expand All @@ -38,4 +39,4 @@ KetherLocalizedException: "&c&l发生了Kether本地化异常, 异常信息: {0}
KetherThrowable: "&c&l发生了Kether异常, 异常信息: {0}"
PlayerIsBindMid: "&c&l你不能换绑账户,若需解绑请联系管理员。"
PlayerUnbindSuccess: "&a&l你已经对 {0} 进行解绑操作。"
PlayerNotBindMid: "&a&l玩家 {0} 并没有绑定任何MID。"
PlayerNotBindMid: "&a&l玩家 {0} 并没有绑定任何MID。"
6 changes: 5 additions & 1 deletion src/main/resources/setting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
# 建议不要低于预设值
# 预设值: 60
# 单位: 秒
cooldown: 60
cooldown: 60

# 是否需要关注
# * 本项为实验项目,可能存在不稳定的情况
needFollow: false

0 comments on commit 28c1da2

Please sign in to comment.