chore(patch): 更新固件信息获取依赖版本

This commit is contained in:
Del Wang
2025-08-15 12:43:06 +08:00
parent affd94d1cf
commit 43e6739726
4 changed files with 38 additions and 51 deletions
+9 -4
View File
@@ -1,9 +1,14 @@
# 你的小米账号/密码
#你的小米账号/密码
MI_USER=23333333
MI_PASS=xxxxxxxxx
# 你的小爱音箱名称/DID
#你的小爱音箱名称/DID
MI_DID=小爱音箱Pro
# 你的 SSH 登录密码默认为 open-xiaoai
#你的 SSH 登录密码默认为 open-xiaoai
SSH_PASSWORD=open-xiaoai
#账号登录异常时,请取消下面的注释,使用 MI_TOKEN 登录
#MI_TOKEN=你的 passToken 获取教程 👉 https://github.com/idootop/migpt-next/issues/4
# 获取设备异常时,请取消下面的注释,查看设备列表详情
#MI_DEBUG=true
+20 -20
View File
@@ -8,11 +8,11 @@
"name": "open-xiaoai-patch",
"version": "1.0.0",
"dependencies": {
"@mi-gpt/miot": "^1.0.0"
"@mi-gpt/miot": "^1.2.1"
},
"devDependencies": {
"@mi-gpt/config": "1.0.0",
"@types/node": "^22.13.11",
"@mi-gpt/config": "1.1.0",
"@types/node": "^24.2.1",
"tsx": "^4.19.3",
"typescript": "^5.8.2"
}
@@ -443,9 +443,9 @@
}
},
"node_modules/@mi-gpt/config": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@mi-gpt/config/-/config-1.0.0.tgz",
"integrity": "sha512-oo/roYiRcGiHsZESjukwPTsRFqddShTJ8gkccR5ZMYn8SySj07A0nCsEsLEfB9mLkvNY8D6PCO1NxbRDDRBBlA==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@mi-gpt/config/-/config-1.1.0.tgz",
"integrity": "sha512-o24iFINsoDuvInnMpfBQ4zCuTObbdodjXyizXmxl3yyYOMjmIAXizO/1UZ9/dv3UVTov3sjL09aCGuBeIVhvtA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -453,12 +453,12 @@
}
},
"node_modules/@mi-gpt/miot": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@mi-gpt/miot/-/miot-1.0.0.tgz",
"integrity": "sha512-smWhddHzK1du3/LW2FifBrIIyeZNx/RvTSe0Zi4v3lYZwK8NeEwomg1jBjktQCCV4Fh8OuqNbCdNbmiVXmr5kw==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@mi-gpt/miot/-/miot-1.2.1.tgz",
"integrity": "sha512-DAFNUsLPepXSqJk/b+zfct8NCQHZzcl7f1t4X2WPKzxmDNagkawYlb96uPbk4syvn+DSg6vqle0Wm+gjmJ4kUA==",
"license": "MIT",
"dependencies": {
"@mi-gpt/utils": "1.0.0",
"@mi-gpt/utils": "1.1.1",
"axios": "^1.8.4",
"pako": "^2.1.0"
},
@@ -467,22 +467,22 @@
}
},
"node_modules/@mi-gpt/utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@mi-gpt/utils/-/utils-1.0.0.tgz",
"integrity": "sha512-hAU/uYPNiNJgXWkQrVqRLe/9Uz8AgtoiNwcbbwQs8iXJcyq3NjcSHkkwUseJAnaQFE9iv/kvHZZsx3r2HhlKjw==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@mi-gpt/utils/-/utils-1.1.1.tgz",
"integrity": "sha512-FiGHV2RDBRGE/Xb9Q5H757t3ZqOpo6gL+44VXiRxQb3fQiapOpn038RAWErHJYZajYzkxP2jl8Wggsb+wp77Zg==",
"license": "MIT",
"engines": {
"node": ">=16"
}
},
"node_modules/@types/node": {
"version": "22.14.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz",
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
"version": "24.2.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz",
"integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
"undici-types": "~7.10.0"
}
},
"node_modules/asynckit": {
@@ -883,9 +883,9 @@
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
"dev": true,
"license": "MIT"
}
+3 -3
View File
@@ -11,11 +11,11 @@
"build": "sh src/build.sh"
},
"dependencies": {
"@mi-gpt/miot": "^1.0.0"
"@mi-gpt/miot": "^1.2.1"
},
"devDependencies": {
"@mi-gpt/config": "1.0.0",
"@types/node": "^22.13.11",
"@mi-gpt/config": "1.1.0",
"@types/node": "^24.2.1",
"tsx": "^4.19.3",
"typescript": "^5.8.2"
}
+6 -24
View File
@@ -13,36 +13,18 @@ const kSupportedDevices = [
// 获取 OTA 信息
async function getOTA(channel: "release" | "current" | "stable" = "release") {
const MiNA = await getMiNA({
did: process.env.MI_DID!,
userId: process.env.MI_USER!,
password: process.env.MI_PASS!,
passToken: process.env.MI_TOKEN,
debug: !!process.env.MI_DEBUG,
});
if (!MiNA) {
console.log(`❌ 登录失败,请检查小米账号密码是否正确:`);
console.log(`当前账号:${process.env.MI_USER}`);
console.log(`当前密码:${process.env.MI_PASS}`);
return;
}
const devices = await MiNA.getDevices();
const speaker = devices?.find(
(e: any) =>
e.name === process.env.MI_DID || e.miotDID === process.env.MI_DID
);
if (!speaker) {
console.log(`❌ 找不到设备: ${process.env.MI_DID}`);
console.log(`可用设备列表:`);
console.log(
JSON.stringify(
devices.map((e: any) => ({
name: e.name,
did: e.miotDID,
})),
null,
4
)
);
return;
}
const speaker = MiNA.account.device as any;
if (!kSupportedDevices.includes(speaker.hardware)) {
console.log(
@@ -65,7 +47,7 @@ async function getOTA(channel: "release" | "current" | "stable" = "release") {
}
const model = speaker.hardware;
const time = new Date().getTime();
const time = Date.now();
const sn = process.env.DEBUG_VERSION ? "" : speaker.serialNumber;
const version = process.env.DEBUG_VERSION ?? speaker.romVersion;
const otaInfo = `channel=${channel}&filterID=${sn}&locale=zh_CN&model=${model}&time=${time}&version=${version}&8007236f-a2d6-4847-ac83-c49395ad6d65`;
@@ -88,7 +70,7 @@ async function main() {
} else {
ota = await getOTA();
}
if (!ota.url) {
if (!ota?.url) {
console.log(`❌ 获取设备信息失败`);
process.exit(1);
}