mihomo-cli 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.js +9 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.1] - 2026-04-22
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- **TUN DNS 默认值**:使用属性存在性检查替代 falsy 检查,避免订阅中 `dns.enable: false` 等值被覆盖
|
|
8
|
+
- **覆写文件名显示**:`overwrite.yaml` 不再显示为 "yaml",改为 "主文件"
|
|
9
|
+
|
|
10
|
+
### 优化
|
|
11
|
+
|
|
12
|
+
- **消除重复文件扫描**:覆写文件加载从每次构建 2 次减少为 1 次
|
|
13
|
+
- **清理死代码**:移除 `resetUserData`、`getGitHubMirror`、`setGitHubMirror`、未使用的类型字段
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
3
17
|
## [2.0.0] - 2026-04-11
|
|
4
18
|
|
|
5
19
|
### 架构重写
|
package/dist/index.js
CHANGED
|
@@ -2949,9 +2949,9 @@ function loadOverwriteFile() {
|
|
|
2949
2949
|
}
|
|
2950
2950
|
return results;
|
|
2951
2951
|
}
|
|
2952
|
-
function applyOverwrite(baseConfig) {
|
|
2952
|
+
function applyOverwrite(baseConfig, preloadedFiles) {
|
|
2953
2953
|
if (!isOverwriteEnabled()) return baseConfig;
|
|
2954
|
-
const overwriteFiles = loadOverwriteFile();
|
|
2954
|
+
const overwriteFiles = preloadedFiles || loadOverwriteFile();
|
|
2955
2955
|
if (overwriteFiles.length === 0) return baseConfig;
|
|
2956
2956
|
let result = { ...baseConfig };
|
|
2957
2957
|
for (const file of overwriteFiles) {
|
|
@@ -2995,8 +2995,8 @@ function buildConfig(subRawContent, mode) {
|
|
|
2995
2995
|
throw new Error("\u8BA2\u9605\u5185\u5BB9\u4E3A\u7A7A");
|
|
2996
2996
|
}
|
|
2997
2997
|
const overwriteEnabled = isOverwriteEnabled();
|
|
2998
|
-
const withOverwrites = applyOverwrite(subscriptionConfig);
|
|
2999
2998
|
const overwriteFiles = overwriteEnabled ? loadOverwriteFile() : [];
|
|
2999
|
+
const withOverwrites = applyOverwrite(subscriptionConfig, overwriteFiles);
|
|
3000
3000
|
const systemConfig = {};
|
|
3001
3001
|
for (const [key, value] of Object.entries(BASE_CONFIG)) {
|
|
3002
3002
|
if (!(key in withOverwrites)) {
|
|
@@ -3007,9 +3007,9 @@ function buildConfig(subRawContent, mode) {
|
|
|
3007
3007
|
systemConfig.tun = TUN_CONFIG.tun;
|
|
3008
3008
|
const subDns = withOverwrites.dns || {};
|
|
3009
3009
|
const dns = {};
|
|
3010
|
-
if (!subDns
|
|
3011
|
-
if (!
|
|
3012
|
-
if (!
|
|
3010
|
+
if (!("enable" in subDns)) dns.enable = true;
|
|
3011
|
+
if (!("enhanced-mode" in subDns)) dns["enhanced-mode"] = "fake-ip";
|
|
3012
|
+
if (!("fake-ip-range" in subDns)) dns["fake-ip-range"] = "198.18.0.1/16";
|
|
3013
3013
|
if (Object.keys(dns).length > 0) {
|
|
3014
3014
|
systemConfig.dns = dns;
|
|
3015
3015
|
}
|
|
@@ -3662,7 +3662,6 @@ function listLogs() {
|
|
|
3662
3662
|
const stat = fs5.statSync(filePath);
|
|
3663
3663
|
result.archives.push({
|
|
3664
3664
|
name: file,
|
|
3665
|
-
timestamp: match[1],
|
|
3666
3665
|
path: filePath,
|
|
3667
3666
|
size: stat.size,
|
|
3668
3667
|
mtime: stat.mtime,
|
|
@@ -3938,9 +3937,8 @@ var compareVersions = (v1, v2) => {
|
|
|
3938
3937
|
// src/kernel.ts
|
|
3939
3938
|
var GITHUB_REPO = "MetaCubeX/mihomo";
|
|
3940
3939
|
var KERNEL_HTTP_TIMEOUT = 12e4;
|
|
3941
|
-
var KERNEL_MAX_CONTENT_LENGTH = 200 * 1024 * 1024;
|
|
3942
3940
|
var KERNEL_DOWNLOAD_TIMEOUT = 18e4;
|
|
3943
|
-
var HTTP_CLIENT = createHttpClient({ timeout: KERNEL_HTTP_TIMEOUT
|
|
3941
|
+
var HTTP_CLIENT = createHttpClient({ timeout: KERNEL_HTTP_TIMEOUT });
|
|
3944
3942
|
function withMirror(url, mirror) {
|
|
3945
3943
|
if (mirror && (url.startsWith("https://github.com/") || url.startsWith("https://api.github.com/"))) {
|
|
3946
3944
|
return mirror + url;
|
|
@@ -4000,7 +3998,6 @@ async function checkUpdate(mirror) {
|
|
|
4000
3998
|
latest: latestVersion,
|
|
4001
3999
|
needsUpdate,
|
|
4002
4000
|
assets: latest.assets,
|
|
4003
|
-
htmlUrl: latest.html_url,
|
|
4004
4001
|
release: latest
|
|
4005
4002
|
};
|
|
4006
4003
|
}
|
|
@@ -4241,7 +4238,7 @@ import path5 from "path";
|
|
|
4241
4238
|
|
|
4242
4239
|
// src/subscription.ts
|
|
4243
4240
|
var DEFAULT_UPDATE_INTERVAL_HOURS = 12;
|
|
4244
|
-
var HTTP_CLIENT2 = createHttpClient({ timeout: 6e4
|
|
4241
|
+
var HTTP_CLIENT2 = createHttpClient({ timeout: 6e4 });
|
|
4245
4242
|
function parseUserInfo(header) {
|
|
4246
4243
|
if (!header) return null;
|
|
4247
4244
|
const info = {};
|
|
@@ -4458,7 +4455,7 @@ function printStatus() {
|
|
|
4458
4455
|
console.log(`${colors.gray("\u8BA2\u9605: ")}\u672A\u914D\u7F6E`);
|
|
4459
4456
|
}
|
|
4460
4457
|
if (overwriteEnabled && overwriteFiles.length > 0) {
|
|
4461
|
-
const names = overwriteFiles.map((f) => f.name.replace(/^overwrite\.?/, "")).join(", ");
|
|
4458
|
+
const names = overwriteFiles.map((f) => f.name.replace(/^overwrite\.?/, "").replace(/\.ya?ml$/, "") || "\u4E3B\u6587\u4EF6").join(", ");
|
|
4462
4459
|
console.log(`${colors.gray("\u8986\u5199: ")}${colors.green("\u5DF2\u542F\u7528")} (${names})`);
|
|
4463
4460
|
} else if (overwriteEnabled) {
|
|
4464
4461
|
console.log(`${colors.gray("\u8986\u5199: ")}${colors.green("\u5DF2\u542F\u7528")} (\u65E0\u6587\u4EF6)`);
|