fix(media-unlock): avoid misleading region for Muse AI in Rule mode (#8685)

* fix(media-unlock): avoid misleading region from cloudflare trace for Muse AI

Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>

* chore(changelog): append missing statements

- Simply express what has changed in `Changelog.md`

Assisted-by: MAI Code 2 (high)
Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>

---------

Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
Co-authored-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
This commit is contained in:
星海
2026-11-19 01:24:54 +00:00
committed by GitHub
co-authored by ❤是纱雾酱哟~
parent 7b7a5947b9
commit 3f7af9ab02
2 changed files with 7 additions and 11 deletions
+1
View File
@@ -38,6 +38,7 @@
- 修复「连接」页表格排序时表头换行、标题位置跳动
- 修复「TUN 设置」未手动保存时,界面显示的默认 MTU 1500 未生效
- 修复「链式代理」节点列表按名称排序,未保持订阅中的节点顺序
- 修复规则模式下 Muse AI 解锁检测显示错误的出口地区
**🍎 macOS**
+6 -11
View File
@@ -1,28 +1,23 @@
use reqwest::Client;
use crate::utils::{classify_restricted_status, get_trace_location};
use crate::utils::classify_restricted_status;
use super::UnlockItem;
pub(crate) const MUSE_AI_NAME: &str = "Muse AI";
const MUSE_URL: &str = "https://muse.ai";
const CLOUDFLARE_TRACE_URL: &str = "https://www.cloudflare.com/cdn-cgi/trace";
// The aymh ("Are You a Human") gateway answers plain HTTP requests with a
// generic Meta error page that always contains the Facebook logo asset.
const AYMH_ERROR_MARKERS: &[&str] = &["Sorry, something went wrong", "static.facebook.com/images/logos"];
pub(super) async fn check_muse_ai(client: &Client) -> UnlockItem {
// muse.ai itself is served by Vercel, so resolve the exit region through
// the generic Cloudflare trace endpoint instead of a service-specific one.
let region = get_trace_location(client, CLOUDFLARE_TRACE_URL)
.await
.map(|code| code.trim().to_ascii_uppercase())
.map(|code| UnlockItem::region_label(&code));
// muse.ai is served by Vercel and does not expose a service-specific region trace endpoint.
// Querying a generic third-party domain (e.g. www.cloudflare.com/cdn-cgi/trace) would report
// that domain's proxy group rather than muse.ai's actual exit in Rule mode, so leave region as None.
let Ok(response) = client.get(MUSE_URL).send().await else {
return UnlockItem::checked(MUSE_AI_NAME, "Failed (Network Connection)", region);
return UnlockItem::checked(MUSE_AI_NAME, "Failed (Network Connection)", None);
};
let status = response.status();
@@ -44,5 +39,5 @@ pub(super) async fn check_muse_ai(client: &Client) -> UnlockItem {
classify_restricted_status(status).unwrap_or("Failed")
};
UnlockItem::checked(MUSE_AI_NAME, result, region)
UnlockItem::checked(MUSE_AI_NAME, result, None)
}