mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2026-05-09 10:01: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) {
|
||||
val client = OkHttpClient()
|
||||
try {
|
||||
val versionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName
|
||||
val request = Request.Builder()
|
||||
.url(old.source)
|
||||
.header("User-Agent", "ClashforWindows/0.19.23")
|
||||
.header("User-Agent", "ClashMetaForAndroid/$versionName")
|
||||
.build()
|
||||
|
||||
client.newCall(request).execute().use { response ->
|
||||
|
||||
@@ -76,9 +76,10 @@ object ProfileProcessor {
|
||||
if (snapshot?.type == Profile.Type.Url) {
|
||||
if (snapshot.source.startsWith("https://", true)) {
|
||||
val client = OkHttpClient()
|
||||
val versionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName
|
||||
val request = Request.Builder()
|
||||
.url(snapshot.source)
|
||||
.header("User-Agent", "ClashforWindows/0.19.23")
|
||||
.header("User-Agent", "ClashMetaForAndroid/$versionName")
|
||||
.build()
|
||||
|
||||
client.newCall(request).execute().use { response ->
|
||||
|
||||
Reference in New Issue
Block a user