Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: service install failure on windows, and lua runner misorder due to mihomo limitation #1866

Merged
merged 12 commits into from
Oct 26, 2024
5 changes: 4 additions & 1 deletion backend/tauri/src/core/service/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ pub async fn get_service_install_args<'n>() -> Result<Vec<OsString>, anyhow::Err
let user = {
#[cfg(windows)]
{
nyanpasu_utils::os::get_current_user_sid().await?
MNDIA marked this conversation as resolved.
Show resolved Hide resolved
match nyanpasu_utils::os::get_current_user_sid().await {
Ok(sid) => sid,
Err(_) => "%USERNAME%".to_string(),
}
}
#[cfg(not(windows))]
{
Expand Down
6 changes: 6 additions & 0 deletions backend/tauri/src/enhance/builtin/config_fixer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default function main(params) {
if (typeof params["log-level"] === "boolean") {
params["log-level"] = "debug";
}
return params;
}
5 changes: 0 additions & 5 deletions backend/tauri/src/enhance/builtin/config_fixer.lua

This file was deleted.

2 changes: 1 addition & 1 deletion backend/tauri/src/enhance/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl ChainItem {
// 修复配置的一些问题
let config_fixer = ChainItem::to_script(
"config_fixer",
ChainTypeWrapper::new_lua(include_str!("./builtin/config_fixer.lua").to_string()),
ChainTypeWrapper::new_js(include_str!("./builtin/config_fixer.js").to_string()),
);

// 移除或转换 Clash Rs 不支持的字段
Expand Down
2 changes: 1 addition & 1 deletion backend/tauri/src/enhance/script/lua/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Runner for LuaRunner {
let file = wrap_result!(tokio::fs::read_to_string(path).await);
self.process_honey(mapping, &file).await
}

// TODO: Keep the order of the dictionary structure in the configuration when processing lua. Because mihomo needs ordered dictionaries for dns policy.
async fn process_honey(&self, mapping: Mapping, script: &str) -> ProcessOutput {
let lua = wrap_result!(create_lua_context());
let logger = Arc::new(Mutex::new(Some(Logs::new())));
Expand Down
20 changes: 10 additions & 10 deletions frontend/nyanpasu/src/components/proxies/group-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ export const GroupList = ({
if (!data?.groups) {
return [];
}
if (!deferredProxiesFilter) {
return data.groups;
}
return data.groups.filter((group) => {
return (
!(group.hidden ?? false) &&
(group.name
.toLowerCase()
.includes(deferredProxiesFilter.toLowerCase()) ||
let matchesFilter = true;
if (!deferredProxiesFilter) {
} else {
matchesFilter =
group.name
.toLowerCase()
.includes(deferredProxiesFilter.toLowerCase()) ||
group.all?.some((proxy) => {
return proxy.name
.toLowerCase()
.includes(deferredProxiesFilter.toLowerCase());
}) ||
false)
);
false;
}
return !(group.hidden ?? false) && matchesFilter;
});
}, [data?.groups, deferredProxiesFilter]);

Expand Down
Loading