The session-stream web app: a single HTTP listener (9988) that serves a page
per enabled session, keyed by a spoken phrase. Off by default, so a stream
exists only for the sessions it was enabled on.
src/hhstream_live/phrase.py four EFF-large words + a 5-char base-36 tail
(~77.5 bits); the phrase is the password
src/hhstream_live/publisher.py one capture thread + one frame slot per
output; one slot/no queue; capture paused at
zero viewers
src/hhstream_live/server.py the router: /, /<phrase>/, /stream.mjpg,
/frame.jpg, /status.json; unknown phrase is
an empty 404, rate-limited
src/hhstream_live/pages.py the built-in dark pages (no CDN, no build)
src/hhstream_live/__main__.py hhstream-live serve|phrase, standalone
The root page is a form, never a list: the phrase is known only by whoever
enabled the stream. Transport is MJPEG (multipart/x-mixed-replace), reusing
the JPEG grim already produces. Not yet wired to the broker -- that is
stage 2. Tests: tests/live (51).
43 lines
1.4 KiB
Nix
43 lines
1.4 KiB
Nix
{
|
|
lib,
|
|
python3,
|
|
...
|
|
}:
|
|
python3.pkgs.buildPythonApplication {
|
|
pname = "hhstream";
|
|
version = "0.1.0";
|
|
pyproject = true;
|
|
|
|
src = ../.;
|
|
|
|
build-system = [ python3.pkgs.setuptools ];
|
|
|
|
# `hhstream-pointer` is a Wayland client, so it needs libwayland's marshalling.
|
|
# The wlr virtual-pointer protocol itself is *not* a build input: the generated
|
|
# module is vendored under src/hhstream_pointer/_protocol, so a checkout builds
|
|
# without a code generator. See that package's docstring for why, and
|
|
# hhstream_pointer._protocol.regenerate for how to refresh it.
|
|
dependencies = [ python3.pkgs.pywayland ];
|
|
|
|
# Unit tests are wired up in the flake's `checks` so they can run without
|
|
# installing the package; see docs/CONTRACT.md.
|
|
doCheck = false;
|
|
|
|
# Cheap proof that the vendored protocol still binds against this pywayland:
|
|
# importing it runs the scanner-generated `_gen_c()` for both interfaces.
|
|
pythonImportsCheck = [
|
|
"hhstream_pointer.ops"
|
|
"hhstream_pointer._protocol.wlr_virtual_pointer_unstable_v1"
|
|
# The web app: importing the server pulls in the router, the publisher and
|
|
# the pages. The phrase generator's wordlist is covered by the unit suite,
|
|
# which reads the *installed* package.
|
|
"hhstream_live.server"
|
|
];
|
|
|
|
meta = {
|
|
description = "Publish a headless Hyprland session's frames on a Unix socket";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "hhstream-server";
|
|
};
|
|
}
|