Hiperdex: Add randomUA (#3459)

Add randomUA
This commit is contained in:
Chopper 2024-06-08 02:16:23 -03:00 committed by Draff
parent ae52c158c3
commit 058aeaa54e
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 14 additions and 1 deletions

View File

@ -3,8 +3,12 @@ ext {
extClass = '.Hiperdex'
themePkg = 'madara'
baseUrl = 'https://hiperdex.com'
overrideVersionCode = 11
overrideVersionCode = 12
isNsfw = true
}
apply from: "$rootDir/common.gradle"
dependencies {
implementation project(':lib:randomua')
}

View File

@ -5,6 +5,10 @@ import android.content.SharedPreferences
import android.widget.Toast
import androidx.preference.EditTextPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.lib.randomua.addRandomUAPreferenceToScreen
import eu.kanade.tachiyomi.lib.randomua.getPrefCustomUA
import eu.kanade.tachiyomi.lib.randomua.getPrefUAType
import eu.kanade.tachiyomi.lib.randomua.setRandomUserAgent
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.ConfigurableSource
import okhttp3.HttpUrl.Companion.toHttpUrl
@ -30,6 +34,10 @@ class Hiperdex :
override val client = super.client.newBuilder()
.addInterceptor(::domainChangeIntercept)
.setRandomUserAgent(
preferences.getPrefUAType(),
preferences.getPrefCustomUA(),
)
.build()
private var lastDomain = ""
@ -102,6 +110,7 @@ class Hiperdex :
}
}
screen.addPreference(baseUrlPref)
addRandomUAPreferenceToScreen(screen)
}
private var SharedPreferences.baseUrlHost