mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2026-05-09 18:11:26 +08:00
chore: Changing the User-Agent used to retrieve subscription-userinfo
ClashForWindows is no longer able to retrieve information from some providers.
This commit is contained in:
@@ -139,9 +139,10 @@ class ProfileManager(private val context: Context) : IProfileManager,
|
|||||||
suspend fun updateFlow(old: Imported) {
|
suspend fun updateFlow(old: Imported) {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
try {
|
try {
|
||||||
|
val versionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(old.source)
|
.url(old.source)
|
||||||
.header("User-Agent", "ClashforWindows/0.19.23")
|
.header("User-Agent", "ClashMetaForAndroid/$versionName")
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
client.newCall(request).execute().use { response ->
|
client.newCall(request).execute().use { response ->
|
||||||
|
|||||||
@@ -76,9 +76,10 @@ object ProfileProcessor {
|
|||||||
if (snapshot?.type == Profile.Type.Url) {
|
if (snapshot?.type == Profile.Type.Url) {
|
||||||
if (snapshot.source.startsWith("https://", true)) {
|
if (snapshot.source.startsWith("https://", true)) {
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
val versionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url(snapshot.source)
|
.url(snapshot.source)
|
||||||
.header("User-Agent", "ClashforWindows/0.19.23")
|
.header("User-Agent", "ClashMetaForAndroid/$versionName")
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
client.newCall(request).execute().use { response ->
|
client.newCall(request).execute().use { response ->
|
||||||
|
|||||||
Reference in New Issue
Block a user