mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
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:
3
bun.lock
3
bun.lock
@@ -117,7 +117,6 @@
|
|||||||
"plist": "^3.1.0",
|
"plist": "^3.1.0",
|
||||||
"proper-lockfile": "^4.1.2",
|
"proper-lockfile": "^4.1.2",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"qrcode-terminal": "^0.12.0",
|
|
||||||
"react": "^19.2.5",
|
"react": "^19.2.5",
|
||||||
"react-compiler-runtime": "^1.0.0",
|
"react-compiler-runtime": "^1.0.0",
|
||||||
"react-reconciler": "^0.33.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": ["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=="],
|
"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=="],
|
"queue-microtask": ["queue-microtask@1.2.3", "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
|
||||||
|
|||||||
@@ -67,11 +67,11 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alcalzone/ansi-tokenize": "^0.3.0",
|
"@alcalzone/ansi-tokenize": "^0.3.0",
|
||||||
"@ant/model-provider": "workspace:*",
|
|
||||||
"@ant/claude-for-chrome-mcp": "workspace:*",
|
"@ant/claude-for-chrome-mcp": "workspace:*",
|
||||||
"@ant/computer-use-input": "workspace:*",
|
"@ant/computer-use-input": "workspace:*",
|
||||||
"@ant/computer-use-mcp": "workspace:*",
|
"@ant/computer-use-mcp": "workspace:*",
|
||||||
"@ant/computer-use-swift": "workspace:*",
|
"@ant/computer-use-swift": "workspace:*",
|
||||||
|
"@ant/model-provider": "workspace:*",
|
||||||
"@anthropic-ai/bedrock-sdk": "^0.26.4",
|
"@anthropic-ai/bedrock-sdk": "^0.26.4",
|
||||||
"@anthropic-ai/claude-agent-sdk": "^0.2.114",
|
"@anthropic-ai/claude-agent-sdk": "^0.2.114",
|
||||||
"@anthropic-ai/foundry-sdk": "^0.2.3",
|
"@anthropic-ai/foundry-sdk": "^0.2.3",
|
||||||
@@ -173,7 +173,6 @@
|
|||||||
"plist": "^3.1.0",
|
"plist": "^3.1.0",
|
||||||
"proper-lockfile": "^4.1.2",
|
"proper-lockfile": "^4.1.2",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"qrcode-terminal": "^0.12.0",
|
|
||||||
"react": "^19.2.5",
|
"react": "^19.2.5",
|
||||||
"react-compiler-runtime": "^1.0.0",
|
"react-compiler-runtime": "^1.0.0",
|
||||||
"react-reconciler": "^0.33.0",
|
"react-reconciler": "^0.33.0",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { toString as qrToString } from 'qrcode'
|
||||||
|
|
||||||
export interface QRCodeResult {
|
export interface QRCodeResult {
|
||||||
qrcodeUrl?: string
|
qrcodeUrl?: string
|
||||||
qrcodeId: string
|
qrcodeId: string
|
||||||
@@ -14,20 +16,12 @@ export interface LoginResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function renderQrCodeToTerminal(qrcodeUrl: string): Promise<void> {
|
async function renderQrCodeToTerminal(qrcodeUrl: string): Promise<void> {
|
||||||
const moduleName = 'qrcode-terminal'
|
const output = await qrToString(qrcodeUrl, {
|
||||||
const { default: qrcode } = (await import(moduleName)) as {
|
type: 'terminal',
|
||||||
default: {
|
errorCorrectionLevel: 'L',
|
||||||
generate: (
|
small: true,
|
||||||
text: string,
|
|
||||||
options?: { small?: boolean },
|
|
||||||
callback?: (output: string) => void,
|
|
||||||
) => void
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
qrcode.generate(qrcodeUrl, { small: true }, output => {
|
|
||||||
process.stderr.write(`${output}\n`)
|
|
||||||
})
|
})
|
||||||
|
process.stderr.write(`${output}\n`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function startLogin(apiBaseUrl: string): Promise<QRCodeResult> {
|
export async function startLogin(apiBaseUrl: string): Promise<QRCodeResult> {
|
||||||
|
|||||||
11
src/types/qrcode-terminal.d.ts
vendored
11
src/types/qrcode-terminal.d.ts
vendored
@@ -1,11 +0,0 @@
|
|||||||
declare module 'qrcode-terminal' {
|
|
||||||
const qrcode: {
|
|
||||||
generate(
|
|
||||||
text: string,
|
|
||||||
options?: { small?: boolean },
|
|
||||||
callback?: (output: string) => void,
|
|
||||||
): void
|
|
||||||
}
|
|
||||||
|
|
||||||
export default qrcode
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user