dsh-mobile-plugin 0.5.30 → 0.5.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli/pair.cjs CHANGED
@@ -90,7 +90,9 @@ async function main(argv) {
90
90
  if (args.svg) {
91
91
  const target = path.resolve(args.svg);
92
92
  fs.mkdirSync(path.dirname(target), { recursive: true });
93
- fs.writeFileSync(target, await QRCode.toString(text, { type: 'svg', errorCorrectionLevel: 'M', margin: 2, width: 480 }));
93
+ // 静区给 4 个模块(规范值)与 512 边长:这份 SVG 多半是存下来再转给手机扫,
94
+ // 白边不够、边长只有 280 的时候,手机从相册里认常常读不出来。
95
+ fs.writeFileSync(target, await QRCode.toString(text, { type: 'svg', errorCorrectionLevel: 'M', margin: 4, width: 512 }));
94
96
  process.stdout.write(`二维码已存成图片:${target}\n如果终端太窄扫不动,把这个文件拿下来用看图软件打开再扫。\n\n`);
95
97
  }
96
98
 
@@ -732,18 +732,25 @@ function registerControlPlaneRoutes(deps) {
732
732
  return
733
733
  }
734
734
  try {
735
+ // 静区按规范给 4 个模块:以前是 2,四个角的白边只有半个模块宽,手机在屏幕反光、
736
+ // 或者从截图里认的时候常常连码的边界都找不到 —— 看上去清清楚楚,就是读不出来。
737
+ //
738
+ // 位图边长按 512 生成:SVG 本身是矢量、上屏怎么缩放都清楚,但人会把码截屏、存图、
739
+ // 发到相册里再扫,那时候落在手里的是这张位图,280 的位图放大到屏幕上就是糊的。
735
740
  const svg = await QRCode.toString(text, {
736
741
  type: 'svg',
737
742
  errorCorrectionLevel: 'M',
738
- margin: 2,
739
- width: 280,
743
+ margin: 4,
744
+ width: 512,
740
745
  })
741
746
  sendJson(res, 200, {
742
747
  ok: true,
743
748
  name: payload.name,
744
749
  relayUrl: payload.relayUrl,
745
750
  // 完整列表:老面板/老手机不读它,新手机拿它当候选(首项恒等于上面那条)。
746
- relayUrls: payload.relayUrls,
751
+ // 二维码里只有一条时不写这一格(省字符),回包这里照旧给一份单元素清单 —— 这一格
752
+ // 的形状自始至终是数组,别让调用方为了「有没有」再分一次叉。
753
+ relayUrls: payload.relayUrls || (payload.relayUrl ? [payload.relayUrl] : []),
747
754
  lanUrls: payload.lanUrls,
748
755
  pairingCode: payload.code,
749
756
  // 二维码里带的局域网地址用的是这个端口:首选端口被占时它与 relay.json 里
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-plugin",
3
- "version": "0.5.30",
3
+ "version": "0.5.31",
4
4
  "description": "Mobile API (/api/mobile/v1) and relay client for the DSH mobile app — desktop profile build (dsh 0.2.x, peers resolved by the host)",
5
5
  "license": "MIT",
6
6
  "icon": "./icon.png",