Promote Media Sink preview to production (v0.17.0) #1

Open
Grok wants to merge 31 commits from dev into main
Member

Work on dev for the Guildhall preview. Do not merge unless promoting to production.

Current tip is v0.17.0. The duplicate finder scores possible copies from the file name, size, length, type, and path, including the title, year, episode, and title id in those fields. Each group shows a percent and the reasons for that score. The largest file is listed first.

v0.16.0 remains in this branch. Edit library settings and the main library editor can delete that library. The dialog says the deletion cannot be undone. Type the library name, then enter your password. The session stays signed in. A hub personal library cannot be deleted until an administrator designates a different hub. A main library cannot be deleted while a scan is running. Personal libraries stay when a main library is deleted. Files that exist only in the deleted catalog are removed.

Preview: https://dev.mediasink.valleygeek.net/
Production (after merge): https://mediasink.valleygeek.net/

Work on `dev` for the Guildhall preview. Do not merge unless promoting to production. Current tip is **v0.17.0**. The duplicate finder scores possible copies from the file name, size, length, type, and path, including the title, year, episode, and title id in those fields. Each group shows a percent and the reasons for that score. The largest file is listed first. v0.16.0 remains in this branch. Edit library settings and the main library editor can delete that library. The dialog says the deletion cannot be undone. Type the library name, then enter your password. The session stays signed in. A hub personal library cannot be deleted until an administrator designates a different hub. A main library cannot be deleted while a scan is running. Personal libraries stay when a main library is deleted. Files that exist only in the deleted catalog are removed. Preview: https://dev.mediasink.valleygeek.net/ Production (after merge): https://mediasink.valleygeek.net/
Lift the site-app shell (sessions, mail, hardening, admin, Docker) from
spin-the-activity, rename STA_ identifiers to MS_ / media_sink, and drop
register, guests, carnival copy, and the Readable/carnival theme pair.
The profile has no theme control; screens use one dark Okabe–Ito palette
and a left-rail layout. Domain tables and the script API (scan, PUT, TUS,
split, download) follow DESIGN.md and TECHNICAL.md. Version 0.2.0
(pre-beta MINOR: first application-code).
Local docker-compose.yml stays port-published for this machine. Preview
uses docker-compose.preview.yml so Coolify does not publish 8080 and so
prod/dev blob and Postgres directories stay separate under
/mnt/nas/appstore/media-sink/.
Coolify's compose proxy matches an unmapped container port. expose
alone did not attach the Host router for the preview hostname.
Privacy and Terms routes, templates, footer links, and operator legal
tunables are removed. This is a closed-team tool; those pages were
shell leftovers and are not part of the catalog or hub flow.

Upload bash variants no longer call Python. They check curl, sha256sum,
find, and flock, report HTTP and scan errors, and skip files that
cannot be read or hashed. PowerShell variants use Get-FileHash and
Invoke-WebRequest, with curl.exe for TUS and rate-limited PUT.
Those checks only restated the deletion of Privacy and Terms. The
pages stay absent; the suite no longer special-cases their 404s.
The basic PUT script parsed no arguments and only logged skips and
errors. Operators had no usage text, no stage or file progress, and no
way to post and upload after each file.

-h prints usage and exits before the lock, token, or curl checks so help
works on an unconfigured copy. -v prints stages; repeating it (-vv)
prints each file path. -i POSTs a one-file scan batch and GETs
hub-wanted after each scanned file, then still does the final wanted
pass. getopts treats -vv as two -v flags.

Left upload-tus.sh, upload-split.sh, and the PowerShell variants
unchanged. Did not add SITE_URL env overrides; the configuration block
stays the operator interface.

Version 0.3.0 -> 0.4.0 (new script behavior).
Scan named a main library and created a user library on first contact,
so a script name had to match the shared catalog. Operators instead keep
personal library names of their own and link them on My library. The
administrator creates main libraries, sets each local directory under
MS_MEDIA_ROOT, and designates a already-linked personal library as hub
before queue jobs exist.

Hub files that already sit at {media root}/{local directory}/{relative
path} are marked stored and are not uploaded. Downloads read that path
when present, otherwise the checksum blob store. Uploads of files the
hub does not yet hold still land in the blob store; they are not written
into the Plex tree.

Rejected auto-matching a personal name to a main library, and rejected
chown of MS_MEDIA_ROOT in the entrypoint.

Script-only commits bump PATCH. This change also updates the app, so
the version is 0.4.0 -> 0.5.0.
Coolify rejects volume sources that contain ${, so the preview bind
${MS_MEDIA_ROOT:-/mnt/smb/plexmedia} failed deploy. The Guildhall
compose now mounts /mnt/smb/plexmedia and sets MS_MEDIA_ROOT to that
path. Local compose mounts ./media at /media.

Environment substitution for secrets is unchanged.
Library tables were capped at 72rem, headers packed name/select/summary
into one cramped row, sizes were always GB, and item length showed days
on every row. Delete confirmed but the personal-library row looked
unchanged. Personal libraries could be created in the UI. Sort was
fixed to file name. Target format standard was treated as a codec
label, and the admin form showed the live media root (a lab path on
published hosts).

Library pages now use the same small stat blocks as the admin dashboard,
tables scroll to their content width, and column headers sort with the
choice stored per account. Sizes under 1 GB display in MB with US
commas; item length is H:MM or M:SS. After Delete, the row is marked
deleted. Personal libraries are created by scan only; Edit library
settings handles rename, link, and unlink, with a Hub mark when
designated and unlink blocked until an administrator changes the hub.
Main library rows show file state from hub files, blobs, and pending
jobs. The curator queue has bulk approve/exclude/not wanted.

Paths with spaces and backslash escapes are unescaped in validation and
in the scripts. Product copy uses generic examples such as /mnt/media;
operator binds stay in compose and PROMOTION.md.

Version 0.5.0 -> 0.6.0.
Grok changed title from Instantiate Media Sink (dev preview) to Promote Media Sink preview to production (v0.6.0) 2026-09-18 18:22:45 +00:00
Item disposition was a single catalog value, personal rows had Show,
Sync, Not wanted, and Delete, hub scans enqueued upload jobs, and
length used clock time. That mixed team listing with one account's
choice and hid copy-count rules.

Each account now has Wanted, Exclude (blue), or Not wanted (yellow)
per item on both library pages. Delete is gone. Not wanted keeps at
least minimum copies (default 2), preferring Wanted libraries, then
the hub, then a per-main-library mirror. Hub scans do not enqueue
hub-wanted jobs; files already on the mount are marked present.
New scans match the main library by checksum then name, with a
length confidence for the duplicate finder. Admin Operations Scan
walks the local directory with a live progress bar and writes File
state. Item length is 2h 10m or 15m 7s.

Version 0.6.0 -> 0.7.0.
Grok changed title from Promote Media Sink preview to production (v0.6.0) to Promote Media Sink preview to production (v0.7.0) 2026-09-18 20:40:23 +00:00
Personal libraries get a Hidden/Show/Sync permission next to
disposition, with matching bulk actions and profile defaults (Show
for new accounts). Library selection sits on the left; bulk buttons
on the right. Tables persist page size and add go-to-page and rows
controls. Curator select-all clears after bulk when rows leave.
Side nav on Curator and Admin highlights only the current page.
Grok changed title from Promote Media Sink preview to production (v0.7.0) to Promote Media Sink preview to production (v0.8.0) 2026-09-18 21:27:30 +00:00
Library tables listed every file in a flat page, so a show of twenty
episodes (or a movie with extras and subtitles) filled the list with
basenames. Grouping from relative paths, using Plex preferred folders,
collapses that into title rows that expand.

Each main library has a kind: Movies, Shows, or Other. Kind is an
administrator field rather than a guess from the library name, because
a year-plus-id folder is a movie in a movie library and a show when
the id is tvdb. Personal libraries inherit the linked main library's
kind, or Other when unlinked. Other still groups two directory levels
and sidecar subtitles.

Shows expand show → season/specials/extras → files. Movies expand a
Title (Year) {id} folder to extras folders; a directory that holds only
the feature stays a single row; loose files at the library root stay
ungrouped unless they pair with subtitles; a category folder that holds
several titles is a top-level group. Sidecar grouping is stem plus
language suffixes, including files that are not in a subdirectory.

Group items is on by default and stored on the account. The listing
toggle and the account checkbox write the same field. A listing GET
with group_items overrides for that response only, so the curator
renamer can ask for a flat file list without flipping the preference.

Page size counts top-level rows. Checking a group checks descendant
items. Version 0.8.0 -> 0.9.0.
Grok changed title from Promote Media Sink preview to production (v0.8.0) to Promote Media Sink preview to production (v0.9.0) 2026-09-21 02:31:45 +00:00
Page size already counted top-level groups, not the files inside them.
A library of 28 files that folds into 26 rows now pages as 26, so a
season of many episodes does not consume the page by itself. The new
test locks that: one show of three episodes plus 25 loose files is 26
rows and two pages at 25 per page.

Group rows had no disposition control, so marking a season meant
expanding it and setting each file. Each group now shows Wanted,
Exclude, and Not wanted. The pressed control is the value shared by
every file in the group, including nested folders. When the files
differ, no control is pressed. Choosing one writes that disposition
on every file in the group through the existing bulk action.

Version 0.9.0 -> 0.10.0.
Grok changed title from Promote Media Sink preview to production (v0.9.0) to Promote Media Sink preview to production (v0.10.0) 2026-09-22 04:28:13 +00:00
Grouped listings continued on 0.10 with disposition controls, which
the old rule treated as a new minor. Further work on the feature of
the current minor now stays on that minor and bumps PATCH. A
different feature still starts a new minor. This grouping follow-up
is 0.10.1.

My library group rows had no permission control, so Hidden, Show, or
Sync meant expanding the folder and setting each file. The group row
now shows those buttons. The pressed control is the permission shared
by every file in the group, including nested folders. When the files
differ, no control is pressed. Choosing one writes that permission on
every membership in the group.

The disclosure mark stayed a right-pointing arrow after expand because
the button never changed its glyph. An open group now shows a down arrow.

Version 0.10.0 -> 0.10.1.
The type column sat after length as text. It now sits left of the file name as an icon, with no header. Tables filled the page; they now stay as wide as their columns, up to the page, and visible rows alternate. The library dropdown, Hub mark, and Edit library settings sat on the search row; they now sit above the summary. Page and Rows captions stacked and differed in width, so the pager sat unevenly; the captions share a width and the pager lines up with the table. Bulk actions led with disposition; they follow the row, permissions then disposition, in bordered groups.

Version 0.11.0.
Grok changed title from Promote Media Sink preview to production (v0.10.0) to Promote Media Sink preview to production (v0.11.0) 2026-09-22 05:30:22 +00:00
Those columns stayed on one line, so a narrower window hid the rest of the table. File name and path now wrap, and the table stays within the page.

Version 0.11.1.
Grok changed title from Promote Media Sink preview to production (v0.11.0) to Promote Media Sink preview to production (v0.11.1) 2026-09-22 05:46:47 +00:00
The first library stat showed only the file count. It now shows Items, the count the pager uses, then Files in the same block.

Version 0.11.2.
Grok changed title from Promote Media Sink preview to production (v0.11.1) to Promote Media Sink preview to production (v0.11.2) 2026-09-22 06:19:41 +00:00
Scripts was a list of stock files the operator edited by hand. The page
now collects library directories and download folders, stores that setup
on the account when Save this setup is on, and renders bash. The default
is one script with every piece included. Two scripts writes an upload
file and a download file. Each piece includes or omits a fixed block, so
the same setup can emit the long script or the core scan and transfer.
The upload control selects basic PUT, TUS, or 64 MiB split because those
replace one function rather than stacking. Raw bash and PowerShell files
stay as downloads.

PowerShell rendering is the same profile and piece ids. This commit wires
bash only so the form and the blocks are settled before a second renderer.

Version 0.12.0. A new feature, so the minor moves off the library-list chain.
Grok changed title from Promote Media Sink preview to production (v0.11.2) to Promote Media Sink preview to production (v0.12.0) 2026-09-22 07:03:47 +00:00
Save this setup sits above Download. Resumable upload is the default.
A separate settings file holds the site, speeds, libraries, folders, and
token so a script update can replace the program and leave that file.
The published pin is the app version of the commit that last changed the
generator, not the live app version. The script asks the site with its
token and replaces itself only when that pin is newer. Enter means yes.
A scheduled run does not prompt, and a failed check continues.

An embedded token is written into the settings. Existing tokens are
chosen by name and pasted, because the site stores the name and not the
secret. Create new writes a token once on download. Comments are full,
headers, or none. Explain every failure names a missing tool and an
install command, and does not install it.

Version 0.12.1. Further work on the script builder, so the patch moves.
Grok changed title from Promote Media Sink preview to production (v0.12.0) to Promote Media Sink preview to production (v0.12.1) 2026-09-23 06:32:24 +00:00
The page recalls named configurations, newest first, or starts from a
blank form. Delete asks first. Embedded or separate applies to both the
token and the settings. An existing token is chosen by name and read
from the token file, because the site does not keep the secret. A new
token is created on save or download and written into the settings once.
Speed 0 means unlimited. Personal library names suggest names already on
the account. Download locations must be a real main library. Advanced
stays closed until opened. Preview and Download show the file count, and
each previewed file can be downloaded on its own.

The stock upload and download files are gone. The builder is the only
script source. The script pin moves to v0.12.2 with this generator change.

Version 0.12.2. Further work on the script builder, so the patch moves.
Grok changed title from Promote Media Sink preview to production (v0.12.1) to Promote Media Sink preview to production (v0.12.2) 2026-09-23 16:39:32 +00:00
Choices set the hidden attribute, but the form layout forced those
blocks to stay on screen. Hidden now wins. An existing token is a
masked paste with Show, checked against the account and written into
that download. The secret is still not stored. Focus rings on this form
sit on the control so they do not crowd the next field. Sections that
had no explanation now have a short one.

Version 0.12.3. Further work on the script builder, so the patch moves.
The script pin stays at v0.12.2 because the generated script did not change.
Grok changed title from Promote Media Sink preview to production (v0.12.2) to Promote Media Sink preview to production (v0.12.3) 2026-09-23 17:29:29 +00:00
The published site answers http with 308 to https. The script treated
that redirect as a rejected scan, so each file stopped at post-scan.
Before the first request, an http address that permanently redirects
to https on the same host is used as https. Loopback stays on http.
The Scripts form shows https when the page itself is https for that host.

Version 0.12.4. Further work on the script builder, so the patch moves.
The script pin moves to v0.12.4 with this generator change.
Grok changed title from Promote Media Sink preview to production (v0.12.3) to Promote Media Sink preview to production (v0.12.4) 2026-09-24 03:54:08 +00:00
The page sits between Main library and Scripts. Move up and Move down
store a priority, and the scripts claim jobs in that order. Remove
cancels one pending job. Confirm remove asks first and stays on unless
the account turns it off. Clear queue always asks, then cancels every
pending job for that account.

A column sort was not used, because the stored priority is the run order.
Grok changed title from Promote Media Sink preview to production (v0.12.4) to Promote Media Sink preview to production (v0.13.0) 2026-09-24 04:43:58 +00:00
History lists finished jobs for the account. Keep history is on.
History count 0 keeps every entry. A smaller count keeps the newest
rows. Remove drops one line. Clear log removes the finished jobs
after confirmation. Pending jobs stay on Queue.
Grok changed title from Promote Media Sink preview to production (v0.13.0) to Promote Media Sink preview to production (v0.13.1) 2026-09-24 05:21:38 +00:00
Below 880px the header hides the username, and Menu did not list
Account or Log out, so a narrow window could not open the profile or
sign out. Menu now includes Notifications, Account, and Log out. The
wide header still shows the notification count and the username, and
Log out on a wide window stays on the account page.

Putting those controls on the header row was rejected because the
brand and Menu already fill a phone width.
Grok changed title from Promote Media Sink preview to production (v0.13.1) to Promote Media Sink preview to production (v0.13.2) 2026-09-27 01:33:03 +00:00
A large library add created one notification per file. A script run now
sends one run id, and every new file in that run appends to one unread
notification that states the count and lists the names. The notice is
stored on the first file, so a slow run stays one row and the list grows
while the script is still working. Marking it read closes that run.
Later files start another notice.

Events without a run id, such as linking a library or approving items,
join the open notice for that account, category, and main library when
it was updated within 30 minutes. Waiting until the script exits was
rejected because a killed run would never notify, and a multi-hour scan
would hide the queue until the end. Grouping only when the page renders
was rejected because a slow run has no shared boundary unless the run
id is stored with each file.

Existing unread rows for the same account, category, and library fold
into one notice on startup.

Version 0.14.0. The script pin moves to v0.14.0 because the generator
now sends the run id.
Grok changed title from Promote Media Sink preview to production (v0.13.2) to Promote Media Sink preview to production (v0.14.0) 2026-09-27 02:42:01 +00:00
The image runs sshd beside the web process. MS_SYNC_PORT sets the listen
port and defaults to 2222. A value of 0 does not start the daemon.
Compose publishes that same port.

People stay in the database. A token stores one SSH public key. The
daemon login name is mediasink, and that system user shares the app
uid. A shell is refused. rsync may upload a checksum the hub has asked
for, or download a wanted checksum. Scan and job calls stay on the
bearer token over HTTPS. The account page shows the port and the server
key.

Version 0.15.0.
A token could claim, finish, or download another account's files.
Uploads and range reads held the whole body in memory. Forwarded
client addresses were trusted from every peer, so rate limits could
be spoofed. A password change left API tokens in place.

Claim and complete now require the token's library. Blob download
requires the hub or a user-wanted job. Password changes revoke
tokens. Bodies stream to disk. Uvicorn trusts private and loopback
proxies unless MS_TRUSTED_PROXIES says otherwise.
Grok changed title from Promote Media Sink preview to production (v0.14.0) to Promote Media Sink preview to production (v0.15.1) 2026-09-27 18:41:46 +00:00
Guildhall's git SSH already listens on 2222, so the preview compose
fallback could not publish file sync there. The preview stack now
falls back to 1222, which matches MS_SYNC_PORT on the Coolify
preview resource. Local compose still falls back to 2222.
Neither editor could remove a library. Edit library settings and the
main library editor now include a Delete library section that says the
deletion cannot be undone. The button stays off until the typed name
matches. The first submit asks for the current password. The request
checks that password and does not call set_password, so the session
stays signed in and API tokens stay valid.

A hub personal library is refused until an administrator designates a
different hub, the same rule as unlink. Deleting a personal library
removes memberships and jobs, drops items that exist only there, and
clears a mirror pointer. Items on a linked main library stay.

Deleting a main library unlinks personal libraries and keeps items that
still have a membership. Catalog-only items are removed. Unused checksum
blobs are removed. Files in the local directory stay on disk. A scan in
pending, running, or cancelling blocks the delete so the scan thread
does not keep writing after the job row is gone. Cascading the main
library onto items was rejected because that would erase files people
still have in a personal library.

Version 0.16.0.
Grok changed title from Promote Media Sink preview to production (v0.15.1) to Promote Media Sink preview to production (v0.16.0) 2026-09-30 05:28:47 +00:00
The finder grouped files that shared a size and a short name stem, or a
size and a length, and it listed stored name matches without a score on
the size groups. A re-encode at a different size never met those buckets.
The replacement scores each pair from the file name, size, length, type,
and path, including the title, year, episode, and title id in those
fields, plus any stored match confidence.

A pair needs the same file type and an identity signal: the same or a
similar title, the same file name, the same title id, or the same episode
with a related title. Size and length only raise or lower that score.
Different episode numbers score zero. A feature stays apart from a
trailer, sample, or extras path. Pairs at 0.45 or above join a group.
The group percent is the strongest pair, so a sure match stays visible
when a weaker file is also connected. The largest file is listed first,
and Link to first merges the others into that file. The page shows at
most 200 groups.

Perceptual hashing was rejected. The catalog does not store frames,
resolution, or codecs, and there is no ffmpeg step to produce them.

Version 0.17.0.
Grok changed title from Promote Media Sink preview to production (v0.16.0) to Promote Media Sink preview to production (v0.17.0) 2026-10-01 06:29:47 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin "dev:dev"
git switch "dev"

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch "main"
git merge --no-ff "dev"
git switch "dev"
git rebase "main"
git switch "main"
git merge --ff-only "dev"
git switch "dev"
git rebase "main"
git switch "main"
git merge --no-ff "dev"
git switch "main"
git merge --squash "dev"
git switch "main"
git merge --ff-only "dev"
git switch "main"
git merge "dev"
git push origin "main"
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ai-collab/media-sink!1
No description provided.