mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-18 06:03:17 +08:00
Ship uds-auth offline tgz without npm qrcode fetch (0.2.20).
Bundle qrcode SVG into lib/qrcode-bundled.cjs and drop the runtime dependency so Desktop field installs work without registry.npmjs.org. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
5b5c0a1418
commit
3ba4461566
7 changed files with 2131 additions and 15 deletions
|
|
@ -175,22 +175,24 @@ function buildVerifyUrl(uacBaseUrl, uacQrVerifyPath) {
|
|||
return (uacBaseUrl.replace(/\/$/, '') + '/' + uacQrVerifyPath.replace(/^\//, ''))
|
||||
}
|
||||
|
||||
// Prefer npm `qrcode`; fall back to vendored copy if present.
|
||||
// Prefer offline bundle (shipped in tgz); fall back to npm / legacy vendored tree.
|
||||
async function loadQRCodeLib() {
|
||||
if (_qrcodeLib) return _qrcodeLib
|
||||
try {
|
||||
_qrcodeLib = require('qrcode')
|
||||
return _qrcodeLib
|
||||
} catch {
|
||||
const candidates = [
|
||||
resolve(__dirname, 'qrcode-bundled.cjs'),
|
||||
'qrcode',
|
||||
resolve(__dirname, 'qrcode-lib', 'lib', 'browser.js'),
|
||||
]
|
||||
for (const candidate of candidates) {
|
||||
try {
|
||||
const libPath = resolve(__dirname, 'qrcode-lib', 'lib', 'browser.js')
|
||||
_qrcodeLib = require(libPath)
|
||||
_qrcodeLib = require(candidate)
|
||||
return _qrcodeLib
|
||||
} catch (e) {
|
||||
_logger.error?.('[uds-auth] Failed to load qrcode library:', e)
|
||||
return null
|
||||
} catch {
|
||||
// try next
|
||||
}
|
||||
}
|
||||
_logger.error?.('[uds-auth] Failed to load qrcode library (no bundled/npm/vendored copy)')
|
||||
return null
|
||||
}
|
||||
|
||||
/** Start a UAC TwoDIMAuth QR challenge (no browser jQuery plugins required). */
|
||||
|
|
|
|||
2040
uds-auth/lib/qrcode-bundled.cjs
Normal file
2040
uds-auth/lib/qrcode-bundled.cjs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue