From 10c8c0f74ecbcc413db1220a25e46ffb57d45c7d Mon Sep 17 00:00:00 2001 From: autumn Date: Fri, 22 Apr 2022 09:52:43 +0800 Subject: [PATCH] fix ip.sb --- .gitignore | 1 + ProxySuper.Core/Services/ServiceBase.cs | 4 ++-- ProxySuper.Core/ViewModels/HomeViewModel.cs | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6ec5eb5..3739cc6 100644 --- a/.gitignore +++ b/.gitignore @@ -199,3 +199,4 @@ FakesAssemblies/ # vs code .vscode/* /ProxySU_Core/Data/Record.json +/ProxySuper.WPF/bin diff --git a/ProxySuper.Core/Services/ServiceBase.cs b/ProxySuper.Core/Services/ServiceBase.cs index 6e5e836..3a290dd 100644 --- a/ProxySuper.Core/Services/ServiceBase.cs +++ b/ProxySuper.Core/Services/ServiceBase.cs @@ -412,7 +412,7 @@ namespace ProxySuper.Core.Services string cmd; Progress.Desc = ("检测IPv4"); - cmd = RunCmd(@"curl -s https://api.ip.sb/ip --ipv4 --max-time 8"); + cmd = RunCmd(@"curl -4 ip.sb"); IPv4 = cmd.TrimEnd('\r', '\n'); Progress.Desc = ($"IPv4地址为{IPv4}"); @@ -423,7 +423,7 @@ namespace ProxySuper.Core.Services else { Progress.Desc = ("检测IPv6"); - cmd = RunCmd(@"curl -s https://api.ip.sb/ip --ipv6 --max-time 8"); + cmd = RunCmd(@"curl -6 ip.sb"); IPv6 = cmd.TrimEnd('\r', '\n'); Progress.Desc = ($"IPv6地址为{IPv6}"); diff --git a/ProxySuper.Core/ViewModels/HomeViewModel.cs b/ProxySuper.Core/ViewModels/HomeViewModel.cs index f01c7c5..2ba60a8 100644 --- a/ProxySuper.Core/ViewModels/HomeViewModel.cs +++ b/ProxySuper.Core/ViewModels/HomeViewModel.cs @@ -53,6 +53,10 @@ namespace ProxySuper.Core.ViewModels { ContractResolver = new CamelCasePropertyNamesContractResolver() }); + if (!Directory.Exists("Data")) + { + Directory.CreateDirectory("Data"); + } File.WriteAllText("Data/Record.json", json); }