#1167 当使用 IPC.config 时,程序内打开网页端口号值不正确

This commit is contained in:
Aigio Liu
2022-03-25 22:45:02 +08:00
parent bf5ca108e0
commit 3723e0866f
2 changed files with 23 additions and 2 deletions
@@ -197,9 +197,30 @@ namespace System.Application.Services.Implementation
}
}
string IPCRootUrl
{
get
{
string? value = null;
var a = ArchiSteamFarm.IPC.ArchiKestrel.ServerAddresses;
var loopback = IPAddress.Loopback.ToString();
if (a != null)
{
value = a.FirstOrDefault(x => x.Contains(loopback) && x.StartsWith(Browser2.Prefix_HTTP))
?? a.FirstOrDefault(x => x.Contains(loopback))
?? a.FirstOrDefault();
}
if (string.IsNullOrWhiteSpace(value))
{
value = $"http://{loopback}:{CurrentIPCPortValue}";
}
return value;
}
}
public string GetIPCUrl()
{
var defaultUrl = $"http://{IPAddress.Loopback}:{CurrentIPCPortValue}";
var defaultUrl = IPCRootUrl;
string absoluteConfigDirectory = Path.Combine(ASFPathHelper.AppDataDirectory, SharedInfo.ConfigDirectory);
string customConfigPath = Path.Combine(absoluteConfigDirectory, SharedInfo.IPCConfigFile);
if (File.Exists(customConfigPath))