Compare commits

...
2 Commits
Author SHA1 Message Date
手瓜一十雪 2049e64260 Add newer QQ appids and arch-aware lookup
Release Tag / validate-version (push) Canceled after 0s
Release Tag / trigger-release (push) Canceled after 0s
Updated the external QQ appid, native, and packet tables for newer Linux and Windows builds, including architecture-specific Linux AppID entries. QQBasicInfoWrapper now prefers the matching x64/arm64 AppID before falling back to version-only lookups, and regression tests cover Linux/Windows version resolution and fallback behavior.
2026-09-14 12:36:00 +08:00
手瓜一十雪 7a35ef035a Pin Windows QQ package for release build
Release Tag / validate-version (push) Canceled after 0s
Release Tag / trigger-release (push) Canceled after 0s
The Windows release workflow now uses a fixed QQ installer URL and SHA256 hash, verifies the downloaded installer before packaging, and makes the download cache key sensitive to the selected QQ URL, hash, and Node version. The workflow also switches QQ downloads to curl with retries for transient HTTP errors and centralizes the Node version variable to keep the build config consistent.
2026-09-14 12:01:24 +08:00
6 changed files with 174 additions and 18 deletions

No files matched your search

+23 -8
View File
@@ -65,6 +65,11 @@ jobs:
assemble-windows-node:
needs: build
runs-on: ubuntu-latest
env:
# QQ 9.9.31.49738; SHA256 matches the microsoft/winget-pkgs installer manifest.
QQ_URL: https://github.com/Rodert/qq-versions/releases/download/qq-packages-20260528-3e8913a2/QQ_9.9.31_260528_x64_01.exe
QQ_SHA256: 0beb5cb4ff776cba822caa0abadbd53f5892f12628a86dabea1b372c82c086bc
NODE_VERSION: '22.11.0'
steps:
- uses: actions/checkout@v5
with:
@@ -80,12 +85,18 @@ jobs:
sudo apt update
sudo apt install -y aria2 unzip zip p7zip-full curl jq
- name: Generate download cache key
id: download-cache-key
run: |
DOWNLOAD_HASH=$(printf '%s\n' "$QQ_URL" "$QQ_SHA256" "$NODE_VERSION" | sha256sum | cut -d ' ' -f 1)
echo "key=napcat-downloads-v2-$DOWNLOAD_HASH" >> "$GITHUB_OUTPUT"
- name: Cache QQ and Node.js downloads
id: cache-downloads
uses: actions/cache@v4
with:
path: /tmp/napcat-downloads
key: napcat-downloads-qq9.9.27.45627-node22.11.0
key: ${{ steps.download-cache-key.outputs.key }}
- name: Download QQ and Node.js
if: steps.cache-downloads.outputs.cache-hit != 'true'
@@ -94,15 +105,20 @@ jobs:
mkdir -p /tmp/napcat-downloads
cd /tmp/napcat-downloads
NT_URL="https://qqdl.gtimg.cn/qqfile/QQNT/9.9.32/beta/a33ab721/QQ9.9.32.50969_x64.exe"
echo "Downloading QQ installer..."
aria2c -x16 -s16 -k1M -o "QQ_x64.exe" "$NT_URL"
# Retry download errors, including HTTP 404 responses.
curl --fail --location --retry 5 --retry-all-errors --retry-delay 5 \
--connect-timeout 30 --max-time 600 --user-agent "Mozilla/5.0" \
--output "QQ_x64.exe" "$QQ_URL"
NODE_VER="22.11.0"
NODE_URL="https://nodejs.org/dist/v$NODE_VER/node-v$NODE_VER-win-x64.zip"
echo "Downloading Node.js $NODE_VER..."
NODE_URL="https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-win-x64.zip"
echo "Downloading Node.js $NODE_VERSION..."
aria2c -x1 -s1 -k1M -o "node-win-x64.zip" "$NODE_URL"
- name: Verify QQ installer
run: |
echo "$QQ_SHA256 /tmp/napcat-downloads/QQ_x64.exe" | sha256sum --check --strict -
- name: Assemble NapCat.Shell.Windows.Node.zip
run: |
set -euo pipefail
@@ -159,8 +175,7 @@ jobs:
# -----------------------------
# 7) 拷贝 Node.exe 到 NapCat.Shell.Windows.Node
# -----------------------------
NODE_VER="22.11.0"
cp -a "$NODE_EXTRACT/node-v$NODE_VER-win-x64/node.exe" "$OUT_DIR/" || true
cp -a "$NODE_EXTRACT/node-v$NODE_VERSION-win-x64/node.exe" "$OUT_DIR/" || true
- name: Upload Artifact
uses: actions/upload-artifact@v6
+27 -3
View File
@@ -607,8 +607,32 @@
"appid": 537376344,
"qua": "V1_LNX_NQ_3.2.30_50969_GW_B"
},
"9.9.32-55230": {
"3.2.30-50969-arm64": {
"appid": 537376345,
"qua": "V1_LNX_NQ_3.2.30_50969_GW_B"
},
"9.9.33-52230": {
"appid": 537379411,
"qua": "V1_WIN_NQ_9.9.32_55230_GW_B"
"qua": "V1_WIN_NQ_9.9.33_52230_GW_B"
},
"3.2.32-52194": {
"appid": 537379447,
"qua": "V1_LNX_NQ_3.2.32_52194_GW_B"
},
"3.2.32-52194-arm64": {
"appid": 537379448,
"qua": "V1_LNX_NQ_3.2.32_52194_GW_B"
},
"9.9.35-52892": {
"appid": 537382819,
"qua": "V1_WIN_NQ_9.9.35_52892_GW_B"
},
"3.2.33-52892": {
"appid": 537382855,
"qua": "V1_LNX_NQ_3.2.33_52892_GW_B"
},
"3.2.33-52892-arm64": {
"appid": 537382856,
"qua": "V1_LNX_NQ_3.2.33_52892_GW_B"
}
}
}
+24 -4
View File
@@ -279,8 +279,28 @@
"send": "43A4804",
"recv": "1608CC8"
},
"9.9.32-55230-x64": {
"send": "367FE18",
"recv": "36835CC"
"9.9.33-52230-x64": {
"send": "BF2B5F",
"recv": "23BB4DD"
},
"3.2.32-52194-x64": {
"send": "6C45D20",
"recv": "393DE00"
},
"3.2.32-52194-arm64": {
"send": "493FAD8",
"recv": "17EA1DC"
},
"9.9.35-52892-x64": {
"send": "C361DF",
"recv": "246F3A1"
},
"3.2.33-52892-x64": {
"send": "6DDB4C0",
"recv": "39DA860"
},
"3.2.33-52892-arm64": {
"send": "4A5D658",
"recv": "1813A34"
}
}
}
+25 -1
View File
@@ -786,5 +786,29 @@
"3.2.30-50969-arm64": {
"send": "75BD1D0",
"recv": "75C0B80"
},
"9.9.33-52230-x64": {
"send": "367FE18",
"recv": "36835CC"
},
"3.2.32-52194-x64": {
"send": "C7DBF80",
"recv": "C7DFA20"
},
"3.2.32-52194-arm64": {
"send": "80F36D0",
"recv": "80F7080"
},
"9.9.35-52892-x64": {
"send": "37C30D8",
"recv": "37C688C"
},
"3.2.33-52892-x64": {
"send": "CB06D60",
"recv": "CB0A800"
},
"3.2.33-52892-arm64": {
"send": "832ECA0",
"recv": "8332650"
}
}
}
+3 -2
View File
@@ -79,10 +79,11 @@ export class QQBasicInfoWrapper {
getAppidV2 (): { appid: string; qua: string; } {
// 通过已有表 性能好
const appidTbale = AppidTable as unknown as QQAppidTableType;
const appidTable = AppidTable as unknown as QQAppidTableType;
const fullVersion = this.getFullQQVersion();
if (fullVersion) {
const data = appidTbale[fullVersion];
// 同一 Linux 版本的 x64 和 arm64 使用不同的 AppID,优先匹配架构。
const data = appidTable[`${fullVersion}-${process.arch}`] ?? appidTable[fullVersion];
if (data) {
return data;
}
+72
View File
@@ -0,0 +1,72 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { QQBasicInfoWrapper } from '@/napcat-core/helper/qq-basic-info';
vi.mock('@/napcat-core/index', () => ({ getMajorPath: vi.fn() }));
describe('QQ AppID lookup', () => {
let info: QQBasicInfoWrapper;
const archDescriptor = Object.getOwnPropertyDescriptor(process, 'arch')!;
beforeEach(() => {
Object.defineProperty(process, 'arch', { ...archDescriptor, value: 'x64' });
info = Object.create(QQBasicInfoWrapper.prototype);
info.context = { logger: { log: vi.fn() } } as QQBasicInfoWrapper['context'];
vi.spyOn(info, 'getFullQQVersion');
vi.spyOn(info, 'getAppidV2ByMajor').mockReturnValue('537999999');
});
afterEach(() => {
Object.defineProperty(process, 'arch', archDescriptor);
vi.restoreAllMocks();
});
it.each([
['3.2.30-50969', 'x64', 537376344],
['3.2.30-50969', 'arm64', 537376345],
['3.2.32-52194', 'x64', 537379447],
['3.2.32-52194', 'arm64', 537379448],
['3.2.33-52892', 'x64', 537382855],
['3.2.33-52892', 'arm64', 537382856],
] as const)('uses the scanned AppID for Linux %s %s', (version, arch, appid) => {
Object.defineProperty(process, 'arch', { ...archDescriptor, value: arch });
vi.mocked(info.getFullQQVersion).mockReturnValue(version);
expect(info.getAppidV2()).toEqual({
appid,
qua: `V1_LNX_NQ_${version.replace('-', '_')}_GW_B`,
});
expect(info.getAppidV2ByMajor).not.toHaveBeenCalled();
});
it.each([
['9.9.33-52230', 537379411],
['9.9.35-52892', 537382819],
] as const)('finds Windows %s by its actual package version', (version, appid) => {
vi.mocked(info.getFullQQVersion).mockReturnValue(version);
expect(info.getAppidV2()).toEqual({
appid,
qua: `V1_WIN_NQ_${version.replace('-', '_')}_GW_B`,
});
expect(info.getAppidV2ByMajor).not.toHaveBeenCalled();
});
it('preserves version-only entries when an architecture override is absent', () => {
Object.defineProperty(process, 'arch', { ...archDescriptor, value: 'arm64' });
vi.mocked(info.getFullQQVersion).mockReturnValue('3.2.29-49738');
expect(info.getAppidV2()).toEqual({
appid: 537355867,
qua: 'V1_LNX_NQ_3.2.29_49738_GW_B',
});
expect(info.getAppidV2ByMajor).not.toHaveBeenCalled();
});
it('still scans major.node for an unknown version', () => {
vi.mocked(info.getFullQQVersion).mockReturnValue('3.2.99-99999');
vi.spyOn(info, 'getQUAFallback').mockReturnValue('fallback-qua');
expect(info.getAppidV2()).toEqual({ appid: '537999999', qua: 'fallback-qua' });
expect(info.getAppidV2ByMajor).toHaveBeenCalledWith('3.2.99-99999');
});
});