chore: Changing the User-Agent used to retrieve subscription-userinfo
Some checks failed
Build Debug / BuildDebug (push) Has been cancelled
Build Pre-Release / BuildPreRelease (push) Has been cancelled

ClashForWindows is no longer able to retrieve information from some providers.
This commit is contained in:
xishang0128 2025-09-02 03:28:30 +08:00
parent fda769cc69
commit f6f410fda8
No known key found for this signature in database
GPG Key ID: 02DAB1BEA331D06C
2 changed files with 4 additions and 2 deletions

View File

@ -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 ->

View File

@ -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 ->