Lines 1-21javascript
1import { spawn } from "node:child_process"
2import { mkdir, access, readFile } from "node:fs/promises"
3import { createHash } from "node:crypto"
4import { homedir } from "node:os"
5import { join, dirname } from "node:path"
6import { fileURLToPath } from "node:url"
7import { run } from "./util.js"
9// the binary lives OUTSIDE node_modules: the macOS Screen Recording grant is
10// tied to this exact file, and it must survive package reinstalls/updates.
11// the name embeds the source hash so streamer updates recompile automatically
12const CACHE_DIR = join(homedir(), ".remote-claude")
13const SRC = join(dirname(fileURLToPath(import.meta.url)), "streamer.swift")
LowWeak Crypto
Package source references weak cryptographic algorithms.
capture.jsView on unpkg · L1 15async function ensureBin() {
16 const srcHash = createHash("md5").update(await readFile(SRC)).digest("hex").slice(0, 8)
17 const bin = join(CACHE_DIR, `streamer-${srcHash}`)
18 try { await access(bin); return bin } catch {}
19 await mkdir(CACHE_DIR, { recursive: true })
20 console.log("compiling screen streamer (one-time, ~5s)...")
21 const { code, err } = await run("swiftc", [SRC, "-o", bin])