diff --git a/README.md b/README.md index 38e96d2..a435f99 100644 --- a/README.md +++ b/README.md @@ -96,13 +96,36 @@ extensions or URL schemes; no schema changes are required. As with uploads, keep this interface on a trusted network until authentication and broader access controls are implemented. +## Submission validation + +All new image, video, stream, and YouTube submissions require a nonblank media +name of at most 120 characters, without control characters. Surrounding spaces +are removed. Names must be unique across the media catalog and pending or +currently downloading YouTube jobs, compared case-insensitively after Unicode +normalization and trimming. Failed jobs do not reserve names; completed jobs +normally have a catalog entry that does. Existing records are not renamed or +removed. This rule is enforced by the app and worker when writing under SQLite +transactions, not by a database constraint; direct SQL can bypass it. + +Stream registration accepts HTTP, HTTPS, RTSP, RTMP, RTMPS, UDP, and TCP network +URLs, including local-network hosts. YouTube requests require a supported +individual video URL. Validation checks syntax, not network reachability. + +Image and video uploads require **FFprobe and FFmpeg on PATH** for local-only, +time-limited content validation. Extensions and client MIME types alone are not +trusted; a video stream and a decodable first frame are required. Full files are +not decoded or scanned for malware. Missing validation tools, storage issues, +database failures, and invalid fields produce user-facing errors without saving +an incomplete media entry. Retrying a failed upload starts it from the beginning. + ## Uploading local videos Use **Upload a Video** on the home page, or visit `/upload/video`. Enter a display name and select one video. The limit is 5GB (5 × 1024³ bytes), checked both in the browser and on the server. Common formats including MP4, MKV, MOV, WebM, AVI, -MPEG, and WMV are accepted by extension; the upload does not transcode or inspect -video codecs. +MPEG, and WMV are accepted by extension. Before saving, FFprobe checks for a +video stream and FFmpeg decodes its first frame; the upload does not transcode the +file or guarantee the rest of the video is valid. The page displays transfer progress and warns against navigating away. At 100%, wait for the server to finish saving; only then will the page automatically @@ -125,8 +148,9 @@ space for both Flask's temporary upload and the final video file. Use **Upload a Static Image** on the home page, or visit `/upload/photo`. Enter an image name and choose one JPG/JPEG, PNG, WebP, BMP, TIFF, or GIF file. Files -are accepted by extension; this workflow does not decode the image or check for -animation. SVG and other active-content formats are not accepted. +are checked against their extensions and decoded for validation. Images may be +animated, but only the first frame is checked; dimensions are limited to 50 +megapixels. SVG and other active-content formats are not accepted. Image uploads now use `"image_upload_location": "Images"` in `config.json`, relative to that file. The folder is created automatically when saving an upload @@ -238,5 +262,5 @@ WHERE youtube_download_job_id = 123 Run the database and worker tests without downloading any videos: ```sh -python3 -m unittest test.youtube_download_job_test test.youtube_download_web_test test.upload_video_test test.upload_photo_test test.player_test test.media_library_test -v +python3 -m unittest test.youtube_download_job_test test.youtube_download_web_test test.upload_video_test test.upload_photo_test test.player_test test.media_library_test test.submission_validation_test -v ``` \ No newline at end of file diff --git a/TODO.md b/TODO.md index 418c084..007d5f1 100644 --- a/TODO.md +++ b/TODO.md @@ -30,10 +30,10 @@ an FFplay-based player with unified playback selection; device control is still - [x] Link the home page to a unified media library with Play buttons, live selection indicators, media-type icons, and cached local image/video thumbnails. - [ ] Connect the existing placeholder controls to backend actions. -- [ ] Add input validation for media names, duplicate names, stream URLs, and +- [x] Add input validation for media names, duplicate names, stream URLs, and uploaded files. - [ ] Ensure upload destinations remain inside the configured upload directory. -- [ ] Handle missing form fields, missing files, and storage/database failures +- [x] Handle missing form fields, missing files, and storage/database failures with useful error messages. - [x] Close request-scoped database connections when requests finish. diff --git a/blueprints/configure_stream/configure_stream.html b/blueprints/configure_stream/configure_stream.html index 6dee3b6..45f4841 100644 --- a/blueprints/configure_stream/configure_stream.html +++ b/blueprints/configure_stream/configure_stream.html @@ -14,17 +14,18 @@