feat(config): 支持共享代理配置文件,发布 0.5.2

This commit is contained in:
yml
2026-11-20 13:20:12 +08:00
parent 635d80e63e
commit f4b3cfa486
13 changed files with 595 additions and 6 deletions
+29
View File
@@ -0,0 +1,29 @@
package types
// SharedProxyConfig 是跨实例、跨电脑同步的代理配置。
// 该文件不包含代理 URL、代理过期时间、账号或 Cookie。
type SharedProxyConfig struct {
SchemaVersion int `json:"schemaVersion"`
UpdatedAt string `json:"updatedAt,omitempty"`
Proxy SharedProxySettings `json:"proxy"`
}
// SharedProxySettings 使用指针区分“未提供”与显式零值,支持部分配置覆盖。
type SharedProxySettings struct {
Enabled *bool `json:"enabled,omitempty"`
API *string `json:"api,omitempty"`
AccountsPerProxy *int `json:"accountsPerProxy,omitempty"`
SparePercent *int `json:"sparePercent,omitempty"`
AutoFetchOnSchedule *bool `json:"autoFetchOnSchedule,omitempty"`
AutoWhitelist *bool `json:"autoWhitelist,omitempty"`
WhitelistReplace *bool `json:"whitelistReplace,omitempty"`
WhitelistPassword *string `json:"whitelistPassword,omitempty"`
WhitelistSignKey *string `json:"whitelistSignKey,omitempty"`
}
// FileDialogResult 返回通过系统文件选择器选中的路径。
type FileDialogResult struct {
Success bool `json:"success"`
Path string `json:"path,omitempty"`
Error string `json:"error,omitempty"`
}
+1
View File
@@ -20,6 +20,7 @@ type Config struct {
ProxyEnabled bool `json:"proxyEnabled"` // 是否启用代理
ProxyURL string `json:"proxyUrl"` // 代理地址,支持 http://, https://, socks5://
ProxyAPI string `json:"proxyApi"` // 代理提取 API 地址,支持品赞与通用格式
SharedProxyConfigFile string `json:"sharedProxyConfigFile"` // 本机保存的共享代理配置路径
ProxyExpiresAt int64 `json:"proxyExpiresAt,omitempty"` // 当前静态代理的过期时间(Unix 毫秒),0 表示未知
AutoFetchProxyOnSchedule bool `json:"autoFetchProxyOnSchedule"` // 定时抢购触发前自动从 API 提取最新代理
AccountsPerProxy int `json:"accountsPerProxy"` // 每个独立代理承载的账号数