Happymh: Add referer header for image requests (#2135)

This commit is contained in:
Coin 2024-03-28 19:41:57 +08:00 committed by GitHub
parent e053753d28
commit 4337db6ad0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Happymh'
extClass = '.Happymh'
extVersionCode = 8
extVersionCode = 9
}
apply from: "$rootDir/common.gradle"

View File

@ -154,6 +154,13 @@ class Happymh : HttpSource(), ConfigurableSource {
override fun imageUrlParse(response: Response): String = throw UnsupportedOperationException()
override fun imageRequest(page: Page): Request {
val header = headersBuilder()
.set("Referer", "$baseUrl/")
.build()
return GET(page.imageUrl!!, header)
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val context = screen.context