Files
mihomo-patchbay/shared/geo.ts
T
im0o 2580c03bfa 设置页第二轮:行内编辑、GEO 资源展开、恢复与导入分家
单值设置从常驻输入框改成 InlineEdit(纯文本加铅笔,Enter 或失焦提交,
失焦无效直接放弃——失焦是「我走了」,不该把人拽回来)。测速地址加恢复
默认按钮;内核参数逐项提交,不再攒一个保存按钮。

资源一节按文件展开:四类 GEO 文件的大小和更新时间由服务端 stat 内核
工作目录得来(GET /api/geo;文件名和大小写不敏感匹配照 constant/
path.go:18-20,193-224),下载地址可改(geox-url,config.go:363-368,
默认值 578-583)。行内的更新按钮仍是全量更新——内核只有这一个口子,
没变化的文件靠内容哈希跳过。

上传拆成两个入口:恢复只认带 Patchbay 标记的文件,导入收任意配置;
新增恢复策略(兼容只搬接管段落 listeners/proxy-groups/rules/
proxy-providers/rule-providers,覆盖整份替换)。平时是按钮,拖着文件
进窗口时整行变成投放区。
2026-08-12 01:40:49 +08:00

38 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* GEO 数据库的四类文件。名字和默认下载地址都来自内核源码,
* 界面(资源一节)和服务端(查文件大小和时间)共用这一份。
*/
export interface GeoFileStatus {
/** 界面上显示的名字 */
key: string
/** 在配置 geox-url 段落里的键名(config.go:363-368) */
configKey: string
/** 下载地址:配置里写了用配置的,没写是内核默认 */
url: string
/** 文件字节数。文件还没下载过是 null */
size: number | null
/** 文件修改时间,ISO 格式。没下载过是 null */
updatedAt: string | null
}
/**
* 文件名与内核一致(constant/path.go:18-20、144)。
* GeoIP.dat 和 GeoSite.dat 内核在目录里大小写不敏感地找(path.go:193-224),
* 服务端查文件时也要同样处理。
*/
export const GEO_FILES = [
{ key: 'MMDB', configKey: 'mmdb', file: 'geoip.metadb' },
{ key: 'ASN', configKey: 'asn', file: 'ASN.mmdb' },
{ key: 'GEOIP', configKey: 'geoip', file: 'GeoIP.dat' },
{ key: 'GEOSITE', configKey: 'geosite', file: 'GeoSite.dat' },
] as const
/** 内核的默认下载地址(config.go:578-583)。配置里没写 geox-url 时就是这些。 */
export const DEFAULT_GEOX_URLS: Record<string, string> = {
mmdb: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb',
asn: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb',
geoip: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat',
geosite: 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat',
}