feat(oss-browser-link): 实现一键注册+自动定位补丁功能

1. 新增oss-browser自动定位包装层脚本与注册批处理
2. 优化粘贴行为:焦点在输入框时交给浏览器默认粘贴
3. 新增一批调试与构建辅助脚本
4. 更新oss-browser下载页说明与步骤
This commit is contained in:
yangxiangyuan
2026-08-12 13:29:11 +08:00
parent b21ef2ea3e
commit 4016636153
12 changed files with 583 additions and 10 deletions
@@ -0,0 +1,29 @@
// 校验 register_ossbrowser_launch.bat:关键行 + base64 回环解码与源码一致
const fs = require('fs')
const path = require('path')
const { execFileSync } = require('child_process')
const ROOT = path.join(__dirname, '..', '..')
const BAT = path.join(ROOT, 'public', 'tools', 'oss_browser_link', 'assets', 'register_ossbrowser_launch.bat')
const SRC = path.join(ROOT, 'public', 'tools', 'oss_browser_link', 'assets', 'ossbrowser_wrapper_main.js')
const s = fs.readFileSync(BAT, 'utf8')
if (s.includes('\r\n') === false) { console.log('[FAIL] bat 不是 CRLF'); process.exit(1) }
const lines = s.split(/\r\n/)
console.log('total lines:', lines.length)
console.log('reg cmd line ok:', !!lines.find(l => l.includes('shell\\open\\command') && l.includes('\\"%EXE%\\"')))
console.log('mkdir line ok:', !!lines.find(l => l.includes('mkdir "%~dp0resources\\app"')))
console.log('txt region line ok:', !!lines.find(l => l.includes('echo oss-cn-shanghai>>')))
const marker = '>> "%~dp0_wrapper.b64"'
const b64 = lines.filter(l => l.startsWith('echo ') && l.endsWith(marker)).map(l => l.slice(5, l.length - marker.length)).join('')
console.log('b64 len:', b64.length)
const b64File = path.join(ROOT, 'temp', 'w2.b64')
const outFile = path.join(ROOT, 'temp', 'w2.js')
fs.writeFileSync(b64File, b64)
try { fs.unlinkSync(outFile) } catch {}
execFileSync('certutil', ['-decode', b64File, outFile], { stdio: 'pipe' })
const a = fs.readFileSync(SRC)
const b = fs.readFileSync(outFile)
console.log('roundtrip identical:', a.equals(b))
if (!a.equals(b)) process.exit(1)