@sparkelf/dsh-mobile-bridge-server 0.2.10 → 0.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkelf/dsh-mobile-bridge-server",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "description": "Multi-user bridge server connecting mobile browsers to local DeepSeek Harness instances through outbound tunnels.",
6
6
  "license": "MIT",
package/src/phone.ts CHANGED
@@ -212,8 +212,8 @@ function wsReady() {
212
212
  }
213
213
  if ((full.headers?.['content-type'] ?? '').includes('text/html')) {
214
214
  let html = new TextDecoder().decode(body)
215
- if (!html.includes('/bridge/socket-client.js')) html = html.replace('</head>', PWA_HEAD + '<script src="/bridge/socket-client.js"></script></head>')
216
- else if (!html.includes('/bridge/manifest.webmanifest')) html = html.replace('</head>', PWA_HEAD + '</head>')
215
+ if (!html.includes('/bridge/socket-client.js')) html = html.replace('</head>', '${PWA_HEAD}' + '<script src="/bridge/socket-client.js"></script></head>')
216
+ else if (!html.includes('/bridge/manifest.webmanifest')) html = html.replace('</head>', '${PWA_HEAD}' + '</head>')
217
217
  body = new TextEncoder().encode(html)
218
218
  }
219
219
  pending.delete(frame.id)
package/src/pwa.spec.ts CHANGED
@@ -5,7 +5,8 @@ import { join } from 'node:path'
5
5
  import type { AddressInfo } from 'node:net'
6
6
  import { createBridgeServer } from './server.ts'
7
7
  import { UserStore } from './store.ts'
8
- import { CLIENT_SOURCE, PWA_HEAD } from './phone.ts'
8
+ import { CLIENT_SOURCE, PWA_HEAD, SW_SOURCE } from './phone.ts'
9
+ import { Script } from 'node:vm'
9
10
 
10
11
  const open: Array<{ close: () => void }> = []
11
12
  afterEach(() => { for (const entry of open.splice(0)) entry.close() })
@@ -63,4 +64,12 @@ describe('phone PWA install surface', () => {
63
64
  // criteria hold while '/' navigations stay relay-forwarded (not Sub2API).
64
65
  expect(CLIENT_SOURCE).toContain("location.assign('/')")
65
66
  })
67
+
68
+ it('SW source interpolates PWA_HEAD (no bare module identifier) and parses', () => {
69
+ // The head-inject lives inside the SW template; a bare PWA_HEAD there is a
70
+ // ReferenceError at SW runtime that kills every relayed HTML navigation.
71
+ expect(SW_SOURCE).not.toMatch(/\bPWA_HEAD\b/)
72
+ expect(SW_SOURCE).toContain('rel="manifest" href="/bridge/manifest.webmanifest"')
73
+ expect(() => new Script(SW_SOURCE)).not.toThrow()
74
+ })
66
75
  })