diff --git a/src/en/hiperdex/build.gradle b/src/en/hiperdex/build.gradle index 1ef2f29e3..5ce478df1 100644 --- a/src/en/hiperdex/build.gradle +++ b/src/en/hiperdex/build.gradle @@ -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') +} diff --git a/src/en/hiperdex/src/eu/kanade/tachiyomi/extension/en/hiperdex/Hiperdex.kt b/src/en/hiperdex/src/eu/kanade/tachiyomi/extension/en/hiperdex/Hiperdex.kt index f72335994..6f0a60ad2 100644 --- a/src/en/hiperdex/src/eu/kanade/tachiyomi/extension/en/hiperdex/Hiperdex.kt +++ b/src/en/hiperdex/src/eu/kanade/tachiyomi/extension/en/hiperdex/Hiperdex.kt @@ -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