mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-21 16:34:21 +08:00
🐛 fix(update/proxy): 稳定更新检查与代理运行时
- 更新检查前恢复持久化全局代理,避免重启后代理状态未进入运行时 - 将 DNS、EOF 和临时网络异常转为本地化错误,并对可重试网络错误做短重试 - 优先读取 GitHub asset digest,缺失时再回退 SHA256SUMS 校验文件 - 新增全局代理连接测试后端接口,支持草稿代理、已保存密码复用和清除密码意图 - 更新 Wails 绑定、浏览器 mock 与代理草稿序列化测试
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { createGlobalProxyDraft, toPersistedGlobalProxy } from './globalProxyDraft';
|
||||
import { createGlobalProxyDraft, toPersistedGlobalProxy, toSaveGlobalProxyInput } from './globalProxyDraft';
|
||||
|
||||
describe('global proxy draft', () => {
|
||||
it('hydrates a secretless draft from backend metadata while keeping password input blank', () => {
|
||||
@@ -32,4 +32,18 @@ describe('global proxy draft', () => {
|
||||
expect('password' in persisted).toBe(false);
|
||||
expect(persisted.hasPassword).toBe(true);
|
||||
});
|
||||
|
||||
it('passes explicit saved password clearing intent to the backend save payload', () => {
|
||||
const input = toSaveGlobalProxyInput({
|
||||
enabled: true,
|
||||
type: 'socks5',
|
||||
host: '127.0.0.1',
|
||||
port: 7890,
|
||||
hasPassword: true,
|
||||
clearPassword: true,
|
||||
});
|
||||
|
||||
expect(input.password).toBe('');
|
||||
expect(input.clearPassword).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { GlobalProxyConfig } from '../types';
|
||||
|
||||
type SaveGlobalProxyDraft = Partial<GlobalProxyConfig> & {
|
||||
clearPassword?: boolean;
|
||||
};
|
||||
|
||||
const toTrimmedString = (value: unknown): string => {
|
||||
if (typeof value === 'string') {
|
||||
return value.trim();
|
||||
@@ -53,10 +57,11 @@ export function toPersistedGlobalProxy(value: Partial<GlobalProxyConfig> = {}):
|
||||
};
|
||||
}
|
||||
|
||||
export function toSaveGlobalProxyInput(value: Partial<GlobalProxyConfig> = {}): GlobalProxyConfig {
|
||||
export function toSaveGlobalProxyInput(value: SaveGlobalProxyDraft = {}): GlobalProxyConfig & { clearPassword?: boolean } {
|
||||
const draft = createGlobalProxyDraft(value);
|
||||
return {
|
||||
...draft,
|
||||
password: typeof value.password === 'string' ? value.password : '',
|
||||
clearPassword: value.clearPassword === true || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user