Skip to content

Add Stripchat & CAM4 performer search, continuous recording and recording priority - #31

Merged
raccommode merged 11 commits into
raccommode:mainfrom
MajorLOL:main
Oct 9, 2026
Merged

raccommode merged 11 commits into
raccommode:mainfrom
MajorLOL:main

Conversation

@MajorLOL

@MajorLOL MajorLOL commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Stripchat and CAM4 as providers in "Find a performer", and lets CAM4 recordings continue through short breaks like Stripchat and BongaCams.

Stripchat: performer search

  • searchPeople looks up exact usernames: the text as typed, or for multi-word input the words joined with "", "_" and "-". Links and @NAMEs are accepted.
  • The lookup uses the public profile page through easyx-browser-fetch and reads window.__PRELOADED_STATE__. Stripchat blocks its JSON API for server requests (HTTP 403 plain, 418 with a Chrome fingerprint), but serves the profile page.
  • Only confirmed model accounts are returned, with avatar, gender, country and online status; offline models are found too.

CAM4: performer search

  • searchPeople looks up exact usernames: the text as typed, or for multi-word input the words joined with "" and "_". Links and @NAMEs are accepted.
  • CAM4's profile info API now answers HTTP 401 without a login on www.cam4.com. The lookup therefore tries, in order: the info API on hu.cam4.com, the public streamInfo API (confirms live rooms), and the public profile page through easyx-browser-fetch (also finds offline performers). A 404 means the name does not exist.

Both: source discovery

discoverSources adds exactly the picked room as a source (external ID = profile URL, so a manually added source is not duplicated). Performers without a Stripchat or CAM4 reference get nothing: no name-based guessing.

CAM4: continuous recording

  • CAM4 recordings now use the shared live recorder and continue through short breaks into one video.
  • A returning CAM4 room gets a new stream address. live-recorder.ts gets two optional arguments (a JSON endpoint and the field holding the current master playlist URL), so the recorder can follow the room via streamInfo → cdnURL. Existing callers (Stripchat, BongaCams) are unaffected.
  • When the stream API cannot be used, the download falls back to yt-dlp as before.

Environment

Variable Default Description
CAM4_MERGE_GAP_MINUTES 10 How long a CAM4 recording waits for the room to become public again before it is finished. 0 turns merging off.

Without this variable CAM4 uses STRIPCHAT_MERGE_GAP_MINUTES if set, otherwise 10 minutes. Added to compose.yaml and the README.

Testing

  • 7 new tests in plugins/stripchat/search.test.ts and 10 in plugins/cam4/search.test.ts; all plugin tests pass and tsc --noEmit is clean.
  • The recorder was tested end-to-end against a simulated stream that drops and returns under a new address: both parts were joined into one video.

Adds identity search and source discovery to the Stripchat plugin, so Stripchat
can be used as a provider in the performer search dialog.

- searchPeople looks up exact usernames: the text as typed, or for multi-word
  input the words joined with "", "_" and "-". Links and @NAMEs are accepted.
- The lookup uses the public profile page through easyx-browser-fetch and reads
  window.__PRELOADED_STATE__. Stripchat blocks its JSON API for server requests
  (HTTP 403 plain, 418 with a Chrome fingerprint), but serves the profile page.
- Only confirmed model accounts are returned, with avatar, gender, country and
  online status; offline models are found too.
- discoverSources adds exactly the picked room as a source (external ID = profile
  URL, so a manually added source is not duplicated). Performers without a
  Stripchat reference get nothing: no name-based guessing.
- searchPeople/discoverSources: exact username lookup via
  rest/v1.0/profile/<user>/info (browser-compatible helper on HTTP 403);
  the picked room is added as the only source, no name-based guessing.
- Recordings use the shared live recorder and continue through short breaks
  (CAM4_MERGE_GAP_MINUTES, falls back to STRIPCHAT_MERGE_GAP_MINUTES, default 10).
  Falls back to yt-dlp when the stream API cannot be used.
- live-recorder: optional refresh endpoint + field (args 8 and 9), so the
  recorder can follow a room whose stream address changes after a break.
  Existing callers are unaffected.

Tests: 9 new tests in plugins/cam4/search.test.ts.
CAM4: add performer search and continuous recording
- searchPeople/discoverSources: exact username lookup via
  rest/v1.0/profile/<user>/info (browser-compatible helper on HTTP 403);
  the picked room is added as the only source, no name-based guessing.
- Recordings use the shared live recorder and continue through short breaks
  (CAM4_MERGE_GAP_MINUTES, falls back to STRIPCHAT_MERGE_GAP_MINUTES, default 10).
  Falls back to yt-dlp when the stream API cannot be used.
- live-recorder: optional refresh endpoint + field (args 8 and 9), so the
  recorder can follow a room whose stream address changes after a break.
  Existing callers are unaffected.
- database.ts: new performers.priority column (-1 low, 0 normal, 1 high,
  default 0), added by migration. nextQueued orders by performer priority,
  then by age. New helpers: setPerformerPriority, itemPriority and
  queuedLivePriorities. Positional INSERT INTO performers statements now
  name their columns, so the extra column does not break them.
- downloader.ts: when every slot is busy and a higher-priority live
  recording is queued, the lowest-priority live recording (latest started
  first) is stopped so the waiting one gets the slot. One recording per
  waiting item; paused, encoding and non-live downloads are never
  interrupted. Preempted recordings are kept and not treated as a user
  stop, so the room is recorded again once a slot is free.
- index.ts: PUT /api/performers/:id/priority with
  { "priority": "low" | "normal" | "high" }.
- performer-priority.test.ts: 4 tests for storage, queue order and
  preemption.
- main.tsx: "Recording priority" selector (High / Normal / Low) in
  Manage profile, and a High/Low badge next to the name on performer cards.
- styles.css: styles for the selector and the badge.
@MajorLOL

MajorLOL commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

This is ready for review.

The main changes are performer search for Stripchat and CAM4, CAM4 continuous recording through short breaks, and recording priority/preemption support.

All checks are passing and there are no merge conflicts.

Please let me know if any changes are needed.

@MajorLOL MajorLOL changed the title Stripchat & CAM4: add performer search, CAM4 continuous recording Add Stripchat & CAM4 performer search, continuous recording and recording priority Oct 7, 2026
- BackupSettings.tsx (new): "Backup" panel with an Export backup
  button (downloads a JSON file) and an Import backup button. Two
  options choose whether settings are imported and whether missing
  plugins are installed. After an import it shows a summary of added
  and updated performers and sources, plus any skipped sources or
  plugins with the reason. The page reloads so the imported library
  is visible right away.
- main.tsx: adds "Backup" as a fourth settings category, next to
  Automation, Storage and Subtitles.
- styles.css: styles for the backup panel, its options and the
  import summary.
- backup.ts (new): exports performers (name, aliases, image, links,
  recording priority), their sources (auto-download, scraper,
  interval), application settings and installed plugins to a JSON
  backup. Downloads and plugin configuration (passwords, cookies,
  sessions) are never included. Import merges into the current
  library and never deletes anything: performers are matched by name,
  sources by plugin + external ID, so importing the same file twice
  creates no duplicates. A source that belongs to another performer
  is skipped and reported. Settings are validated with the existing
  settings schema; newer backup formats are rejected.
- database.ts: mergePerformerDetails adds imported aliases and links
  to an existing performer and keeps its current image.
- index.ts: GET /api/backup/export (downloads the file) and
  POST /api/backup/import (?settings=0 / ?plugins=0 to skip those
  parts, 32 MB body limit).
- backup.test.ts (new): 5 tests for export without secrets, restore
  into an empty library, importing twice, source conflicts and
  invalid files.
npm (production, all fixed within the existing version ranges):
- fastify 5.12.1 -> 5.12.5: CVE-2026-76169, CVE-2026-84504, CVE-2026-84469,
  CVE-2026-84428, CVE-2026-92081
- fast-uri -> 3.1.8 / 4.1.5: CVE-2026-86472, CVE-2026-84394, CVE-2026-84292,
  CVE-2026-86818
- undici -> 7.29.1 (via @fastify/reply-from): CVE-2026-85014, CVE-2026-18149,
  CVE-2026-84947, CVE-2026-84890, CVE-2026-19534, CVE-2026-84961,
  CVE-2026-85008, CVE-2026-84933, CVE-2026-18540, CVE-2026-85024
- brace-expansion -> 5.0.12 (via @fastify/static): CVE-2026-102276,
  CVE-2026-102277, CVE-2026-102278

npm (development only): vitest 3 -> 5.0.3 (tinypool prototype pollution,
@vitest/mocker path traversal), plus shell-quote, concurrently and
source-map-js updates. `npm audit` now reports 0 vulnerabilities.

Docker image: ofscraper 3.14.7 pins idna==3.7 and lxml~=5.1. idna 3.20
(CVE-2026-45409) and lxml 6.1.3 (CVE-2026-41066) are installed over them;
ofscraper still imports and runs.

Tests: full suite (446 tests) and the web build pass.
@MajorLOL

MajorLOL commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

I've added three more commits to this PR since opening it:

Backup export and import (fb05b5e, a799d1d)
Settings → Backup can export the library setup to a JSON file and import it again, for example after a reinstall or on another server. The export contains performers (with aliases, links and recording priority), their sources, the application settings and the installed plugins. Downloads and plugin configuration (passwords, cookies, sessions) are never included. Import merges into the current library and never deletes anything, so importing the same file twice creates no duplicates. 5 new tests in server/backup.test.ts.

Security: update dependencies with known CVEs (c4d19bd)

  • Production npm packages, all fixed within the existing version ranges: fastify 5.12.5, fast-uri 3.1.8 / 4.1.5, undici 7.29.1 and brace-expansion 5.0.12. Together they fix 22 CVEs, including CVE-2026-76169 (fastify authentication bypass) and CVE-2026-84961 (undici TLS validation bypass).
  • vitest 3 → 5 (dev only). npm audit now reports 0 vulnerabilities.
  • The Docker image installs idna 3.20 (CVE-2026-45409) and lxml 6.1.3 (CVE-2026-41066) over the versions pinned by ofscraper 3.14.7; ofscraper still imports and runs.

Not changed, for a separate discussion: torch 2.9.1 and transformers 4.57.6 in the subtitle worker have known CVEs, but they only apply when loading untrusted models, and transformers 5 is a major upgrade that needs proper testing.

The full test suite (446 tests) and the web build pass, and the image builds and runs on my Synology NAS.

Happy to split this into separate PRs if that's easier to review.

…ayer controls

- Add a delete button to each library card (shown on hover, always visible on
  touch devices) and a Delete action on the watch page, both with a
  confirmation. After deleting from the watch page you return to the list.
- Fix the player controls and progress bar staying visible for the whole video
  in fullscreen: the hide timer was cleared on every timeupdate. Auto-hide now
  lives in src/player-controls.ts with unit tests.
@MajorLOL

MajorLOL commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

New commit: delete single videos from the library + auto-hide fullscreen player controls

Delete single media items

  • Each library card now has a delete button (top right, shown on hover; always visible on touch devices).
  • The watch page has a Delete action next to "Add to favorites". After deleting you return to the list you came from.
  • Both ask for confirmation and reuse the existing POST /api/media/delete endpoint, so downloader tracking (blocking re-downloads) works the same as the existing multi-select delete. No server changes.

Fix: player controls never hid in fullscreen

  • The keyboard-shortcut effect depended on currentTime, and its cleanup cleared the auto-hide timer on every timeupdate. The controls and progress bar therefore stayed visible for the whole video. In windowed mode this was masked by the mouseleave handler.
  • Auto-hide moved into src/player-controls.ts: it hides after 2.5s of inactivity while playing, shows again on pointer, touch or keyboard activity, and stays visible while paused or while the subtitle menu is open.

Tests

  • New src/player-controls.test.ts (5 tests) and 2 extra tests in src/Player.test.tsx.
  • npm run check: 453 tests pass, build OK.

@raccommode
raccommode merged commit d75ac45 into raccommode:main Oct 9, 2026
5 checks passed
@raccommode

raccommode commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Thanks for the contribution! I reviewed the full PR, including the later backup, dependency and player changes, and merged it after adding fixes in 8c81d88.

The review fixes cover:

  • CAM4 reconnects now actually refresh the stream URL after a short break. Provider searches reject empty/non-model responses, preserve offline status, support legacy live identities and honor cancellation/timeouts.
  • Changes to a running performer's priority now affect preemption, and a recording already stopping does not cause another recording to be stopped unnecessarily.
  • Backups retain all linked identities, match renamed performers and normalized source URLs, report identity conflicts, respect scraper availability/minimum intervals, and roll back unexpected import failures. The import summary remains visible and restored settings refresh correctly.
  • Single-item deletion keeps library pagination/selection consistent and prevents player autoplay from advancing during deletion. Invalid priority requests return HTTP 400.
  • CAM4 merge-gap configuration and backup/priority behavior are documented.

Validation: all 479 tests pass under Node 24, TypeScript and the production build pass, and npm audit reports zero vulnerabilities. The reconnect regression test simulates a changed CAM4 URL and validates the joined MP4 with FFmpeg/ffprobe. I also checked a local backup export/import round trip and player control auto-hide.

PR CI passed, including AMD64 and ARM64 Docker runtime checks and OF-Scraper imports with the updated idna/lxml versions. Provider-specific tests use fixtures; live authenticated broadcasts were not tested.

Released as v2026.41.2. The post-merge workflow passed, and both AMD64 and ARM64 images were published under 2026.41.2 and latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants