소스 검색

initial commit

Johannes Zellner 7 달 전
커밋
248f3f426e
12개의 변경된 파일과 2506개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      .gitignore
  2. 1343 0
      package-lock.json
  3. 20 0
      package.json
  4. BIN
      server/__pycache__/wayland-capture-bridge.cpython-314.pyc
  5. 17 0
      server/dbus-fd.mjs
  6. 70 0
      server/gstreamer.mjs
  7. 328 0
      server/index.mjs
  8. 32 0
      server/jpeg-framer.mjs
  9. 285 0
      server/portal.mjs
  10. 184 0
      server/wayland-capture-bridge.py
  11. 42 0
      server/wayland-python-bridge.mjs
  12. 184 0
      viewer/index.html

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+node_modules/

+ 1343 - 0
package-lock.json

@@ -0,0 +1,1343 @@
+{
+  "name": "nebucast",
+  "version": "1.0.0",
+  "lockfileVersion": 3,
+  "requires": true,
+  "packages": {
+    "": {
+      "name": "nebucast",
+      "version": "1.0.0",
+      "dependencies": {
+        "dbus-next": "^0.10.2",
+        "ws": "^8.18.0"
+      },
+      "engines": {
+        "node": ">=18"
+      },
+      "optionalDependencies": {
+        "usocket": "^0.3.0"
+      }
+    },
+    "node_modules/@nornagon/put": {
+      "version": "0.0.8",
+      "resolved": "https://registry.npmjs.org/@nornagon/put/-/put-0.0.8.tgz",
+      "integrity": "sha512-ugvXJjwF5ldtUpa7D95kruNJ41yFQDEKyF5CW4TgKJnh+W/zmlBzXXeKTyqIgwMFrkePN2JqOBqcF0M0oOunow==",
+      "license": "MIT/X11",
+      "engines": {
+        "node": ">=0.3.0"
+      }
+    },
+    "node_modules/abbrev": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+      "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/ajv": {
+      "version": "6.14.0",
+      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
+      "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "fast-deep-equal": "^3.1.1",
+        "fast-json-stable-stringify": "^2.0.0",
+        "json-schema-traverse": "^0.4.1",
+        "uri-js": "^4.2.2"
+      },
+      "funding": {
+        "type": "github",
+        "url": "https://github.com/sponsors/epoberezkin"
+      }
+    },
+    "node_modules/ansi-regex": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+      "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/aproba": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+      "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/are-we-there-yet": {
+      "version": "1.1.7",
+      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz",
+      "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==",
+      "deprecated": "This package is no longer supported.",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "delegates": "^1.0.0",
+        "readable-stream": "^2.0.6"
+      }
+    },
+    "node_modules/asn1": {
+      "version": "0.2.6",
+      "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
+      "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "safer-buffer": "~2.1.0"
+      }
+    },
+    "node_modules/assert-plus": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+      "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.8"
+      }
+    },
+    "node_modules/asynckit": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/aws-sign2": {
+      "version": "0.7.0",
+      "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+      "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
+      "license": "Apache-2.0",
+      "optional": true,
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/aws4": {
+      "version": "1.13.2",
+      "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz",
+      "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/balanced-match": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/bcrypt-pbkdf": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
+      "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
+      "license": "BSD-3-Clause",
+      "optional": true,
+      "dependencies": {
+        "tweetnacl": "^0.14.3"
+      }
+    },
+    "node_modules/bindings": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+      "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "file-uri-to-path": "1.0.0"
+      }
+    },
+    "node_modules/brace-expansion": {
+      "version": "1.1.13",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
+      "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "balanced-match": "^1.0.0",
+        "concat-map": "0.0.1"
+      }
+    },
+    "node_modules/caseless": {
+      "version": "0.12.0",
+      "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+      "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
+      "license": "Apache-2.0",
+      "optional": true
+    },
+    "node_modules/chownr": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+      "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+      "license": "ISC",
+      "optional": true,
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/code-point-at": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+      "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/combined-stream": {
+      "version": "1.0.8",
+      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "delayed-stream": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/concat-map": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/console-control-strings": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
+      "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/core-util-is": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+      "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/dashdash": {
+      "version": "1.14.1",
+      "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+      "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "assert-plus": "^1.0.0"
+      },
+      "engines": {
+        "node": ">=0.10"
+      }
+    },
+    "node_modules/dbus-next": {
+      "version": "0.10.2",
+      "resolved": "https://registry.npmjs.org/dbus-next/-/dbus-next-0.10.2.tgz",
+      "integrity": "sha512-kLNQoadPstLgKKGIXKrnRsMgtAK/o+ix3ZmcfTfvBHzghiO9yHXpoKImGnB50EXwnfSFaSAullW/7UrSkAISSQ==",
+      "license": "MIT",
+      "dependencies": {
+        "@nornagon/put": "0.0.8",
+        "event-stream": "3.3.4",
+        "hexy": "^0.2.10",
+        "jsbi": "^2.0.5",
+        "long": "^4.0.0",
+        "safe-buffer": "^5.1.1",
+        "xml2js": "^0.4.17"
+      },
+      "optionalDependencies": {
+        "usocket": "^0.3.0"
+      }
+    },
+    "node_modules/delayed-stream": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.4.0"
+      }
+    },
+    "node_modules/delegates": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
+      "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/duplexer": {
+      "version": "0.1.2",
+      "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
+      "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
+      "license": "MIT"
+    },
+    "node_modules/ecc-jsbn": {
+      "version": "0.1.2",
+      "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
+      "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "jsbn": "~0.1.0",
+        "safer-buffer": "^2.1.0"
+      }
+    },
+    "node_modules/env-paths": {
+      "version": "2.2.1",
+      "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
+      "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/event-stream": {
+      "version": "3.3.4",
+      "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
+      "integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==",
+      "license": "MIT",
+      "dependencies": {
+        "duplexer": "~0.1.1",
+        "from": "~0",
+        "map-stream": "~0.1.0",
+        "pause-stream": "0.0.11",
+        "split": "0.3",
+        "stream-combiner": "~0.0.4",
+        "through": "~2.3.1"
+      }
+    },
+    "node_modules/extend": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+      "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/extsprintf": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+      "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
+      "engines": [
+        "node >=0.6.0"
+      ],
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/fast-deep-equal": {
+      "version": "3.1.3",
+      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/fast-json-stable-stringify": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+      "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/file-uri-to-path": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+      "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/forever-agent": {
+      "version": "0.6.1",
+      "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+      "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
+      "license": "Apache-2.0",
+      "optional": true,
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/form-data": {
+      "version": "2.3.3",
+      "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
+      "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "asynckit": "^0.4.0",
+        "combined-stream": "^1.0.6",
+        "mime-types": "^2.1.12"
+      },
+      "engines": {
+        "node": ">= 0.12"
+      }
+    },
+    "node_modules/from": {
+      "version": "0.1.7",
+      "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
+      "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==",
+      "license": "MIT"
+    },
+    "node_modules/fs-minipass": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+      "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "minipass": "^3.0.0"
+      },
+      "engines": {
+        "node": ">= 8"
+      }
+    },
+    "node_modules/fs-minipass/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "yallist": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/fs.realpath": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+      "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/gauge": {
+      "version": "2.7.4",
+      "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
+      "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==",
+      "deprecated": "This package is no longer supported.",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "aproba": "^1.0.3",
+        "console-control-strings": "^1.0.0",
+        "has-unicode": "^2.0.0",
+        "object-assign": "^4.1.0",
+        "signal-exit": "^3.0.0",
+        "string-width": "^1.0.1",
+        "strip-ansi": "^3.0.1",
+        "wide-align": "^1.1.0"
+      }
+    },
+    "node_modules/getpass": {
+      "version": "0.1.7",
+      "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+      "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "assert-plus": "^1.0.0"
+      }
+    },
+    "node_modules/glob": {
+      "version": "7.2.3",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+      "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
+      "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "fs.realpath": "^1.0.0",
+        "inflight": "^1.0.4",
+        "inherits": "2",
+        "minimatch": "^3.1.1",
+        "once": "^1.3.0",
+        "path-is-absolute": "^1.0.0"
+      },
+      "engines": {
+        "node": "*"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
+    "node_modules/graceful-fs": {
+      "version": "4.2.11",
+      "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
+      "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/har-schema": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+      "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
+      "license": "ISC",
+      "optional": true,
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/har-validator": {
+      "version": "5.1.5",
+      "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
+      "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
+      "deprecated": "this library is no longer supported",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "ajv": "^6.12.3",
+        "har-schema": "^2.0.0"
+      },
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/has-unicode": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
+      "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/hexy": {
+      "version": "0.2.11",
+      "resolved": "https://registry.npmjs.org/hexy/-/hexy-0.2.11.tgz",
+      "integrity": "sha512-ciq6hFsSG/Bpt2DmrZJtv+56zpPdnq+NQ4ijEFrveKN0ZG1mhl/LdT1NQZ9se6ty1fACcI4d4vYqC9v8EYpH2A==",
+      "license": "MIT",
+      "bin": {
+        "hexy": "bin/hexy_cmd.js"
+      }
+    },
+    "node_modules/http-signature": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
+      "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "assert-plus": "^1.0.0",
+        "jsprim": "^1.2.2",
+        "sshpk": "^1.7.0"
+      },
+      "engines": {
+        "node": ">=0.8",
+        "npm": ">=1.3.7"
+      }
+    },
+    "node_modules/inflight": {
+      "version": "1.0.6",
+      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+      "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
+      "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "once": "^1.3.0",
+        "wrappy": "1"
+      }
+    },
+    "node_modules/inherits": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/is-fullwidth-code-point": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+      "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "number-is-nan": "^1.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/is-typedarray": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+      "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/isarray": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+      "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/isexe": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+      "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/isstream": {
+      "version": "0.1.2",
+      "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+      "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/jsbi": {
+      "version": "2.0.5",
+      "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-2.0.5.tgz",
+      "integrity": "sha512-TzO/62Hxeb26QMb4IGlI/5X+QLr9Uqp1FPkwp2+KOICW+Q+vSuFj61c8pkT6wAns4WcK56X7CmSHhJeDGWOqxQ=="
+    },
+    "node_modules/jsbn": {
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+      "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/json-schema": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
+      "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
+      "license": "(AFL-2.1 OR BSD-3-Clause)",
+      "optional": true
+    },
+    "node_modules/json-schema-traverse": {
+      "version": "0.4.1",
+      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/json-stringify-safe": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+      "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/jsprim": {
+      "version": "1.4.2",
+      "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
+      "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "assert-plus": "1.0.0",
+        "extsprintf": "1.3.0",
+        "json-schema": "0.4.0",
+        "verror": "1.10.0"
+      },
+      "engines": {
+        "node": ">=0.6.0"
+      }
+    },
+    "node_modules/long": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
+      "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
+      "license": "Apache-2.0"
+    },
+    "node_modules/map-stream": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
+      "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g=="
+    },
+    "node_modules/mime-db": {
+      "version": "1.52.0",
+      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime-types": {
+      "version": "2.1.35",
+      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "mime-db": "1.52.0"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/minimatch": {
+      "version": "3.1.5",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+      "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "brace-expansion": "^1.1.7"
+      },
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/minipass": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+      "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+      "license": "ISC",
+      "optional": true,
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/minizlib": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+      "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "minipass": "^3.0.0",
+        "yallist": "^4.0.0"
+      },
+      "engines": {
+        "node": ">= 8"
+      }
+    },
+    "node_modules/minizlib/node_modules/minipass": {
+      "version": "3.3.6",
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+      "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "yallist": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/mkdirp": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+      "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+      "license": "MIT",
+      "optional": true,
+      "bin": {
+        "mkdirp": "bin/cmd.js"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/nan": {
+      "version": "2.26.2",
+      "resolved": "https://registry.npmjs.org/nan/-/nan-2.26.2.tgz",
+      "integrity": "sha512-0tTvBTYkt3tdGw22nrAy50x7gpbGCCFH3AFcyS5WiUu7Eu4vWlri1woE6qHBSfy11vksDqkiwjOnlR7WV8G1Hw==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/node-gyp": {
+      "version": "7.1.2",
+      "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz",
+      "integrity": "sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "env-paths": "^2.2.0",
+        "glob": "^7.1.4",
+        "graceful-fs": "^4.2.3",
+        "nopt": "^5.0.0",
+        "npmlog": "^4.1.2",
+        "request": "^2.88.2",
+        "rimraf": "^3.0.2",
+        "semver": "^7.3.2",
+        "tar": "^6.0.2",
+        "which": "^2.0.2"
+      },
+      "bin": {
+        "node-gyp": "bin/node-gyp.js"
+      },
+      "engines": {
+        "node": ">= 10.12.0"
+      }
+    },
+    "node_modules/nopt": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
+      "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "abbrev": "1"
+      },
+      "bin": {
+        "nopt": "bin/nopt.js"
+      },
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/npmlog": {
+      "version": "4.1.2",
+      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
+      "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
+      "deprecated": "This package is no longer supported.",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "are-we-there-yet": "~1.1.2",
+        "console-control-strings": "~1.1.0",
+        "gauge": "~2.7.3",
+        "set-blocking": "~2.0.0"
+      }
+    },
+    "node_modules/number-is-nan": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+      "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/oauth-sign": {
+      "version": "0.9.0",
+      "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
+      "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
+      "license": "Apache-2.0",
+      "optional": true,
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/object-assign": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+      "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/once": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+      "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "wrappy": "1"
+      }
+    },
+    "node_modules/path-is-absolute": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+      "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/pause-stream": {
+      "version": "0.0.11",
+      "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
+      "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==",
+      "license": [
+        "MIT",
+        "Apache2"
+      ],
+      "dependencies": {
+        "through": "~2.3"
+      }
+    },
+    "node_modules/performance-now": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+      "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/process-nextick-args": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+      "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/psl": {
+      "version": "1.15.0",
+      "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
+      "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "punycode": "^2.3.1"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/lupomontero"
+      }
+    },
+    "node_modules/punycode": {
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+      "license": "MIT",
+      "optional": true,
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/qs": {
+      "version": "6.5.5",
+      "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.5.tgz",
+      "integrity": "sha512-mzR4sElr1bfCaPJe7m8ilJ6ZXdDaGoObcYR0ZHSsktM/Lt21MVHj5De30GQH2eiZ1qGRTO7LCAzQsUeXTNexWQ==",
+      "license": "BSD-3-Clause",
+      "optional": true,
+      "engines": {
+        "node": ">=0.6"
+      }
+    },
+    "node_modules/readable-stream": {
+      "version": "2.3.8",
+      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
+      "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "core-util-is": "~1.0.0",
+        "inherits": "~2.0.3",
+        "isarray": "~1.0.0",
+        "process-nextick-args": "~2.0.0",
+        "safe-buffer": "~5.1.1",
+        "string_decoder": "~1.1.1",
+        "util-deprecate": "~1.0.1"
+      }
+    },
+    "node_modules/readable-stream/node_modules/safe-buffer": {
+      "version": "5.1.2",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/request": {
+      "version": "2.88.2",
+      "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
+      "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
+      "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
+      "license": "Apache-2.0",
+      "optional": true,
+      "dependencies": {
+        "aws-sign2": "~0.7.0",
+        "aws4": "^1.8.0",
+        "caseless": "~0.12.0",
+        "combined-stream": "~1.0.6",
+        "extend": "~3.0.2",
+        "forever-agent": "~0.6.1",
+        "form-data": "~2.3.2",
+        "har-validator": "~5.1.3",
+        "http-signature": "~1.2.0",
+        "is-typedarray": "~1.0.0",
+        "isstream": "~0.1.2",
+        "json-stringify-safe": "~5.0.1",
+        "mime-types": "~2.1.19",
+        "oauth-sign": "~0.9.0",
+        "performance-now": "^2.1.0",
+        "qs": "~6.5.2",
+        "safe-buffer": "^5.1.2",
+        "tough-cookie": "~2.5.0",
+        "tunnel-agent": "^0.6.0",
+        "uuid": "^3.3.2"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
+    "node_modules/rimraf": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+      "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+      "deprecated": "Rimraf versions prior to v4 are no longer supported",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "glob": "^7.1.3"
+      },
+      "bin": {
+        "rimraf": "bin.js"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/isaacs"
+      }
+    },
+    "node_modules/safe-buffer": {
+      "version": "5.2.1",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+      "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ],
+      "license": "MIT"
+    },
+    "node_modules/safer-buffer": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+      "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/sax": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",
+      "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==",
+      "license": "BlueOak-1.0.0",
+      "engines": {
+        "node": ">=11.0.0"
+      }
+    },
+    "node_modules/semver": {
+      "version": "7.7.4",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
+      "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
+      "license": "ISC",
+      "optional": true,
+      "bin": {
+        "semver": "bin/semver.js"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/set-blocking": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+      "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/signal-exit": {
+      "version": "3.0.7",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
+      "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/split": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz",
+      "integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==",
+      "license": "MIT",
+      "dependencies": {
+        "through": "2"
+      },
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/sshpk": {
+      "version": "1.18.0",
+      "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz",
+      "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "asn1": "~0.2.3",
+        "assert-plus": "^1.0.0",
+        "bcrypt-pbkdf": "^1.0.0",
+        "dashdash": "^1.12.0",
+        "ecc-jsbn": "~0.1.1",
+        "getpass": "^0.1.1",
+        "jsbn": "~0.1.0",
+        "safer-buffer": "^2.0.2",
+        "tweetnacl": "~0.14.0"
+      },
+      "bin": {
+        "sshpk-conv": "bin/sshpk-conv",
+        "sshpk-sign": "bin/sshpk-sign",
+        "sshpk-verify": "bin/sshpk-verify"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/stream-combiner": {
+      "version": "0.0.4",
+      "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
+      "integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==",
+      "license": "MIT",
+      "dependencies": {
+        "duplexer": "~0.1.1"
+      }
+    },
+    "node_modules/string_decoder": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+      "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "safe-buffer": "~5.1.0"
+      }
+    },
+    "node_modules/string_decoder/node_modules/safe-buffer": {
+      "version": "5.1.2",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/string-width": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+      "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "code-point-at": "^1.0.0",
+        "is-fullwidth-code-point": "^1.0.0",
+        "strip-ansi": "^3.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/strip-ansi": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+      "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==",
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "ansi-regex": "^2.0.0"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/tar": {
+      "version": "6.2.1",
+      "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
+      "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
+      "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "chownr": "^2.0.0",
+        "fs-minipass": "^2.0.0",
+        "minipass": "^5.0.0",
+        "minizlib": "^2.1.1",
+        "mkdirp": "^1.0.3",
+        "yallist": "^4.0.0"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/through": {
+      "version": "2.3.8",
+      "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+      "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
+      "license": "MIT"
+    },
+    "node_modules/tough-cookie": {
+      "version": "2.5.0",
+      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
+      "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
+      "license": "BSD-3-Clause",
+      "optional": true,
+      "dependencies": {
+        "psl": "^1.1.28",
+        "punycode": "^2.1.1"
+      },
+      "engines": {
+        "node": ">=0.8"
+      }
+    },
+    "node_modules/tunnel-agent": {
+      "version": "0.6.0",
+      "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+      "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+      "license": "Apache-2.0",
+      "optional": true,
+      "dependencies": {
+        "safe-buffer": "^5.0.1"
+      },
+      "engines": {
+        "node": "*"
+      }
+    },
+    "node_modules/tweetnacl": {
+      "version": "0.14.5",
+      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+      "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
+      "license": "Unlicense",
+      "optional": true
+    },
+    "node_modules/uri-js": {
+      "version": "4.4.1",
+      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+      "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+      "license": "BSD-2-Clause",
+      "optional": true,
+      "dependencies": {
+        "punycode": "^2.1.0"
+      }
+    },
+    "node_modules/usocket": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/usocket/-/usocket-0.3.0.tgz",
+      "integrity": "sha512-V/H02RNiaOCJZuPoKont/y12VJaImC6C5xW7OzPFjYu9qnig0yv9hyp9E7Wqjm6d8yZuZouH3NAfDATVMgh2SQ==",
+      "hasInstallScript": true,
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "bindings": "^1.5.0",
+        "nan": "^2.14.2",
+        "node-gyp": "^7.1.2"
+      }
+    },
+    "node_modules/util-deprecate": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+      "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/uuid": {
+      "version": "3.4.0",
+      "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+      "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+      "deprecated": "Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.",
+      "license": "MIT",
+      "optional": true,
+      "bin": {
+        "uuid": "bin/uuid"
+      }
+    },
+    "node_modules/verror": {
+      "version": "1.10.0",
+      "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+      "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
+      "engines": [
+        "node >=0.6.0"
+      ],
+      "license": "MIT",
+      "optional": true,
+      "dependencies": {
+        "assert-plus": "^1.0.0",
+        "core-util-is": "1.0.2",
+        "extsprintf": "^1.2.0"
+      }
+    },
+    "node_modules/verror/node_modules/core-util-is": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+      "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
+      "license": "MIT",
+      "optional": true
+    },
+    "node_modules/which": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+      "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "isexe": "^2.0.0"
+      },
+      "bin": {
+        "node-which": "bin/node-which"
+      },
+      "engines": {
+        "node": ">= 8"
+      }
+    },
+    "node_modules/wide-align": {
+      "version": "1.1.5",
+      "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
+      "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
+      "license": "ISC",
+      "optional": true,
+      "dependencies": {
+        "string-width": "^1.0.2 || 2 || 3 || 4"
+      }
+    },
+    "node_modules/wrappy": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+      "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+      "license": "ISC",
+      "optional": true
+    },
+    "node_modules/ws": {
+      "version": "8.20.0",
+      "resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
+      "integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=10.0.0"
+      },
+      "peerDependencies": {
+        "bufferutil": "^4.0.1",
+        "utf-8-validate": ">=5.0.2"
+      },
+      "peerDependenciesMeta": {
+        "bufferutil": {
+          "optional": true
+        },
+        "utf-8-validate": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/xml2js": {
+      "version": "0.4.23",
+      "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
+      "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
+      "license": "MIT",
+      "dependencies": {
+        "sax": ">=0.6.0",
+        "xmlbuilder": "~11.0.0"
+      },
+      "engines": {
+        "node": ">=4.0.0"
+      }
+    },
+    "node_modules/xmlbuilder": {
+      "version": "11.0.1",
+      "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
+      "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=4.0"
+      }
+    },
+    "node_modules/yallist": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+      "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+      "license": "ISC",
+      "optional": true
+    }
+  }
+}

+ 20 - 0
package.json

@@ -0,0 +1,20 @@
+{
+  "name": "nebucast",
+  "version": "1.0.0",
+  "private": true,
+  "type": "module",
+  "description": "GNOME screen capture over WebSocket (JPEG @ 30fps)",
+  "scripts": {
+    "start": "node server/index.mjs"
+  },
+  "engines": {
+    "node": ">=18"
+  },
+  "dependencies": {
+    "dbus-next": "^0.10.2",
+    "ws": "^8.18.0"
+  },
+  "optionalDependencies": {
+    "usocket": "^0.3.0"
+  }
+}

BIN
server/__pycache__/wayland-capture-bridge.cpython-314.pyc


+ 17 - 0
server/dbus-fd.mjs

@@ -0,0 +1,17 @@
+import { createRequire } from "node:module";
+
+const require = createRequire(import.meta.url);
+
+/**
+ * dbus-next needs the native `usocket` module to receive Unix FDs (OpenPipeWireRemote).
+ * Without it, Node falls back to net.Socket and FD unmarshalling fails → hang/exit.
+ */
+export function dbusUnixFdTransportAvailable() {
+  try {
+    require.resolve("usocket");
+    require("usocket");
+    return true;
+  } catch {
+    return false;
+  }
+}

+ 70 - 0
server/gstreamer.mjs

@@ -0,0 +1,70 @@
+import { spawn } from "node:child_process";
+import { createJpegFramer } from "./jpeg-framer.mjs";
+
+/** @param {{ fps: number; quality: number }} opts */
+export function buildPipeline(source, { fps, quality }) {
+  return (
+    `${source} ! videoconvert ! videoscale ! video/x-raw,width=1280,height=720 ! ` +
+    `videorate ! video/x-raw,framerate=${fps}/1 ! jpegenc quality=${quality} ! ` +
+    `fdsink fd=1 sync=false`
+  );
+}
+
+/**
+ * @param {object} opts
+ * @param {string} opts.pipeline
+ * @param {number | undefined} opts.pipeWireFd - if set, duplicated to child as fd 3
+ * @param {(frame: Buffer) => void} opts.onFrame
+ * @param {(err: Error) => void} [opts.onSpawnError]
+ * @param {(code: number | null, signal?: string) => void} [opts.onExit]
+ */
+export function startGstreamer(opts) {
+  const { pipeline, pipeWireFd, onFrame, onSpawnError, onExit } = opts;
+
+  const stdio =
+    pipeWireFd !== undefined && pipeWireFd !== null
+      ? ["ignore", "pipe", "pipe", pipeWireFd]
+      : ["ignore", "pipe", "pipe"];
+
+  const argv = ["-q", ...pipeline.trim().split(/\s+/)];
+  const child = spawn("gst-launch-1.0", argv, {
+    stdio,
+  });
+
+  if (!child.stdout) {
+    onSpawnError?.(new Error("gstreamer: no stdout"));
+    return { child: null, stop: () => {} };
+  }
+
+  const framer = createJpegFramer(onFrame);
+
+  child.stdout.on("data", (chunk) => framer.push(chunk));
+
+  child.stderr?.on("data", (d) => {
+    const s = d.toString().trim();
+    if (s) console.error("[gstreamer]", s);
+  });
+
+  child.on("error", (err) => onSpawnError?.(err));
+
+  child.on("exit", (code, signal) => onExit?.(code, signal));
+
+  function stop() {
+    child.kill("SIGTERM");
+  }
+
+  return { child, stop };
+}
+
+export function defaultSourceForSession() {
+  const session = process.env.XDG_SESSION_TYPE || "";
+  if (session === "x11") {
+    return "ximagesrc use-damage=0 show-pointer=true";
+  }
+  return "pipewiresrc do-timestamp=true keepalive-time=1000";
+}
+
+/** PipeWire fd is passed to the child as stdio fd 3 (see spawn stdio array). */
+export function pipewireSourceForChild(nodeId) {
+  return `pipewiresrc fd=3 path=${nodeId} do-timestamp=true keepalive-time=1000`;
+}

+ 328 - 0
server/index.mjs

@@ -0,0 +1,328 @@
+#!/usr/bin/env node
+import { createServer } from "node:http";
+import { readFile } from "node:fs/promises";
+import { closeSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import { dirname, join } from "node:path";
+import { WebSocketServer } from "ws";
+
+import { negotiateScreencastPortal } from "./portal.mjs";
+import { dbusUnixFdTransportAvailable } from "./dbus-fd.mjs";
+import { startPythonWaylandBridge } from "./wayland-python-bridge.mjs";
+import {
+  buildPipeline,
+  startGstreamer,
+  defaultSourceForSession,
+  pipewireSourceForChild,
+} from "./gstreamer.mjs";
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const VIEWER_PATH = join(__dirname, "..", "viewer", "index.html");
+
+function parseArgs(argv) {
+  const out = {
+    host: "0.0.0.0",
+    port: 9000,
+    fps: 30,
+    quality: 80,
+    source: null,
+    httpPort: 8080,
+    verbose: false,
+  };
+
+  for (let i = 0; i < argv.length; i++) {
+    const a = argv[i];
+    if (a === "--host") out.host = argv[++i];
+    else if (a === "--port") out.port = Number(argv[++i]);
+    else if (a === "--fps") out.fps = Number(argv[++i]);
+    else if (a === "--quality") out.quality = Number(argv[++i]);
+    else if (a === "--source") out.source = argv[++i];
+    else if (a === "--http-port") out.httpPort = Number(argv[++i]);
+    else if (a === "--verbose" || a === "-v") out.verbose = true;
+    else if (a === "--help" || a === "-h") {
+      console.log(`Usage: node server/index.mjs [options]
+
+  --host ADDR       WebSocket bind (default 0.0.0.0)
+  --port N          WebSocket port (default 9000)
+  --fps N           Target framerate (default 30)
+  --quality N       JPEG 1-100 (default 80)
+  --source STR      Override GStreamer source element chain (before ! videoconvert)
+  --http-port N     Serve viewer over HTTP (default 8080; 0 to disable)
+  --verbose         Extra portal + pipeline debug (also NEBUCAST_VERBOSE=1)
+
+Environment:
+  NEBUCAST_VERBOSE=1           Same as --verbose
+  NEBUCAST_PORTAL_TRACE=0      Disable step-by-step [portal] logs
+  NEBUCAST_PROCESS_DEBUG=1     Log beforeExit when the event loop drains
+  NEBUCAST_FORCE_PYTHON_BRIDGE=1  Always use Python Wayland bridge (skip usocket path)
+`);
+      process.exit(0);
+    }
+  }
+  return out;
+}
+
+function installProcessDiagnostics(opts) {
+  process.on("unhandledRejection", (reason, p) => {
+    console.error("[nebucast] unhandledRejection:", reason);
+    if (reason instanceof Error && reason.stack) console.error(reason.stack);
+    console.error("[nebucast] promise:", p);
+  });
+  process.on("uncaughtException", (err) => {
+    console.error("[nebucast] uncaughtException:", err?.stack || err);
+  });
+  if (opts.verbose || process.env.NEBUCAST_PROCESS_DEBUG === "1") {
+    process.on("beforeExit", (code) => {
+      console.error("[nebucast] beforeExit code=", code, "(event loop draining)");
+    });
+  }
+}
+
+async function main() {
+  const opts = parseArgs(process.argv.slice(2));
+  installProcessDiagnostics(opts);
+
+  const sessionType = process.env.XDG_SESSION_TYPE || "";
+
+  if (opts.verbose) {
+    console.info("[nebucast] verbose on | XDG_SESSION_TYPE=%s", sessionType || "(unset)");
+  }
+
+  function onEarlySigint() {
+    console.error("\nInterrupted.");
+    process.exit(130);
+  }
+  process.once("SIGINT", onEarlySigint);
+
+  let portalBus = null;
+  let pwFd = null;
+  let source = opts.source;
+  let stopGst = () => {};
+  /** @type {import('ws').WebSocketServer | null} */
+  let wss = null;
+  let httpServer = null;
+  let shuttingDown = false;
+
+  function cleanupResources() {
+    if (pwFd != null) {
+      try {
+        closeSync(pwFd);
+      } catch {
+        /* ignore */
+      }
+      pwFd = null;
+    }
+    try {
+      portalBus?.disconnect();
+    } catch {
+      /* ignore */
+    }
+    portalBus = null;
+  }
+
+  function shutdown(exitCode = 0) {
+    if (shuttingDown) return;
+    shuttingDown = true;
+    console.error("[nebucast] shutdown() invoked, exitCode=", exitCode);
+    if (opts.verbose) {
+      console.error(new Error("[nebucast] shutdown trace").stack);
+    }
+    try {
+      stopGst();
+    } catch {
+      /* ignore */
+    }
+    cleanupResources();
+    const finish = () => process.exit(exitCode);
+    if (wss) {
+      wss.close(() => {
+        if (httpServer) {
+          httpServer.close(finish);
+        } else {
+          finish();
+        }
+      });
+    } else if (httpServer) {
+      httpServer.close(finish);
+    } else {
+      finish();
+    }
+  }
+
+  try {
+    const clients = new Set();
+
+    function broadcastFrame(frame) {
+      for (const ws of clients) {
+        if (ws.readyState !== ws.OPEN) continue;
+        if (ws.bufferedAmount > 8 * 1024 * 1024) continue;
+        try {
+          ws.send(frame, { binary: true });
+        } catch {
+          clients.delete(ws);
+        }
+      }
+    }
+
+    function handleCaptureExit(code, signal, tag) {
+      console.info("[%s] process exit: code=%s signal=%s", tag, code, signal ?? "(none)");
+      if (code !== 0 && code !== null) {
+        console.error("[%s] non-zero exit", tag);
+      }
+      shutdown(code !== 0 && code !== null ? 1 : 0);
+    }
+
+    try {
+      wss = await new Promise((resolve, reject) => {
+        let settled = false;
+        const server = new WebSocketServer({
+          host: opts.host,
+          port: opts.port,
+          maxPayload: 4 * 1024 * 1024,
+          perMessageDeflate: false,
+        });
+        server.once("listening", () => {
+          if (settled) return;
+          settled = true;
+          console.info("WebSocket stream: ws://%s:%d", opts.host, opts.port);
+          resolve(server);
+        });
+        server.once("error", (err) => {
+          if (settled) return;
+          settled = true;
+          reject(err);
+        });
+        server.on("connection", (ws) => {
+          clients.add(ws);
+          ws.on("close", () => clients.delete(ws));
+          ws.on("error", () => clients.delete(ws));
+        });
+      });
+    } catch (err) {
+      const code = err?.code;
+      console.error("[ws]", err.message);
+      if (code === "EADDRINUSE") {
+        console.error(
+          "[nebucast] Port %d is already in use. Use another port, e.g. npm start -- --port 9001",
+          opts.port,
+        );
+        console.error("[nebucast] See what holds it: ss -tlnp | grep ':%d '   or   fuser -v %d/tcp", opts.port, opts.port);
+      }
+      process.exit(1);
+    }
+
+    wss.on("error", (err) => {
+      console.error("[ws]", err.message);
+      shutdown(1);
+    });
+
+    let child;
+
+    if (!source && sessionType !== "x11") {
+      console.info("Wayland (or non-X11) — using XDG Desktop Portal for screen capture");
+      const useUsocket =
+        process.env.NEBUCAST_FORCE_PYTHON_BRIDGE !== "1" && dbusUnixFdTransportAvailable();
+      if (opts.verbose) {
+        console.info("[nebucast] D-Bus Unix FD (usocket) available:", useUsocket);
+      }
+
+      if (useUsocket) {
+        const p = await negotiateScreencastPortal({ verbose: opts.verbose });
+        portalBus = p.bus;
+        pwFd = p.fd;
+        const pipeSource = pipewireSourceForChild(p.nodeId);
+        const pipeline = buildPipeline(pipeSource, {
+          fps: opts.fps,
+          quality: opts.quality,
+        });
+        if (opts.verbose) console.info("[gstreamer] pipeline:", pipeline);
+        const gst = startGstreamer({
+          pipeline,
+          pipeWireFd: pwFd,
+          onFrame: broadcastFrame,
+          onSpawnError: (err) => console.error("[gstreamer]", err),
+          onExit: (code, signal) => handleCaptureExit(code, signal, "gstreamer"),
+        });
+        child = gst.child;
+        stopGst = gst.stop;
+      } else {
+        console.warn(
+          "[nebucast] The native `usocket` module is missing or failed to load. " +
+            "Node’s D-Bus socket cannot receive PipeWire fds (OpenPipeWireRemote). " +
+            "Falling back to Python: server/wayland-capture-bridge.py " +
+            "(python3, dbus-python, PyGObject, GStreamer). " +
+            "For pure Node on Wayland, install usocket (often works on Node 20–22).",
+        );
+        portalBus = null;
+        pwFd = null;
+        const py = startPythonWaylandBridge({
+          fps: opts.fps,
+          quality: opts.quality,
+          onFrame: broadcastFrame,
+          onSpawnError: (err) => console.error("[wayland-bridge]", err),
+          onExit: (code, signal) => handleCaptureExit(code, signal, "wayland-bridge"),
+        });
+        child = py.child;
+        stopGst = py.stop;
+      }
+    } else {
+      if (!source) source = defaultSourceForSession();
+      const pipeline = buildPipeline(source, {
+        fps: opts.fps,
+        quality: opts.quality,
+      });
+      if (opts.verbose) console.info("[gstreamer] pipeline:", pipeline);
+      const gst = startGstreamer({
+        pipeline,
+        pipeWireFd: undefined,
+        onFrame: broadcastFrame,
+        onSpawnError: (err) => console.error("[gstreamer]", err),
+        onExit: (code, signal) => handleCaptureExit(code, signal, "gstreamer"),
+      });
+      child = gst.child;
+      stopGst = gst.stop;
+    }
+
+    if (!child) {
+      cleanupResources();
+      wss.close(() => process.exit(1));
+      return;
+    }
+
+    if (opts.httpPort > 0) {
+      const viewerHtml = await readFile(VIEWER_PATH, "utf8");
+      httpServer = createServer((req, res) => {
+        if (req.url === "/" || req.url?.startsWith("/index.html")) {
+          res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
+          res.end(viewerHtml);
+          return;
+        }
+        res.writeHead(404);
+        res.end();
+      });
+      httpServer.listen(opts.httpPort, opts.host, () => {
+        console.info("Viewer: http://%s:%d/", opts.host, opts.httpPort);
+      });
+    }
+
+    process.off("SIGINT", onEarlySigint);
+    process.once("SIGINT", () => shutdown(0));
+    process.once("SIGTERM", () => shutdown(0));
+  } catch (err) {
+    console.error(err.message || err);
+    if (wss) {
+      wss.close(() => {
+        cleanupResources();
+        process.exit(1);
+      });
+    } else {
+      cleanupResources();
+      process.exit(1);
+    }
+  }
+}
+
+main().catch((err) => {
+  console.error(err?.stack || err?.message || err);
+  process.exit(1);
+});

+ 32 - 0
server/jpeg-framer.mjs

@@ -0,0 +1,32 @@
+const SOI = Buffer.from([0xff, 0xd8]);
+const EOI = Buffer.from([0xff, 0xd9]);
+
+/**
+ * Buffers stdout chunks and invokes onFrame with each complete JPEG (SOI … EOI).
+ */
+export function createJpegFramer(onFrame) {
+  let buf = Buffer.alloc(0);
+
+  return {
+    push(chunk) {
+      if (!chunk.length) return;
+      buf = Buffer.concat([buf, chunk]);
+
+      while (buf.length >= 4) {
+        const start = buf.indexOf(SOI);
+        if (start === -1) {
+          buf = buf.length >= 1 ? buf.subarray(buf.length - 1) : Buffer.alloc(0);
+          break;
+        }
+        if (start > 0) buf = buf.subarray(start);
+
+        const end = buf.indexOf(EOI, 2);
+        if (end === -1) break;
+
+        const frame = buf.subarray(0, end + 2);
+        buf = buf.subarray(end + 2);
+        onFrame(Buffer.from(frame));
+      }
+    },
+  };
+}

+ 285 - 0
server/portal.mjs

@@ -0,0 +1,285 @@
+import dbus from "dbus-next";
+
+const { sessionBus, Variant, MessageType } = dbus;
+
+const REQUEST_IFACE = "org.freedesktop.portal.Request";
+const PORTAL_NAME = "org.freedesktop.portal.Desktop";
+const PORTAL_PATH = "/org/freedesktop/portal/desktop";
+
+const SOURCE_TYPE_MONITOR = 1;
+const CURSOR_MODE_EMBEDDED = 2;
+
+function unwrap(v) {
+  if (v instanceof Variant) return unwrap(v.value);
+  return v;
+}
+
+function fail(stage, code) {
+  throw new Error(`${stage} failed with response ${code}`);
+}
+
+function summarizeResults(results, verbose) {
+  if (!results || typeof results !== "object") return String(results);
+  const keys = Object.keys(results);
+  const out = { keys };
+  if (verbose) {
+    try {
+      out.dump = JSON.stringify(results, replacer, 2);
+    } catch (e) {
+      out.dump = `(could not stringify: ${e.message})`;
+    }
+  }
+  return out;
+}
+
+/**
+ * @param {import('dbus-next').MessageBus} bus
+ * @param {string} step — label for logs
+ * @param {() => Promise<string>} callMethod — returns Request `handle` (object path)
+ * @param {{ trace: boolean; verbose: boolean }} logOpts
+ */
+async function waitPortalResponse(bus, step, callMethod, logOpts) {
+  const { trace, verbose } = logOpts;
+
+  if (trace) console.info(`[portal] ${step}: calling D-Bus method…`);
+
+  const handlePath = await callMethod();
+
+  if (trace) {
+    console.info(`[portal] ${step}: method returned request handle:`, handlePath);
+  }
+
+  if (typeof handlePath !== "string" || !handlePath.startsWith("/")) {
+    throw new Error(
+      `Portal did not return a request object path (got ${typeof handlePath}: ${String(handlePath)})`,
+    );
+  }
+
+  const match = `type='signal',interface='${REQUEST_IFACE}',member='Response',path='${handlePath}'`;
+
+  if (verbose) {
+    console.info(`[portal] ${step}: AddMatch rule:`, match);
+  }
+
+  return new Promise((resolve, reject) => {
+    let settled = false;
+
+    const onMsg = (msg) => {
+      if (msg.type !== MessageType.SIGNAL) return;
+      if (msg.path !== handlePath) return;
+      if (msg.interface !== REQUEST_IFACE) return;
+      if (msg.member !== "Response") return;
+
+      if (settled) return;
+      settled = true;
+
+      bus.removeListener("message", onMsg);
+      bus._removeMatch(match).catch(() => {});
+
+      const code = msg.body[0];
+      const results = msg.body[1] || {};
+
+      if (trace) {
+        console.info(`[portal] ${step}: Response signal received, code=${code}`);
+        console.info(`[portal] ${step}: results summary:`, summarizeResults(results, verbose));
+      }
+      if (verbose) {
+        console.info(`[portal] ${step}: raw msg.signature=`, msg.signature, "body length=", msg.body?.length);
+      }
+
+      resolve({ code, results });
+    };
+
+    bus.on("message", onMsg);
+
+    bus
+      ._addMatch(match)
+      .then(() => {
+        if (trace) {
+          console.info(`[portal] ${step}: AddMatch registered; waiting for Response on`);
+          console.info(`[portal] ${step}:   ${handlePath}`);
+        }
+      })
+      .catch((err) => {
+        if (!settled) {
+          settled = true;
+          bus.removeListener("message", onMsg);
+          reject(err);
+        }
+      });
+  });
+}
+
+/**
+ * PipeWire node id from Start results: `streams` is `a(ua{sv})` → [[nodeId, props], ...].
+ */
+function extractNodeId(results, verbose) {
+  const streamsRaw = results.streams;
+  if (verbose) {
+    console.info("[portal] Start: raw results.streams type=", typeof streamsRaw);
+    try {
+      console.info(
+        "[portal] Start: streams (verbose)=",
+        JSON.stringify(streamsRaw, replacer, 2),
+      );
+    } catch (e) {
+      console.info("[portal] Start: streams not JSON-serializable:", e.message);
+    }
+  }
+
+  const streams = unwrap(streamsRaw);
+  if (!Array.isArray(streams) || streams.length === 0) {
+    return null;
+  }
+  const first = streams[0];
+  if (Array.isArray(first) && first.length > 0) {
+    const id = unwrap(first[0]);
+    if (id !== undefined && id !== null) {
+      if (typeof id === "bigint") return Number(id);
+      return Number(id);
+    }
+  }
+  return null;
+}
+
+/**
+ * @param {{ verbose?: boolean; trace?: boolean }} [options]
+ * - trace: step-by-step portal logs (default true unless NEBUCAST_PORTAL_TRACE=0)
+ * - verbose: extra dumps (default: argv --verbose or NEBUCAST_VERBOSE=1)
+ */
+export async function negotiateScreencastPortal(options = {}) {
+  const envTrace = process.env.NEBUCAST_PORTAL_TRACE !== "0";
+  const envVerbose =
+    process.env.NEBUCAST_VERBOSE === "1" || process.env.DEBUG?.includes("nebucast");
+
+  const trace = options.trace !== false && envTrace;
+  const verbose = Boolean(options.verbose || envVerbose);
+
+  const logOpts = { trace, verbose };
+
+  if (trace) {
+    console.info("[portal] connecting session D-Bus (negotiateUnixFd=true)…");
+  }
+
+  const bus = sessionBus({ negotiateUnixFd: true });
+
+  await new Promise((resolve, reject) => {
+    if (bus.name) resolve();
+    else {
+      bus.once("connect", resolve);
+      bus.once("error", reject);
+    }
+  });
+
+  if (trace) {
+    console.info("[portal] bus connected, unique name:", bus.name);
+  }
+
+  bus.on("error", (err) => {
+    console.error("[portal] bus error:", err?.stack || err?.message || err);
+  });
+
+  let n = 0;
+  const nextToken = () => `sc${++n}`;
+
+  if (trace) {
+    console.info("[portal] introspecting", PORTAL_NAME, PORTAL_PATH);
+  }
+
+  const portal = await bus.getProxyObject(PORTAL_NAME, PORTAL_PATH);
+  const sc = portal.getInterface("org.freedesktop.portal.ScreenCast");
+
+  let t = nextToken();
+  if (trace) console.info("[portal] CreateSession handle_token=", t);
+
+  const r1 = await waitPortalResponse(
+    bus,
+    "CreateSession",
+    () =>
+      sc.CreateSession({
+        handle_token: new Variant("s", t),
+        session_handle_token: new Variant("s", "nebucast_session"),
+      }),
+    logOpts,
+  );
+  if (r1.code !== 0) fail("CreateSession", r1.code);
+
+  const sessionPath = unwrap(r1.results.session_handle);
+  if (typeof sessionPath !== "string") {
+    throw new Error("CreateSession: missing session_handle");
+  }
+  console.info("[portal] session:", sessionPath);
+
+  t = nextToken();
+  if (trace) console.info("[portal] SelectSources handle_token=", t);
+
+  const r2 = await waitPortalResponse(
+    bus,
+    "SelectSources",
+    () =>
+      sc.SelectSources(sessionPath, {
+        handle_token: new Variant("s", t),
+        types: new Variant("u", SOURCE_TYPE_MONITOR),
+        cursor_mode: new Variant("u", CURSOR_MODE_EMBEDDED),
+      }),
+    logOpts,
+  );
+  if (r2.code !== 0) fail("SelectSources", r2.code);
+  console.info("[portal] source selected, starting…");
+
+  t = nextToken();
+  if (trace) console.info("[portal] Start handle_token=", t);
+
+  const r3 = await waitPortalResponse(
+    bus,
+    "Start",
+    () =>
+      sc.Start(sessionPath, "", {
+        handle_token: new Variant("s", t),
+      }),
+    logOpts,
+  );
+  if (r3.code !== 0) fail("Start", r3.code);
+
+  const nodeIdNum = extractNodeId(r3.results, verbose);
+  if (nodeIdNum === null || Number.isNaN(nodeIdNum)) {
+    console.error("[portal] Start results:", JSON.stringify(r3.results, replacer, 2));
+    throw new Error(
+      "Start: could not read PipeWire node id from streams (see log above).",
+    );
+  }
+
+  if (trace) {
+    console.info("[portal] calling OpenPipeWireRemote for", sessionPath);
+  }
+
+  let fd;
+  try {
+    fd = await sc.OpenPipeWireRemote(sessionPath, {});
+  } catch (e) {
+    console.error("[portal] OpenPipeWireRemote threw:", e?.stack || e?.message || e);
+    throw e;
+  }
+
+  if (trace) {
+    console.info("[portal] OpenPipeWireRemote returned:", fd, `(type ${typeof fd})`);
+  }
+
+  if (typeof fd !== "number" || fd < 0) {
+    throw new Error(
+      `OpenPipeWireRemote: expected unix fd number, got ${typeof fd}: ${String(fd)}`,
+    );
+  }
+
+  console.info("[portal] PipeWire fd=%d node=%d", fd, nodeIdNum);
+
+  return { fd, nodeId: nodeIdNum, bus };
+}
+
+function replacer(_key, value) {
+  if (value instanceof Variant) {
+    return { _variant: value.signature, value: value.value };
+  }
+  if (typeof value === "bigint") return value.toString();
+  return value;
+}

+ 184 - 0
server/wayland-capture-bridge.py

@@ -0,0 +1,184 @@
+#!/usr/bin/env python3
+"""
+Wayland screen capture: XDG portal + GStreamer → raw JPEG stream on stdout.
+Used when Node cannot receive D-Bus Unix FDs (no `usocket` native module).
+
+Requires: python-dbus, PyGObject, GStreamer (same as screencast).
+"""
+from __future__ import annotations
+
+import argparse
+import logging
+import shutil
+import signal
+import subprocess
+import sys
+import threading
+
+import dbus
+from dbus.mainloop.glib import DBusGMainLoop
+
+import gi
+
+gi.require_version("GLib", "2.0")
+from gi.repository import GLib
+
+log = logging.getLogger("nebucast-bridge")
+
+SCREEN_CAST_IFACE = "org.freedesktop.portal.ScreenCast"
+REQUEST_IFACE = "org.freedesktop.portal.Request"
+PORTAL_BUS = "org.freedesktop.portal.Desktop"
+PORTAL_PATH = "/org/freedesktop/portal/desktop"
+
+SOURCE_TYPE_MONITOR = 1
+CURSOR_MODE_EMBEDDED = 2
+
+
+class PortalSession:
+    def __init__(self):
+        DBusGMainLoop(set_as_default=True)
+        self._bus = dbus.SessionBus()
+        self._portal = self._bus.get_object(PORTAL_BUS, PORTAL_PATH)
+        self._sc = dbus.Interface(self._portal, SCREEN_CAST_IFACE)
+        self._loop = GLib.MainLoop()
+        self._session = None
+        self._node_id = None
+        self._pw_fd = None
+        self._n = 0
+        self._sender = self._bus.get_unique_name().replace(".", "_").lstrip(":")
+
+    def _token(self):
+        self._n += 1
+        return f"nb{self._n}"
+
+    def _on_response(self, token, callback):
+        path = f"/org/freedesktop/portal/desktop/request/{self._sender}/{token}"
+        self._bus.add_signal_receiver(
+            callback,
+            signal_name="Response",
+            dbus_interface=REQUEST_IFACE,
+            path=path,
+        )
+
+    def _fail(self, stage, code):
+        log.error("%s failed with response %d", stage, code)
+        self._loop.quit()
+
+    def run(self) -> tuple[int, int]:
+        t = self._token()
+        self._on_response(t, self._created)
+        self._sc.CreateSession(
+            {
+                "handle_token": t,
+                "session_handle_token": "nebucast_py_bridge",
+            }
+        )
+        self._loop.run()
+        if self._pw_fd is None or self._node_id is None:
+            raise RuntimeError(
+                "Portal session failed. Use GNOME on Wayland with xdg-desktop-portal-gnome."
+            )
+        return self._pw_fd, self._node_id
+
+    def _created(self, code, results):
+        if code != 0:
+            return self._fail("CreateSession", code)
+        self._session = str(results["session_handle"])
+        log.info("Session: %s", self._session)
+        t = self._token()
+        self._on_response(t, self._sources_selected)
+        self._sc.SelectSources(
+            self._session,
+            {
+                "handle_token": t,
+                "types": dbus.UInt32(SOURCE_TYPE_MONITOR),
+                "cursor_mode": dbus.UInt32(CURSOR_MODE_EMBEDDED),
+            },
+        )
+
+    def _sources_selected(self, code, results):
+        if code != 0:
+            return self._fail("SelectSources", code)
+        log.info("Source selected, starting…")
+        t = self._token()
+        self._on_response(t, self._started)
+        self._sc.Start(self._session, "", {"handle_token": t})
+
+    def _started(self, code, results):
+        if code != 0:
+            return self._fail("Start", code)
+        streams = results.get("streams", [])
+        if not streams:
+            return self._fail("Start (no streams)", -1)
+        self._node_id = int(streams[0][0])
+        fd_obj = self._sc.OpenPipeWireRemote(self._session, {})
+        self._pw_fd = fd_obj.take()
+        log.info("PipeWire fd=%d node=%d", self._pw_fd, self._node_id)
+        self._loop.quit()
+
+
+def build_pipeline(pw_fd: int, node_id: int, fps: int, quality: int) -> list[str]:
+    src = (
+        f"pipewiresrc fd={pw_fd} path={node_id} do-timestamp=true keepalive-time=1000"
+    )
+    rest = (
+        f"! videoconvert ! videoscale ! video/x-raw,width=1280,height=720 ! "
+        f"videorate ! video/x-raw,framerate={fps}/1 ! "
+        f"jpegenc quality={quality} ! fdsink fd=1 sync=false"
+    )
+    return ["gst-launch-1.0", "-q", *src.split(), *rest.split()]
+
+
+def main() -> None:
+    logging.basicConfig(
+        level=logging.INFO,
+        format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
+    )
+    ap = argparse.ArgumentParser()
+    ap.add_argument("--fps", type=int, default=30)
+    ap.add_argument("--quality", type=int, default=80)
+    args = ap.parse_args()
+
+    session = PortalSession()
+    pw_fd, node_id = session.run()
+
+    argv = build_pipeline(pw_fd, node_id, args.fps, args.quality)
+    log.info("Starting gstreamer (fd=%d node=%d)", pw_fd, node_id)
+
+    proc = subprocess.Popen(
+        argv,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        pass_fds=(pw_fd,),
+    )
+
+    def cleanup(*_args):
+        if proc.poll() is None:
+            proc.terminate()
+
+    signal.signal(signal.SIGTERM, cleanup)
+    signal.signal(signal.SIGINT, cleanup)
+
+    def drain_stderr():
+        if proc.stderr:
+            for line in iter(proc.stderr.readline, b""):
+                sys.stderr.buffer.write(line)
+                sys.stderr.buffer.flush()
+
+    threading.Thread(target=drain_stderr, daemon=True).start()
+
+    try:
+        assert proc.stdout is not None
+        shutil.copyfileobj(proc.stdout, sys.stdout.buffer)
+    finally:
+        cleanup()
+        proc.wait()
+
+    rc = proc.returncode
+    if rc not in (0, -signal.SIGTERM, -signal.SIGINT):
+        log.error("gst-launch exited %s", rc)
+        sys.exit(1)
+
+
+if __name__ == "__main__":
+    main()

+ 42 - 0
server/wayland-python-bridge.mjs

@@ -0,0 +1,42 @@
+import { spawn } from "node:child_process";
+import { fileURLToPath } from "node:url";
+import { dirname, join } from "node:path";
+import { createJpegFramer } from "./jpeg-framer.mjs";
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const SCRIPT = join(__dirname, "wayland-capture-bridge.py");
+
+/**
+ * Portal + GStreamer in Python (OpenPipeWireRemote works with dbus-python).
+ * Emits the same JPEG stream as startGstreamer on stdout.
+ */
+export function startPythonWaylandBridge(opts) {
+  const { fps, quality, onFrame, onSpawnError, onExit } = opts;
+
+  const child = spawn("python3", [SCRIPT, "--fps", String(fps), "--quality", String(quality)], {
+    stdio: ["ignore", "pipe", "pipe"],
+  });
+
+  if (!child.stdout) {
+    onSpawnError?.(new Error("python bridge: no stdout"));
+    return { child: null, stop: () => {} };
+  }
+
+  const framer = createJpegFramer(onFrame);
+
+  child.stdout.on("data", (chunk) => framer.push(chunk));
+
+  child.stderr?.on("data", (d) => {
+    process.stderr.write(d);
+  });
+
+  child.on("error", (err) => onSpawnError?.(err));
+
+  child.on("exit", (code, signal) => onExit?.(code, signal));
+
+  function stop() {
+    child.kill("SIGTERM");
+  }
+
+  return { child, stop };
+}

+ 184 - 0
viewer/index.html

@@ -0,0 +1,184 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Nebucast Viewer</title>
+<style>
+  *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
+  :root{
+    --bg:#0f0f0f; --surface:#1a1a1a; --border:#2a2a2a;
+    --text:#e0e0e0; --text-dim:#888; --accent:#6c8cff; --red:#ff5555;
+  }
+  html,body{height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:var(--text)}
+
+  #app{display:flex;flex-direction:column;height:100vh}
+
+  header{
+    display:flex;align-items:center;justify-content:space-between;
+    padding:12px 20px;background:var(--surface);border-bottom:1px solid var(--border);
+    flex-shrink:0;
+  }
+  header h1{font-size:16px;font-weight:600;letter-spacing:-.3px}
+  #status{
+    display:flex;align-items:center;gap:8px;
+    font-size:13px;color:var(--text-dim);
+  }
+  #status .dot{
+    width:8px;height:8px;border-radius:50%;background:var(--red);
+    transition:background .3s;
+  }
+  #status.live .dot{background:#44cc44;animation:pulse 2s infinite}
+  @keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
+
+  .controls{
+    display:flex;align-items:center;gap:12px;
+    padding:10px 20px;background:var(--surface);border-bottom:1px solid var(--border);
+    flex-shrink:0;
+  }
+  .controls label{font-size:13px;color:var(--text-dim)}
+  .controls input[type=text]{
+    background:var(--bg);border:1px solid var(--border);border-radius:6px;
+    color:var(--text);padding:6px 10px;font-size:13px;width:280px;
+    font-family:ui-monospace,monospace;
+  }
+  .controls input:focus{outline:none;border-color:var(--accent)}
+  button{
+    background:var(--accent);color:#fff;border:none;border-radius:6px;
+    padding:6px 16px;font-size:13px;font-weight:500;cursor:pointer;
+    transition:opacity .15s;
+  }
+  button:hover{opacity:.85}
+  button:active{opacity:.7}
+  button.disconnect{background:var(--red)}
+
+  .video-wrap{
+    flex:1;display:flex;align-items:center;justify-content:center;
+    padding:16px;min-height:0;overflow:hidden;
+  }
+  #frame{
+    max-width:100%;max-height:100%;border-radius:8px;
+    background:#000;box-shadow:0 4px 24px rgba(0,0,0,.5);
+    image-rendering:auto;
+  }
+
+  .stats{
+    padding:8px 20px;background:var(--surface);border-top:1px solid var(--border);
+    font-size:12px;color:var(--text-dim);display:flex;gap:24px;flex-shrink:0;
+    font-family:ui-monospace,monospace;
+  }
+</style>
+</head>
+<body>
+<div id="app">
+  <header>
+    <h1>Nebucast Viewer</h1>
+    <div id="status"><span class="dot"></span><span id="status-text">Disconnected</span></div>
+  </header>
+
+  <div class="controls">
+    <label for="ws-url">Server</label>
+    <input type="text" id="ws-url" value="ws://localhost:9000">
+    <button id="btn-connect">Connect</button>
+  </div>
+
+  <div class="video-wrap">
+    <img id="frame" alt="">
+  </div>
+
+  <div class="stats">
+    <span>Frames: <strong id="stat-frames">0</strong></span>
+    <span>FPS: <strong id="stat-fps">0</strong></span>
+    <span>Received: <strong id="stat-bytes">0 B</strong></span>
+  </div>
+</div>
+
+<script>
+(function () {
+  var frame      = document.getElementById("frame");
+  var urlInput   = document.getElementById("ws-url");
+  var btnConn    = document.getElementById("btn-connect");
+  var statusEl   = document.getElementById("status");
+  var statusTxt  = document.getElementById("status-text");
+  var statFrames = document.getElementById("stat-frames");
+  var statFps    = document.getElementById("stat-fps");
+  var statBytes  = document.getElementById("stat-bytes");
+
+  var ws = null;
+  var totalFrames = 0;
+  var totalBytes = 0;
+  var fpsCounter = 0;
+  var fpsTimer = null;
+  var prevUrl = null;
+
+  function formatBytes(n) {
+    if (n < 1024) return n + " B";
+    if (n < 1048576) return (n / 1024).toFixed(1) + " KB";
+    if (n < 1073741824) return (n / 1048576).toFixed(1) + " MB";
+    return (n / 1073741824).toFixed(1) + " GB";
+  }
+
+  function connect() {
+    var url = urlInput.value.trim();
+    if (!url) return;
+    if (ws) disconnect();
+
+    ws = new WebSocket(url);
+    ws.binaryType = "arraybuffer";
+
+    ws.onopen = function () {
+      statusEl.className = "live";
+      statusTxt.textContent = "Connected";
+      btnConn.textContent = "Disconnect";
+      btnConn.className = "disconnect";
+      fpsTimer = setInterval(function () {
+        statFps.textContent = fpsCounter;
+        fpsCounter = 0;
+      }, 1000);
+    };
+
+    ws.onmessage = function (ev) {
+      var blob = new Blob([ev.data], { type: "image/jpeg" });
+      var url = URL.createObjectURL(blob);
+      if (prevUrl) URL.revokeObjectURL(prevUrl);
+      prevUrl = url;
+      frame.src = url;
+
+      totalFrames++;
+      fpsCounter++;
+      totalBytes += ev.data.byteLength;
+      statFrames.textContent = totalFrames;
+      statBytes.textContent = formatBytes(totalBytes);
+    };
+
+    ws.onclose = function () { setDisconnected(); };
+    ws.onerror = function () { setDisconnected(); };
+  }
+
+  function disconnect() {
+    if (ws) { ws.close(); ws = null; }
+    if (fpsTimer) { clearInterval(fpsTimer); fpsTimer = null; }
+    if (prevUrl) { URL.revokeObjectURL(prevUrl); prevUrl = null; }
+    setDisconnected();
+  }
+
+  function setDisconnected() {
+    statusEl.className = "";
+    statusTxt.textContent = "Disconnected";
+    btnConn.textContent = "Connect";
+    btnConn.className = "";
+  }
+
+  btnConn.addEventListener("click", function () {
+    if (ws && ws.readyState === WebSocket.OPEN) disconnect();
+    else connect();
+  });
+
+  if (location.hash.length > 1) {
+    urlInput.value = decodeURIComponent(location.hash.slice(1));
+    connect();
+  }
+})();
+</script>
+</body>
+</html>