Linux system proxy adds kde version processing

pull/6297/head
2dust 2024-12-17 11:05:12 +08:00
parent c49ba735a0
commit a6e246948a
1 changed files with 14 additions and 4 deletions

View File

@ -69,7 +69,7 @@
{
lstCmd.Add(new CmdItem()
{
Cmd = "kwriteconfig5",
Cmd = GetKdeVersion(),
Arguments = ["--file", $"{configDir}/kioslaverc", "--group", "Proxy Settings", "--key", "ProxyType", "0"]
});
}
@ -88,12 +88,13 @@
private static List<CmdItem> GetSetCmd4Kde(string type, string host, int port, string configDir)
{
List<CmdItem> lstCmd = [];
var cmd = GetKdeVersion();
if (type.IsNullOrEmpty())
{
lstCmd.Add(new()
{
Cmd = "kwriteconfig5",
Cmd = cmd,
Arguments = ["--file", $"{configDir}/kioslaverc", "--group", "Proxy Settings", "--key", "ProxyType", "1"]
});
}
@ -101,7 +102,7 @@
{
lstCmd.Add(new()
{
Cmd = "kwriteconfig5",
Cmd = cmd,
Arguments = ["--file", $"{configDir}/kioslaverc", "--group", "Proxy Settings", "--key", "NoProxyFor", host]
});
}
@ -110,7 +111,7 @@
var type2 = type.Equals("https") ? "http" : type;
lstCmd.Add(new CmdItem()
{
Cmd = "kwriteconfig5",
Cmd = cmd,
Arguments = ["--file", $"{configDir}/kioslaverc", "--group", "Proxy Settings", "--key", $"{type}Proxy", $"{type2}://{host}:{port}"]
});
}
@ -172,5 +173,14 @@
return isKde;
}
private static string GetKdeVersion()
{
var ver = Environment.GetEnvironmentVariable("KDE_SESSION_VERSION") ?? "0";
return ver switch
{
"6" => "kwriteconfig6",
_ => "kwriteconfig5"
};
}
}
}