mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-10 11:40:28 +08:00
feat: add Windows 7 compatibility build using win7 target
This commit is contained in:
parent
388581d75e
commit
197c9d3af8
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -205,6 +205,8 @@ jobs:
|
||||
GITHUB_EVENT_NAME: workflow_dispatch
|
||||
run: node scripts/update-version.mjs
|
||||
- name: Prepare
|
||||
env:
|
||||
LEGACY_BUILD: 'true'
|
||||
run: pnpm prepare --${{ matrix.arch }}
|
||||
- name: Build
|
||||
env:
|
||||
|
||||
@ -332,11 +332,13 @@ function getSysproxyNodeName() {
|
||||
}
|
||||
})()
|
||||
|
||||
const isWin7Build = process.env.LEGACY_BUILD === 'true'
|
||||
|
||||
switch (platform) {
|
||||
case 'win32':
|
||||
if (arch === 'x64') return 'sysproxy.win32-x64-msvc.node'
|
||||
if (arch === 'x64') return isWin7Build ? 'sysproxy.win32-x64-msvc-win7.node' : 'sysproxy.win32-x64-msvc.node'
|
||||
if (arch === 'arm64') return 'sysproxy.win32-arm64-msvc.node'
|
||||
if (arch === 'ia32') return 'sysproxy.win32-ia32-msvc.node'
|
||||
if (arch === 'ia32') return isWin7Build ? 'sysproxy.win32-ia32-msvc-win7.node' : 'sysproxy.win32-ia32-msvc.node'
|
||||
break
|
||||
case 'darwin':
|
||||
if (arch === 'x64') return 'sysproxy.darwin-x64.node'
|
||||
|
||||
@ -1,11 +1,19 @@
|
||||
const { existsSync } = require('fs')
|
||||
const { join, dirname } = require('path')
|
||||
const os = require('os')
|
||||
|
||||
const { platform, arch } = process
|
||||
|
||||
let nativeBinding = null
|
||||
let loadError = null
|
||||
|
||||
function isWindows7() {
|
||||
if (platform !== 'win32') return false
|
||||
const release = os.release()
|
||||
// Windows 7 is NT 6.1
|
||||
return release.startsWith('6.1')
|
||||
}
|
||||
|
||||
function isMusl() {
|
||||
// 优先使用 process.report(Node.js 12+,最可靠)
|
||||
if (process.report && typeof process.report.getReport === 'function') {
|
||||
@ -23,10 +31,11 @@ function isMusl() {
|
||||
}
|
||||
|
||||
function getBindingName() {
|
||||
const win7 = isWindows7()
|
||||
switch (platform) {
|
||||
case 'win32':
|
||||
if (arch === 'x64') return 'sysproxy.win32-x64-msvc.node'
|
||||
if (arch === 'ia32') return 'sysproxy.win32-ia32-msvc.node'
|
||||
if (arch === 'x64') return win7 ? 'sysproxy.win32-x64-msvc-win7.node' : 'sysproxy.win32-x64-msvc.node'
|
||||
if (arch === 'ia32') return win7 ? 'sysproxy.win32-ia32-msvc-win7.node' : 'sysproxy.win32-ia32-msvc.node'
|
||||
if (arch === 'arm64') return 'sysproxy.win32-arm64-msvc.node'
|
||||
break
|
||||
case 'darwin':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user