diff --git a/.air.toml b/.air.toml index 62d8322..ec6b3d2 100644 --- a/.air.toml +++ b/.air.toml @@ -5,7 +5,7 @@ tmp_dir = "tmp" [build] args_bin = [] bin = "./tmp/main" - cmd = "go mod tidy && go build -o ./tmp/main ." + cmd = "go mod tidy && go build -o ./tmp/main ./cmd/simplenvr" delay = 1000 exclude_dir = ["assets", "tmp", "vendor", "testdata"] exclude_file = [] diff --git a/.github/workflows/prepared-export-browser.yml b/.github/workflows/prepared-export-browser.yml index e765d70..1ff87ad 100644 --- a/.github/workflows/prepared-export-browser.yml +++ b/.github/workflows/prepared-export-browser.yml @@ -43,8 +43,8 @@ jobs: - name: Protocol regressions and real HTTPS/browser acceptance run: | . "$RUNNER_TEMP/export-browser-venv/bin/activate" - python -m unittest discover -s tests -p 'test_prepared_export_protocol.py' -v - GITHUB_SHA="$CHECKPOINT_SHA" bash tests/runtime-browser-acceptance.sh simplenvr-export-test "$RUNNER_TEMP/prepared-export-browser" + python -m unittest discover -s tests/acceptance -p 'test_prepared_export_protocol.py' -v + GITHUB_SHA="$CHECKPOINT_SHA" bash tests/acceptance/runtime-browser-acceptance.sh simplenvr-export-test "$RUNNER_TEMP/prepared-export-browser" - name: Retain media, network, browser and container evidence if: always() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/prepared-export-go.yml b/.github/workflows/prepared-export-go.yml index 5514a0c..d32ea1d 100644 --- a/.github/workflows/prepared-export-go.yml +++ b/.github/workflows/prepared-export-go.yml @@ -39,7 +39,7 @@ jobs: - run: bash .github/scripts/ci-media-apt.sh update - run: bash .github/scripts/ci-media-apt.sh install ffmpeg - name: Prepared protocol regression tests - run: python3 -m unittest discover -s tests -p 'test_prepared_export_protocol.py' -v + run: python3 -m unittest discover -s tests/acceptance -p 'test_prepared_export_protocol.py' -v - name: Verify dependencies and build the exact checkout run: | go mod download @@ -47,7 +47,7 @@ jobs: git diff --exit-code -- go.mod go.sum go build ./... - name: Full race-enabled Go suite including Node and native media tests - run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/core-ci-evidence.sh "$RUNNER_TEMP/prepared-export-go" + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/acceptance/core-ci-evidence.sh "$RUNNER_TEMP/prepared-export-go" - name: Static analysis if: always() run: go vet ./... diff --git a/.github/workflows/safety-ci.yml b/.github/workflows/safety-ci.yml index ae0f2a2..3319765 100644 --- a/.github/workflows/safety-ci.yml +++ b/.github/workflows/safety-ci.yml @@ -31,8 +31,8 @@ jobs: persist-credentials: false - name: Browser CI diagnostic helper regression tests run: | - python3 -m unittest discover -s tests -p 'test_browser_ci_diagnostics.py' -v - python3 -m unittest discover -s tests -p 'test_browser_network_ready.py' -v + python3 -m unittest discover -s tests/acceptance -p 'test_browser_ci_diagnostics.py' -v + python3 -m unittest discover -s tests/acceptance -p 'test_browser_network_ready.py' -v - uses: actions/setup-go@v5 with: go-version: '1.26.x' @@ -51,10 +51,10 @@ jobs: - name: Build run: go build ./... - name: Core evidence assessor regression tests - run: python3 -m unittest discover -s tests -p 'test_core_ci_evidence.py' -v + run: python3 -m unittest discover -s tests/acceptance -p 'test_core_ci_evidence.py' -v - name: Race-enabled tests including media and shutdown lifecycle shell: bash - run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/core-ci-evidence.sh "$RUNNER_TEMP/simplenvr-core-evidence" + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/acceptance/core-ci-evidence.sh "$RUNNER_TEMP/simplenvr-core-evidence" - name: Retain core test execution evidence even on failure if: always() uses: actions/upload-artifact@v4 @@ -100,7 +100,7 @@ jobs: run: docker build -t simplenvr-safety-test . - name: Active runtime-container recording, SIGTERM and restart intent shell: bash - run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/active-container-storage.sh simplenvr-safety-test + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/acceptance/active-container-storage.sh simplenvr-safety-test - name: Runtime container SIGTERM smoke test shell: bash run: | @@ -126,7 +126,7 @@ jobs: - name: Runtime export backpressure, disconnect, SIGTERM and restart timeout-minutes: 6 shell: bash - run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/runtime-export-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-export-evidence" + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/acceptance/runtime-export-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-export-evidence" - name: Retain runtime-export evidence even on failure if: always() uses: actions/upload-artifact@v4 @@ -173,7 +173,7 @@ jobs: run: | set -euo pipefail . "$RUNNER_TEMP/simplenvr-browser-venv/bin/activate" - GITHUB_SHA="$CHECKPOINT_SHA" bash tests/runtime-browser-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-browser-evidence" + GITHUB_SHA="$CHECKPOINT_SHA" bash tests/acceptance/runtime-browser-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-browser-evidence" - name: Retain runtime-browser acceptance evidence if: always() uses: actions/upload-artifact@v4 @@ -227,7 +227,7 @@ jobs: go mod download go mod verify git diff --exit-code -- go.mod go.sum - go test -c -o "$RUNNER_TEMP/correspondence-resource.test" . + go test -c -o "$RUNNER_TEMP/correspondence-resource.test" ./cmd/simplenvr - name: Measure longer generated recordings and existing ceiling refusal timeout-minutes: 8 shell: bash @@ -238,13 +238,13 @@ jobs: git diff --exit-code -- go.mod go.sum - name: Evidence assessment regression tests if: always() - run: python3 -m unittest discover -s tests -p 'test_correspondence_assessment.py' -v + run: python3 -m unittest discover -s tests/acceptance -p 'test_correspondence_assessment.py' -v - name: Assess full adapter and native prebuffer evidence if: always() shell: bash run: | set -euo pipefail - python3 tests/correspondence_assessment.py "$RUNNER_TEMP/correspondence-resources" \ + python3 tests/acceptance/correspondence_assessment.py "$RUNNER_TEMP/correspondence-resources" \ --expected-head "$CHECKPOINT_SHA" \ --output "$RUNNER_TEMP/correspondence-resources/assessment.json" \ --summary "$RUNNER_TEMP/correspondence-resources/assessment.md" diff --git a/.gitignore b/.gitignore index 2863609..f73829f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /tmp eventburp.sh +/simplenvr +__pycache__/ diff --git a/Dockerfile b/Dockerfile index ab6bd9a..80e99e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,15 +4,15 @@ ENV GOFLAGS=-mod=readonly COPY go.mod go.sum ./ RUN sha256sum go.mod go.sum > /tmp/dependencies.sha256 && go mod download && go mod verify && sha256sum -c /tmp/dependencies.sha256 COPY . . -RUN CGO_ENABLED=0 go build -trimpath -o simplenvr . && sha256sum -c /tmp/dependencies.sha256 +RUN CGO_ENABLED=0 go build -trimpath -o simplenvr ./cmd/simplenvr && sha256sum -c /tmp/dependencies.sha256 # Runtime base pinned by digest; update deliberately and re-run Safety verification. FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf RUN apk add --no-cache ffmpeg ca-certificates && ffmpeg -hide_banner -encoders 2>/dev/null | grep -q '[[:space:]]libx264[[:space:]]' WORKDIR /app COPY --from=builder /app/simplenvr /app/simplenvr -COPY --from=builder /app/templates /app/templates -COPY --from=builder /app/static /app/static +COPY --from=builder /app/web/templates /app/web/templates +COPY --from=builder /app/web/static /app/web/static EXPOSE 443 STOPSIGNAL SIGTERM ENTRYPOINT ["/app/simplenvr"] diff --git a/README.md b/README.md index e2af9e8..acd10b3 100644 --- a/README.md +++ b/README.md @@ -6,30 +6,7 @@ SimpleNVR records RTSP cameras with FFmpeg. Use the web interface to manage came Use the image from GitHub Container Registry. The example defaults to `v0.2.2`, which includes built-in authentication and server-prepared exports. An image's release workflow must finish publishing before it can be pulled. -Save as `compose.yaml`: - -```yaml -services: - simplenvr: - image: ghcr.io/mouldybread/simplenvr:${SIMPLENVR_VERSION:-v0.2.2} - restart: unless-stopped - ports: - - "127.0.0.1:8443:443" - environment: - NVR_EXPORT_SCRATCH_DIR: /exports - volumes: - - type: bind - source: ./recordings - target: /recordings - bind: - create_host_path: false - - type: bind - source: ./exports - target: /exports - bind: - create_host_path: false - - ./certs:/certs -``` +The example Compose file is [docs/compose/compose.yaml](docs/compose/compose.yaml). Copy it into your install directory as `compose.yaml` before running the commands below, because its `./recordings`, `./exports` and `./certs` paths are relative to the Compose file. Optionally set `SIMPLENVR_VERSION` in `.env` to another published version that supports these features. Unlike the old example, this Compose file actually uses that setting. diff --git a/active_recorder_shutdown_test.go b/cmd/simplenvr/active_recorder_shutdown_test.go similarity index 100% rename from active_recorder_shutdown_test.go rename to cmd/simplenvr/active_recorder_shutdown_test.go diff --git a/auth.go b/cmd/simplenvr/auth.go similarity index 100% rename from auth.go rename to cmd/simplenvr/auth.go diff --git a/auth_session_probe_test.go b/cmd/simplenvr/auth_session_probe_test.go similarity index 100% rename from auth_session_probe_test.go rename to cmd/simplenvr/auth_session_probe_test.go diff --git a/auth_session_renewal_test.go b/cmd/simplenvr/auth_session_renewal_test.go similarity index 99% rename from auth_session_renewal_test.go rename to cmd/simplenvr/auth_session_renewal_test.go index 217d3ed..0bb2ace 100644 --- a/auth_session_renewal_test.go +++ b/cmd/simplenvr/auth_session_renewal_test.go @@ -21,7 +21,7 @@ type dashboardRoute struct { path string } -// Requests the dashboard issues, taken from static/js/*.js and the routes +// Requests the dashboard issues, taken from web/static/js/*.js and the routes // registered in main.go. /auth/session is covered by the probe tests. var dashboardRoutes = []dashboardRoute{ {"index", "GET", "/"}, diff --git a/auth_session_restart_test.go b/cmd/simplenvr/auth_session_restart_test.go similarity index 100% rename from auth_session_restart_test.go rename to cmd/simplenvr/auth_session_restart_test.go diff --git a/auth_session_timeout_test.go b/cmd/simplenvr/auth_session_timeout_test.go similarity index 100% rename from auth_session_timeout_test.go rename to cmd/simplenvr/auth_session_timeout_test.go diff --git a/auth_test.go b/cmd/simplenvr/auth_test.go similarity index 100% rename from auth_test.go rename to cmd/simplenvr/auth_test.go diff --git a/background_cleanup.go b/cmd/simplenvr/background_cleanup.go similarity index 100% rename from background_cleanup.go rename to cmd/simplenvr/background_cleanup.go diff --git a/background_cleanup_test.go b/cmd/simplenvr/background_cleanup_test.go similarity index 100% rename from background_cleanup_test.go rename to cmd/simplenvr/background_cleanup_test.go diff --git a/buffer_test.go b/cmd/simplenvr/buffer_test.go similarity index 100% rename from buffer_test.go rename to cmd/simplenvr/buffer_test.go diff --git a/camera_deletion.go b/cmd/simplenvr/camera_deletion.go similarity index 100% rename from camera_deletion.go rename to cmd/simplenvr/camera_deletion.go diff --git a/camera_deletion_batch_failure_test.go b/cmd/simplenvr/camera_deletion_batch_failure_test.go similarity index 100% rename from camera_deletion_batch_failure_test.go rename to cmd/simplenvr/camera_deletion_batch_failure_test.go diff --git a/camera_deletion_completion_integration_test.go b/cmd/simplenvr/camera_deletion_completion_integration_test.go similarity index 100% rename from camera_deletion_completion_integration_test.go rename to cmd/simplenvr/camera_deletion_completion_integration_test.go diff --git a/camera_deletion_completion_sync_test.go b/cmd/simplenvr/camera_deletion_completion_sync_test.go similarity index 100% rename from camera_deletion_completion_sync_test.go rename to cmd/simplenvr/camera_deletion_completion_sync_test.go diff --git a/camera_deletion_ownership_test.go b/cmd/simplenvr/camera_deletion_ownership_test.go similarity index 100% rename from camera_deletion_ownership_test.go rename to cmd/simplenvr/camera_deletion_ownership_test.go diff --git a/camera_deletion_parent_identity_test.go b/cmd/simplenvr/camera_deletion_parent_identity_test.go similarity index 100% rename from camera_deletion_parent_identity_test.go rename to cmd/simplenvr/camera_deletion_parent_identity_test.go diff --git a/camera_deletion_partial_sync_test.go b/cmd/simplenvr/camera_deletion_partial_sync_test.go similarity index 100% rename from camera_deletion_partial_sync_test.go rename to cmd/simplenvr/camera_deletion_partial_sync_test.go diff --git a/camera_deletion_test.go b/cmd/simplenvr/camera_deletion_test.go similarity index 100% rename from camera_deletion_test.go rename to cmd/simplenvr/camera_deletion_test.go diff --git a/camera_registration.go b/cmd/simplenvr/camera_registration.go similarity index 100% rename from camera_registration.go rename to cmd/simplenvr/camera_registration.go diff --git a/camera_registration_test.go b/cmd/simplenvr/camera_registration_test.go similarity index 100% rename from camera_registration_test.go rename to cmd/simplenvr/camera_registration_test.go diff --git a/camera_removal_confirmation_frontend_test.go b/cmd/simplenvr/camera_removal_confirmation_frontend_test.go similarity index 52% rename from camera_removal_confirmation_frontend_test.go rename to cmd/simplenvr/camera_removal_confirmation_frontend_test.go index 2dbc383..224da38 100644 --- a/camera_removal_confirmation_frontend_test.go +++ b/cmd/simplenvr/camera_removal_confirmation_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendCameraRemovalConfirmation(t *testing.T) { - runFrontendRegression(t, "tests/camera-removal-confirmation.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/camera-removal-confirmation.cjs", "UTC") } diff --git a/camera_removal_empty_state_test.go b/cmd/simplenvr/camera_removal_empty_state_test.go similarity index 96% rename from camera_removal_empty_state_test.go rename to cmd/simplenvr/camera_removal_empty_state_test.go index 6e5073e..82e256a 100644 --- a/camera_removal_empty_state_test.go +++ b/cmd/simplenvr/camera_removal_empty_state_test.go @@ -16,7 +16,7 @@ import ( // nonredirected HTTP 200 text/html fragment with no document-level tags, so the // served empty state must satisfy that contract rather than look ambiguous. func TestCameraListEmptyStateSatisfiesRemovalResponseContract(t *testing.T) { - parsed, err := template.ParseGlob("templates/*.html") + parsed, err := template.ParseGlob("web/templates/*.html") if err != nil { t.Fatal(err) } diff --git a/cleanup.go b/cmd/simplenvr/cleanup.go similarity index 100% rename from cleanup.go rename to cmd/simplenvr/cleanup.go diff --git a/cleanup_test.go b/cmd/simplenvr/cleanup_test.go similarity index 100% rename from cleanup_test.go rename to cmd/simplenvr/cleanup_test.go diff --git a/continuous_recording_health.go b/cmd/simplenvr/continuous_recording_health.go similarity index 100% rename from continuous_recording_health.go rename to cmd/simplenvr/continuous_recording_health.go diff --git a/continuous_recording_health_test.go b/cmd/simplenvr/continuous_recording_health_test.go similarity index 98% rename from continuous_recording_health_test.go rename to cmd/simplenvr/continuous_recording_health_test.go index 697f46d..770c399 100644 --- a/continuous_recording_health_test.go +++ b/cmd/simplenvr/continuous_recording_health_test.go @@ -57,7 +57,7 @@ func TestContinuousUpstreamFailureAndCameraResponse(t *testing.T) { defer func(){nvr=oldNVR;templates=oldTemplates}() nvr=&NVR{cameras:map[string]*Camera{cam.ID:cam,other.ID:other},cameraOrder:[]string{cam.ID,other.ID}} var parseErr error - templates,parseErr=template.ParseFiles("templates/cameras.html") + templates,parseErr=template.ParseFiles("web/templates/cameras.html") if parseErr!=nil {t.Fatal(parseErr)} w:=httptest.NewRecorder();camerasHandler(w,httptest.NewRequest("GET","https://nvr.test/api/cameras",nil)) if w.Code!=200 || strings.Count(w.Body.String(),`class="camera-recording-error"`)!=1 || !strings.Contains(w.Body.String(),"DESCRIBE 404") {t.Fatalf("%d %s",w.Code,w.Body.String())} @@ -150,7 +150,7 @@ func TestContinuousTimeoutOnlyReportsCaptureDeadline(t *testing.T) { } func TestRecordSegmentFreezesCaptureOutcomeBeforePublication(t *testing.T) { - raw,err:=os.ReadFile("recorder.go");if err!=nil {t.Fatal(err)} + raw,err:=os.ReadFile("cmd/simplenvr/recorder.go");if err!=nil {t.Fatal(err)} source:=string(raw) start,end:=strings.Index(source,"func recordSegment("),strings.Index(source,"func sanitizeFilename(") if start<0 || end<=start {t.Fatal("recordSegment not found")} diff --git a/deletion_day_membership_test.go b/cmd/simplenvr/deletion_day_membership_test.go similarity index 100% rename from deletion_day_membership_test.go rename to cmd/simplenvr/deletion_day_membership_test.go diff --git a/deletion_preservation_evidence_test.go b/cmd/simplenvr/deletion_preservation_evidence_test.go similarity index 100% rename from deletion_preservation_evidence_test.go rename to cmd/simplenvr/deletion_preservation_evidence_test.go diff --git a/deployment_storage_boundaries_test.go b/cmd/simplenvr/deployment_storage_boundaries_test.go similarity index 100% rename from deployment_storage_boundaries_test.go rename to cmd/simplenvr/deployment_storage_boundaries_test.go diff --git a/disk_usage.go b/cmd/simplenvr/disk_usage.go similarity index 100% rename from disk_usage.go rename to cmd/simplenvr/disk_usage.go diff --git a/disk_usage_scale_test.go b/cmd/simplenvr/disk_usage_scale_test.go similarity index 100% rename from disk_usage_scale_test.go rename to cmd/simplenvr/disk_usage_scale_test.go diff --git a/disk_usage_test.go b/cmd/simplenvr/disk_usage_test.go similarity index 100% rename from disk_usage_test.go rename to cmd/simplenvr/disk_usage_test.go diff --git a/disk_usage_tracker_test.go b/cmd/simplenvr/disk_usage_tracker_test.go similarity index 100% rename from disk_usage_tracker_test.go rename to cmd/simplenvr/disk_usage_tracker_test.go diff --git a/event_assembly_presentation.go b/cmd/simplenvr/event_assembly_presentation.go similarity index 100% rename from event_assembly_presentation.go rename to cmd/simplenvr/event_assembly_presentation.go diff --git a/event_assembly_presentation_test.go b/cmd/simplenvr/event_assembly_presentation_test.go similarity index 100% rename from event_assembly_presentation_test.go rename to cmd/simplenvr/event_assembly_presentation_test.go diff --git a/event_capture_inventory.go b/cmd/simplenvr/event_capture_inventory.go similarity index 100% rename from event_capture_inventory.go rename to cmd/simplenvr/event_capture_inventory.go diff --git a/event_capture_inventory_test.go b/cmd/simplenvr/event_capture_inventory_test.go similarity index 100% rename from event_capture_inventory_test.go rename to cmd/simplenvr/event_capture_inventory_test.go diff --git a/event_clear_confirmation_frontend_test.go b/cmd/simplenvr/event_clear_confirmation_frontend_test.go similarity index 52% rename from event_clear_confirmation_frontend_test.go rename to cmd/simplenvr/event_clear_confirmation_frontend_test.go index 3debbf5..f6ad6bd 100644 --- a/event_clear_confirmation_frontend_test.go +++ b/cmd/simplenvr/event_clear_confirmation_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendEventClearConfirmation(t *testing.T) { - runFrontendRegression(t, "tests/event-clear-confirmation.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/event-clear-confirmation.cjs", "UTC") } diff --git a/event_coarse_timeline.go b/cmd/simplenvr/event_coarse_timeline.go similarity index 100% rename from event_coarse_timeline.go rename to cmd/simplenvr/event_coarse_timeline.go diff --git a/event_coarse_timeline_test.go b/cmd/simplenvr/event_coarse_timeline_test.go similarity index 100% rename from event_coarse_timeline_test.go rename to cmd/simplenvr/event_coarse_timeline_test.go diff --git a/event_concat_plan_evidence.go b/cmd/simplenvr/event_concat_plan_evidence.go similarity index 100% rename from event_concat_plan_evidence.go rename to cmd/simplenvr/event_concat_plan_evidence.go diff --git a/event_concat_plan_evidence_test.go b/cmd/simplenvr/event_concat_plan_evidence_test.go similarity index 100% rename from event_concat_plan_evidence_test.go rename to cmd/simplenvr/event_concat_plan_evidence_test.go diff --git a/event_control_terminal_integration_test.go b/cmd/simplenvr/event_control_terminal_integration_test.go similarity index 100% rename from event_control_terminal_integration_test.go rename to cmd/simplenvr/event_control_terminal_integration_test.go diff --git a/event_correspondence_admission_batch_test.go b/cmd/simplenvr/event_correspondence_admission_batch_test.go similarity index 100% rename from event_correspondence_admission_batch_test.go rename to cmd/simplenvr/event_correspondence_admission_batch_test.go diff --git a/event_correspondence_admission_concurrent_test.go b/cmd/simplenvr/event_correspondence_admission_concurrent_test.go similarity index 100% rename from event_correspondence_admission_concurrent_test.go rename to cmd/simplenvr/event_correspondence_admission_concurrent_test.go diff --git a/event_correspondence_admission_test.go b/cmd/simplenvr/event_correspondence_admission_test.go similarity index 100% rename from event_correspondence_admission_test.go rename to cmd/simplenvr/event_correspondence_admission_test.go diff --git a/event_correspondence_bound_resource_test.go b/cmd/simplenvr/event_correspondence_bound_resource_test.go similarity index 100% rename from event_correspondence_bound_resource_test.go rename to cmd/simplenvr/event_correspondence_bound_resource_test.go diff --git a/event_correspondence_complete_interruption_test.go b/cmd/simplenvr/event_correspondence_complete_interruption_test.go similarity index 100% rename from event_correspondence_complete_interruption_test.go rename to cmd/simplenvr/event_correspondence_complete_interruption_test.go diff --git a/event_correspondence_complete_resource_test.go b/cmd/simplenvr/event_correspondence_complete_resource_test.go similarity index 100% rename from event_correspondence_complete_resource_test.go rename to cmd/simplenvr/event_correspondence_complete_resource_test.go diff --git a/event_correspondence_complete_validation_test.go b/cmd/simplenvr/event_correspondence_complete_validation_test.go similarity index 100% rename from event_correspondence_complete_validation_test.go rename to cmd/simplenvr/event_correspondence_complete_validation_test.go diff --git a/event_correspondence_missing_audio_refusal_test.go b/cmd/simplenvr/event_correspondence_missing_audio_refusal_test.go similarity index 100% rename from event_correspondence_missing_audio_refusal_test.go rename to cmd/simplenvr/event_correspondence_missing_audio_refusal_test.go diff --git a/event_correspondence_native_prebuffer_test.go b/cmd/simplenvr/event_correspondence_native_prebuffer_test.go similarity index 100% rename from event_correspondence_native_prebuffer_test.go rename to cmd/simplenvr/event_correspondence_native_prebuffer_test.go diff --git a/event_correspondence_native_tracks_test.go b/cmd/simplenvr/event_correspondence_native_tracks_test.go similarity index 100% rename from event_correspondence_native_tracks_test.go rename to cmd/simplenvr/event_correspondence_native_tracks_test.go diff --git a/event_correspondence_presentation_boundary_test.go b/cmd/simplenvr/event_correspondence_presentation_boundary_test.go similarity index 100% rename from event_correspondence_presentation_boundary_test.go rename to cmd/simplenvr/event_correspondence_presentation_boundary_test.go diff --git a/event_correspondence_probe_diagnostic_test.go b/cmd/simplenvr/event_correspondence_probe_diagnostic_test.go similarity index 100% rename from event_correspondence_probe_diagnostic_test.go rename to cmd/simplenvr/event_correspondence_probe_diagnostic_test.go diff --git a/event_correspondence_prototype_native_test.go b/cmd/simplenvr/event_correspondence_prototype_native_test.go similarity index 100% rename from event_correspondence_prototype_native_test.go rename to cmd/simplenvr/event_correspondence_prototype_native_test.go diff --git a/event_correspondence_prototype_safety_test.go b/cmd/simplenvr/event_correspondence_prototype_safety_test.go similarity index 100% rename from event_correspondence_prototype_safety_test.go rename to cmd/simplenvr/event_correspondence_prototype_safety_test.go diff --git a/event_correspondence_prototype_test.go b/cmd/simplenvr/event_correspondence_prototype_test.go similarity index 100% rename from event_correspondence_prototype_test.go rename to cmd/simplenvr/event_correspondence_prototype_test.go diff --git a/event_correspondence_prototype_unit_test.go b/cmd/simplenvr/event_correspondence_prototype_unit_test.go similarity index 100% rename from event_correspondence_prototype_unit_test.go rename to cmd/simplenvr/event_correspondence_prototype_unit_test.go diff --git a/event_correspondence_resource_test.go b/cmd/simplenvr/event_correspondence_resource_test.go similarity index 100% rename from event_correspondence_resource_test.go rename to cmd/simplenvr/event_correspondence_resource_test.go diff --git a/event_correspondence_stream_safety_test.go b/cmd/simplenvr/event_correspondence_stream_safety_test.go similarity index 100% rename from event_correspondence_stream_safety_test.go rename to cmd/simplenvr/event_correspondence_stream_safety_test.go diff --git a/event_correspondence_stream_test.go b/cmd/simplenvr/event_correspondence_stream_test.go similarity index 100% rename from event_correspondence_stream_test.go rename to cmd/simplenvr/event_correspondence_stream_test.go diff --git a/event_coverage_assessment.go b/cmd/simplenvr/event_coverage_assessment.go similarity index 100% rename from event_coverage_assessment.go rename to cmd/simplenvr/event_coverage_assessment.go diff --git a/event_coverage_assessment_test.go b/cmd/simplenvr/event_coverage_assessment_test.go similarity index 100% rename from event_coverage_assessment_test.go rename to cmd/simplenvr/event_coverage_assessment_test.go diff --git a/event_coverage_retention_test.go b/cmd/simplenvr/event_coverage_retention_test.go similarity index 100% rename from event_coverage_retention_test.go rename to cmd/simplenvr/event_coverage_retention_test.go diff --git a/event_duration_evidence.go b/cmd/simplenvr/event_duration_evidence.go similarity index 100% rename from event_duration_evidence.go rename to cmd/simplenvr/event_duration_evidence.go diff --git a/event_duration_evidence_test.go b/cmd/simplenvr/event_duration_evidence_test.go similarity index 100% rename from event_duration_evidence_test.go rename to cmd/simplenvr/event_duration_evidence_test.go diff --git a/event_duration_integration_test.go b/cmd/simplenvr/event_duration_integration_test.go similarity index 100% rename from event_duration_integration_test.go rename to cmd/simplenvr/event_duration_integration_test.go diff --git a/event_execution_provenance.go b/cmd/simplenvr/event_execution_provenance.go similarity index 100% rename from event_execution_provenance.go rename to cmd/simplenvr/event_execution_provenance.go diff --git a/event_execution_provenance_test.go b/cmd/simplenvr/event_execution_provenance_test.go similarity index 100% rename from event_execution_provenance_test.go rename to cmd/simplenvr/event_execution_provenance_test.go diff --git a/event_failure_preservation_test.go b/cmd/simplenvr/event_failure_preservation_test.go similarity index 100% rename from event_failure_preservation_test.go rename to cmd/simplenvr/event_failure_preservation_test.go diff --git a/event_job_inventory.go b/cmd/simplenvr/event_job_inventory.go similarity index 100% rename from event_job_inventory.go rename to cmd/simplenvr/event_job_inventory.go diff --git a/event_job_inventory_test.go b/cmd/simplenvr/event_job_inventory_test.go similarity index 100% rename from event_job_inventory_test.go rename to cmd/simplenvr/event_job_inventory_test.go diff --git a/event_owned_checkpoint.go b/cmd/simplenvr/event_owned_checkpoint.go similarity index 100% rename from event_owned_checkpoint.go rename to cmd/simplenvr/event_owned_checkpoint.go diff --git a/event_owned_checkpoint_test.go b/cmd/simplenvr/event_owned_checkpoint_test.go similarity index 100% rename from event_owned_checkpoint_test.go rename to cmd/simplenvr/event_owned_checkpoint_test.go diff --git a/event_presentation_evidence.go b/cmd/simplenvr/event_presentation_evidence.go similarity index 100% rename from event_presentation_evidence.go rename to cmd/simplenvr/event_presentation_evidence.go diff --git a/event_presentation_evidence_test.go b/cmd/simplenvr/event_presentation_evidence_test.go similarity index 100% rename from event_presentation_evidence_test.go rename to cmd/simplenvr/event_presentation_evidence_test.go diff --git a/event_presentation_probe_limit_test.go b/cmd/simplenvr/event_presentation_probe_limit_test.go similarity index 100% rename from event_presentation_probe_limit_test.go rename to cmd/simplenvr/event_presentation_probe_limit_test.go diff --git a/event_publication_checkpoint.go b/cmd/simplenvr/event_publication_checkpoint.go similarity index 100% rename from event_publication_checkpoint.go rename to cmd/simplenvr/event_publication_checkpoint.go diff --git a/event_publication_checkpoint_test.go b/cmd/simplenvr/event_publication_checkpoint_test.go similarity index 100% rename from event_publication_checkpoint_test.go rename to cmd/simplenvr/event_publication_checkpoint_test.go diff --git a/event_publication_day_test.go b/cmd/simplenvr/event_publication_day_test.go similarity index 100% rename from event_publication_day_test.go rename to cmd/simplenvr/event_publication_day_test.go diff --git a/event_published_output.go b/cmd/simplenvr/event_published_output.go similarity index 100% rename from event_published_output.go rename to cmd/simplenvr/event_published_output.go diff --git a/event_published_output_test.go b/cmd/simplenvr/event_published_output_test.go similarity index 100% rename from event_published_output_test.go rename to cmd/simplenvr/event_published_output_test.go diff --git a/event_recovery.go b/cmd/simplenvr/event_recovery.go similarity index 100% rename from event_recovery.go rename to cmd/simplenvr/event_recovery.go diff --git a/event_recovery_day_inspection.go b/cmd/simplenvr/event_recovery_day_inspection.go similarity index 100% rename from event_recovery_day_inspection.go rename to cmd/simplenvr/event_recovery_day_inspection.go diff --git a/event_recovery_day_inspection_test.go b/cmd/simplenvr/event_recovery_day_inspection_test.go similarity index 100% rename from event_recovery_day_inspection_test.go rename to cmd/simplenvr/event_recovery_day_inspection_test.go diff --git a/event_recovery_inspection.go b/cmd/simplenvr/event_recovery_inspection.go similarity index 100% rename from event_recovery_inspection.go rename to cmd/simplenvr/event_recovery_inspection.go diff --git a/event_recovery_inspection_test.go b/cmd/simplenvr/event_recovery_inspection_test.go similarity index 100% rename from event_recovery_inspection_test.go rename to cmd/simplenvr/event_recovery_inspection_test.go diff --git a/event_recovery_lifecycle_contract_test.go b/cmd/simplenvr/event_recovery_lifecycle_contract_test.go similarity index 100% rename from event_recovery_lifecycle_contract_test.go rename to cmd/simplenvr/event_recovery_lifecycle_contract_test.go diff --git a/event_recovery_schema_contract_test.go b/cmd/simplenvr/event_recovery_schema_contract_test.go similarity index 100% rename from event_recovery_schema_contract_test.go rename to cmd/simplenvr/event_recovery_schema_contract_test.go diff --git a/event_recovery_snapshot_contract_test.go b/cmd/simplenvr/event_recovery_snapshot_contract_test.go similarity index 100% rename from event_recovery_snapshot_contract_test.go rename to cmd/simplenvr/event_recovery_snapshot_contract_test.go diff --git a/event_recovery_status.go b/cmd/simplenvr/event_recovery_status.go similarity index 100% rename from event_recovery_status.go rename to cmd/simplenvr/event_recovery_status.go diff --git a/event_recovery_test.go b/cmd/simplenvr/event_recovery_test.go similarity index 100% rename from event_recovery_test.go rename to cmd/simplenvr/event_recovery_test.go diff --git a/event_release_day_path_test.go b/cmd/simplenvr/event_release_day_path_test.go similarity index 100% rename from event_release_day_path_test.go rename to cmd/simplenvr/event_release_day_path_test.go diff --git a/event_release_revalidation.go b/cmd/simplenvr/event_release_revalidation.go similarity index 100% rename from event_release_revalidation.go rename to cmd/simplenvr/event_release_revalidation.go diff --git a/event_release_revalidation_test.go b/cmd/simplenvr/event_release_revalidation_test.go similarity index 100% rename from event_release_revalidation_test.go rename to cmd/simplenvr/event_release_revalidation_test.go diff --git a/event_retention_test.go b/cmd/simplenvr/event_retention_test.go similarity index 100% rename from event_retention_test.go rename to cmd/simplenvr/event_retention_test.go diff --git a/event_segment_clock.go b/cmd/simplenvr/event_segment_clock.go similarity index 100% rename from event_segment_clock.go rename to cmd/simplenvr/event_segment_clock.go diff --git a/event_segment_clock_test.go b/cmd/simplenvr/event_segment_clock_test.go similarity index 100% rename from event_segment_clock_test.go rename to cmd/simplenvr/event_segment_clock_test.go diff --git a/event_selection_timing.go b/cmd/simplenvr/event_selection_timing.go similarity index 100% rename from event_selection_timing.go rename to cmd/simplenvr/event_selection_timing.go diff --git a/event_selection_timing_test.go b/cmd/simplenvr/event_selection_timing_test.go similarity index 100% rename from event_selection_timing_test.go rename to cmd/simplenvr/event_selection_timing_test.go diff --git a/event_staging.go b/cmd/simplenvr/event_staging.go similarity index 100% rename from event_staging.go rename to cmd/simplenvr/event_staging.go diff --git a/event_staging_day_count_test.go b/cmd/simplenvr/event_staging_day_count_test.go similarity index 100% rename from event_staging_day_count_test.go rename to cmd/simplenvr/event_staging_day_count_test.go diff --git a/event_staging_directory_release.go b/cmd/simplenvr/event_staging_directory_release.go similarity index 100% rename from event_staging_directory_release.go rename to cmd/simplenvr/event_staging_directory_release.go diff --git a/event_staging_directory_release_test.go b/cmd/simplenvr/event_staging_directory_release_test.go similarity index 100% rename from event_staging_directory_release_test.go rename to cmd/simplenvr/event_staging_directory_release_test.go diff --git a/event_staging_input_release.go b/cmd/simplenvr/event_staging_input_release.go similarity index 100% rename from event_staging_input_release.go rename to cmd/simplenvr/event_staging_input_release.go diff --git a/event_staging_input_release_test.go b/cmd/simplenvr/event_staging_input_release_test.go similarity index 100% rename from event_staging_input_release_test.go rename to cmd/simplenvr/event_staging_input_release_test.go diff --git a/event_staging_inventory.go b/cmd/simplenvr/event_staging_inventory.go similarity index 100% rename from event_staging_inventory.go rename to cmd/simplenvr/event_staging_inventory.go diff --git a/event_staging_inventory_test.go b/cmd/simplenvr/event_staging_inventory_test.go similarity index 100% rename from event_staging_inventory_test.go rename to cmd/simplenvr/event_staging_inventory_test.go diff --git a/event_staging_test.go b/cmd/simplenvr/event_staging_test.go similarity index 100% rename from event_staging_test.go rename to cmd/simplenvr/event_staging_test.go diff --git a/event_storage_admission_test.go b/cmd/simplenvr/event_storage_admission_test.go similarity index 100% rename from event_storage_admission_test.go rename to cmd/simplenvr/event_storage_admission_test.go diff --git a/event_storage_retry.go b/cmd/simplenvr/event_storage_retry.go similarity index 100% rename from event_storage_retry.go rename to cmd/simplenvr/event_storage_retry.go diff --git a/event_storage_retry_test.go b/cmd/simplenvr/event_storage_retry_test.go similarity index 100% rename from event_storage_retry_test.go rename to cmd/simplenvr/event_storage_retry_test.go diff --git a/event_terminal_lease_test.go b/cmd/simplenvr/event_terminal_lease_test.go similarity index 100% rename from event_terminal_lease_test.go rename to cmd/simplenvr/event_terminal_lease_test.go diff --git a/event_terminal_retention_integration_test.go b/cmd/simplenvr/event_terminal_retention_integration_test.go similarity index 100% rename from event_terminal_retention_integration_test.go rename to cmd/simplenvr/event_terminal_retention_integration_test.go diff --git a/event_video_continuity.go b/cmd/simplenvr/event_video_continuity.go similarity index 100% rename from event_video_continuity.go rename to cmd/simplenvr/event_video_continuity.go diff --git a/event_video_continuity_test.go b/cmd/simplenvr/event_video_continuity_test.go similarity index 100% rename from event_video_continuity_test.go rename to cmd/simplenvr/event_video_continuity_test.go diff --git a/event_video_presentation_json.go b/cmd/simplenvr/event_video_presentation_json.go similarity index 100% rename from event_video_presentation_json.go rename to cmd/simplenvr/event_video_presentation_json.go diff --git a/event_video_presentation_json_test.go b/cmd/simplenvr/event_video_presentation_json_test.go similarity index 100% rename from event_video_presentation_json_test.go rename to cmd/simplenvr/event_video_presentation_json_test.go diff --git a/event_video_presentation_probe.go b/cmd/simplenvr/event_video_presentation_probe.go similarity index 100% rename from event_video_presentation_probe.go rename to cmd/simplenvr/event_video_presentation_probe.go diff --git a/event_video_presentation_probe_test.go b/cmd/simplenvr/event_video_presentation_probe_test.go similarity index 100% rename from event_video_presentation_probe_test.go rename to cmd/simplenvr/event_video_presentation_probe_test.go diff --git a/events.go b/cmd/simplenvr/events.go similarity index 100% rename from events.go rename to cmd/simplenvr/events.go diff --git a/export_copy_extension.go b/cmd/simplenvr/export_copy_extension.go similarity index 100% rename from export_copy_extension.go rename to cmd/simplenvr/export_copy_extension.go diff --git a/export_copy_extension_test.go b/cmd/simplenvr/export_copy_extension_test.go similarity index 100% rename from export_copy_extension_test.go rename to cmd/simplenvr/export_copy_extension_test.go diff --git a/export_copy_join_test.go b/cmd/simplenvr/export_copy_join_test.go similarity index 100% rename from export_copy_join_test.go rename to cmd/simplenvr/export_copy_join_test.go diff --git a/export_copy_outpoint_test.go b/cmd/simplenvr/export_copy_outpoint_test.go similarity index 100% rename from export_copy_outpoint_test.go rename to cmd/simplenvr/export_copy_outpoint_test.go diff --git a/export_copy_packets_test.go b/cmd/simplenvr/export_copy_packets_test.go similarity index 100% rename from export_copy_packets_test.go rename to cmd/simplenvr/export_copy_packets_test.go diff --git a/export_copy_timestamps_test.go b/cmd/simplenvr/export_copy_timestamps_test.go similarity index 100% rename from export_copy_timestamps_test.go rename to cmd/simplenvr/export_copy_timestamps_test.go diff --git a/export_default_limits_test.go b/cmd/simplenvr/export_default_limits_test.go similarity index 100% rename from export_default_limits_test.go rename to cmd/simplenvr/export_default_limits_test.go diff --git a/export_estimate.go b/cmd/simplenvr/export_estimate.go similarity index 100% rename from export_estimate.go rename to cmd/simplenvr/export_estimate.go diff --git a/export_estimate_test.go b/cmd/simplenvr/export_estimate_test.go similarity index 100% rename from export_estimate_test.go rename to cmd/simplenvr/export_estimate_test.go diff --git a/export_http.go b/cmd/simplenvr/export_http.go similarity index 100% rename from export_http.go rename to cmd/simplenvr/export_http.go diff --git a/export_http_test.go b/cmd/simplenvr/export_http_test.go similarity index 100% rename from export_http_test.go rename to cmd/simplenvr/export_http_test.go diff --git a/export_inputs.go b/cmd/simplenvr/export_inputs.go similarity index 100% rename from export_inputs.go rename to cmd/simplenvr/export_inputs.go diff --git a/export_inputs_test.go b/cmd/simplenvr/export_inputs_test.go similarity index 100% rename from export_inputs_test.go rename to cmd/simplenvr/export_inputs_test.go diff --git a/export_jobs.go b/cmd/simplenvr/export_jobs.go similarity index 100% rename from export_jobs.go rename to cmd/simplenvr/export_jobs.go diff --git a/export_jobs_test.go b/cmd/simplenvr/export_jobs_test.go similarity index 100% rename from export_jobs_test.go rename to cmd/simplenvr/export_jobs_test.go diff --git a/export_keyframes.go b/cmd/simplenvr/export_keyframes.go similarity index 100% rename from export_keyframes.go rename to cmd/simplenvr/export_keyframes.go diff --git a/export_keyframes_native_test.go b/cmd/simplenvr/export_keyframes_native_test.go similarity index 100% rename from export_keyframes_native_test.go rename to cmd/simplenvr/export_keyframes_native_test.go diff --git a/export_keyframes_test.go b/cmd/simplenvr/export_keyframes_test.go similarity index 100% rename from export_keyframes_test.go rename to cmd/simplenvr/export_keyframes_test.go diff --git a/export_media.go b/cmd/simplenvr/export_media.go similarity index 100% rename from export_media.go rename to cmd/simplenvr/export_media.go diff --git a/export_media_test.go b/cmd/simplenvr/export_media_test.go similarity index 100% rename from export_media_test.go rename to cmd/simplenvr/export_media_test.go diff --git a/export_mode_ui_test.go b/cmd/simplenvr/export_mode_ui_test.go similarity index 57% rename from export_mode_ui_test.go rename to cmd/simplenvr/export_mode_ui_test.go index e5117cd..f961a6a 100644 --- a/export_mode_ui_test.go +++ b/cmd/simplenvr/export_mode_ui_test.go @@ -4,6 +4,6 @@ import "testing" func TestPreparedExportModeUI(t *testing.T) { for _,zone:=range []string{"UTC","America/Chicago"} { - t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/export-mode-ui.cjs",zone)}) + t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/frontend/export-mode-ui.cjs",zone)}) } } diff --git a/export_nal_length.go b/cmd/simplenvr/export_nal_length.go similarity index 100% rename from export_nal_length.go rename to cmd/simplenvr/export_nal_length.go diff --git a/export_nal_length_test.go b/cmd/simplenvr/export_nal_length_test.go similarity index 100% rename from export_nal_length_test.go rename to cmd/simplenvr/export_nal_length_test.go diff --git a/export_network_test.go b/cmd/simplenvr/export_network_test.go similarity index 100% rename from export_network_test.go rename to cmd/simplenvr/export_network_test.go diff --git a/export_phase_cancellation_test.go b/cmd/simplenvr/export_phase_cancellation_test.go similarity index 100% rename from export_phase_cancellation_test.go rename to cmd/simplenvr/export_phase_cancellation_test.go diff --git a/export_plan.go b/cmd/simplenvr/export_plan.go similarity index 100% rename from export_plan.go rename to cmd/simplenvr/export_plan.go diff --git a/export_plan_test.go b/cmd/simplenvr/export_plan_test.go similarity index 100% rename from export_plan_test.go rename to cmd/simplenvr/export_plan_test.go diff --git a/export_probe.go b/cmd/simplenvr/export_probe.go similarity index 100% rename from export_probe.go rename to cmd/simplenvr/export_probe.go diff --git a/export_probe_admission.go b/cmd/simplenvr/export_probe_admission.go similarity index 100% rename from export_probe_admission.go rename to cmd/simplenvr/export_probe_admission.go diff --git a/export_queue_details_frontend_test.go b/cmd/simplenvr/export_queue_details_frontend_test.go similarity index 57% rename from export_queue_details_frontend_test.go rename to cmd/simplenvr/export_queue_details_frontend_test.go index 59839a4..abbda5d 100644 --- a/export_queue_details_frontend_test.go +++ b/cmd/simplenvr/export_queue_details_frontend_test.go @@ -4,6 +4,6 @@ import "testing" func TestPreparedExportQueueDetailsUI(t *testing.T) { for _,zone:=range []string{"UTC","America/Chicago"} { - t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/export-queue-details.cjs",zone)}) + t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/frontend/export-queue-details.cjs",zone)}) } } diff --git a/export_queue_http_test.go b/cmd/simplenvr/export_queue_http_test.go similarity index 100% rename from export_queue_http_test.go rename to cmd/simplenvr/export_queue_http_test.go diff --git a/export_queue_test.go b/cmd/simplenvr/export_queue_test.go similarity index 100% rename from export_queue_test.go rename to cmd/simplenvr/export_queue_test.go diff --git a/export_range_controls_frontend_test.go b/cmd/simplenvr/export_range_controls_frontend_test.go similarity index 57% rename from export_range_controls_frontend_test.go rename to cmd/simplenvr/export_range_controls_frontend_test.go index 4a535c7..4372262 100644 --- a/export_range_controls_frontend_test.go +++ b/cmd/simplenvr/export_range_controls_frontend_test.go @@ -4,6 +4,6 @@ import "testing" func TestExportRangeControlsFrontend(t *testing.T) { for _,zone:=range []string{"UTC","America/Chicago"} { - t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/export-range-controls.cjs",zone)}) + t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/frontend/export-range-controls.cjs",zone)}) } } diff --git a/export_render_cancellation_test.go b/cmd/simplenvr/export_render_cancellation_test.go similarity index 100% rename from export_render_cancellation_test.go rename to cmd/simplenvr/export_render_cancellation_test.go diff --git a/export_stamped_selection_test.go b/cmd/simplenvr/export_stamped_selection_test.go similarity index 100% rename from export_stamped_selection_test.go rename to cmd/simplenvr/export_stamped_selection_test.go diff --git a/export_trim.go b/cmd/simplenvr/export_trim.go similarity index 100% rename from export_trim.go rename to cmd/simplenvr/export_trim.go diff --git a/export_trim_test.go b/cmd/simplenvr/export_trim_test.go similarity index 100% rename from export_trim_test.go rename to cmd/simplenvr/export_trim_test.go diff --git a/export_visibility_test.go b/cmd/simplenvr/export_visibility_test.go similarity index 100% rename from export_visibility_test.go rename to cmd/simplenvr/export_visibility_test.go diff --git a/first_run_setup.go b/cmd/simplenvr/first_run_setup.go similarity index 100% rename from first_run_setup.go rename to cmd/simplenvr/first_run_setup.go diff --git a/first_run_setup_test.go b/cmd/simplenvr/first_run_setup_test.go similarity index 100% rename from first_run_setup_test.go rename to cmd/simplenvr/first_run_setup_test.go diff --git a/frontend_security_test.go b/cmd/simplenvr/frontend_security_test.go similarity index 82% rename from frontend_security_test.go rename to cmd/simplenvr/frontend_security_test.go index 9041aeb..862eb54 100644 --- a/frontend_security_test.go +++ b/cmd/simplenvr/frontend_security_test.go @@ -22,10 +22,10 @@ func runFrontendRegression(t *testing.T,script,zone string) { if err!=nil {t.Fatalf("frontend regressions failed (%s, %s): %v\n%s",script,zone,err,output)} } -func TestFrontendEventRendering(t *testing.T) {runFrontendRegression(t,"tests/event-rendering.cjs","UTC")} -func TestFrontendExportUI(t *testing.T) {runFrontendRegression(t,"tests/export-ui.cjs","UTC")} +func TestFrontendEventRendering(t *testing.T) {runFrontendRegression(t,"tests/frontend/event-rendering.cjs","UTC")} +func TestFrontendExportUI(t *testing.T) {runFrontendRegression(t,"tests/frontend/export-ui.cjs","UTC")} func TestFrontendEventNavigation(t *testing.T) { for _,zone:=range []string{"UTC","Asia/Hong_Kong","America/Chicago"} { - t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/event-navigation.cjs",zone)}) + t.Run(zone,func(t *testing.T){runFrontendRegression(t,"tests/frontend/event-navigation.cjs",zone)}) } } diff --git a/go2rtc_scan.go b/cmd/simplenvr/go2rtc_scan.go similarity index 100% rename from go2rtc_scan.go rename to cmd/simplenvr/go2rtc_scan.go diff --git a/go2rtc_scan_test.go b/cmd/simplenvr/go2rtc_scan_test.go similarity index 100% rename from go2rtc_scan_test.go rename to cmd/simplenvr/go2rtc_scan_test.go diff --git a/handlers.go b/cmd/simplenvr/handlers.go similarity index 100% rename from handlers.go rename to cmd/simplenvr/handlers.go diff --git a/http_jobs_test.go b/cmd/simplenvr/http_jobs_test.go similarity index 100% rename from http_jobs_test.go rename to cmd/simplenvr/http_jobs_test.go diff --git a/legacy_download_test.go b/cmd/simplenvr/legacy_download_test.go similarity index 68% rename from legacy_download_test.go rename to cmd/simplenvr/legacy_download_test.go index 21c6aea..5974e13 100644 --- a/legacy_download_test.go +++ b/cmd/simplenvr/legacy_download_test.go @@ -11,7 +11,7 @@ import ( func TestNoLegacyDownloadCallsInAssets(t *testing.T) { legacy:=regexp.MustCompile(`\bfunction\s+startDownload\b|\bstartDownload\s*\(|=\s*startDownload\b|\b(?:window|globalThis)\s*(?:\.\s*startDownload\b|\[\s*['"]startDownload['"]\s*\])`) - for _,root:=range []string{"static","templates"} { + for _,root:=range []string{"web/static","web/templates"} { err:=filepath.WalkDir(root,func(path string,entry fs.DirEntry,walkErr error) error { if walkErr!=nil {return walkErr} if entry.IsDir() {return nil} @@ -23,10 +23,10 @@ func TestNoLegacyDownloadCallsInAssets(t *testing.T) { }) if err!=nil {t.Fatal(err)} } - playback,err:=func()([]byte,error){var all []byte;for _,p:=range []string{"static/js/playback-state.js","static/js/playback-camera-date.js","static/js/playback-timeline-load.js","static/js/playback-canvas.js","static/js/playback-seek-session.js","static/js/playback-video-controls.js"}{b,e:=os.ReadFile(p);if e!=nil{return nil,e};all=append(all,b...)};return all,nil}();if err!=nil {t.Fatal(err)} + playback,err:=func()([]byte,error){var all []byte;for _,p:=range []string{"web/static/js/playback-state.js","web/static/js/playback-camera-date.js","web/static/js/playback-timeline-load.js","web/static/js/playback-canvas.js","web/static/js/playback-seek-session.js","web/static/js/playback-video-controls.js"}{b,e:=os.ReadFile(p);if e!=nil{return nil,e};all=append(all,b...)};return all,nil}();if err!=nil {t.Fatal(err)} if bytes.Contains(playback,[]byte("/api/download")) {t.Fatal("playback module must not retain a direct export-request path")} - page,err:=os.ReadFile("templates/index.html");if err!=nil {t.Fatal(err)} + page,err:=os.ReadFile("web/templates/index.html");if err!=nil {t.Fatal(err)} if !bytes.Contains(page,[]byte(`onclick="startExportDownloads()"`)) {t.Fatal("monitored export entry point is not wired to the page")} } -func TestFrontendDownloadEntryPoints(t *testing.T) {runFrontendRegression(t,"tests/download-entrypoints.cjs","UTC")} +func TestFrontendDownloadEntryPoints(t *testing.T) {runFrontendRegression(t,"tests/frontend/download-entrypoints.cjs","UTC")} diff --git a/lifecycle.go b/cmd/simplenvr/lifecycle.go similarity index 100% rename from lifecycle.go rename to cmd/simplenvr/lifecycle.go diff --git a/lifecycle_test.go b/cmd/simplenvr/lifecycle_test.go similarity index 100% rename from lifecycle_test.go rename to cmd/simplenvr/lifecycle_test.go diff --git a/live_proxy.go b/cmd/simplenvr/live_proxy.go similarity index 100% rename from live_proxy.go rename to cmd/simplenvr/live_proxy.go diff --git a/live_proxy_test.go b/cmd/simplenvr/live_proxy_test.go similarity index 100% rename from live_proxy_test.go rename to cmd/simplenvr/live_proxy_test.go diff --git a/live_stream_names_frontend_test.go b/cmd/simplenvr/live_stream_names_frontend_test.go similarity index 53% rename from live_stream_names_frontend_test.go rename to cmd/simplenvr/live_stream_names_frontend_test.go index 7aefbbf..c67298b 100644 --- a/live_stream_names_frontend_test.go +++ b/cmd/simplenvr/live_stream_names_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendLiveStreamNames(t *testing.T) { - runFrontendRegression(t, "tests/live-stream-names.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/live-stream-names.cjs", "UTC") } diff --git a/login_page.go b/cmd/simplenvr/login_page.go similarity index 100% rename from login_page.go rename to cmd/simplenvr/login_page.go diff --git a/login_page_test.go b/cmd/simplenvr/login_page_test.go similarity index 100% rename from login_page_test.go rename to cmd/simplenvr/login_page_test.go diff --git a/main.go b/cmd/simplenvr/main.go similarity index 98% rename from main.go rename to cmd/simplenvr/main.go index c2353b0..ae1b76b 100644 --- a/main.go +++ b/cmd/simplenvr/main.go @@ -103,7 +103,7 @@ func main() { // Saving new session settings asks for the same graceful shutdown as SIGTERM; // the container's restart policy then starts the process again. auth.restart=stopSignals - templates,err=template.ParseGlob("templates/*.html");if err!=nil {log.Fatal("Failed to load templates: ",err)} + templates,err=template.ParseGlob("web/templates/*.html");if err!=nil {log.Fatal("Failed to load templates: ",err)} if err=nvr.load();err!=nil {log.Fatal("Refusing startup with invalid camera configuration: ",err)} log.Printf("Loaded %d cameras from disk",len(nvr.cameras)) recoverBeforeStartup(appCtx,nvr) @@ -138,7 +138,7 @@ func main() { http.HandleFunc("/api/events/clear-all",clearAllEventsHandler) http.HandleFunc("/api/events/clear-camera",clearCameraEventsHandler) http.HandleFunc("/api/recordings/cleanup-orphaned",cleanupOrphanedRecordingsHandler) - http.Handle("/static/",http.StripPrefix("/static/",http.FileServer(http.Dir("static")))) + http.Handle("/static/",http.StripPrefix("/static/",http.FileServer(http.Dir("web/static")))) http.HandleFunc("/",indexHandler) gate:=newShutdownGate(themedLoginPage(auth.Handler(exports.Handler(http.DefaultServeMux)))) gate.startBackgroundJob(exports.runLifecycle) diff --git a/media_mutation_ownership.go b/cmd/simplenvr/media_mutation_ownership.go similarity index 100% rename from media_mutation_ownership.go rename to cmd/simplenvr/media_mutation_ownership.go diff --git a/media_mutation_ownership_test.go b/cmd/simplenvr/media_mutation_ownership_test.go similarity index 100% rename from media_mutation_ownership_test.go rename to cmd/simplenvr/media_mutation_ownership_test.go diff --git a/media_process.go b/cmd/simplenvr/media_process.go similarity index 100% rename from media_process.go rename to cmd/simplenvr/media_process.go diff --git a/media_process_test.go b/cmd/simplenvr/media_process_test.go similarity index 100% rename from media_process_test.go rename to cmd/simplenvr/media_process_test.go diff --git a/orphan_cleanup.go b/cmd/simplenvr/orphan_cleanup.go similarity index 100% rename from orphan_cleanup.go rename to cmd/simplenvr/orphan_cleanup.go diff --git a/orphan_cleanup_budget.go b/cmd/simplenvr/orphan_cleanup_budget.go similarity index 100% rename from orphan_cleanup_budget.go rename to cmd/simplenvr/orphan_cleanup_budget.go diff --git a/orphan_cleanup_budget_test.go b/cmd/simplenvr/orphan_cleanup_budget_test.go similarity index 100% rename from orphan_cleanup_budget_test.go rename to cmd/simplenvr/orphan_cleanup_budget_test.go diff --git a/orphan_cleanup_days.go b/cmd/simplenvr/orphan_cleanup_days.go similarity index 100% rename from orphan_cleanup_days.go rename to cmd/simplenvr/orphan_cleanup_days.go diff --git a/orphan_cleanup_reporting_frontend_test.go b/cmd/simplenvr/orphan_cleanup_reporting_frontend_test.go similarity index 52% rename from orphan_cleanup_reporting_frontend_test.go rename to cmd/simplenvr/orphan_cleanup_reporting_frontend_test.go index 08c925a..be3ce15 100644 --- a/orphan_cleanup_reporting_frontend_test.go +++ b/cmd/simplenvr/orphan_cleanup_reporting_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendOrphanCleanupReporting(t *testing.T) { - runFrontendRegression(t, "tests/orphan-cleanup-reporting.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/orphan-cleanup-reporting.cjs", "UTC") } diff --git a/orphan_cleanup_test.go b/cmd/simplenvr/orphan_cleanup_test.go similarity index 100% rename from orphan_cleanup_test.go rename to cmd/simplenvr/orphan_cleanup_test.go diff --git a/orphan_day_recheck_test.go b/cmd/simplenvr/orphan_day_recheck_test.go similarity index 100% rename from orphan_day_recheck_test.go rename to cmd/simplenvr/orphan_day_recheck_test.go diff --git a/persistence.go b/cmd/simplenvr/persistence.go similarity index 100% rename from persistence.go rename to cmd/simplenvr/persistence.go diff --git a/persistence_primary_type_test.go b/cmd/simplenvr/persistence_primary_type_test.go similarity index 100% rename from persistence_primary_type_test.go rename to cmd/simplenvr/persistence_primary_type_test.go diff --git a/persistence_read.go b/cmd/simplenvr/persistence_read.go similarity index 100% rename from persistence_read.go rename to cmd/simplenvr/persistence_read.go diff --git a/persistence_recovery_entries_test.go b/cmd/simplenvr/persistence_recovery_entries_test.go similarity index 100% rename from persistence_recovery_entries_test.go rename to cmd/simplenvr/persistence_recovery_entries_test.go diff --git a/persistence_responses_frontend_test.go b/cmd/simplenvr/persistence_responses_frontend_test.go similarity index 53% rename from persistence_responses_frontend_test.go rename to cmd/simplenvr/persistence_responses_frontend_test.go index b9e91d8..2507c36 100644 --- a/persistence_responses_frontend_test.go +++ b/cmd/simplenvr/persistence_responses_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendPersistenceResponses(t *testing.T) { - runFrontendRegression(t, "tests/persistence-responses.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/persistence-responses.cjs", "UTC") } diff --git a/persistence_save_recovery_test.go b/cmd/simplenvr/persistence_save_recovery_test.go similarity index 100% rename from persistence_save_recovery_test.go rename to cmd/simplenvr/persistence_save_recovery_test.go diff --git a/persistence_save_replacement_test.go b/cmd/simplenvr/persistence_save_replacement_test.go similarity index 100% rename from persistence_save_replacement_test.go rename to cmd/simplenvr/persistence_save_replacement_test.go diff --git a/persistence_test.go b/cmd/simplenvr/persistence_test.go similarity index 100% rename from persistence_test.go rename to cmd/simplenvr/persistence_test.go diff --git a/persistence_write.go b/cmd/simplenvr/persistence_write.go similarity index 100% rename from persistence_write.go rename to cmd/simplenvr/persistence_write.go diff --git a/persistence_write_failure_test.go b/cmd/simplenvr/persistence_write_failure_test.go similarity index 100% rename from persistence_write_failure_test.go rename to cmd/simplenvr/persistence_write_failure_test.go diff --git a/playback.go b/cmd/simplenvr/playback.go similarity index 100% rename from playback.go rename to cmd/simplenvr/playback.go diff --git a/playback_continuation_frontend_test.go b/cmd/simplenvr/playback_continuation_frontend_test.go similarity index 72% rename from playback_continuation_frontend_test.go rename to cmd/simplenvr/playback_continuation_frontend_test.go index 7556711..8f2567e 100644 --- a/playback_continuation_frontend_test.go +++ b/cmd/simplenvr/playback_continuation_frontend_test.go @@ -5,7 +5,7 @@ import "testing" func TestFrontendPlaybackContinuation(t *testing.T) { for _, zone := range []string{"UTC", "Asia/Hong_Kong", "America/Chicago"} { t.Run(zone, func(t *testing.T) { - runFrontendRegression(t, "tests/playback-continuation.cjs", zone) + runFrontendRegression(t, "tests/frontend/playback-continuation.cjs", zone) }) } } diff --git a/cmd/simplenvr/playback_controls_frontend_test.go b/cmd/simplenvr/playback_controls_frontend_test.go new file mode 100644 index 0000000..b1e2344 --- /dev/null +++ b/cmd/simplenvr/playback_controls_frontend_test.go @@ -0,0 +1,8 @@ +package main + +import "testing" + +func TestFrontendPlaybackControls(t *testing.T) { + runFrontendRegression(t, "tests/frontend/playback-controls.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/playback-controls.cjs", "America/Chicago") +} diff --git a/cmd/simplenvr/playback_failures_frontend_test.go b/cmd/simplenvr/playback_failures_frontend_test.go new file mode 100644 index 0000000..01d9a20 --- /dev/null +++ b/cmd/simplenvr/playback_failures_frontend_test.go @@ -0,0 +1,8 @@ +package main + +import "testing" + +func TestFrontendPlaybackFailures(t *testing.T) { + runFrontendRegression(t, "tests/frontend/playback-failures.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/playback-failures.cjs", "America/Chicago") +} diff --git a/playback_lifecycle_frontend_test.go b/cmd/simplenvr/playback_lifecycle_frontend_test.go similarity index 53% rename from playback_lifecycle_frontend_test.go rename to cmd/simplenvr/playback_lifecycle_frontend_test.go index 4ae4b9c..f914025 100644 --- a/playback_lifecycle_frontend_test.go +++ b/cmd/simplenvr/playback_lifecycle_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendPlaybackLifecycle(t *testing.T) { - runFrontendRegression(t, "tests/playback-lifecycle.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/playback-lifecycle.cjs", "UTC") } diff --git a/prebuffer_preservation.go b/cmd/simplenvr/prebuffer_preservation.go similarity index 100% rename from prebuffer_preservation.go rename to cmd/simplenvr/prebuffer_preservation.go diff --git a/prebuffer_preservation_test.go b/cmd/simplenvr/prebuffer_preservation_test.go similarity index 100% rename from prebuffer_preservation_test.go rename to cmd/simplenvr/prebuffer_preservation_test.go diff --git a/private_media.go b/cmd/simplenvr/private_media.go similarity index 100% rename from private_media.go rename to cmd/simplenvr/private_media.go diff --git a/private_media_day_test.go b/cmd/simplenvr/private_media_day_test.go similarity index 100% rename from private_media_day_test.go rename to cmd/simplenvr/private_media_day_test.go diff --git a/private_media_test.go b/cmd/simplenvr/private_media_test.go similarity index 100% rename from private_media_test.go rename to cmd/simplenvr/private_media_test.go diff --git a/publication_ownership_test.go b/cmd/simplenvr/publication_ownership_test.go similarity index 100% rename from publication_ownership_test.go rename to cmd/simplenvr/publication_ownership_test.go diff --git a/published_deletion_admission.go b/cmd/simplenvr/published_deletion_admission.go similarity index 100% rename from published_deletion_admission.go rename to cmd/simplenvr/published_deletion_admission.go diff --git a/published_deletion_admission_test.go b/cmd/simplenvr/published_deletion_admission_test.go similarity index 100% rename from published_deletion_admission_test.go rename to cmd/simplenvr/published_deletion_admission_test.go diff --git a/published_deletion_engine.go b/cmd/simplenvr/published_deletion_engine.go similarity index 100% rename from published_deletion_engine.go rename to cmd/simplenvr/published_deletion_engine.go diff --git a/published_deletion_engine_test.go b/cmd/simplenvr/published_deletion_engine_test.go similarity index 100% rename from published_deletion_engine_test.go rename to cmd/simplenvr/published_deletion_engine_test.go diff --git a/published_deletion_work.go b/cmd/simplenvr/published_deletion_work.go similarity index 100% rename from published_deletion_work.go rename to cmd/simplenvr/published_deletion_work.go diff --git a/recorder.go b/cmd/simplenvr/recorder.go similarity index 100% rename from recorder.go rename to cmd/simplenvr/recorder.go diff --git a/recording_control_persistence.go b/cmd/simplenvr/recording_control_persistence.go similarity index 100% rename from recording_control_persistence.go rename to cmd/simplenvr/recording_control_persistence.go diff --git a/recording_control_persistence_test.go b/cmd/simplenvr/recording_control_persistence_test.go similarity index 100% rename from recording_control_persistence_test.go rename to cmd/simplenvr/recording_control_persistence_test.go diff --git a/recording_deletion.go b/cmd/simplenvr/recording_deletion.go similarity index 100% rename from recording_deletion.go rename to cmd/simplenvr/recording_deletion.go diff --git a/recording_deletion_confirmation_frontend_test.go b/cmd/simplenvr/recording_deletion_confirmation_frontend_test.go similarity index 52% rename from recording_deletion_confirmation_frontend_test.go rename to cmd/simplenvr/recording_deletion_confirmation_frontend_test.go index d8ee2a9..e942e92 100644 --- a/recording_deletion_confirmation_frontend_test.go +++ b/cmd/simplenvr/recording_deletion_confirmation_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendRecordingDeletionConfirmation(t *testing.T) { - runFrontendRegression(t, "tests/recording-deletion-confirmation.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/recording-deletion-confirmation.cjs", "UTC") } diff --git a/recording_durability_test.go b/cmd/simplenvr/recording_durability_test.go similarity index 100% rename from recording_durability_test.go rename to cmd/simplenvr/recording_durability_test.go diff --git a/recording_intent_status_test.go b/cmd/simplenvr/recording_intent_status_test.go similarity index 96% rename from recording_intent_status_test.go rename to cmd/simplenvr/recording_intent_status_test.go index 36dffa4..47caf57 100644 --- a/recording_intent_status_test.go +++ b/cmd/simplenvr/recording_intent_status_test.go @@ -8,7 +8,7 @@ import ( ) func TestCameraTemplateRecordingStatus(t *testing.T) { - tmpl,err:=template.ParseFiles("templates/cameras.html") + tmpl,err:=template.ParseFiles("web/templates/cameras.html") if err!=nil {t.Fatal(err)} failure:=continuousRecordingNotice{Code:"upstream_rtsp_unavailable",Message:"Could not open upstream stream",Detail:"DESCRIBE 404",PublicationMessage:"Check recording storage",Retrying:true} notRetrying:=failure;notRetrying.Retrying=false @@ -59,7 +59,7 @@ func TestCameraTemplateRecordingStatus(t *testing.T) { } func TestCameraTemplateRecordingRecoveryAndEscaping(t *testing.T) { - tmpl,err:=template.ParseFiles("templates/cameras.html");if err!=nil {t.Fatal(err)} + tmpl,err:=template.ParseFiles("web/templates/cameras.html");if err!=nil {t.Fatal(err)} view:=map[string]interface{}{ "ID":"test","Name":"Test camera","RTSPUrl":"","RecordDir":"/recordings/test","DiskUsage":"0 B", "IsRecording":true,"RecordingMode":ModeContinuous,"ModeDisplay":"Continuous","RetentionDisplay":7, diff --git a/recording_intervals.go b/cmd/simplenvr/recording_intervals.go similarity index 100% rename from recording_intervals.go rename to cmd/simplenvr/recording_intervals.go diff --git a/recording_intervals_test.go b/cmd/simplenvr/recording_intervals_test.go similarity index 100% rename from recording_intervals_test.go rename to cmd/simplenvr/recording_intervals_test.go diff --git a/recording_list_retired_test.go b/cmd/simplenvr/recording_list_retired_test.go similarity index 100% rename from recording_list_retired_test.go rename to cmd/simplenvr/recording_list_retired_test.go diff --git a/recording_publication.go b/cmd/simplenvr/recording_publication.go similarity index 100% rename from recording_publication.go rename to cmd/simplenvr/recording_publication.go diff --git a/recording_publication_parent_revalidation_test.go b/cmd/simplenvr/recording_publication_parent_revalidation_test.go similarity index 100% rename from recording_publication_parent_revalidation_test.go rename to cmd/simplenvr/recording_publication_parent_revalidation_test.go diff --git a/recording_publication_test.go b/cmd/simplenvr/recording_publication_test.go similarity index 100% rename from recording_publication_test.go rename to cmd/simplenvr/recording_publication_test.go diff --git a/recording_stamp.go b/cmd/simplenvr/recording_stamp.go similarity index 100% rename from recording_stamp.go rename to cmd/simplenvr/recording_stamp.go diff --git a/recording_stamp_failclosed_test.go b/cmd/simplenvr/recording_stamp_failclosed_test.go similarity index 100% rename from recording_stamp_failclosed_test.go rename to cmd/simplenvr/recording_stamp_failclosed_test.go diff --git a/recording_stamp_producers_test.go b/cmd/simplenvr/recording_stamp_producers_test.go similarity index 100% rename from recording_stamp_producers_test.go rename to cmd/simplenvr/recording_stamp_producers_test.go diff --git a/recording_stamp_publish.go b/cmd/simplenvr/recording_stamp_publish.go similarity index 100% rename from recording_stamp_publish.go rename to cmd/simplenvr/recording_stamp_publish.go diff --git a/recording_stamp_publish_test.go b/cmd/simplenvr/recording_stamp_publish_test.go similarity index 100% rename from recording_stamp_publish_test.go rename to cmd/simplenvr/recording_stamp_publish_test.go diff --git a/recording_stamp_recovery.go b/cmd/simplenvr/recording_stamp_recovery.go similarity index 100% rename from recording_stamp_recovery.go rename to cmd/simplenvr/recording_stamp_recovery.go diff --git a/recording_stamp_recovery_test.go b/cmd/simplenvr/recording_stamp_recovery_test.go similarity index 100% rename from recording_stamp_recovery_test.go rename to cmd/simplenvr/recording_stamp_recovery_test.go diff --git a/recording_stamp_review_test.go b/cmd/simplenvr/recording_stamp_review_test.go similarity index 100% rename from recording_stamp_review_test.go rename to cmd/simplenvr/recording_stamp_review_test.go diff --git a/recording_stamp_scale_test.go b/cmd/simplenvr/recording_stamp_scale_test.go similarity index 100% rename from recording_stamp_scale_test.go rename to cmd/simplenvr/recording_stamp_scale_test.go diff --git a/recording_stamp_scan.go b/cmd/simplenvr/recording_stamp_scan.go similarity index 100% rename from recording_stamp_scan.go rename to cmd/simplenvr/recording_stamp_scan.go diff --git a/recording_stamp_scan_test.go b/cmd/simplenvr/recording_stamp_scan_test.go similarity index 100% rename from recording_stamp_scan_test.go rename to cmd/simplenvr/recording_stamp_scan_test.go diff --git a/recording_stamp_test.go b/cmd/simplenvr/recording_stamp_test.go similarity index 100% rename from recording_stamp_test.go rename to cmd/simplenvr/recording_stamp_test.go diff --git a/registry_io_boundaries_test.go b/cmd/simplenvr/registry_io_boundaries_test.go similarity index 100% rename from registry_io_boundaries_test.go rename to cmd/simplenvr/registry_io_boundaries_test.go diff --git a/retention_day_folders_test.go b/cmd/simplenvr/retention_day_folders_test.go similarity index 100% rename from retention_day_folders_test.go rename to cmd/simplenvr/retention_day_folders_test.go diff --git a/retention_day_selection_test.go b/cmd/simplenvr/retention_day_selection_test.go similarity index 100% rename from retention_day_selection_test.go rename to cmd/simplenvr/retention_day_selection_test.go diff --git a/retention_deletion_engine.go b/cmd/simplenvr/retention_deletion_engine.go similarity index 100% rename from retention_deletion_engine.go rename to cmd/simplenvr/retention_deletion_engine.go diff --git a/retention_deletion_engine_test.go b/cmd/simplenvr/retention_deletion_engine_test.go similarity index 100% rename from retention_deletion_engine_test.go rename to cmd/simplenvr/retention_deletion_engine_test.go diff --git a/retention_policy.go b/cmd/simplenvr/retention_policy.go similarity index 100% rename from retention_policy.go rename to cmd/simplenvr/retention_policy.go diff --git a/retention_policy_test.go b/cmd/simplenvr/retention_policy_test.go similarity index 100% rename from retention_policy_test.go rename to cmd/simplenvr/retention_policy_test.go diff --git a/retention_publication_serialization_test.go b/cmd/simplenvr/retention_publication_serialization_test.go similarity index 100% rename from retention_publication_serialization_test.go rename to cmd/simplenvr/retention_publication_serialization_test.go diff --git a/retention_scale_evidence_test.go b/cmd/simplenvr/retention_scale_evidence_test.go similarity index 100% rename from retention_scale_evidence_test.go rename to cmd/simplenvr/retention_scale_evidence_test.go diff --git a/retention_snapshot.go b/cmd/simplenvr/retention_snapshot.go similarity index 100% rename from retention_snapshot.go rename to cmd/simplenvr/retention_snapshot.go diff --git a/retention_snapshot_test.go b/cmd/simplenvr/retention_snapshot_test.go similarity index 100% rename from retention_snapshot_test.go rename to cmd/simplenvr/retention_snapshot_test.go diff --git a/retention_wiring_bounds_test.go b/cmd/simplenvr/retention_wiring_bounds_test.go similarity index 100% rename from retention_wiring_bounds_test.go rename to cmd/simplenvr/retention_wiring_bounds_test.go diff --git a/runtime_storage_failure_test.go b/cmd/simplenvr/runtime_storage_failure_test.go similarity index 100% rename from runtime_storage_failure_test.go rename to cmd/simplenvr/runtime_storage_failure_test.go diff --git a/session_expiry_frontend_test.go b/cmd/simplenvr/session_expiry_frontend_test.go similarity index 53% rename from session_expiry_frontend_test.go rename to cmd/simplenvr/session_expiry_frontend_test.go index ecdbe3c..09d70fd 100644 --- a/session_expiry_frontend_test.go +++ b/cmd/simplenvr/session_expiry_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendSessionExpiry(t *testing.T) { - runFrontendRegression(t, "tests/session-expiry.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/session-expiry.cjs", "UTC") } diff --git a/shutdown.go b/cmd/simplenvr/shutdown.go similarity index 100% rename from shutdown.go rename to cmd/simplenvr/shutdown.go diff --git a/shutdown_completion.go b/cmd/simplenvr/shutdown_completion.go similarity index 100% rename from shutdown_completion.go rename to cmd/simplenvr/shutdown_completion.go diff --git a/shutdown_storage_boundaries_test.go b/cmd/simplenvr/shutdown_storage_boundaries_test.go similarity index 100% rename from shutdown_storage_boundaries_test.go rename to cmd/simplenvr/shutdown_storage_boundaries_test.go diff --git a/shutdown_test.go b/cmd/simplenvr/shutdown_test.go similarity index 100% rename from shutdown_test.go rename to cmd/simplenvr/shutdown_test.go diff --git a/storage_admission.go b/cmd/simplenvr/storage_admission.go similarity index 100% rename from storage_admission.go rename to cmd/simplenvr/storage_admission.go diff --git a/storage_admission_test.go b/cmd/simplenvr/storage_admission_test.go similarity index 100% rename from storage_admission_test.go rename to cmd/simplenvr/storage_admission_test.go diff --git a/storage_failure_integration_test.go b/cmd/simplenvr/storage_failure_integration_test.go similarity index 100% rename from storage_failure_integration_test.go rename to cmd/simplenvr/storage_failure_integration_test.go diff --git a/storage_status.go b/cmd/simplenvr/storage_status.go similarity index 100% rename from storage_status.go rename to cmd/simplenvr/storage_status.go diff --git a/storage_status_test.go b/cmd/simplenvr/storage_status_test.go similarity index 100% rename from storage_status_test.go rename to cmd/simplenvr/storage_status_test.go diff --git a/cmd/simplenvr/testmain_test.go b/cmd/simplenvr/testmain_test.go new file mode 100644 index 0000000..409554c --- /dev/null +++ b/cmd/simplenvr/testmain_test.go @@ -0,0 +1,37 @@ +package main + +import ( + "fmt" + "os" + "path/filepath" + "testing" +) + +// TestMain runs every test from the repository root, so the repository-relative +// paths the tests use (web/, tests/, ...) keep resolving after the Go sources +// moved to cmd/simplenvr. It finds the root by walking up to go.mod. When the +// process is not inside the repository (for example a helper process that a +// test starts in a private fixture directory), the working directory is left +// unchanged. +func TestMain(m *testing.M) { + dir, err := os.Getwd() + if err != nil { + fmt.Fprintln(os.Stderr, "TestMain: getwd:", err) + os.Exit(2) + } + for { + if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { + if err := os.Chdir(dir); err != nil { + fmt.Fprintln(os.Stderr, "TestMain: chdir:", err) + os.Exit(2) + } + break + } + parent := filepath.Dir(dir) + if parent == dir { + break + } + dir = parent + } + os.Exit(m.Run()) +} diff --git a/timeline_camera_filter_frontend_test.go b/cmd/simplenvr/timeline_camera_filter_frontend_test.go similarity index 53% rename from timeline_camera_filter_frontend_test.go rename to cmd/simplenvr/timeline_camera_filter_frontend_test.go index 0e9c57d..d699a4e 100644 --- a/timeline_camera_filter_frontend_test.go +++ b/cmd/simplenvr/timeline_camera_filter_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendTimelineCameraFilter(t *testing.T) { - runFrontendRegression(t, "tests/timeline-camera-filter.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/timeline-camera-filter.cjs", "UTC") } diff --git a/timeline_canvas_frontend_test.go b/cmd/simplenvr/timeline_canvas_frontend_test.go similarity index 73% rename from timeline_canvas_frontend_test.go rename to cmd/simplenvr/timeline_canvas_frontend_test.go index 3bd8cc9..03ac785 100644 --- a/timeline_canvas_frontend_test.go +++ b/cmd/simplenvr/timeline_canvas_frontend_test.go @@ -5,7 +5,7 @@ import "testing" func TestFrontendTimelineCanvas(t *testing.T) { for _, zone := range []string{"UTC", "Asia/Hong_Kong", "America/Chicago"} { t.Run(zone, func(t *testing.T) { - runFrontendRegression(t, "tests/timeline-canvas.cjs", zone) + runFrontendRegression(t, "tests/frontend/timeline-canvas.cjs", zone) }) } } diff --git a/timeline_geometry_frontend_test.go b/cmd/simplenvr/timeline_geometry_frontend_test.go similarity index 73% rename from timeline_geometry_frontend_test.go rename to cmd/simplenvr/timeline_geometry_frontend_test.go index fbb0713..1912218 100644 --- a/timeline_geometry_frontend_test.go +++ b/cmd/simplenvr/timeline_geometry_frontend_test.go @@ -5,7 +5,7 @@ import "testing" func TestFrontendTimelineGeometry(t *testing.T) { for _, zone := range []string{"UTC", "Asia/Hong_Kong", "America/Chicago"} { t.Run(zone, func(t *testing.T) { - runFrontendRegression(t, "tests/timeline-geometry.cjs", zone) + runFrontendRegression(t, "tests/frontend/timeline-geometry.cjs", zone) }) } } diff --git a/timeline_window.go b/cmd/simplenvr/timeline_window.go similarity index 100% rename from timeline_window.go rename to cmd/simplenvr/timeline_window.go diff --git a/timeline_window_test.go b/cmd/simplenvr/timeline_window_test.go similarity index 100% rename from timeline_window_test.go rename to cmd/simplenvr/timeline_window_test.go diff --git a/toast_text_frontend_test.go b/cmd/simplenvr/toast_text_frontend_test.go similarity index 53% rename from toast_text_frontend_test.go rename to cmd/simplenvr/toast_text_frontend_test.go index c82d309..086e38d 100644 --- a/toast_text_frontend_test.go +++ b/cmd/simplenvr/toast_text_frontend_test.go @@ -3,5 +3,5 @@ package main import "testing" func TestFrontendToastText(t *testing.T) { - runFrontendRegression(t, "tests/toast-text.cjs", "UTC") + runFrontendRegression(t, "tests/frontend/toast-text.cjs", "UTC") } diff --git a/docs/PREPARED_EXPORT_VERIFICATION.md b/docs/PREPARED_EXPORT_VERIFICATION.md index 1c83f5a..6ecee31 100644 --- a/docs/PREPARED_EXPORT_VERIFICATION.md +++ b/docs/PREPARED_EXPORT_VERIFICATION.md @@ -41,4 +41,4 @@ Passing synthetic acceptance is not production-camera, full-resolution, multi-Gi The live browser fixture has a single camera, so queuing several cameras from the UI in one request and the 8-camera client limit are covered by the Node UI tests, not by live Chrome. The server's capacity limit is exercised live through the API, with several jobs for the same camera. -The older routed-response harness `tests/browser-export-acceptance.py` has been removed. It targeted the retired direct-download flow and was not run by any workflow. The live-runtime entrypoint is `tests/runtime-browser-acceptance.py`, invoked through the expanded playback runner. +The older routed-response harness `tests/browser-export-acceptance.py` has been removed. It targeted the retired direct-download flow and was not run by any workflow. The live-runtime entrypoint is `tests/acceptance/runtime-browser-acceptance.py`, invoked through the expanded playback runner. diff --git a/docs/RECORDING_LAYOUT.md b/docs/RECORDING_LAYOUT.md index 80ac9f8..d1c7a90 100644 --- a/docs/RECORDING_LAYOUT.md +++ b/docs/RECORDING_LAYOUT.md @@ -27,7 +27,7 @@ Duplicates are deduplicated, an unknown ID returns 404, and an empty ID returns 400. Omitting `camera_id` scans all registered cameras. The playback page sends one `camera_id` for each camera selected for playback and makes no request when none is selected, so a problem in one camera's files does not affect another camera's view. -It does this from `static/js/timeline-camera-filter.js`, a small script that wraps +It does this from `web/static/js/timeline-camera-filter.js`, a small script that wraps the page's timeline request, because `playback.js` itself is unchanged. A recording overlaps the window exactly when `start < windowEnd` and diff --git a/docs/REPOSITORY_LAYOUT.md b/docs/REPOSITORY_LAYOUT.md new file mode 100644 index 0000000..ada9812 --- /dev/null +++ b/docs/REPOSITORY_LAYOUT.md @@ -0,0 +1,47 @@ +# Repository layout (issue #16) + +Status: complete. This page describes the final layout and the move inventory. + +## Layout + +- `cmd/simplenvr/` - all Go sources and Go tests (`package main`, unchanged), plus `testmain_test.go` +- `web/templates/`, `web/static/` - HTML templates and static assets +- `tests/frontend/` - Node (`*.cjs`) frontend suites +- `tests/acceptance/` - Python helpers and their unit tests, and the shell acceptance scripts +- `tests/fixtures/`, `tests/evidence/` - unchanged +- `docs/` - documentation; `docs/compose/compose.yaml` holds the Compose example +- `.github/` - workflows and scripts (unchanged location) +- Root: `go.mod`, `go.sum`, `Dockerfile`, `Dockerfile.dev`, `.air.toml`, `README.md`, `LICENSE.md`, `DISCLAIMER.md`, `.gitignore` + +Decisions: all Go files move to `cmd/simplenvr/`; `Dockerfile` stays at the root so `docker build .` and the publish workflow work unchanged; `LICENSE.md` and `DISCLAIMER.md` stay at the root; Compose examples live in `docs/`. `Dockerfile.dev` and `.air.toml` also stay at the root (they were proposed for `build/` only alongside the Dockerfile). The test scripts are grouped into `tests/frontend/` and `tests/acceptance/` rather than the originally proposed `runtime/` and `ci/` split. + +The package is not split into `internal/` packages: about 300 files share unexported symbols, so that would be a behavior refactor, not a move. + +## Old to new + +| Old | New | +|---|---| +| `*.go`, `*_test.go` (root) | `cmd/simplenvr/` | +| `templates/` | `web/templates/` | +| `static/` | `web/static/` | +| `tests/*.cjs` | `tests/frontend/` | +| `tests/*.py`, `tests/*.sh` | `tests/acceptance/` | +| `tests/fixtures`, `tests/evidence` | unchanged | +| Compose example in `README.md` | `docs/compose/compose.yaml` | + +Files were moved with `git mv`, so history follows them (`git log --follow`). + +## Runtime paths + +- The binary still loads `web/templates/*.html` and serves `web/static` relative to the working directory, so run it from the repository root: `go run ./cmd/simplenvr`. +- In the container image the layout is `/app/web/templates` and `/app/web/static` with `WORKDIR /app`. +- `/recordings`, `/certs` and the `/static/` URL route are unchanged. + +## Development + +- Build: `go build ./cmd/simplenvr` +- Test: `go vet ./... && go test -race ./...` (tests run from the repository root via `cmd/simplenvr/testmain_test.go`) +- Python acceptance unit tests: `python3 -m unittest discover -s tests/acceptance` +- Docker: `docker build .` + +CI triggers, job names, required checks and test assertions are unchanged. See `docs/CHECKPOINT_CI.md` for the `run-checkpoint-ci` label flow; every new head needs its own run. diff --git a/docs/STORAGE_DEPLOYMENT_BOUNDARIES.md b/docs/STORAGE_DEPLOYMENT_BOUNDARIES.md index dbe0210..d0c7573 100644 --- a/docs/STORAGE_DEPLOYMENT_BOUNDARIES.md +++ b/docs/STORAGE_DEPLOYMENT_BOUNDARIES.md @@ -35,13 +35,13 @@ These are required restrictions for the proposed supported profile, not claims o The opt-in Go test is skipped unless SIMPLENVR_DEPLOYMENT_TEST_ROOT names a real scratch parent on the intended filesystem. Example, using an operator-owned directory on that filesystem: - SIMPLENVR_DEPLOYMENT_TEST_ROOT=/operator-supplied/scratch go test -count=1 -v -run '^TestDeploymentFilesystemCompatibility$' . + SIMPLENVR_DEPLOYMENT_TEST_ROOT=/operator-supplied/scratch go test -count=1 -v -run '^TestDeploymentFilesystemCompatibility$' ./cmd/simplenvr It creates only a uniquely named synthetic scratch directory, then removes that test directory. It does not inspect or delete existing recordings. It checks actual no-replace rename/collision preservation, reopening an original inode through procfs after pathname replacement, and the application's publication boundary with an accepting synthetic probe. Save the exact commit, runtime/kernel/filesystem context and DEPLOYMENT_FILESYSTEM_COMPATIBILITY log. Run under the intended permissions and container procfs policy. This is not a media-decode, power-loss, fsync-durability or lost-mount test. ## Active runtime-container CI fixture -The added CI step builds on the unchanged runtime Dockerfile and runs tests/active-container-storage.sh against that exact CI-built image. It requires active continuous and event-buffer FFmpeg processes, continuous output bytes and at least two prebuffer segments before SIGTERM. It checks clean container exit, persisted restart intent for both cameras, a new nonempty published partial per stop, transient-buffer cleanup and byte-identical synthetic retained event inputs/checkpoints. It repeats start/stop in the same container to exercise persisted restart intent. +The added CI step builds on the unchanged runtime Dockerfile and runs tests/acceptance/active-container-storage.sh against that exact CI-built image. It requires active continuous and event-buffer FFmpeg processes, continuous output bytes and at least two prebuffer segments before SIGTERM. It checks clean container exit, persisted restart intent for both cameras, a new nonempty published partial per stop, transient-buffer cleanup and byte-identical synthetic retained event inputs/checkpoints. It repeats start/stop in the same container to exercise persisted restart intent. The fixture uses the real application, Alpine runtime and real FFmpeg, a read-only root, writable recordings/certs/tmp mounts, dropped capabilities except NET_BIND_SERVICE, no-new-privileges and no networking. A wrapper replaces RTSP input with a paced looping synthetic file. It does not validate Dahua RTSP disconnect/reconnect, queued event capture/assembly in the runtime image, authenticated export traffic, genuine browser behavior, physical storage or production mount-loss handling. It checks published partial presence, not complete footage. Synthetic fixture directories are removed by the test; production evidence is never touched. Existing empty-camera SIGTERM smoke and all prior media/storage tests remain enabled. diff --git a/docs/audit/AUDIT_EVIDENCE_ADDENDUM_2026-11-16.md b/docs/audit/AUDIT_EVIDENCE_ADDENDUM_2026-11-16.md index 2b17534..a2a3cad 100644 --- a/docs/audit/AUDIT_EVIDENCE_ADDENDUM_2026-11-16.md +++ b/docs/audit/AUDIT_EVIDENCE_ADDENDUM_2026-11-16.md @@ -37,7 +37,7 @@ CSRF proof, cross-tab idempotency, or deletion permission. ## Failed runtime-export campaign at 926dd03 The user-provided output identifies the command as -`bash tests/runtime-export-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-export-evidence"`. +`bash tests/acceptance/runtime-export-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-export-evidence"`. | Campaign case | Reported state | | --- | --- | diff --git a/docs/audit/EVENT_CORRESPONDENCE_EVIDENCE_ASSESSMENT.md b/docs/audit/EVENT_CORRESPONDENCE_EVIDENCE_ASSESSMENT.md index 7539aa6..71ab5a1 100644 --- a/docs/audit/EVENT_CORRESPONDENCE_EVIDENCE_ASSESSMENT.md +++ b/docs/audit/EVENT_CORRESPONDENCE_EVIDENCE_ASSESSMENT.md @@ -17,7 +17,7 @@ tail-latency claims. Background lifetime CPU is separate; zero kernel block operations do not prove zero logical reads. No host threshold is invented. Usage: -python3 tests/correspondence_assessment.py EXTRACTED_ARTIFACT_DIRECTORY \ +python3 tests/acceptance/correspondence_assessment.py EXTRACTED_ARTIFACT_DIRECTORY \ --expected-head FULL_COMMIT_SHA --output assessment.json --summary assessment.md The workflow runs regression tests and assessment after resource collection, diff --git a/docs/audit/EVENT_NVR_INGESTION_POLICY.md b/docs/audit/EVENT_NVR_INGESTION_POLICY.md index 5d3e924..9e2027f 100644 --- a/docs/audit/EVENT_NVR_INGESTION_POLICY.md +++ b/docs/audit/EVENT_NVR_INGESTION_POLICY.md @@ -51,7 +51,7 @@ or deployment is included. Run manually with stock ffmpeg/ffprobe and libx264/AAC available: - python3 tests/qualify_ingestion_time.py ingestion-qualification.json + python3 tests/acceptance/qualify_ingestion_time.py ingestion-qualification.json This developer tool generates three seconds of H.264 B-frames and AAC and sends it over loopback UDP/MPEG-TS with deliberately non-UTC source timestamps. It compares diff --git a/docs/audit/EXPORT_UI.md b/docs/audit/EXPORT_UI.md index cb0737c..0801b5f 100644 --- a/docs/audit/EXPORT_UI.md +++ b/docs/audit/EXPORT_UI.md @@ -24,4 +24,4 @@ Server reason codes (output_limit, estimate_exceeded, deadline_exceeded, empty_o ## Tests and limits -Node tests (tests/export-ui.cjs, tests/export-mode-ui.cjs, tests/export-range-controls.cjs, tests/export-queue-details.cjs, tests/download-entrypoints.cjs) exercise the real module with a stub DOM, the real timeline geometry helper and stubbed fetch/streams. They are not browser tests. tests/runtime-browser-acceptance.py drives the panel in Chrome against a container in CI, including the queue list and its download link, Clear all, the range handles with a real mouse and keyboard, and the server's capacity limit. Browser download restrictions, filesystem failures and media completeness of saved files remain unverified. Real-browser/authenticated export integration, storage-failure validation and final whole-branch review remain required under AUDIT_ACCEPTANCE.md. +Node tests (tests/frontend/export-ui.cjs, tests/frontend/export-mode-ui.cjs, tests/frontend/export-range-controls.cjs, tests/frontend/export-queue-details.cjs, tests/frontend/download-entrypoints.cjs) exercise the real module with a stub DOM, the real timeline geometry helper and stubbed fetch/streams. They are not browser tests. tests/acceptance/runtime-browser-acceptance.py drives the panel in Chrome against a container in CI, including the queue list and its download link, Clear all, the range handles with a real mouse and keyboard, and the server's capacity limit. Browser download restrictions, filesystem failures and media completeness of saved files remain unverified. Real-browser/authenticated export integration, storage-failure validation and final whole-branch review remain required under AUDIT_ACCEPTANCE.md. diff --git a/docs/audit/RECOVERY_MANIFEST_CONTRACT_ACCEPTANCE.md b/docs/audit/RECOVERY_MANIFEST_CONTRACT_ACCEPTANCE.md index b17ffdc..1263ecf 100644 --- a/docs/audit/RECOVERY_MANIFEST_CONTRACT_ACCEPTANCE.md +++ b/docs/audit/RECOVERY_MANIFEST_CONTRACT_ACCEPTANCE.md @@ -85,7 +85,7 @@ no identity on error, camera binding, no positive diagnostic authority and stabl canonical marshal/parse/marshal. Ordinary required Go test discovery executes the seed corpus; it is NOT an extended fuzz campaign. Optional separately reviewed run: -go test -run '^$' -fuzz '^FuzzRecoveryContractStrictManifest$' -fuzztime=20s -parallel=2 -timeout=45s . +go test -run '^$' -fuzz '^FuzzRecoveryContractStrictManifest$' -fuzztime=20s -parallel=2 -timeout=45s ./cmd/simplenvr ## Evidence and limitations diff --git a/docs/audit/RUNTIME_BROWSER_ACCEPTANCE.md b/docs/audit/RUNTIME_BROWSER_ACCEPTANCE.md index badc0b3..ce9c2e8 100644 --- a/docs/audit/RUNTIME_BROWSER_ACCEPTANCE.md +++ b/docs/audit/RUNTIME_BROWSER_ACCEPTANCE.md @@ -34,7 +34,7 @@ CI uploads the commit/image/browser report, saved synthetic whole-copy and trim For an explicit local run with Docker, the image, Python Playwright/Chromium and host FFmpeg installed: - bash tests/runtime-browser-acceptance.sh IMAGE EVIDENCE_DIRECTORY + bash tests/acceptance/runtime-browser-acceptance.sh IMAGE EVIDENCE_DIRECTORY The driver generates and cleans its own application state. It does not run against an arbitrary existing production server. It requires sudo for synthetic container-owned state cleanup. Do not point its fixture storage at deployment evidence. diff --git a/docs/audit/RUNTIME_EXPORT_BACKPRESSURE_ACCEPTANCE.md b/docs/audit/RUNTIME_EXPORT_BACKPRESSURE_ACCEPTANCE.md index a149c9d..e633452 100644 --- a/docs/audit/RUNTIME_EXPORT_BACKPRESSURE_ACCEPTANCE.md +++ b/docs/audit/RUNTIME_EXPORT_BACKPRESSURE_ACCEPTANCE.md @@ -7,11 +7,11 @@ defect is claimed and no production implementation is changed. ## Integrated batch -- tests/runtime-export-acceptance.sh owns an isolated synthetic state directory, +- tests/acceptance/runtime-export-acceptance.sh owns an isolated synthetic state directory, fixture generator, password initializer and hardened runtime container. -- tests/runtime_export_acceptance.py exercises authenticated real HTTPS exports, +- tests/acceptance/runtime_export_acceptance.py exercises authenticated real HTTPS exports, bounded ownership observations, disconnect, SIGTERM, persistence and restart. -- tests/test_runtime_export_acceptance.py contains 22 tooling regression methods. +- tests/acceptance/test_runtime_export_acceptance.py contains 22 tooling regression methods. - .github/workflows/safety-ci.yml runs the campaign as a mandatory core step after the existing recording/restart and SIGTERM smoke checks, then retains evidence with always(). The existing aggregate requires core. Both isolated Chrome diff --git a/docs/compose/compose.yaml b/docs/compose/compose.yaml new file mode 100644 index 0000000..a9eb6a2 --- /dev/null +++ b/docs/compose/compose.yaml @@ -0,0 +1,20 @@ +services: + simplenvr: + image: ghcr.io/mouldybread/simplenvr:${SIMPLENVR_VERSION:-v0.2.2} + restart: unless-stopped + ports: + - "127.0.0.1:8443:443" + environment: + NVR_EXPORT_SCRATCH_DIR: /exports + volumes: + - type: bind + source: ./recordings + target: /recordings + bind: + create_host_path: false + - type: bind + source: ./exports + target: /exports + bind: + create_host_path: false + - ./certs:/certs diff --git a/playback_controls_frontend_test.go b/playback_controls_frontend_test.go deleted file mode 100644 index 6e21d25..0000000 --- a/playback_controls_frontend_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -import "testing" - -func TestFrontendPlaybackControls(t *testing.T) { - runFrontendRegression(t, "tests/playback-controls.cjs", "UTC") - runFrontendRegression(t, "tests/playback-controls.cjs", "America/Chicago") -} diff --git a/playback_failures_frontend_test.go b/playback_failures_frontend_test.go deleted file mode 100644 index 74be9f0..0000000 --- a/playback_failures_frontend_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -import "testing" - -func TestFrontendPlaybackFailures(t *testing.T) { - runFrontendRegression(t, "tests/playback-failures.cjs", "UTC") - runFrontendRegression(t, "tests/playback-failures.cjs", "America/Chicago") -} diff --git a/tests/active-container-storage.sh b/tests/acceptance/active-container-storage.sh similarity index 98% rename from tests/active-container-storage.sh rename to tests/acceptance/active-container-storage.sh index 0de96fe..0a97c99 100644 --- a/tests/active-container-storage.sh +++ b/tests/acceptance/active-container-storage.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -image=${1:?usage: bash tests/active-container-storage.sh IMAGE} +image=${1:?usage: bash tests/acceptance/active-container-storage.sh IMAGE} work=$(mktemp -d "${RUNNER_TEMP:-/tmp}/simplenvr-active-container.XXXXXX") state=$work/state fixture=$work/fixture diff --git a/tests/browser_ci_diagnostics.py b/tests/acceptance/browser_ci_diagnostics.py similarity index 100% rename from tests/browser_ci_diagnostics.py rename to tests/acceptance/browser_ci_diagnostics.py diff --git a/tests/browser_network_ready.py b/tests/acceptance/browser_network_ready.py similarity index 100% rename from tests/browser_network_ready.py rename to tests/acceptance/browser_network_ready.py diff --git a/tests/browser_playback_control.py b/tests/acceptance/browser_playback_control.py similarity index 100% rename from tests/browser_playback_control.py rename to tests/acceptance/browser_playback_control.py diff --git a/tests/browser_playback_edges.py b/tests/acceptance/browser_playback_edges.py similarity index 100% rename from tests/browser_playback_edges.py rename to tests/acceptance/browser_playback_edges.py diff --git a/tests/browser_playback_transport.py b/tests/acceptance/browser_playback_transport.py similarity index 100% rename from tests/browser_playback_transport.py rename to tests/acceptance/browser_playback_transport.py diff --git a/tests/capture-copy-media.py b/tests/acceptance/capture-copy-media.py similarity index 100% rename from tests/capture-copy-media.py rename to tests/acceptance/capture-copy-media.py diff --git a/tests/core-ci-evidence.sh b/tests/acceptance/core-ci-evidence.sh similarity index 93% rename from tests/core-ci-evidence.sh rename to tests/acceptance/core-ci-evidence.sh index d2599c9..971861a 100644 --- a/tests/core-ci-evidence.sh +++ b/tests/acceptance/core-ci-evidence.sh @@ -5,10 +5,10 @@ mkdir -p "$evidence" evidence=$(cd "$evidence" && pwd) head=$(git rev-parse HEAD) expected_head=${GITHUB_SHA:?GitHub head required} -package=$(go list .) +package=$(go list ./cmd/simplenvr) media="$evidence/bframe-media" mkdir -p "$media/bin" -helper=$(pwd)/tests/capture-copy-media.py +helper=$(pwd)/tests/acceptance/capture-copy-media.py for tool in ffmpeg ffprobe; do printf '#!/bin/sh\nexec python3 "$SIMPLENVR_CAPTURE_HELPER" %s "$@"\n' "$tool" > "$media/bin/$tool" chmod 700 "$media/bin/$tool" @@ -47,7 +47,7 @@ with open(path,'w') as f: 'runtime_qualified':False,'cleanup_authorized':False},f,indent=2) f.write('\n') PY -python3 tests/core_ci_evidence.py "$evidence" --expected-head "$expected_head" +python3 tests/acceptance/core_ci_evidence.py "$evidence" --expected-head "$expected_head" test "$test_exit" -eq 0 test "$tee_exit" -eq 0 test "${focused_statuses[0]}" -eq 0 diff --git a/tests/core_ci_evidence.py b/tests/acceptance/core_ci_evidence.py similarity index 100% rename from tests/core_ci_evidence.py rename to tests/acceptance/core_ci_evidence.py diff --git a/tests/correspondence_assessment.py b/tests/acceptance/correspondence_assessment.py similarity index 100% rename from tests/correspondence_assessment.py rename to tests/acceptance/correspondence_assessment.py diff --git a/tests/prepared_export_protocol.py b/tests/acceptance/prepared_export_protocol.py similarity index 100% rename from tests/prepared_export_protocol.py rename to tests/acceptance/prepared_export_protocol.py diff --git a/tests/qualify_ingestion_time.py b/tests/acceptance/qualify_ingestion_time.py similarity index 98% rename from tests/qualify_ingestion_time.py rename to tests/acceptance/qualify_ingestion_time.py index 95e8b10..cc47575 100644 --- a/tests/qualify_ingestion_time.py +++ b/tests/acceptance/qualify_ingestion_time.py @@ -2,7 +2,7 @@ """Offline qualification of a CANDIDATE, not production ingestion-time support. Requires stock ffmpeg/ffprobe, libx264 and AAC. Uses generated media, temporary -files and loopback UDP only. Run: python3 tests/qualify_ingestion_time.py report.json +files and loopback UDP only. Run: python3 tests/acceptance/qualify_ingestion_time.py report.json Exit 0 means this limited fixture passed, 1 means candidate unqualified, 2 means infrastructure/fixture failure. None of these outcomes certifies RTSP or coverage. """ diff --git a/tests/runtime-browser-acceptance.py b/tests/acceptance/runtime-browser-acceptance.py similarity index 100% rename from tests/runtime-browser-acceptance.py rename to tests/acceptance/runtime-browser-acceptance.py diff --git a/tests/runtime-browser-acceptance.sh b/tests/acceptance/runtime-browser-acceptance.sh similarity index 92% rename from tests/runtime-browser-acceptance.sh rename to tests/acceptance/runtime-browser-acceptance.sh index d530cd7..b976b1d 100644 --- a/tests/runtime-browser-acceptance.sh +++ b/tests/acceptance/runtime-browser-acceptance.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -image=${1:?usage: bash tests/runtime-browser-acceptance.sh IMAGE EVIDENCE_DIR} +image=${1:?usage: bash tests/acceptance/runtime-browser-acceptance.sh IMAGE EVIDENCE_DIR} evidence=${2:?evidence directory required} work=$(mktemp -d "${RUNNER_TEMP:-/tmp}/simplenvr-runtime-browser.XXXXXX") state=$work/state @@ -16,7 +16,7 @@ cleanup() { sudo rm -rf -- "$work" } trap cleanup EXIT -timeout --kill-after=2 20 python3 -m unittest discover -s tests -p 'test_browser_playback*.py' -v \ +timeout --kill-after=2 20 python3 -m unittest discover -s tests/acceptance -p 'test_browser_playback*.py' -v \ 2>&1 | tee "$evidence/playback-edge-unit-tests.log" # Deterministic non-reordered video exercises the supported subsection-copy path. # The Go suite separately retains reordered-video refusal and accurate rendering. @@ -74,9 +74,9 @@ port=$(docker inspect -f '{{(index (index .NetworkSettings.Ports "443/tcp") 0).H image_id=$(docker image inspect -f '{{.Id}}' "$image") host_ifindex=$(docker exec "$name" cat /sys/class/net/eth0/iflink) [[ "$host_ifindex" =~ ^[1-9][0-9]*$ ]] -timeout --kill-after=10 340 python3 tests/browser_network_ready.py \ +timeout --kill-after=10 340 python3 tests/acceptance/browser_network_ready.py \ --ifindex "$host_ifindex" --evidence "$evidence" -- \ - python3 tests/runtime-browser-expanded.py \ + python3 tests/acceptance/runtime-browser-expanded.py \ --origin "https://127.0.0.1:$port" --container "$name" \ --commit "${GITHUB_SHA:-$(git rev-parse HEAD)}" --image-id "$image_id" --evidence "$evidence" docker stop --timeout 75 "$name" >/dev/null diff --git a/tests/runtime-browser-expanded.py b/tests/acceptance/runtime-browser-expanded.py similarity index 100% rename from tests/runtime-browser-expanded.py rename to tests/acceptance/runtime-browser-expanded.py diff --git a/tests/runtime-export-acceptance.sh b/tests/acceptance/runtime-export-acceptance.sh similarity index 92% rename from tests/runtime-export-acceptance.sh rename to tests/acceptance/runtime-export-acceptance.sh index 210ea5c..c721349 100644 --- a/tests/runtime-export-acceptance.sh +++ b/tests/acceptance/runtime-export-acceptance.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -image=${1:?usage: bash tests/runtime-export-acceptance.sh IMAGE EVIDENCE_DIR} +image=${1:?usage: bash tests/acceptance/runtime-export-acceptance.sh IMAGE EVIDENCE_DIR} evidence=${2:?evidence directory required} work=$(mktemp -d "${RUNNER_TEMP:-/tmp}/simplenvr-runtime-export.XXXXXX") state=$work/state @@ -12,7 +12,7 @@ cleanup() { status=$? cleanup_failed=0 # Keep safe failure facts visible before disposable fixture teardown. - timeout --kill-after=2 5 python3 tests/runtime_export_diagnostics.py \ + timeout --kill-after=2 5 python3 tests/acceptance/runtime_export_diagnostics.py \ "$evidence/runtime-export-report.json" | tee "$evidence/runtime-export-console-summary.json" || cleanup_failed=1 # No raw auth/proc/network captures. Keep a bounded completion-marker count # even when the campaign fails before it can finish its JSON report. @@ -37,7 +37,7 @@ PY exit "$status" } trap cleanup EXIT -timeout --kill-after=2 20 python3 -m unittest discover -s tests -p 'test_runtime_export*.py' -v \ +timeout --kill-after=2 20 python3 -m unittest discover -s tests/acceptance -p 'test_runtime_export*.py' -v \ 2>&1 | tee "$evidence/runtime-export-tooling-tests.log" # Deliberately complex, bounded, video-only input. Generate with the exact # runtime image, before applying the pacing shim to application exports. @@ -77,7 +77,7 @@ docker run -d --name "$name" --label simplenvr.safety.fixture=runtime-export \ --mount "type=bind,src=$state,dst=/recordings" \ --mount "type=bind,src=$bin,dst=/fixture-bin,readonly" "$image" >/dev/null image_id=$(docker image inspect -f '{{.Id}}' "$image") -timeout --kill-after=10 240 python3 tests/runtime_export_acceptance.py \ +timeout --kill-after=10 240 python3 tests/acceptance/runtime_export_acceptance.py \ --container "$name" --state "$state" --evidence "$evidence" \ --commit "${GITHUB_SHA:-$(git rev-parse HEAD)}" --image-id "$image_id" test "$(docker inspect -f '{{.State.Running}}' "$name")" = false diff --git a/tests/runtime_export_acceptance.py b/tests/acceptance/runtime_export_acceptance.py similarity index 100% rename from tests/runtime_export_acceptance.py rename to tests/acceptance/runtime_export_acceptance.py diff --git a/tests/runtime_export_diagnostics.py b/tests/acceptance/runtime_export_diagnostics.py similarity index 100% rename from tests/runtime_export_diagnostics.py rename to tests/acceptance/runtime_export_diagnostics.py diff --git a/tests/runtime_export_writer_observer.py b/tests/acceptance/runtime_export_writer_observer.py similarity index 100% rename from tests/runtime_export_writer_observer.py rename to tests/acceptance/runtime_export_writer_observer.py diff --git a/tests/test_browser_ci_diagnostics.py b/tests/acceptance/test_browser_ci_diagnostics.py similarity index 100% rename from tests/test_browser_ci_diagnostics.py rename to tests/acceptance/test_browser_ci_diagnostics.py diff --git a/tests/test_browser_network_ready.py b/tests/acceptance/test_browser_network_ready.py similarity index 100% rename from tests/test_browser_network_ready.py rename to tests/acceptance/test_browser_network_ready.py diff --git a/tests/test_browser_playback_control.py b/tests/acceptance/test_browser_playback_control.py similarity index 95% rename from tests/test_browser_playback_control.py rename to tests/acceptance/test_browser_playback_control.py index 35bf8d0..ed3d746 100644 --- a/tests/test_browser_playback_control.py +++ b/tests/acceptance/test_browser_playback_control.py @@ -10,12 +10,12 @@ from browser_playback_control import template_contract, mark_failed_stages -ROOT = Path(__file__).resolve().parent.parent +ROOT = Path(__file__).resolve().parent.parent.parent class MarkupTests(unittest.TestCase): def test_actual_template_has_operable_control(self): - self.assertTrue(template_contract((ROOT / "templates/index.html").read_text())) + self.assertTrue(template_contract((ROOT / "web/templates/index.html").read_text())) def test_bad_markup_is_rejected(self): button = '' @@ -45,7 +45,7 @@ def test_failure_marks_only_running_stages(self): class AggregateTests(unittest.IsolatedAsyncioTestCase): def module(self): - spec=importlib.util.spec_from_file_location('browser_expanded_contract',ROOT/'tests/runtime-browser-expanded.py') + spec=importlib.util.spec_from_file_location('browser_expanded_contract',ROOT/'tests/acceptance/runtime-browser-expanded.py') module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) return module diff --git a/tests/test_browser_playback_edges.py b/tests/acceptance/test_browser_playback_edges.py similarity index 100% rename from tests/test_browser_playback_edges.py rename to tests/acceptance/test_browser_playback_edges.py diff --git a/tests/test_browser_playback_transport.py b/tests/acceptance/test_browser_playback_transport.py similarity index 100% rename from tests/test_browser_playback_transport.py rename to tests/acceptance/test_browser_playback_transport.py diff --git a/tests/test_core_ci_evidence.py b/tests/acceptance/test_core_ci_evidence.py similarity index 99% rename from tests/test_core_ci_evidence.py rename to tests/acceptance/test_core_ci_evidence.py index 6995d12..fcdf496 100644 --- a/tests/test_core_ci_evidence.py +++ b/tests/acceptance/test_core_ci_evidence.py @@ -159,7 +159,7 @@ def test_wrapper_preserves_exit_failure_and_head_mismatch(self): for name,body in programs.items(): path=bindir/name;path.write_text(body);path.chmod(0o700) wrapper=Path(m.__file__).with_name('core-ci-evidence.sh') - checkout=wrapper.parent.parent + checkout=wrapper.parent.parent.parent for mode in ('pass','test_failure','stale_head','tee_failure'): with self.subTest(mode=mode): evidence=self.root/('evidence-'+mode) diff --git a/tests/test_correspondence_assessment.py b/tests/acceptance/test_correspondence_assessment.py similarity index 100% rename from tests/test_correspondence_assessment.py rename to tests/acceptance/test_correspondence_assessment.py diff --git a/tests/test_prepared_export_protocol.py b/tests/acceptance/test_prepared_export_protocol.py similarity index 100% rename from tests/test_prepared_export_protocol.py rename to tests/acceptance/test_prepared_export_protocol.py diff --git a/tests/test_runtime_export_acceptance.py b/tests/acceptance/test_runtime_export_acceptance.py similarity index 100% rename from tests/test_runtime_export_acceptance.py rename to tests/acceptance/test_runtime_export_acceptance.py diff --git a/tests/test_runtime_export_diagnostics.py b/tests/acceptance/test_runtime_export_diagnostics.py similarity index 98% rename from tests/test_runtime_export_diagnostics.py rename to tests/acceptance/test_runtime_export_diagnostics.py index 2b7af20..fa6d73c 100644 --- a/tests/test_runtime_export_diagnostics.py +++ b/tests/acceptance/test_runtime_export_diagnostics.py @@ -109,7 +109,7 @@ def test_exact_exit_trap_preserves_failure_and_cleanup_accounting(self): for name in ("docker","sudo"):(binary/name).chmod(0o700) env=dict(os.environ,PATH=str(binary)+os.pathsep+os.environ["PATH"],DIAGNOSTIC_TEST_RM_FAIL="1" if fail else "0") script='set -euo pipefail\nevidence=$1\nwork=$2\nname=simplenvr-runtime-export-123\n'+cleanup+'trap cleanup EXIT\nexit "$3"\n' - result=subprocess.run(["bash","-c",script,"test",str(evidence),str(root),str(code)],cwd=path.parent.parent,env=env,capture_output=True,text=True,timeout=5) + result=subprocess.run(["bash","-c",script,"test",str(evidence),str(root),str(code)],cwd=path.parent.parent.parent,env=env,capture_output=True,text=True,timeout=5) self.assertEqual(result.returncode,1 if fail else code) self.assertIn('"diagnostic_only": true',result.stdout) self.assertEqual((evidence/"runtime-export-report.json").read_text(),raw) diff --git a/tests/test_runtime_export_observer_exit.py b/tests/acceptance/test_runtime_export_observer_exit.py similarity index 100% rename from tests/test_runtime_export_observer_exit.py rename to tests/acceptance/test_runtime_export_observer_exit.py diff --git a/tests/test_runtime_export_writer_observer.py b/tests/acceptance/test_runtime_export_writer_observer.py similarity index 100% rename from tests/test_runtime_export_writer_observer.py rename to tests/acceptance/test_runtime_export_writer_observer.py diff --git a/tests/camera-removal-confirmation.cjs b/tests/frontend/camera-removal-confirmation.cjs similarity index 98% rename from tests/camera-removal-confirmation.cjs rename to tests/frontend/camera-removal-confirmation.cjs index 78412d2..cfa86d9 100644 --- a/tests/camera-removal-confirmation.cjs +++ b/tests/frontend/camera-removal-confirmation.cjs @@ -2,7 +2,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/cameras.js', 'utf8'); +const source = fs.readFileSync('web/static/js/cameras.js', 'utf8'); const fragment = '
Current camera list
'; function element(role, options) { const classes = new Set(); let html = ''; @@ -41,7 +41,7 @@ function harness(options = {}) { return promise; } }); - vm.runInContext(source,c,{filename:'static/js/cameras.js'}); c.setupDeleteCamerasModal(); + vm.runInContext(source,c,{filename:'web/static/js/cameras.js'}); c.setupDeleteCamerasModal(); const state=code => vm.runInContext(code,c); return {c,nodes,timers,calls,notices,state,get refreshes() { return refreshes; }, advance(ms) { now+=ms; },flush(delay) { for (const [id,t] of [...timers]) if(t.delay===delay) { timers.delete(id);t.fn(); } }, diff --git a/tests/download-entrypoints.cjs b/tests/frontend/download-entrypoints.cjs similarity index 73% rename from tests/download-entrypoints.cjs rename to tests/frontend/download-entrypoints.cjs index 0ed2ccb..8bff52d 100644 --- a/tests/download-entrypoints.cjs +++ b/tests/frontend/download-entrypoints.cjs @@ -2,13 +2,13 @@ const assert=require('node:assert/strict'); const fs=require('node:fs'); const vm=require('node:vm'); const context=vm.createContext({console,document:{readyState:'loading',addEventListener(){},getElementById(){return null;}},window:{addEventListener(){}}}); -vm.runInContext(['static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''),context,{filename:'static/js/playback.js'}); +vm.runInContext(['web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''),context,{filename:'web/static/js/playback.js'}); assert.equal(vm.runInContext('typeof startDownload',context),'undefined'); assert.equal(Object.prototype.hasOwnProperty.call(context,'startDownload'),false); // The old export modal and its separate camera checklist are gone; export uses the playback selection. for (const legacy of ['openDownloadModal','closeDownloadModal','toggleDownloadCamera','renderDownloadCameraSelection','expandDownloadTimeEarlier','expandDownloadTimeLater']) assert.equal(vm.runInContext(`typeof ${legacy}`,context),'undefined',legacy); -vm.runInContext(fs.readFileSync('static/js/export-ui.js','utf8'),context,{filename:'static/js/export-ui.js'}); +vm.runInContext(fs.readFileSync('web/static/js/export-ui.js','utf8'),context,{filename:'web/static/js/export-ui.js'}); assert.equal(vm.runInContext('typeof startDownload',context),'undefined'); assert.equal(vm.runInContext('typeof startExportDownloads',context),'function'); for (const entry of ['cancelExportDownloads','openExportPanel','closeExportPanel','refreshExportQueue','clearExportQueue','renderExportRangeOverlay','refreshExportCameraGuidance']) diff --git a/tests/event-clear-confirmation.cjs b/tests/frontend/event-clear-confirmation.cjs similarity index 98% rename from tests/event-clear-confirmation.cjs rename to tests/frontend/event-clear-confirmation.cjs index 0418e77..d059a55 100644 --- a/tests/event-clear-confirmation.cjs +++ b/tests/frontend/event-clear-confirmation.cjs @@ -2,7 +2,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/modals.js', 'utf8'); +const source = fs.readFileSync('web/static/js/modals.js', 'utf8'); const cleared = {success:true,count:3}; function element() { const classes=new Set(); @@ -31,7 +31,7 @@ function harness(options={}) { if(options.syncThrow) throw new Error('');return promise; } }); - vm.runInContext(source,c,{filename:'static/js/modals.js'});ready.forEach(fn=>fn()); + vm.runInContext(source,c,{filename:'web/static/js/modals.js'});ready.forEach(fn=>fn()); const state=code=>vm.runInContext(code,c); return {c,nodes,timers,calls,notices,state,get refreshes() { return refreshes; }, advance(ms) { now+=ms; },flush(delay) { for(const [id,t] of [...timers]) if(t.delay===delay) {timers.delete(id);t.fn();} }, diff --git a/tests/event-navigation.cjs b/tests/frontend/event-navigation.cjs similarity index 94% rename from tests/event-navigation.cjs rename to tests/frontend/event-navigation.cjs index ea3dc96..8dc25ce 100644 --- a/tests/event-navigation.cjs +++ b/tests/frontend/event-navigation.cjs @@ -5,7 +5,7 @@ const timers = new Map(), requests = [], errors = [], seeks = []; let nextTimer = 0; const picker = {value:''}; const context = vm.createContext({console,AbortController,document:{readyState:'loading',addEventListener(){},getElementById:id=>id==='timeline-date-picker'?picker:null},window:{},localStorage:{getItem(){return null;},setItem(){}},showError:message=>errors.push(message),setTimeout(fn,delay){const id=++nextTimer;timers.set(id,{fn,delay});return id;},clearTimeout(id){timers.delete(id);},fetch(url,options){return new Promise((resolve,reject)=>requests.push({url,options,resolve,reject}));}}); -for (const file of ['static/js/events.js','static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js']) vm.runInContext(fs.readFileSync(file,'utf8'),context,{filename:file}); +for (const file of ['web/static/js/events.js','web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js']) vm.runInContext(fs.readFileSync(file,'utf8'),context,{filename:file}); vm.runInContext(`allCameras=[{id:'front',name:'Front Door'},{id:'back',name:'Back Door'}]; selectedCameras=['back'];`,context); context.renderCameraSelector=()=>{}; context.renderTimeline=()=>{}; context.updateVideoGrid=()=>{}; context.performSeek=time=>seeks.push(time.getTime()); diff --git a/tests/event-rendering.cjs b/tests/frontend/event-rendering.cjs similarity index 90% rename from tests/event-rendering.cjs rename to tests/frontend/event-rendering.cjs index 6de28d6..b3ac3ea 100644 --- a/tests/event-rendering.cjs +++ b/tests/frontend/event-rendering.cjs @@ -21,7 +21,7 @@ class Element { const list = new Element('div'); const body = new Element('body'); const context = vm.createContext({console,document:{readyState:'loading',body,addEventListener(){},createElement:tag => new Element(tag),getElementById:id => id === 'events-list' ? list : null},window:{}}); -for (const file of ['static/js/events.js','static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js']) vm.runInContext(fs.readFileSync(file,'utf8'),context,{filename:file}); +for (const file of ['web/static/js/events.js','web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js']) vm.runInContext(fs.readFileSync(file,'utf8'),context,{filename:file}); const payload = `& ' \\ `; const camera = `front');globalThis.pwned=3;// ${payload}`; const timestamp = `');globalThis.pwned=4;//`; diff --git a/tests/export-mode-ui.cjs b/tests/frontend/export-mode-ui.cjs similarity index 100% rename from tests/export-mode-ui.cjs rename to tests/frontend/export-mode-ui.cjs diff --git a/tests/export-queue-details.cjs b/tests/frontend/export-queue-details.cjs similarity index 100% rename from tests/export-queue-details.cjs rename to tests/frontend/export-queue-details.cjs diff --git a/tests/export-range-controls.cjs b/tests/frontend/export-range-controls.cjs similarity index 100% rename from tests/export-range-controls.cjs rename to tests/frontend/export-range-controls.cjs diff --git a/tests/export-ui-fixture.cjs b/tests/frontend/export-ui-fixture.cjs similarity index 94% rename from tests/export-ui-fixture.cjs rename to tests/frontend/export-ui-fixture.cjs index d7f7472..1a82576 100644 --- a/tests/export-ui-fixture.cjs +++ b/tests/frontend/export-ui-fixture.cjs @@ -3,9 +3,9 @@ // DOMContentLoaded callbacks, and models the pointer and keyboard APIs used by handles. // HTML sinks and inline handlers throw so any HTML injection path fails the tests. const fs = require('node:fs'), vm = require('node:vm'), path = require('node:path'); -const root = path.join(__dirname, '..'); -const source = fs.readFileSync(path.join(root, 'static/js/export-ui.js'), 'utf8'); -const geometrySource = fs.readFileSync(path.join(root, 'static/js/timeline-geometry.js'), 'utf8'); +const root = path.join(__dirname, '..', '..'); +const source = fs.readFileSync(path.join(root, 'web/static/js/export-ui.js'), 'utf8'); +const geometrySource = fs.readFileSync(path.join(root, 'web/static/js/timeline-geometry.js'), 'utf8'); const VIEW_START = Date.parse('2026-11-21T00:00:00Z'), VIEW_END = Date.parse('2026-11-22T00:00:00Z'); function environment(fetcher, ids = ['front'], options = {}) { @@ -60,12 +60,12 @@ function environment(fetcher, ids = ['front'], options = {}) { fetch(url, options) { requests.push({url, options}); return fetcher(url, options); }, showSuccess(m) { notices.push(['success', m]); }, showError(m) { notices.push(['error', m]); }, }); - vm.runInContext(geometrySource, context, {filename: 'static/js/timeline-geometry.js'}); + vm.runInContext(geometrySource, context, {filename: 'web/static/js/timeline-geometry.js'}); const cameras = options.cameras || ids.map((id, i) => ({id, name: `Camera ${i + 1}`})); vm.runInContext(`let downloadStartTime=new Date('2026-11-21T00:00:00Z'),downloadEndTime=new Date('2026-11-21T00:01:00Z'),currentTimePosition=Date.parse('2026-11-21T12:00:00Z'),selectedCameras=${JSON.stringify(ids)},allCameras=${JSON.stringify(cameras)}; function timelineViewport(){return {start:${VIEW_START},end:${VIEW_END}};}`, context); if (vm.runInContext('typeof TimelineGeometry', context) !== 'object') throw Error('timeline-geometry.js did not load'); - vm.runInContext(source, context, {filename: 'static/js/export-ui.js'}); + vm.runInContext(source, context, {filename: 'web/static/js/export-ui.js'}); ready.forEach(fn => fn()); const run = code => vm.runInContext(code, context); const flush = async () => { for (let i = 0; i < 12; i++) await new Promise(r => setImmediate(r)); }; diff --git a/tests/export-ui.cjs b/tests/frontend/export-ui.cjs similarity index 99% rename from tests/export-ui.cjs rename to tests/frontend/export-ui.cjs index 8e22ec8..ed64d83 100644 --- a/tests/export-ui.cjs +++ b/tests/frontend/export-ui.cjs @@ -1,7 +1,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'), path = require('node:path'); const {environment, letterId, view, response} = require('./export-ui-fixture.cjs'); -const source = fs.readFileSync(path.join(__dirname, '../static/js/export-ui.js'), 'utf8'); +const source = fs.readFileSync(path.join(__dirname, '../../web/static/js/export-ui.js'), 'utf8'); // Static security policy: no video buffering, no HTML sinks, no legacy approval flow. for (const banned of ['new Blob(', 'createObjectURL', '.blob()', 'arrayBuffer(', 'innerHTML', 'outerHTML', 'insertAdjacentHTML', 'document.write', diff --git a/tests/live-stream-names.cjs b/tests/frontend/live-stream-names.cjs similarity index 97% rename from tests/live-stream-names.cjs rename to tests/frontend/live-stream-names.cjs index bbf2ae8..5a76894 100644 --- a/tests/live-stream-names.cjs +++ b/tests/frontend/live-stream-names.cjs @@ -2,7 +2,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/modals.js', 'utf8'); +const source = fs.readFileSync('web/static/js/modals.js', 'utf8'); const origin = 'https://nvr.invalid:9443'; const videoHTML = ''; function harness(onDemand=false) { @@ -29,7 +29,7 @@ function harness(onDemand=false) { window:{},showError:message=>errors.push(message),console, fetch() {throw new Error('Live-name tests must not contact a server');} }); - vm.runInContext(source,context,{filename:'static/js/modals.js'}); + vm.runInContext(source,context,{filename:'web/static/js/modals.js'}); return {context,nodes,errors,assignments,get creations() {return creations;},get rewrites() {return rewrites;}, state:code=>vm.runInContext(code,context)}; } diff --git a/tests/orphan-cleanup-reporting.cjs b/tests/frontend/orphan-cleanup-reporting.cjs similarity index 99% rename from tests/orphan-cleanup-reporting.cjs rename to tests/frontend/orphan-cleanup-reporting.cjs index 8e728a2..98de142 100644 --- a/tests/orphan-cleanup-reporting.cjs +++ b/tests/frontend/orphan-cleanup-reporting.cjs @@ -2,7 +2,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/cameras.js', 'utf8'); +const source = fs.readFileSync('web/static/js/cameras.js', 'utf8'); const valid = {success:true,count:2,size_mb:1.25,skipped_recovery_dirs:0,failures:0,interrupted:false,limit_reached:false}; function element() { diff --git a/tests/persistence-responses.cjs b/tests/frontend/persistence-responses.cjs similarity index 98% rename from tests/persistence-responses.cjs rename to tests/frontend/persistence-responses.cjs index 4ed779a..13cb7b2 100644 --- a/tests/persistence-responses.cjs +++ b/tests/frontend/persistence-responses.cjs @@ -5,7 +5,7 @@ const vm = require('node:vm'); const sources = ['cameras.js', 'modals.js'].map(name => ({ name, - text: fs.readFileSync(path.join(__dirname, '..', 'static', 'js', name), 'utf8') + text: fs.readFileSync(path.join(__dirname, '..', '..', 'web', 'static', 'js', name), 'utf8') })); const html = '
Updated camera list
'; const intentMessage = 'Recording enabled; footage capture is not yet verified.'; diff --git a/tests/playback-continuation.cjs b/tests/frontend/playback-continuation.cjs similarity index 91% rename from tests/playback-continuation.cjs rename to tests/frontend/playback-continuation.cjs index 2c19feb..2a015df 100644 --- a/tests/playback-continuation.cjs +++ b/tests/frontend/playback-continuation.cjs @@ -9,11 +9,11 @@ class Video { set src(value){this.assignments.push(value);this.ended=false;} removeAttribute(){}pause(){}play(){this.plays++;return Promise.resolve();} } -const source=['static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); +const source=['web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); function harness(extra=[]){ const timers=new Map(),errors=[];let id=0;const video=new Video(); const c=vm.createContext({console,testVideo:video,document:{readyState:'loading',addEventListener(){},getElementById(){return null;}},showError:message=>errors.push(message),setTimeout(fn,delay){const key=++id;timers.set(key,{fn,delay});return key;},clearTimeout(key){timers.delete(key);}}); - vm.runInContext(source,c,{filename:'static/js/playback.js'});const run=code=>vm.runInContext(code,c); + vm.runInContext(source,c,{filename:'web/static/js/playback.js'});const run=code=>vm.runInContext(code,c); run(`currentDate=new Date(2026,10,10);allCameras=[{id:'a',name:'A'}];selectedCameras=['a'];videoPlayers=[testVideo];`); const start=new Date(2026,10,10,12).getTime(),segment=(a,b,path)=>({camera_id:'a',start_time:new Date(start+a*1000).toISOString(),end_time:new Date(start+b*1000).toISOString(),file_path:path}); c.segments=[segment(0,60,'/first.mp4'),...extra.map(item=>segment(...item))];run('timelineSegments=segments'); diff --git a/tests/playback-controls.cjs b/tests/frontend/playback-controls.cjs similarity index 95% rename from tests/playback-controls.cjs rename to tests/frontend/playback-controls.cjs index f05584a..d34dd31 100644 --- a/tests/playback-controls.cjs +++ b/tests/frontend/playback-controls.cjs @@ -1,6 +1,6 @@ 'use strict'; const assert=require('node:assert/strict'),fs=require('node:fs'),vm=require('node:vm'); -const source=['static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); +const source=['web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); class Video { constructor(){this.listeners=new Map();this.style={};this.message={style:{}};this.parentElement={querySelector:()=>this.message};this.duration=60;this.currentTime=0;this.ended=false;this.plays=0;this.pauses=0;this.nextPlay=null;this.assignments=[];} addEventListener(name,fn){if(!this.listeners.has(name))this.listeners.set(name,new Set());this.listeners.get(name).add(fn);} diff --git a/tests/playback-failures.cjs b/tests/frontend/playback-failures.cjs similarity index 93% rename from tests/playback-failures.cjs rename to tests/frontend/playback-failures.cjs index 8eb345f..debbcb8 100644 --- a/tests/playback-failures.cjs +++ b/tests/frontend/playback-failures.cjs @@ -1,6 +1,6 @@ 'use strict'; const assert=require('node:assert/strict'),fs=require('node:fs'),vm=require('node:vm'); -const source=['static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); +const source=['web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); class Video { constructor(){this.listeners=new Map();this.style={};this.message={style:{}};this.parentElement={querySelector:()=>this.message};this.duration=60;this.currentTime=0;this.ended=false;this.assignments=[];this.plays=0;this.pauses=0;this.nextPlay=null;} addEventListener(name,fn){if(!this.listeners.has(name))this.listeners.set(name,new Set());this.listeners.get(name).add(fn);} @@ -14,7 +14,7 @@ class Video { function harness(extra=[[60,120,'/second.mp4']]){ const timers=new Map(),errors=[];let id=0;const video=new Video(); const c=vm.createContext({console,testVideo:video,document:{readyState:'loading',addEventListener(){},getElementById(){return null;}},showError:message=>errors.push(message),setTimeout(fn,delay){const key=++id;timers.set(key,{fn,delay});return key;},clearTimeout(key){timers.delete(key);}}); - vm.runInContext(source,c,{filename:'static/js/playback.js'});const run=code=>vm.runInContext(code,c); + vm.runInContext(source,c,{filename:'web/static/js/playback.js'});const run=code=>vm.runInContext(code,c); run(`currentDate=new Date(2026,10,10);allCameras=[{id:'a',name:'A'}];selectedCameras=['a'];videoPlayers=[testVideo];`); const start=new Date(2026,10,10,12).getTime(); const segment=(a,b,path)=>({camera_id:'a',start_time:new Date(start+a*1000).toISOString(),end_time:new Date(start+b*1000).toISOString(),file_path:path}); diff --git a/tests/playback-lifecycle.cjs b/tests/frontend/playback-lifecycle.cjs similarity index 92% rename from tests/playback-lifecycle.cjs rename to tests/frontend/playback-lifecycle.cjs index dd57ed8..564128d 100644 --- a/tests/playback-lifecycle.cjs +++ b/tests/frontend/playback-lifecycle.cjs @@ -1,6 +1,6 @@ 'use strict'; const assert=require('node:assert/strict'),fs=require('node:fs'),vm=require('node:vm'); -const source=['static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); +const source=['web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js'].map(f=>fs.readFileSync(f,'utf8')).join(''); class Video { constructor(){this.listeners=new Map();this.assignments=[];this.style={};this.message={style:{}};this.duration=60;this.currentTime=0;this.playCount=0;this.pauseCount=0;this.parentElement={querySelector:()=>this.message};} addEventListener(name,fn){if(!this.listeners.has(name))this.listeners.set(name,new Set());this.listeners.get(name).add(fn);} @@ -15,7 +15,7 @@ class Video { function harness(){ const timers=new Map();let next=0; const c=vm.createContext({console,document:{readyState:'loading',addEventListener(){},getElementById(){return null;}},setTimeout(fn,delay){const id=++next;timers.set(id,{fn,delay});return id;},clearTimeout(id){timers.delete(id);}}); - vm.runInContext(source,c,{filename:'static/js/playback.js'}); + vm.runInContext(source,c,{filename:'web/static/js/playback.js'}); const run=code=>vm.runInContext(code,c); const video=new Video();c.testVideo=video; run(`allCameras=[{id:'a',name:'A'}];selectedCameras=['a'];videoPlayers=[testVideo];timelineSegments=[{camera_id:'a',start_time:'2026-11-10T12:00:00Z',end_time:'2026-11-10T12:01:00Z',file_path:'/first.mp4'}];`); diff --git a/tests/recording-deletion-confirmation.cjs b/tests/frontend/recording-deletion-confirmation.cjs similarity index 98% rename from tests/recording-deletion-confirmation.cjs rename to tests/frontend/recording-deletion-confirmation.cjs index cb6e647..290fc2b 100644 --- a/tests/recording-deletion-confirmation.cjs +++ b/tests/frontend/recording-deletion-confirmation.cjs @@ -2,7 +2,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/recordings.js', 'utf8'); +const source = fs.readFileSync('web/static/js/recordings.js', 'utf8'); const complete = {success:true,deleted:2,size_mb:1.25,failures:0}; function element() { const classes = new Set(); @@ -31,7 +31,7 @@ function harness(options = {}) { return promise; } }); - vm.runInContext(source,c,{filename:'static/js/recordings.js'}); ready.forEach(fn => fn()); + vm.runInContext(source,c,{filename:'web/static/js/recordings.js'}); ready.forEach(fn => fn()); const run = code => vm.runInContext(code,c); return {c,nodes,timers,calls,notices,run,get refreshes() { return refreshes; }, advance(ms) { now += ms; }, diff --git a/tests/session-expiry.cjs b/tests/frontend/session-expiry.cjs similarity index 97% rename from tests/session-expiry.cjs rename to tests/frontend/session-expiry.cjs index b50d8ad..90b530c 100644 --- a/tests/session-expiry.cjs +++ b/tests/frontend/session-expiry.cjs @@ -2,7 +2,7 @@ const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/core.js', 'utf8'); +const source = fs.readFileSync('web/static/js/core.js', 'utf8'); const ORIGIN = 'https://nvr.test'; const settle = () => new Promise(resolve => setImmediate(resolve)); const response = (status, path) => ({ status, url: new URL(path, ORIGIN + '/').href }); @@ -28,7 +28,7 @@ function harness({ visibility = 'visible', responder = path => response(204, pat getElementById: () => null }; const context = vm.createContext({ window, document, URL, AbortSignal, console, setTimeout: () => 0 }); - vm.runInContext(source, context, { filename: 'static/js/core.js' }); + vm.runInContext(source, context, { filename: 'web/static/js/core.js' }); return { window, document, calls, replaced, intervals, state, bodyListeners, interval: () => intervals[0].fn(), diff --git a/tests/timeline-camera-filter.cjs b/tests/frontend/timeline-camera-filter.cjs similarity index 96% rename from tests/timeline-camera-filter.cjs rename to tests/frontend/timeline-camera-filter.cjs index 6c0e8d5..0ea53af 100644 --- a/tests/timeline-camera-filter.cjs +++ b/tests/frontend/timeline-camera-filter.cjs @@ -1,12 +1,12 @@ 'use strict'; -// Regression tests for static/js/timeline-camera-filter.js: the camera_id filter on timeline +// Regression tests for web/static/js/timeline-camera-filter.js: the camera_id filter on timeline // requests and the warning shown when the server leaves unreadable recordings out. const assert = require('node:assert/strict'); const fs = require('node:fs'); const vm = require('node:vm'); const { test } = require('node:test'); -const source = fs.readFileSync('static/js/timeline-camera-filter.js', 'utf8'); +const source = fs.readFileSync('web/static/js/timeline-camera-filter.js', 'utf8'); const ORIGIN = 'https://nvr.test'; const TIMELINE = '/api/timeline/recordings'; const QUERY = 'start_time=2026-11-10T00%3A00%3A00.000Z&end_time=2026-11-11T00%3A00%3A00.000Z'; @@ -36,7 +36,7 @@ function harness({ selected, warn = true } = {}) { if (warn) sandbox.showWarning = (message, duration) => { warnings.push({ message, duration }); }; const context = vm.createContext(sandbox); if (selected) vm.runInContext('var selectedCameras = ' + JSON.stringify(selected) + ';', context); - vm.runInContext(source, context, { filename: 'static/js/timeline-camera-filter.js' }); + vm.runInContext(source, context, { filename: 'web/static/js/timeline-camera-filter.js' }); return { context, calls, warnings, consoleWarnings, fetch: (input, init) => context.window.fetch(input, init), diff --git a/tests/timeline-canvas.cjs b/tests/frontend/timeline-canvas.cjs similarity index 92% rename from tests/timeline-canvas.cjs rename to tests/frontend/timeline-canvas.cjs index 66733d4..d8e785a 100644 --- a/tests/timeline-canvas.cjs +++ b/tests/frontend/timeline-canvas.cjs @@ -14,7 +14,7 @@ const ctx={fillRect(...a){rectangles.push(a);},fillText(s){labels.push(s);},meas const rect={left:10,top:20,width:500,height:170}; const canvas={offsetWidth:1000,width:1000,height:85,style:{},getContext(){return ctx;},getBoundingClientRect(){return rect;},addEventListener(k,fn){listeners[k]=fn;}}; const context=vm.createContext({console,document:{readyState:'loading',body,createElement:tag=>new Element(tag),addEventListener(){},getElementById:id=>id==='timeline-canvas'?canvas:null},window:{},setTimeout(fn,delay){const id=++timerID;timers.set(id,{fn,delay});return id;},clearTimeout(id){timers.delete(id);}}); -for(const file of ['static/js/events.js','static/js/timeline-geometry.js','static/js/playback-state.js','static/js/playback-camera-date.js','static/js/playback-timeline-load.js','static/js/playback-canvas.js','static/js/playback-seek-session.js','static/js/playback-video-controls.js']) vm.runInContext(fs.readFileSync(file,'utf8'),context,{filename:file}); +for(const file of ['web/static/js/events.js','web/static/js/timeline-geometry.js','web/static/js/playback-state.js','web/static/js/playback-camera-date.js','web/static/js/playback-timeline-load.js','web/static/js/playback-canvas.js','web/static/js/playback-seek-session.js','web/static/js/playback-video-controls.js']) vm.runInContext(fs.readFileSync(file,'utf8'),context,{filename:file}); const run=code=>vm.runInContext(code,context);context.performSeek=time=>seeks.push(time.getTime()); function flush(){for(const [id,timer] of [...timers])if(timer.delay===100){timers.delete(id);timer.fn();}} function click(f,y=80){listeners.click({clientX:rect.left+f*rect.width,clientY:rect.top+y*rect.height/canvas.height});flush();} @@ -53,6 +53,6 @@ hover(event);assert.equal(body.children.length,1,'repeat hover replaces the prev listeners.mousemove({clientX:rect.left,clientY:rect.top+rect.height});assert.equal(canvas.style.cursor,'default');assert.equal(body.children.length,0); hover(event);assert.equal(body.children.length,1);listeners.mouseleave();assert.equal(body.children.length,0);assert.equal(run('eventTooltip'),null); rect.width=0;const count=seeks.length;click(0.5);assert.equal(seeks.length,count); -const page=fs.readFileSync('templates/index.html','utf8'),scripts=[...page.matchAll(/