Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Update api hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
zjns committed Mar 19, 2023
1 parent aec2b55 commit 55473ef
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ object BannerV3AdHook : ApiHook {
"https://api.bilibili.com/pgc/page/?"
)

override val enabled: Boolean
get() = sPrefs.getBoolean("hidden", false)
override val enabled by lazy {
sPrefs.getBoolean("hidden", false)
&& sPrefs.getBoolean("purify_banner_ads", false)
}

override fun canHandler(api: String) = targetApis.any { api.startsWith(it) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import me.iacn.biliroaming.utils.toJSONObject
object BannerV8AdHook : ApiHook {
private const val feedApi = "https://app.bilibili.com/x/v2/feed/index"

override val enabled: Boolean
get() = sPrefs.getBoolean("hidden", false)
override val enabled by lazy {
sPrefs.getBoolean("hidden", false)
&& sPrefs.getBoolean("purify_banner_ads", false)
}

override fun canHandler(api: String) = api.startsWith(feedApi)

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/me/iacn/biliroaming/hook/api/CardsHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import org.json.JSONObject
object CardsHook : ApiHook {
private const val cardsApi = "https://api.bilibili.com/pgc/season/player/cards"

override val enabled: Boolean
get() = sPrefs.getBoolean("hidden", false)
override val enabled by lazy {
sPrefs.getBoolean("hidden", false)
&& sPrefs.getBoolean("block_up_rcmd_ads", false)
}

override fun canHandler(api: String) = api.startsWith(cardsApi)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import org.json.JSONObject
object SeasonRcmdHook : ApiHook {
private const val rcmdApi = "https://api.bilibili.com/pgc/season/app/related/recommend"

override val enabled: Boolean
get() = sPrefs.getBoolean("hidden", false)
override val enabled by lazy {
sPrefs.getBoolean("hidden", false)
&& sPrefs.getBoolean("remove_video_relate_promote", false)
}

override fun canHandler(api: String) = api.startsWith(rcmdApi)

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/me/iacn/biliroaming/hook/api/SkinHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import org.json.JSONObject
object SkinHook : ApiHook {
private const val skinApi = "https://app.bilibili.com/x/resource/show/skin"

override val enabled: Boolean
get() = sPrefs.getBoolean("hidden", false)
override val enabled by lazy {
sPrefs.getBoolean("hidden", false)
&& sPrefs.getBoolean("skin", false)
&& !sPrefs.getString("skin_json", null).isNullOrEmpty()
}

override fun canHandler(api: String) = api.startsWith(skinApi)

Expand Down

0 comments on commit 55473ef

Please sign in to comment.