fix: import profile panic (#5346)

* fix: import profile panic

docs: update UPDATELOG.md

chore: update

* perf: spawn import profile
This commit is contained in:
oomeow
2025-11-07 22:46:30 +08:00
committed by GitHub
parent 758c21e656
commit 76bf91ff8a
3 changed files with 10 additions and 39 deletions

View File

@@ -37,6 +37,7 @@
- 修复 Linux 系统主题切换不生效 - 修复 Linux 系统主题切换不生效
- 修复 `允许自动更新` 字段使手动订阅刷新失效 - 修复 `允许自动更新` 字段使手动订阅刷新失效
- 修复轻量模式托盘状态不同步 - 修复轻量模式托盘状态不同步
- 修复一键导入订阅导致应用卡死崩溃的问题
<details> <details>
<summary><strong> ✨ 新增功能 </strong></summary> <summary><strong> ✨ 新增功能 </strong></summary>

View File

@@ -456,16 +456,10 @@ impl PrfItem {
Ok(Self { Ok(Self {
uid: Some(id), uid: Some(id),
itype: Some("merge".into()), itype: Some("merge".into()),
name: None,
desc: None,
file: Some(file), file: Some(file),
url: None,
selected: None,
extra: None,
option: None,
home: None,
updated: Some(chrono::Local::now().timestamp() as usize), updated: Some(chrono::Local::now().timestamp() as usize),
file_data: Some(template), file_data: Some(template),
..Default::default()
}) })
} }
@@ -481,16 +475,10 @@ impl PrfItem {
Ok(Self { Ok(Self {
uid: Some(id), uid: Some(id),
itype: Some("script".into()), itype: Some("script".into()),
name: None,
desc: None,
file: Some(file), file: Some(file),
url: None,
home: None,
selected: None,
extra: None,
option: None,
updated: Some(chrono::Local::now().timestamp() as usize), updated: Some(chrono::Local::now().timestamp() as usize),
file_data: Some(tmpl::ITEM_SCRIPT.into()), file_data: Some(tmpl::ITEM_SCRIPT.into()),
..Default::default()
}) })
} }
@@ -502,16 +490,10 @@ impl PrfItem {
Ok(Self { Ok(Self {
uid: Some(uid), uid: Some(uid),
itype: Some("rules".into()), itype: Some("rules".into()),
name: None,
desc: None,
file: Some(file), file: Some(file),
url: None,
home: None,
selected: None,
extra: None,
option: None,
updated: Some(chrono::Local::now().timestamp() as usize), updated: Some(chrono::Local::now().timestamp() as usize),
file_data: Some(tmpl::ITEM_RULES.into()), file_data: Some(tmpl::ITEM_RULES.into()),
..Default::default()
}) })
} }
@@ -523,16 +505,10 @@ impl PrfItem {
Ok(Self { Ok(Self {
uid: Some(uid), uid: Some(uid),
itype: Some("proxies".into()), itype: Some("proxies".into()),
name: None,
desc: None,
file: Some(file), file: Some(file),
url: None,
home: None,
selected: None,
extra: None,
option: None,
updated: Some(chrono::Local::now().timestamp() as usize), updated: Some(chrono::Local::now().timestamp() as usize),
file_data: Some(tmpl::ITEM_PROXIES.into()), file_data: Some(tmpl::ITEM_PROXIES.into()),
..Default::default()
}) })
} }
@@ -544,16 +520,10 @@ impl PrfItem {
Ok(Self { Ok(Self {
uid: Some(uid), uid: Some(uid),
itype: Some("groups".into()), itype: Some("groups".into()),
name: None,
desc: None,
file: Some(file), file: Some(file),
url: None,
home: None,
selected: None,
extra: None,
option: None,
updated: Some(chrono::Local::now().timestamp() as usize), updated: Some(chrono::Local::now().timestamp() as usize),
file_data: Some(tmpl::ITEM_GROUPS.into()), file_data: Some(tmpl::ITEM_GROUPS.into()),
..Default::default()
}) })
} }

View File

@@ -112,14 +112,14 @@ pub fn embed_server() {
// Use map instead of and_then to avoid Send issues // Use map instead of and_then to avoid Send issues
let scheme = warp::path!("commands" / "scheme") let scheme = warp::path!("commands" / "scheme")
.and(warp::query::<QueryParam>()) .and(warp::query::<QueryParam>())
.map(|query: QueryParam| { .and_then(|query: QueryParam| async move {
tokio::task::spawn_local(async move { AsyncHandler::spawn(|| async move {
logging_error!(Type::Setup, resolve::resolve_scheme(&query.param).await); logging_error!(Type::Setup, resolve::resolve_scheme(&query.param).await);
}); });
warp::reply::with_status::<std::string::String>( Ok::<_, warp::Rejection>(warp::reply::with_status::<std::string::String>(
"ok".to_string(), "ok".to_string(),
warp::http::StatusCode::OK, warp::http::StatusCode::OK,
) ))
}); });
let commands = visible.or(scheme).or(pac); let commands = visible.or(scheme).or(pac);