fix: 改用 qrcode 生成 weixin 登录二维码

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
1111
2026-04-19 18:49:57 +08:00
parent 3b3e4fb1ea
commit dbc8a85cd7
4 changed files with 8 additions and 29 deletions

View File

@@ -117,7 +117,6 @@
"plist": "^3.1.0",
"proper-lockfile": "^4.1.2",
"qrcode": "^1.5.4",
"qrcode-terminal": "^0.12.0",
"react": "^19.2.5",
"react-compiler-runtime": "^1.0.0",
"react-reconciler": "^0.33.0",
@@ -2477,8 +2476,6 @@
"qrcode": ["qrcode@1.5.4", "https://registry.npmmirror.com/qrcode/-/qrcode-1.5.4.tgz", { "dependencies": { "dijkstrajs": "^1.0.1", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, "bin": { "qrcode": "bin/qrcode" } }, "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg=="],
"qrcode-terminal": ["qrcode-terminal@0.12.0", "", { "bin": { "qrcode-terminal": "./bin/qrcode-terminal.js" } }, "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ=="],
"qs": ["qs@6.15.1", "https://registry.npmmirror.com/qs/-/qs-6.15.1.tgz", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg=="],
"queue-microtask": ["queue-microtask@1.2.3", "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],

View File

@@ -67,11 +67,11 @@
},
"devDependencies": {
"@alcalzone/ansi-tokenize": "^0.3.0",
"@ant/model-provider": "workspace:*",
"@ant/claude-for-chrome-mcp": "workspace:*",
"@ant/computer-use-input": "workspace:*",
"@ant/computer-use-mcp": "workspace:*",
"@ant/computer-use-swift": "workspace:*",
"@ant/model-provider": "workspace:*",
"@anthropic-ai/bedrock-sdk": "^0.26.4",
"@anthropic-ai/claude-agent-sdk": "^0.2.114",
"@anthropic-ai/foundry-sdk": "^0.2.3",
@@ -173,7 +173,6 @@
"plist": "^3.1.0",
"proper-lockfile": "^4.1.2",
"qrcode": "^1.5.4",
"qrcode-terminal": "^0.12.0",
"react": "^19.2.5",
"react-compiler-runtime": "^1.0.0",
"react-reconciler": "^0.33.0",

View File

@@ -1,3 +1,5 @@
import { toString as qrToString } from 'qrcode'
export interface QRCodeResult {
qrcodeUrl?: string
qrcodeId: string
@@ -14,20 +16,12 @@ export interface LoginResult {
}
async function renderQrCodeToTerminal(qrcodeUrl: string): Promise<void> {
const moduleName = 'qrcode-terminal'
const { default: qrcode } = (await import(moduleName)) as {
default: {
generate: (
text: string,
options?: { small?: boolean },
callback?: (output: string) => void,
) => void
}
}
qrcode.generate(qrcodeUrl, { small: true }, output => {
process.stderr.write(`${output}\n`)
const output = await qrToString(qrcodeUrl, {
type: 'terminal',
errorCorrectionLevel: 'L',
small: true,
})
process.stderr.write(`${output}\n`)
}
export async function startLogin(apiBaseUrl: string): Promise<QRCodeResult> {

View File

@@ -1,11 +0,0 @@
declare module 'qrcode-terminal' {
const qrcode: {
generate(
text: string,
options?: { small?: boolean },
callback?: (output: string) => void,
): void
}
export default qrcode
}