mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-11 04:00:32 +08:00
fix: use explicit arch parameter for sysproxy node selection
This commit is contained in:
parent
295c4400e9
commit
ab58248d7b
@ -321,10 +321,10 @@ const SYSPROXY_RS_VERSION = 'v0.1.0'
|
|||||||
const SYSPROXY_RS_URL_PREFIX = `https://github.com/mihomo-party-org/sysproxy-rs-opti/releases/download/${SYSPROXY_RS_VERSION}`
|
const SYSPROXY_RS_URL_PREFIX = `https://github.com/mihomo-party-org/sysproxy-rs-opti/releases/download/${SYSPROXY_RS_VERSION}`
|
||||||
|
|
||||||
function getSysproxyNodeName() {
|
function getSysproxyNodeName() {
|
||||||
|
// 检测是否为 musl 系统(与 src/native/sysproxy/index.js 保持一致)
|
||||||
const isMusl = (() => {
|
const isMusl = (() => {
|
||||||
if (platform !== 'linux') return false
|
if (platform !== 'linux') return false
|
||||||
try {
|
try {
|
||||||
// 通过 ldd --version 输出判断是否为 musl
|
|
||||||
const output = execSync('ldd --version 2>&1 || true').toString()
|
const output = execSync('ldd --version 2>&1 || true').toString()
|
||||||
return output.includes('musl')
|
return output.includes('musl')
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const { existsSync, readFileSync } = require('fs')
|
const { existsSync } = require('fs')
|
||||||
const { join, dirname } = require('path')
|
const { join, dirname } = require('path')
|
||||||
|
|
||||||
const { platform, arch } = process
|
const { platform, arch } = process
|
||||||
@ -7,17 +7,19 @@ let nativeBinding = null
|
|||||||
let loadError = null
|
let loadError = null
|
||||||
|
|
||||||
function isMusl() {
|
function isMusl() {
|
||||||
if (!process.report || typeof process.report.getReport !== 'function') {
|
// 优先使用 process.report(Node.js 12+,最可靠)
|
||||||
try {
|
if (process.report && typeof process.report.getReport === 'function') {
|
||||||
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
||||||
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
||||||
} catch {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const { glibcVersionRuntime } = process.report.getReport().header
|
const { glibcVersionRuntime } = process.report.getReport().header
|
||||||
return !glibcVersionRuntime
|
return !glibcVersionRuntime
|
||||||
}
|
}
|
||||||
|
// 备选:检查 ldd --version 输出
|
||||||
|
try {
|
||||||
|
const { execSync } = require('child_process')
|
||||||
|
const output = execSync('ldd --version 2>&1 || true').toString()
|
||||||
|
return output.includes('musl')
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBindingName() {
|
function getBindingName() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user