Skip to content

Commit

Permalink
fix: 修复因升级导致校验系统失效
Browse files Browse the repository at this point in the history
  • Loading branch information
BingZi-233 committed Dec 26, 2023
1 parent 7aa75d5 commit 945d02f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 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.15
version=1.3.16
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ object NetworkEngine {
player.warningAsLang("CookieNotFound")
return
}
val sessData = cookieCache[player.uniqueId]?.let { list -> list.SESSDATA.let { "SESSDATA=$it" } } ?: let {
val sessData = cookieCache[player.uniqueId]?.let { list -> list.SESSDATA?.let { "SESSDATA=$it" } } ?: let {
player.warningAsLang("CookieNotFound")
return
}
Expand Down Expand Up @@ -258,7 +258,7 @@ object NetworkEngine {
}
}
val sessData = cookieCache[player.uniqueId]?.let { list ->
list.SESSDATA.let { "SESSDATA=$it" }
list.SESSDATA?.let { "SESSDATA=$it" }
} ?: let {
player.warningAsLang("CookieNotFound")
return
Expand Down Expand Up @@ -332,7 +332,9 @@ object NetworkEngine {
*/
fun getUserInfo(cookie: CookieData): UserInfoData? {
// 获取 SASSDATA
val sessData = "SESSDATA=${cookie.SESSDATA}"
val sessData = cookie.SESSDATA?.let { "SESSDATA=$it" } ?: let {
return null
}
// 获取用户信息
val response = bilibiliAPI.getUserInfo(sessData).execute()
// 判断请求是否成功并且返回的数据 code 是否为 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ package online.bingiz.bilibili.video.internal.entity
* @constructor Create empty Cookie data
*/
data class CookieData(
var SESSDATA: String = "",
var bili_jct: String = "",
var DedeUserID: String = "",
var DedeUserID__ckMd5: String = "",
var sid: String = ""
var SESSDATA: String? = null,
var bili_jct: String? = null,
var DedeUserID: String? = null,
var DedeUserID__ckMd5: String? = null,
var sid: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ object PlayerListener {
baffleCache.reset(player.name)
// 保存玩家Cookie数据
cookieCache.get(player.uniqueId)?.let {
player.setDataContainer("SESSDATA", it.SESSDATA)
player.setDataContainer("bili_jct", it.bili_jct)
player.setDataContainer("DedeUserID", it.DedeUserID)
player.setDataContainer("DedeUserID__ckMd5", it.DedeUserID__ckMd5)
player.setDataContainer("sid", it.sid)
it.SESSDATA?.let { it1 -> player.setDataContainer("SESSDATA", it1) }
it.bili_jct?.let { it1 -> player.setDataContainer("bili_jct", it1) }
it.DedeUserID?.let { it1 -> player.setDataContainer("DedeUserID", it1) }
it.DedeUserID__ckMd5?.let { it1 -> player.setDataContainer("DedeUserID__ckMd5", it1) }
it.sid?.let { it1 -> player.setDataContainer("sid", it1) }
}
// 驱逐Cookie缓存
cookieCache.invalidate(player.uniqueId)
Expand Down

0 comments on commit 945d02f

Please sign in to comment.