Files
2026-04-08 01:12:53 +08:00

46 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
"use strict";
const { execFileSync } = require("child_process");
const path = require("path");
const fs = require("fs");
const os = require("os");
// ── 平台 → 产物文件名映射 ────────────────────────────────────────────────────
const PLATFORM_MAP = {
"darwin-x64": "tmeet-macOS-Intel",
"darwin-arm64": "tmeet-macOS-AppleSilicon",
"linux-x64": "tmeet-Linux-x86_64",
"linux-arm64": "tmeet-Linux-ARM64",
"win32-x64": "tmeet-Windows-x86_64.exe",
};
const platform = os.platform();
const arch = os.arch();
const key = `${platform}-${arch}`;
const binaryName = PLATFORM_MAP[key];
if (!binaryName) {
process.exit(1);
}
const binaryPath = path.join(__dirname, "..", "dist", binaryName);
if (!fs.existsSync(binaryPath)) {
// 二进制不存在,无需清理
process.exit(0);
}
// 确保可执行权限Windows 不需要)
if (platform !== "win32") {
fs.chmodSync(binaryPath, 0o755);
}
// 执行 tmeet auth logout 清理登录态
try {
execFileSync(binaryPath, ["auth", "logout"], { stdio: "inherit" });
} catch (err) {
process.exit(0);
}