- authenticated WebSocket link (dependency-free RFC6455 + stream mux), pairing codes, per-device keys (hashed), revoke/remove - /r/<device>/ proxy of the full DSH UI (HTTP, Remote WebSocket, SSE) with per-device cookie minting; slave->slave relay through the master - Devices sidebar panel (all devices' sessions, new session on device), Remote devices settings page, finished-session toasts - plugin + config sync master->slave: registry bundles via pluginManager, link: plugins as tarballs, cordis.patch.yml into a managed bundle layer (!!js preserved), allow/deny, opt-in per-secret credential sync - deploy helpers + e2e probes, unit tests
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
// E2E: listen to the local /dsh-remote/stream (SSE) for N seconds and print events.
|
|
// node deploy/e2e-events.mjs [seconds] [port]
|
|
import fs from 'node:fs'
|
|
import http from 'node:http'
|
|
import os from 'node:os'
|
|
import path from 'node:path'
|
|
import { mintCookie } from '../lib/auth-cookie.mjs'
|
|
|
|
const secs = Number(process.argv[2] || 30)
|
|
const port = process.argv[3] || process.env.DSH_PORT || '3081'
|
|
const home = process.env.DSH_HOME || path.join(os.homedir(), '.dsh')
|
|
const secret = fs.readFileSync(path.join(home, '.credentials.yaml'), 'utf8').match(/browser-session:[\s\S]*?secret:\s*([A-Za-z0-9_-]{43})/)[1]
|
|
const authority = `127.0.0.1:${port}`
|
|
const req = http.get({ host: '127.0.0.1', port, path: '/dsh-remote/stream', headers: { cookie: mintCookie(authority, secret, 1), host: authority } }, (res) => {
|
|
console.log('stream', res.statusCode)
|
|
res.setEncoding('utf8')
|
|
res.on('data', (d) => { for (const line of d.split('\n')) if (line.startsWith('data:')) console.log(new Date().toISOString().slice(11, 19), line.slice(5).trim()) })
|
|
})
|
|
setTimeout(() => { req.destroy(); process.exit(0) }, secs * 1000)
|