Skip to content

Commit 75381f3

Browse files
authored
适配新版HiPer启动 (#30)
1 parent f6d53ce commit 75381f3

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/hiper.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ pub fn run_hiper(ctx: ExtEventSink, token: String, use_tun: bool) -> DynResult {
124124
let tap_path = hiper_dir_path.join("tap-windows.exe");
125125
let wintun_path = hiper_dir_path.join("wintun.dll");
126126
let wintun_disabled_path = hiper_dir_path.join("wintun.dll.disabled");
127-
let hiper_plus_path = hiper_dir_path.join("hpr.exe");
128-
let hiper_env_path = hiper_dir_path.join("hpr_env.exe");
127+
let hiper_plus_path = hiper_dir_path.join("hiper.exe");
129128

130129
std::fs::create_dir_all(&hiper_dir_path).context("无法创建 HiPer 安装目录")?;
131130
std::fs::create_dir_all(&certs_dir_path).context("无法创建 HiPer 凭证证书目录")?;
@@ -153,7 +152,7 @@ pub fn run_hiper(ctx: ExtEventSink, token: String, use_tun: bool) -> DynResult {
153152
if !wintun_path.exists() {
154153
let _ = ctx.submit_command(SET_START_TEXT, "正在下载安装 WinTUN", Target::Auto);
155154
let res = tinyget::get(
156-
"https://gitcode.net/to/hiper/-/raw/plus/windows/wintun/amd64/wintun.dll",
155+
"https://gitcode.net/to/hiper/-/raw/master/windows-amd64/wintun.dll",
157156
)
158157
.send()
159158
.context("无法下载 WinTUN")?;
@@ -163,7 +162,7 @@ pub fn run_hiper(ctx: ExtEventSink, token: String, use_tun: bool) -> DynResult {
163162
if !tap_path.exists() {
164163
let _ = ctx.submit_command(SET_START_TEXT, "正在下载 WinTAP", Target::Auto);
165164
let res = tinyget::get(
166-
"https://gitcode.net/to/hiper/-/raw/plus/windows/tap-windows-9.21.2.exe",
165+
"https://gitcode.net/to/hiper/-/raw/master/tap-windows-9.21.2.exe",
167166
)
168167
.send()
169168
.context("无法下载 WinTAP 安装程序")?;
@@ -186,28 +185,13 @@ pub fn run_hiper(ctx: ExtEventSink, token: String, use_tun: bool) -> DynResult {
186185
} else {
187186
let _ = ctx.submit_command(SET_START_TEXT, "正在安装 HiPer", Target::Auto);
188187
}
189-
let res = tinyget::get("https://gitcode.net/to/hiper/-/raw/plus/windows/64bit/hpr.exe")
188+
let res = tinyget::get("https://gitcode.net/to/hiper/-/raw/master/windows-amd64/hiper.exe")
190189
.send()
191190
.context("无法下载 HiPer Plus 程序")?;
192191
println!("HPR downloaded, size {}", res.as_bytes().len());
193192

194193
write_file_safe(&hiper_plus_path, res.as_bytes()).context("无法安装 HiPer Plus 程序")?;
195194

196-
if hiper_plus_path.exists() {
197-
let _ = ctx.submit_command(SET_START_TEXT, "正在检查 HiPer Env 并更新", Target::Auto);
198-
} else {
199-
let _ = ctx.submit_command(SET_START_TEXT, "正在安装 HiPer Env", Target::Auto);
200-
}
201-
202-
let res = tinyget::get("https://gitcode.net/to/hiper/-/raw/plus/windows/64bit/hpr_env.exe")
203-
.send()
204-
.context("无法下载 HiPer Plus Env 程序")?;
205-
println!("HPR Env downloaded, size {}", res.as_bytes().len());
206-
207-
write_file_safe(&hiper_env_path, res.as_bytes()).context("无法安装 HiPer Plus Env 程序")?;
208-
209-
HAS_UPDATED.store(true, std::sync::atomic::Ordering::SeqCst);
210-
}
211195

212196
let _ = ctx.submit_command(SET_START_TEXT, "正在启动 HiPer", Target::Auto);
213197

0 commit comments

Comments
 (0)