diff --git a/.github/workflows/imersip-p92-single-engine.yml b/.github/workflows/imersip-p92-single-engine.yml index db569d122..07a76e439 100644 --- a/.github/workflows/imersip-p92-single-engine.yml +++ b/.github/workflows/imersip-p92-single-engine.yml @@ -202,13 +202,12 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - # The release verifier uses a strict dist/ allowlist. Attach the - # acoustic FAT and MIT KEMAR attribution OUTSIDE verified dist/, - # not by making unverified changes to the portable application. + # The release verifier scans the compiled EXE for the full MIT KEMAR + # notice and AGPLv3. Only the field-test instruction remains outside + # verified dist/; don't scatter redundant legal files in artifacts. New-Item -ItemType Directory -Path field_candidate -Force | Out-Null Copy-Item -LiteralPath dist -Destination field_candidate/ArSonMix-Portable -Recurse Copy-Item -LiteralPath docs/IMERSIP_P92_SINGLE_NATIVE_ENGINE_FAT_20261116.md -Destination field_candidate/IMERSIP_P92_FIELD_FAT.md - Copy-Item -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Destination field_candidate/THIRD_PARTY_8D_SONKU_HRTF.md - uses: actions/upload-artifact@v4 with: name: ImerSip-P92-Shared-Core-Windows-x64-${{ github.run_id }} diff --git a/.github/workflows/release-contracts.yml b/.github/workflows/release-contracts.yml index d98fecad5..ce37967a8 100644 --- a/.github/workflows/release-contracts.yml +++ b/.github/workflows/release-contracts.yml @@ -10,6 +10,12 @@ on: - 'scripts/build_verify_windows_installer.ps1' - 'scripts/test_inno_graceful_update_windows.ps1' - 'tests/license_distribution_contract.test.mjs' + - 'scripts/verify_embedded_legal.py' + - 'web/approved-native-legal.js' + - 'src/EmbeddedLegalResources.h' + - 'src/Main.cpp' + - 'scripts/build_approved_native_gui.py' + - 'CMakeLists.txt' - 'site/index.html' - 'site/downloads.js' - 'scripts/build_release_catalog.py' @@ -39,6 +45,12 @@ on: - 'scripts/build_verify_windows_installer.ps1' - 'scripts/test_inno_graceful_update_windows.ps1' - 'tests/license_distribution_contract.test.mjs' + - 'scripts/verify_embedded_legal.py' + - 'web/approved-native-legal.js' + - 'src/EmbeddedLegalResources.h' + - 'src/Main.cpp' + - 'scripts/build_approved_native_gui.py' + - 'CMakeLists.txt' - 'scripts/build_release_catalog.py' - 'scripts/verify_release_setup_zip.py' - 'tests/test_release_setup_zip.py' @@ -70,6 +82,8 @@ jobs: run: | node --check site/downloads.js node --test tests/license_distribution_contract.test.mjs + python scripts/verify_embedded_legal.py --self-test + node --check web/approved-native-legal.js node --test tests/downloads_runtime_contract.test.mjs node --check scripts/release_ci_dispatch.mjs node --test tests/release_ci_dispatch_contract.test.mjs diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 510ff54de..7035107d1 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -140,6 +140,32 @@ jobs: - name: Block incomplete product release only when preparing product review if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft && startsWith(github.head_ref, 'integration/product-') }} run: node scripts/check_console_puzzle.mjs --release + embedded-legal-center: + name: Embedded AGPL center real Chromium UX (2 sizes) + needs: quick + if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'feat/embedded-premium-legal-') }} + runs-on: ubuntu-latest + timeout-minutes: 12 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Chromium for native-only legal UI proof + run: | + python -m pip install playwright + python -m playwright install --with-deps chromium + - name: Verify offline legal tabs, source action, visual bounds and focus + run: python tests/embedded_legal_center_chromium_smoke.py + - name: Preserve actual legal-center screenshots + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: ArSonMix-Embedded-AGPL-UX-${{ github.run_id }} + path: arsonmix-legal-center-*.png + if-no-files-found: ignore + retention-days: 7 + gain-metal-knob-preview: name: GAIN metal knob Chromium FAT (5 viewports) needs: quick diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f58974e5..fffb588a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,7 @@ file(GLOB_RECURSE ARMIX_APPROVED_GUI_SOURCE_INPUTS CONFIGURE_DEPENDS list(APPEND ARMIX_APPROVED_GUI_SOURCE_INPUTS "${CMAKE_CURRENT_SOURCE_DIR}/web/approved-native-bridge.js" "${CMAKE_CURRENT_SOURCE_DIR}/web/approved-native-context-menu.js" + "${CMAKE_CURRENT_SOURCE_DIR}/web/approved-native-legal.js" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/build_approved_native_gui.py" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/build_pages.py" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/compose_native_peq.py") @@ -289,9 +290,48 @@ if(ARMIX_IMMERSIB_RELEASE_CANDIDATE) list(APPEND ARMIX_IMERSIB_SCENE_PNG_SOURCES "${scene}") endforeach() endif() +# Every original and third-party notice is compiled into the same native JUCE +# executable. No adjacent legal .txt/.md files in any installed/portable tree. +# Keep these resource basenames stable, alphanumeric names: EmbeddedLegalResources.h maps them. +set(ARMIX_LEGAL_EMBED_DIR "${CMAKE_CURRENT_BINARY_DIR}/approved_legal") +file(MAKE_DIRECTORY "${ARMIX_LEGAL_EMBED_DIR}") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" + "${ARMIX_LEGAL_EMBED_DIR}/armixagpl.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE-NOTICE.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixnotice.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/docs/THIRD_PARTY_8D_SONKU_HRTF.md" + "${ARMIX_LEGAL_EMBED_DIR}/armixhrirmit.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/third_party/signalsmith/LICENSE-STRETCH.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixsignalsmithstretch.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/third_party/signalsmith/LICENSE-LINEAR.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixsignalsmithlinear.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/web/assets/fonts/OFL-LICENSE-Inter.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixinterofl.txt" COPYONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/installer/VB-CABLE-NOTICE.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixvbcablenotice.txt" COPYONLY) +# Explicit allowlist avoids picking up stale resources from an earlier +# incremental configure and keeps BinaryData contents reproducible. +set(ARMIX_LEGAL_RESOURCE_FILES + "${ARMIX_LEGAL_EMBED_DIR}/armixagpl.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixnotice.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixhrirmit.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixsignalsmithstretch.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixsignalsmithlinear.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixinterofl.txt" + "${ARMIX_LEGAL_EMBED_DIR}/armixvbcablenotice.txt") +list(LENGTH ARMIX_LEGAL_RESOURCE_FILES ARMIX_LEGAL_RESOURCE_COUNT) +if(NOT ARMIX_LEGAL_RESOURCE_COUNT EQUAL 7) + message(FATAL_ERROR "All seven exact-source legal documents must be embedded") +endif() +foreach(ARMIX_LEGAL_RESOURCE IN LISTS ARMIX_LEGAL_RESOURCE_FILES) + if(NOT EXISTS "${ARMIX_LEGAL_RESOURCE}") + message(FATAL_ERROR "Missing legal BinaryData source: ${ARMIX_LEGAL_RESOURCE}") + endif() +endforeach() juce_add_binary_data(ARMixAssets SOURCES "${ARMIX_APPROVED_GUI_DIR}/index.html" ${ARMIX_APPROVED_GUI_BINARIES} ${ARMIX_GUITAR_SKIN_PNGS} + ${ARMIX_LEGAL_RESOURCE_FILES} "${ARMIX_BRAND_DIR}/arsonmix-256.png" ${ARMIX_IMERSIB_SCENE_PNG_SOURCES}) target_include_directories(ARMixConsole PRIVATE "${ARMIX_APPROVED_GUI_DIR}") diff --git a/LICENSE-NOTICE.txt b/LICENSE-NOTICE.txt index 3a3194fc2..1527c967a 100644 --- a/LICENSE-NOTICE.txt +++ b/LICENSE-NOTICE.txt @@ -5,7 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only The original ArSonMix digital mixer application, native mixing/routing implementation, original GUI/bridge source, and ArSonMix-owned native built-in effects are licensed under the GNU Affero General Public License, version 3 -only (AGPL-3.0-only). The complete terms are in the accompanying LICENSE. +only (AGPL-3.0-only). The complete terms are in the source repository +LICENSE and are embedded in the native ArSonMix executable (More > About & +Licenses), readable offline without separate files in the installation folder. Native built-in effects in this repository include Parametric EQ, Compressor, Harmonice, Vocal Delay, 8D-SonKu, Guitar FX Rig, and ImmerSIB where built and @@ -20,10 +22,10 @@ Third-party materials are NOT relicensed by this notice: - JUCE and its modules, Steinberg VST3 and ASIO SDKs, and independently installed or optional FactoryFX VST3 plugins retain their own applicable terms, distribution permissions and requirements. -- MIT KEMAR/HRIR data attribution: THIRD_PARTY_8D_SONKU_HRTF.md. -- Vendored Signalsmith components: LICENSE-SIGNALSMITH-STRETCH.txt and - LICENSE-SIGNALSMITH-LINEAR.txt. -- Embedded Inter font: OFL-LICENSE-Inter.txt. +- MIT KEMAR/HRIR attribution: docs/THIRD_PARTY_8D_SONKU_HRTF.md. +- Vendored Signalsmith components: third_party/signalsmith/LICENSE-STRETCH.txt + and LICENSE-LINEAR.txt. +- Embedded Inter font: web/assets/fonts/OFL-LICENSE-Inter.txt. - Optional VB-Audio VB-CABLE driver: ThirdParty/VB-Audio/VB-CABLE-NOTICE.txt in the Windows installer; the vendor's own usage/licensing terms apply. diff --git a/README.md b/README.md index 8753ea776..36d7e6970 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Windows alpha builds are intended for field testing, not certified low-latency m ## License — mixer and native built-in FX -**AGPL-3.0-only (GNU Affero General Public License version 3 only)** applies to original ArSonMix mixer code, routing and JUCE host, original desktop/web GUI implementation, and ArSonMix-owned **native built-in FX**, including EQ, Compressor, Harmonice, Vocal Delay, 8D-SonKu, Guitar FX and feature-gated ImmerSIB. See the complete [LICENSE](LICENSE) and [LICENSE-NOTICE.txt](LICENSE-NOTICE.txt). Source code and release tags are available in this repository for recipients of the application. +**AGPL-3.0-only (GNU Affero General Public License version 3 only)** applies to original ArSonMix mixer code, routing and JUCE host, original desktop/web GUI implementation, and ArSonMix-owned **native built-in FX**, including EQ, Compressor, Harmonice, Vocal Delay, 8D-SonKu, Guitar FX and feature-gated ImmerSIB. See the complete [LICENSE](LICENSE) and [LICENSE-NOTICE.txt](LICENSE-NOTICE.txt). In native desktop builds, open **More > About & Licenses** to read the complete AGPL and bundled third-party notices offline; they are embedded inside ArSonMix.exe/the macOS or Linux executable, not scattered across the install directory. The Windows installer also embeds the same source notices without a separate agreement screen. Source code and release tags are available in this repository for recipients of the application. Third-party components are **not automatically relicensed**: JUCE, VST3/ASIO SDKs, MIT-licensed KEMAR/HRIR and Signalsmith materials, Inter font, VB-CABLE, and independently installed/approved FactoryFX VST3 may carry separate terms. Refer to distributed notices and `third_party/`. AGPL does not grant a redistribution licence for commercial VST3 plugins. diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index 7f89cac2c..6ced1b257 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -44,6 +44,17 @@ SetupMutex=ArSonMix.PerUserInstaller.SingleInstance ; WM_CLOSE followed by full process exit is required before replacing EXE. CloseApplications=no RestartApplications=no +; Clean only the exact legacy top-level documents installed by <= alpha.24. +; No wildcards, recursion, Studio data, shows, presets or third-party dirs. +; Inno processes [InstallDelete] before [Files], including in-place upgrades. +[InstallDelete] +Type: files; Name: "{app}\LICENSE" +Type: files; Name: "{app}\LICENSE-NOTICE.txt" +Type: files; Name: "{app}\LICENSE-SIGNALSMITH-STRETCH.txt" +Type: files; Name: "{app}\LICENSE-SIGNALSMITH-LINEAR.txt" +Type: files; Name: "{app}\OFL-LICENSE-Inter.txt" +Type: files; Name: "{app}\THIRD_PARTY_8D_SONKU_HRTF.md" +Type: files; Name: "{app}\README.md" [Files] ; The vendor standard cable ZIP is kept AS IS, with mandatory attribution. ; Do not redistribute extra A+B / C+D driver packages. @@ -57,14 +68,16 @@ Source: "ArSonMixUpdateShutdown.ps1"; Flags: dontcopy Source: "ArSonMixAutoUpdate.ps1"; DestDir: "{app}"; Flags: ignoreversion Source: "{#SourceRoot}\verified-gui.exe"; DestDir: "{app}"; DestName: "ArSonMix.exe"; Flags: ignoreversion Source: "{#SourceRoot}\BUILD_PROVENANCE.json"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourceRoot}\README.md"; DestDir: "{app}"; Flags: ignoreversion -; Ship original AGPLv3 and third-party terms without new installer UI steps. -Source: "{#SourceRoot}\LICENSE"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourceRoot}\LICENSE-NOTICE.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourceRoot}\LICENSE-SIGNALSMITH-STRETCH.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourceRoot}\LICENSE-SIGNALSMITH-LINEAR.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourceRoot}\OFL-LICENSE-Inter.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#SourceRoot}\THIRD_PARTY_8D_SONKU_HRTF.md"; DestDir: "{app}"; Flags: ignoreversion +; The complete original and vendor legal documents are embedded both in +; ArSonMix.exe (offline About & Licenses) and inside this Setup payload. +; dontcopy = not installed into {app}; no clickthrough wizard or file litter. +Source: "..\LICENSE"; Flags: dontcopy +Source: "..\LICENSE-NOTICE.txt"; Flags: dontcopy +Source: "..\docs\THIRD_PARTY_8D_SONKU_HRTF.md"; Flags: dontcopy +Source: "..\third_party\signalsmith\LICENSE-STRETCH.txt"; Flags: dontcopy +Source: "..\third_party\signalsmith\LICENSE-LINEAR.txt"; Flags: dontcopy +Source: "..\web\assets\fonts\OFL-LICENSE-Inter.txt"; Flags: dontcopy +; VB-CABLE vendor notice is already inside the vendor [Files] payload. Source: "{#SourceRoot}\FactoryFX\*"; DestDir: "{app}\FactoryFX"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist [Icons] Name: "{autoprograms}\ArSonMix"; Filename: "{app}\ArSonMix.exe"; WorkingDir: "{app}" diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py index 871859770..2289b00e4 100644 --- a/scripts/build_approved_native_gui.py +++ b/scripts/build_approved_native_gui.py @@ -23,7 +23,8 @@ NATIVE_ADAPTER = ROOT / "web" / "approved-native-bridge.js" ADAPTER_MARKER = ('\n' '\n' - '\n') + '\n' + '\n') SCHEMA = "arsonmix.approved-native-pages-bundle.v2" @@ -354,6 +355,8 @@ def stage(out: Path) -> dict: shutil.copy2(NATIVE_ADAPTER, out / "assets" / "approved-native-bridge.js") shutil.copy2(ROOT / "web" / "approved-native-context-menu.js", out / "assets" / "approved-native-context-menu.js") + shutil.copy2(ROOT / "web" / "approved-native-legal.js", + out / "assets" / "approved-native-legal.js") shutil.copy2(ROOT / "web" / "approved-native-contract.js", out / "assets" / "approved-native-contract.js") native = native_html(approved.decode("utf-8")).encode("utf-8") diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index d02482276..2a39740c7 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -38,11 +38,7 @@ $fixtureProcess=$null try { New-Item -ItemType Directory -Force -Path $stage | Out-Null Copy-Item -LiteralPath $exe -Destination (Join-Path $stage "verified-gui.exe") - foreach($item in @("BUILD_PROVENANCE.json","README.md", - "LICENSE","LICENSE-NOTICE.txt", - "LICENSE-SIGNALSMITH-STRETCH.txt", - "LICENSE-SIGNALSMITH-LINEAR.txt","OFL-LICENSE-Inter.txt", - "THIRD_PARTY_8D_SONKU_HRTF.md")){ + foreach($item in @("BUILD_PROVENANCE.json")){ Copy-Item -LiteralPath (Join-Path $dist $item) -Destination (Join-Path $stage $item) } Copy-Item -LiteralPath "assets/icon/arsonmix-app.ico" -Destination (Join-Path $stage "arsonmix-app.ico") @@ -70,26 +66,15 @@ try { } $installedManifest=Get-Content -LiteralPath (Join-Path $install "BUILD_PROVENANCE.json") -Raw -Encoding UTF8 | ConvertFrom-Json if($installedManifest.sourceCommit -ne $sha){throw "Wrong installed provenance"} - $installedNotice = Join-Path $install "THIRD_PARTY_8D_SONKU_HRTF.md" - if(-not (Test-Path -LiteralPath $installedNotice -PathType Leaf) -or - (Get-FileHash -LiteralPath $installedNotice -Algorithm SHA256).Hash.ToLowerInvariant() -ne - $manifest.hrirNoticeSha256) { - throw "Installed third-party KEMAR/MIT notice missing or altered" - } - # Confirm Inno preserved all mandatory legal texts byte-for-byte. - $installedLicenses = [ordered]@{ - "LICENSE" = "licenseTextSha256" - "LICENSE-NOTICE.txt" = "licenseNoticeSha256" - "LICENSE-SIGNALSMITH-STRETCH.txt" = "signalsmithStretchLicenseSha256" - "LICENSE-SIGNALSMITH-LINEAR.txt" = "signalsmithLinearLicenseSha256" - "OFL-LICENSE-Inter.txt" = "interOflLicenseSha256" - } - foreach($name in $installedLicenses.Keys){ - $installedPath = Join-Path $install $name - $hashField = $installedLicenses[$name] - if(-not (Test-Path -LiteralPath $installedPath -PathType Leaf) -or - (Get-FileHash -LiteralPath $installedPath -Algorithm SHA256).Hash.ToLowerInvariant() -ne $manifest.$hashField){ - throw "Installed licence missing or altered: $name" + # Full AGPL and third-party terms live in ArSonMix.exe and Setup itself. + # The installed directory must have NO redundant top-level legal files. + & python scripts/verify_embedded_legal.py --binary $installedExe + if($LASTEXITCODE -ne 0){throw "Installed EXE missing exact-source embedded licenses"} + foreach($name in @("LICENSE","LICENSE-NOTICE.txt", + "LICENSE-SIGNALSMITH-STRETCH.txt","LICENSE-SIGNALSMITH-LINEAR.txt", + "OFL-LICENSE-Inter.txt","THIRD_PARTY_8D_SONKU_HRTF.md")){ + if(Test-Path -LiteralPath (Join-Path $install $name)){ + throw "Installer left a redundant top-level legal document: $name" } } # REAL Windows in-place UPDATE test: replace the *test-installed* PE @@ -116,6 +101,14 @@ try { if(-not (Test-Path -LiteralPath $fixtureReady)){ throw "Installed upgrade fixture did not show its Windows message-loop window" } + # Upgrade fixture: migration from the old alpha.24 footprint must not + # leave the old top-level licenses/README in the installed application. + $legacyLooseFiles=@("LICENSE","LICENSE-NOTICE.txt", + "LICENSE-SIGNALSMITH-STRETCH.txt","LICENSE-SIGNALSMITH-LINEAR.txt", + "OFL-LICENSE-Inter.txt","THIRD_PARTY_8D_SONKU_HRTF.md","README.md") + foreach($name in $legacyLooseFiles){ + "legacy-installer-document" | Set-Content -LiteralPath (Join-Path $install $name) + } $installSentinel=Join-Path $install "arsonmix-user-file.keep" "preserve-user-files-across-upgrade" | Set-Content -LiteralPath $installSentinel $upgradeLog=Join-Path $env:RUNNER_TEMP ("arsonmix-upgrade-"+[guid]::NewGuid().ToString("N")+".log") @@ -146,6 +139,11 @@ try { (Test-Path -LiteralPath (Join-Path $install "portable_mode.txt"))){ throw "In-place update failed verified EXE replacement or data preservation" } + foreach($name in $legacyLooseFiles){ + if(Test-Path -LiteralPath (Join-Path $install $name)){ + throw "Old loose legal file survived in-place update: $name" + } + } Write-Host "INNO_GRACEFUL_UPDATE_PASS: running app Windows session close, verified PE replacement, user files preserved" $uninstall=Join-Path $install "unins000.exe" if(-not (Test-Path -LiteralPath $uninstall -PathType Leaf)){throw "Uninstaller missing"} diff --git a/scripts/package_native_linux.sh b/scripts/package_native_linux.sh index c20935a49..61756ad94 100644 --- a/scripts/package_native_linux.sh +++ b/scripts/package_native_linux.sh @@ -19,14 +19,9 @@ mkdir -p "$out"; out="$(cd "$out" && pwd)" tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT mkdir -p "$tmp/ArSonMix" cp "$exe" "$tmp/ArSonMix/ArSonMix" -cp LICENSE "$tmp/ArSonMix/LICENSE" -cp LICENSE-NOTICE.txt "$tmp/ArSonMix/LICENSE-NOTICE.txt" -cp docs/THIRD_PARTY_8D_SONKU_HRTF.md "$tmp/ArSonMix/THIRD_PARTY_8D_SONKU_HRTF.md" -cp third_party/signalsmith/LICENSE-STRETCH.txt "$tmp/ArSonMix/LICENSE-SIGNALSMITH-STRETCH.txt" -cp third_party/signalsmith/LICENSE-LINEAR.txt "$tmp/ArSonMix/LICENSE-SIGNALSMITH-LINEAR.txt" -cp web/assets/fonts/OFL-LICENSE-Inter.txt "$tmp/ArSonMix/OFL-LICENSE-Inter.txt" -grep -q '^GNU AFFERO GENERAL PUBLIC LICENSE' "$tmp/ArSonMix/LICENSE" -grep -q 'AGPL-3.0-only' "$tmp/ArSonMix/LICENSE-NOTICE.txt" +# The compiled app carries all original AGPL and third-party notices. +# Fail closed on missing bytes, without cluttering the tarball/DMG root. +python3 scripts/verify_embedded_legal.py --binary "$exe" cat > "$tmp/ArSonMix/README-TEST.txt" <<'INFO' ArSonMix native Linux alpha; UNSIGNED OPEN-SOURCE TEST BUILD. Extract and run ./ArSonMix (chmod +x ArSonMix if needed). diff --git a/scripts/package_native_macos.sh b/scripts/package_native_macos.sh index 382b07a71..3a00a3579 100644 --- a/scripts/package_native_macos.sh +++ b/scripts/package_native_macos.sh @@ -29,14 +29,9 @@ mkdir -p "$out"; out="$(cd "$out" && pwd)" tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT mkdir -p "$tmp/ArSonMix" cp -R "$app" "$tmp/ArSonMix/ArSonMix.app" -cp LICENSE "$tmp/ArSonMix/LICENSE" -cp LICENSE-NOTICE.txt "$tmp/ArSonMix/LICENSE-NOTICE.txt" -cp docs/THIRD_PARTY_8D_SONKU_HRTF.md "$tmp/ArSonMix/THIRD_PARTY_8D_SONKU_HRTF.md" -cp third_party/signalsmith/LICENSE-STRETCH.txt "$tmp/ArSonMix/LICENSE-SIGNALSMITH-STRETCH.txt" -cp third_party/signalsmith/LICENSE-LINEAR.txt "$tmp/ArSonMix/LICENSE-SIGNALSMITH-LINEAR.txt" -cp web/assets/fonts/OFL-LICENSE-Inter.txt "$tmp/ArSonMix/OFL-LICENSE-Inter.txt" -grep -q '^GNU AFFERO GENERAL PUBLIC LICENSE' "$tmp/ArSonMix/LICENSE" -grep -q 'AGPL-3.0-only' "$tmp/ArSonMix/LICENSE-NOTICE.txt" +# The compiled app carries all original AGPL and third-party notices. +# Fail closed on missing bytes, without cluttering the tarball/DMG root. +python3 scripts/verify_embedded_legal.py --binary "$app/Contents/MacOS/$bundle_exe" cat > "$tmp/ArSonMix/README-TEST.txt" <<'INFO' ArSonMix native macOS alpha; COMMUNITY TEST / NO PAID SIGNING. This app has free ad-hoc code signing, not Apple Developer ID/notarization. diff --git a/scripts/package_native_windows.ps1 b/scripts/package_native_windows.ps1 index b1a683c33..a1d22032d 100644 --- a/scripts/package_native_windows.ps1 +++ b/scripts/package_native_windows.ps1 @@ -86,28 +86,10 @@ if (-not (Test-Path -LiteralPath $fatGuide -PathType Leaf)) { throw "Missing hardware FAT guide" } Copy-Item -LiteralPath $readme -Destination (Join-Path $OutputDir "README.md") -# Preserve full AGPLv3 terms and vendor notices next to the shipped binary. -$licenseSources = [ordered]@{ - "LICENSE" = "LICENSE" - "LICENSE-NOTICE.txt" = "LICENSE-NOTICE.txt" - "LICENSE-SIGNALSMITH-STRETCH.txt" = "third_party/signalsmith/LICENSE-STRETCH.txt" - "LICENSE-SIGNALSMITH-LINEAR.txt" = "third_party/signalsmith/LICENSE-LINEAR.txt" - "OFL-LICENSE-Inter.txt" = "web/assets/fonts/OFL-LICENSE-Inter.txt" -} -foreach ($name in $licenseSources.Keys) { - $source = $licenseSources[$name] - if (-not (Test-Path -LiteralPath $source -PathType Leaf)) { - throw "Mandatory source licence missing: $source" - } - Copy-Item -LiteralPath $source -Destination (Join-Path $OutputDir $name) -Force -} +# Verify *compiled* JUCE BinaryData, not loose legal documents in the ZIP. +& python scripts/verify_embedded_legal.py --binary $destination +if ($LASTEXITCODE -ne 0) { throw "Compiled native mixer lacks the exact-source embedded legal texts" } Copy-Item -LiteralPath $fatGuide -Destination (Join-Path $OutputDir "HARDWARE_FAT_GUIDE.md") -# Ship MIT KEMAR/HRIR attribution with the actual portable executable. -$hrirNotice = "docs/THIRD_PARTY_8D_SONKU_HRTF.md" -if (-not (Test-Path -LiteralPath $hrirNotice -PathType Leaf)) { - throw "Mandatory MIT KEMAR/HRIR attribution missing" -} -Copy-Item -LiteralPath $hrirNotice -Destination (Join-Path $OutputDir "THIRD_PARTY_8D_SONKU_HRTF.md") # Selective FAT-only extraction from parked #270, no PCM or GUI production code. $fatBundleFiles = @("collect_hardware_fat_windows.ps1", "m3e_fat_evidence_gate.mjs") foreach ($file in $fatBundleFiles) { @@ -143,12 +125,14 @@ $manifest = [ordered]@{ exeSha256 = (Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash.ToLowerInvariant() fatCollectorSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "collect_hardware_fat_windows.ps1") -Algorithm SHA256).Hash.ToLowerInvariant() fatGateSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "m3e_fat_evidence_gate.mjs") -Algorithm SHA256).Hash.ToLowerInvariant() - hrirNoticeSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "THIRD_PARTY_8D_SONKU_HRTF.md") -Algorithm SHA256).Hash.ToLowerInvariant() - licenseTextSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "LICENSE") -Algorithm SHA256).Hash.ToLowerInvariant() - licenseNoticeSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "LICENSE-NOTICE.txt") -Algorithm SHA256).Hash.ToLowerInvariant() - signalsmithStretchLicenseSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "LICENSE-SIGNALSMITH-STRETCH.txt") -Algorithm SHA256).Hash.ToLowerInvariant() - signalsmithLinearLicenseSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "LICENSE-SIGNALSMITH-LINEAR.txt") -Algorithm SHA256).Hash.ToLowerInvariant() - interOflLicenseSha256 = (Get-FileHash -LiteralPath (Join-Path $OutputDir "OFL-LICENSE-Inter.txt") -Algorithm SHA256).Hash.ToLowerInvariant() + legalEmbedding = "JUCE_BINARYDATA_OFFLINE_LEGAL_CENTER_V1" + hrirNoticeSha256 = (Get-FileHash -LiteralPath "docs/THIRD_PARTY_8D_SONKU_HRTF.md" -Algorithm SHA256).Hash.ToLowerInvariant() + licenseTextSha256 = (Get-FileHash -LiteralPath "LICENSE" -Algorithm SHA256).Hash.ToLowerInvariant() + licenseNoticeSha256 = (Get-FileHash -LiteralPath "LICENSE-NOTICE.txt" -Algorithm SHA256).Hash.ToLowerInvariant() + signalsmithStretchLicenseSha256 = (Get-FileHash -LiteralPath "third_party/signalsmith/LICENSE-STRETCH.txt" -Algorithm SHA256).Hash.ToLowerInvariant() + signalsmithLinearLicenseSha256 = (Get-FileHash -LiteralPath "third_party/signalsmith/LICENSE-LINEAR.txt" -Algorithm SHA256).Hash.ToLowerInvariant() + interOflLicenseSha256 = (Get-FileHash -LiteralPath "web/assets/fonts/OFL-LICENSE-Inter.txt" -Algorithm SHA256).Hash.ToLowerInvariant() + vbCableNoticeSha256 = (Get-FileHash -LiteralPath "installer/VB-CABLE-NOTICE.txt" -Algorithm SHA256).Hash.ToLowerInvariant() approvedGuiRoute = $approvedGui.authoritativePagesRoute approvedGuiOutput = $approvedGui.authoritativePagesOutput approvedGuiCanonicalSource = $approvedGui.canonicalSource diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index 4f5ed6fc0..d88c420c7 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -48,22 +48,8 @@ try { & $csc "/nologo" "/target:winexe" "/reference:System.Windows.Forms.dll" "/out:$(Join-Path $stage 'verified-gui.exe')" (Join-Path $root "tests/fixtures/installer_graceful_close.cs") Assert-Condition ($LASTEXITCODE -eq 0) "Test-only WinForms fixture failed to compile" Copy-Item -LiteralPath (Join-Path $root "assets/icon/arsonmix-app.ico") -Destination (Join-Path $stage "arsonmix-app.ico") - "Test-only installer mechanics fixture" | Set-Content -LiteralPath (Join-Path $stage "README.md") - # Match the real Inno source manifest: full third-party legal notices - # are required for test fixtures as well as public native bundles. - Copy-Item -LiteralPath (Join-Path $root "docs/THIRD_PARTY_8D_SONKU_HRTF.md") -Destination (Join-Path $stage "THIRD_PARTY_8D_SONKU_HRTF.md") - # Keep Inno test staging identical to its legal [Files] contract. - # This is a fixture EXE, but the notices must be real source bytes. - $licenseSources = [ordered]@{ - "LICENSE" = "LICENSE" - "LICENSE-NOTICE.txt" = "LICENSE-NOTICE.txt" - "LICENSE-SIGNALSMITH-STRETCH.txt" = "third_party/signalsmith/LICENSE-STRETCH.txt" - "LICENSE-SIGNALSMITH-LINEAR.txt" = "third_party/signalsmith/LICENSE-LINEAR.txt" - "OFL-LICENSE-Inter.txt" = "web/assets/fonts/OFL-LICENSE-Inter.txt" - } - foreach($name in $licenseSources.Keys){ - Copy-Item -LiteralPath (Join-Path $root $licenseSources[$name]) -Destination (Join-Path $stage $name) - } + # Source legal texts are embedded in the Setup executable by Inno itself; + # the test-only staged EXE deliberately has no JUCE resources. '{"sourceCommit":"TEST_FIXTURE_ONLY","fatStatus":"NOT_A_PRODUCT"}' | Set-Content -LiteralPath (Join-Path $stage "BUILD_PROVENANCE.json") # Contract fixture, NEVER vendor bytes: /VERYSILENT has the optional # vendor step skipped in silent mode. This proves ordinary repair/upgrade can @@ -84,19 +70,23 @@ try { Assert-Condition ($first.ExitCode -eq 0) ("First test install exit="+$first.ExitCode) $installedExe=Join-Path $install "ArSonMix.exe" Assert-Condition (Test-Path -LiteralPath $installedExe -PathType Leaf) "Installed fixture missing" - $mitSourceHash=(Get-FileHash -LiteralPath (Join-Path $root "docs/THIRD_PARTY_8D_SONKU_HRTF.md") -Algorithm SHA256).Hash - $installedMit=Join-Path $install "THIRD_PARTY_8D_SONKU_HRTF.md" - Assert-Condition ((Test-Path -LiteralPath $installedMit -PathType Leaf) -and - (Get-FileHash -LiteralPath $installedMit -Algorithm SHA256).Hash -eq $mitSourceHash) "Inno fixture did not install exact MIT KEMAR notice" - foreach($name in $licenseSources.Keys){ - $actual = Join-Path $install $name - $expected = Join-Path $stage $name - Assert-Condition ((Test-Path -LiteralPath $actual -PathType Leaf) -and - (Get-FileHash -LiteralPath $actual -Algorithm SHA256).Hash -eq - (Get-FileHash -LiteralPath $expected -Algorithm SHA256).Hash) "Inno fixture omitted/modified licence: $name" + # No top-level loose legal documents should be installed. The real FAT + # separately scans the actual JUCE PE for the seven full embedded texts. + foreach($name in @("LICENSE","LICENSE-NOTICE.txt", + "LICENSE-SIGNALSMITH-STRETCH.txt","LICENSE-SIGNALSMITH-LINEAR.txt", + "OFL-LICENSE-Inter.txt","THIRD_PARTY_8D_SONKU_HRTF.md")){ + Assert-Condition (-not (Test-Path -LiteralPath (Join-Path $install $name))) "Installer left redundant legal file: $name" } $fixtureHash=(Get-FileHash -LiteralPath (Join-Path $stage "verified-gui.exe") -Algorithm SHA256).Hash Assert-Condition ((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash -eq $fixtureHash) "First install changed test executable bytes" + # Simulate an actual installed alpha.24 or earlier footprint. + # Same-version in-place upgrade must remove only these known old files. + $legacyLooseFiles=@("LICENSE","LICENSE-NOTICE.txt", + "LICENSE-SIGNALSMITH-STRETCH.txt","LICENSE-SIGNALSMITH-LINEAR.txt", + "OFL-LICENSE-Inter.txt","THIRD_PARTY_8D_SONKU_HRTF.md","README.md") + foreach($name in $legacyLooseFiles){ + "legacy-installer-document" | Set-Content -LiteralPath (Join-Path $install $name) + } $userFile=Join-Path $install "user-file.keep" "user-file-must-survive" | Set-Content -LiteralPath $userFile $fixtureProcess=Start-Process -FilePath $installedExe -ArgumentList @(('"' + $ready + '"'),('"' + $closed + '"')) -PassThru @@ -119,6 +109,9 @@ try { Assert-Condition ($exited -and $marker -and ($acceptedSaves -contains $markerText)) "Inno did not request a saved, graceful Windows session close" Assert-Condition ($newHash -eq $fixtureHash) "Updated installed fixture hash mismatch" Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Update removed user data" + foreach($name in $legacyLooseFiles){ + Assert-Condition (-not (Test-Path -LiteralPath (Join-Path $install $name))) "Legacy legal file survived upgrade: $name" + } # Upgrade from a PRE-HANDSHAKE ArSonMix.exe, exactly the case the old # test omitted and which caused DeleteFile failed; code 5 in the field. # Its FormClosing marker proves an old GUI was asked to quit normally. diff --git a/scripts/verify_embedded_legal.py b/scripts/verify_embedded_legal.py new file mode 100644 index 000000000..3bb6ad731 --- /dev/null +++ b/scripts/verify_embedded_legal.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: AGPL-3.0-only +"""Fail closed unless exact-source legal texts are embedded in a native binary. + +JUCE's juce_add_binary_data generates byte-identical constant resource arrays. +This checks the *real compiled executable*, not just a CMake or source marker. +""" +from __future__ import annotations + +import argparse +from pathlib import Path +import tempfile + +SOURCES = ( + "LICENSE", + "LICENSE-NOTICE.txt", + "docs/THIRD_PARTY_8D_SONKU_HRTF.md", + "third_party/signalsmith/LICENSE-STRETCH.txt", + "third_party/signalsmith/LICENSE-LINEAR.txt", + "web/assets/fonts/OFL-LICENSE-Inter.txt", + "installer/VB-CABLE-NOTICE.txt", +) + + +def verify(binary: bytes, root: Path) -> None: + for path in SOURCES: + source = (root / path).read_bytes() + if len(source) < 50: + raise ValueError(f"Legal notice unexpectedly short: {path}") + if source not in binary: + raise ValueError(f"Native executable missing exact embedded notice: {path}") + if b"GNU AFFERO GENERAL PUBLIC LICENSE" not in binary: + raise ValueError("AGPLv3 marker absent") + if b"END OF TERMS AND CONDITIONS" not in binary: + raise ValueError("Truncated AGPLv3") + + +def self_test(root: Path) -> None: + combined = b"\0".join((root / item).read_bytes() for item in SOURCES) + verify(combined, root) + for missing in SOURCES: + if missing == "LICENSE": + removed = combined.replace((root / missing).read_bytes(), b"bad") + else: + removed = combined.replace((root / missing).read_bytes(), b"bad") + try: + verify(removed, root) + except ValueError: + continue + raise AssertionError(f"Negative embedded-notice check passed: {missing}") + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument("--binary", type=Path) + parser.add_argument("--source-root", type=Path, default=Path(__file__).resolve().parents[1]) + parser.add_argument("--self-test", action="store_true") + args = parser.parse_args() + root = args.source_root.resolve() + if args.self_test: + self_test(root) + print("EMBEDDED_LEGAL_SELF_TEST_PASS") + return + if args.binary is None: + parser.error("--binary is required without --self-test") + verify(args.binary.read_bytes(), root) + print("ARSONMIX_EMBEDDED_LEGAL_BINARY_PASS") + + +if __name__ == "__main__": + main() diff --git a/scripts/verify_native_windows_artifact.ps1 b/scripts/verify_native_windows_artifact.ps1 index e39017fa8..7fab79530 100644 --- a/scripts/verify_native_windows_artifact.ps1 +++ b/scripts/verify_native_windows_artifact.ps1 @@ -11,12 +11,6 @@ $expected = @( "BUILD_PROVENANCE.json", "HARDWARE_FAT_GUIDE.md", "README.md", - "LICENSE", - "LICENSE-NOTICE.txt", - "LICENSE-SIGNALSMITH-STRETCH.txt", - "LICENSE-SIGNALSMITH-LINEAR.txt", - "OFL-LICENSE-Inter.txt", - "THIRD_PARTY_8D_SONKU_HRTF.md", "portable_mode.txt", "collect_hardware_fat_windows.ps1", "m3e_fat_evidence_gate.mjs", @@ -42,45 +36,34 @@ if (@(Compare-Object -ReferenceObject $expected -DifferenceObject $actual).Count } $manifest = Get-Content -LiteralPath (Join-Path $OutputDir "BUILD_PROVENANCE.json") -Raw -Encoding UTF8 | ConvertFrom-Json -$notice = "THIRD_PARTY_8D_SONKU_HRTF.md" -$sourceNotice = Join-Path "docs" $notice -$distNotice = Join-Path $OutputDir $notice -if (-not (Test-Path -LiteralPath $sourceNotice -PathType Leaf) -or - -not (Test-Path -LiteralPath $distNotice -PathType Leaf)) { - throw "MIT/HRIR attribution absent from source or distribution" +# Compare the exact-source legal hashes recorded at packaging, and scan +# the REAL PE for all seven full original bytes (JUCE BinaryData). +if ($manifest.legalEmbedding -ne "JUCE_BINARYDATA_OFFLINE_LEGAL_CENTER_V1") { + throw "Expected embedded legal center missing from provenance" } -$noticeHash = (Get-FileHash -LiteralPath $sourceNotice -Algorithm SHA256).Hash.ToLowerInvariant() -$distNoticeHash = (Get-FileHash -LiteralPath $distNotice -Algorithm SHA256).Hash.ToLowerInvariant() -if ($manifest.hrirNoticeSha256 -ne $noticeHash -or $noticeHash -ne $distNoticeHash) { - throw "Third-party HRIR notice differs from exact source/manifest" +$legalSources = [ordered]@{ + "LICENSE" = "licenseTextSha256" + "LICENSE-NOTICE.txt" = "licenseNoticeSha256" + "docs/THIRD_PARTY_8D_SONKU_HRTF.md" = "hrirNoticeSha256" + "third_party/signalsmith/LICENSE-STRETCH.txt" = "signalsmithStretchLicenseSha256" + "third_party/signalsmith/LICENSE-LINEAR.txt" = "signalsmithLinearLicenseSha256" + "web/assets/fonts/OFL-LICENSE-Inter.txt" = "interOflLicenseSha256" + "installer/VB-CABLE-NOTICE.txt" = "vbCableNoticeSha256" } -$noticeText = Get-Content -LiteralPath $distNotice -Raw -Encoding UTF8 -foreach ($marker in @("Bill Gardner", "Keith Martin", "Aristotel Digenis", - "Permission is hereby granted", "THE SOFTWARE IS PROVIDED")) { - if (-not $noticeText.Contains($marker)) { throw "Incomplete HRIR notice: $marker" } -} -# Source, staged bytes, and exact-source manifest hashes must ALL agree. -$licenseFiles = [ordered]@{ - "LICENSE" = @("LICENSE", "licenseTextSha256") - "LICENSE-NOTICE.txt" = @("LICENSE-NOTICE.txt", "licenseNoticeSha256") - "LICENSE-SIGNALSMITH-STRETCH.txt" = @("third_party/signalsmith/LICENSE-STRETCH.txt", "signalsmithStretchLicenseSha256") - "LICENSE-SIGNALSMITH-LINEAR.txt" = @("third_party/signalsmith/LICENSE-LINEAR.txt", "signalsmithLinearLicenseSha256") - "OFL-LICENSE-Inter.txt" = @("web/assets/fonts/OFL-LICENSE-Inter.txt", "interOflLicenseSha256") -} -foreach ($name in $licenseFiles.Keys) { - $source = $licenseFiles[$name][0] - $field = $licenseFiles[$name][1] - $sourceHash = (Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash.ToLowerInvariant() - $distHash = (Get-FileHash -LiteralPath (Join-Path $OutputDir $name) -Algorithm SHA256).Hash.ToLowerInvariant() - if ($sourceHash -ne $distHash -or $distHash -ne $manifest.$field) { - throw "Distribution licence missing or differs from source: $name" +foreach ($source in $legalSources.Keys) { + $key = $legalSources[$source] + $actualHash = (Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash.ToLowerInvariant() + if ($manifest.$key -ne $actualHash) { + throw "Embedded legal source changed since packaging: $source" } } -$agplText = Get-Content -LiteralPath (Join-Path $OutputDir "LICENSE") -Raw -Encoding UTF8 +$agplText = Get-Content -LiteralPath "LICENSE" -Raw -Encoding UTF8 if (-not $agplText.StartsWith("GNU AFFERO GENERAL PUBLIC LICENSE") -or -not $agplText.Contains("END OF TERMS AND CONDITIONS")) { - throw "Full AGPL-3.0 text absent from distribution" + throw "Source AGPL text is incomplete" } +& python scripts/verify_embedded_legal.py --binary (Join-Path $OutputDir $expected[0]) +if ($LASTEXITCODE -ne 0) { throw "Exact-source embedded legal scan failed" } # FAT tools match source bytes, distributed bytes AND the current SHA manifest. $fatTools = @{ "collect_hardware_fat_windows.ps1" = [string]$manifest.fatCollectorSha256 diff --git a/src/EmbeddedLegalResources.h b/src/EmbeddedLegalResources.h new file mode 100644 index 000000000..9698e8a69 --- /dev/null +++ b/src/EmbeddedLegalResources.h @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once + +// The native JUCE binary owns the complete offline legal notices. +// Resource names are deterministic CMake configure_file() outputs. +// No adjacent .txt/.md files or runtime filesystem requests are required. +inline bool resolveEmbeddedLegalResource (const juce::String& request, + const char*& data, int& size, + juce::String& mime) +{ + const auto path = request.upToFirstOccurrenceOf ("?", false, false); + mime = "text/plain; charset=utf-8"; +#define ARMIX_LEGAL_ROUTE(route, symbol) \ + if (path == route) { data = BinaryData::symbol; size = BinaryData::symbol##Size; return true; } + ARMIX_LEGAL_ROUTE ("/legal/overview", armixnotice_txt) + ARMIX_LEGAL_ROUTE ("/legal/agpl", armixagpl_txt) + ARMIX_LEGAL_ROUTE ("/legal/hrir", armixhrirmit_txt) + ARMIX_LEGAL_ROUTE ("/legal/signalsmith-stretch", armixsignalsmithstretch_txt) + ARMIX_LEGAL_ROUTE ("/legal/signalsmith-linear", armixsignalsmithlinear_txt) + ARMIX_LEGAL_ROUTE ("/legal/inter", armixinterofl_txt) + ARMIX_LEGAL_ROUTE ("/legal/vb-cable", armixvbcablenotice_txt) +#undef ARMIX_LEGAL_ROUTE + return false; +} diff --git a/src/Main.cpp b/src/Main.cpp index de8f7b1c4..7b5e76c1b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -5,6 +5,7 @@ #include #include #include "ApprovedGuiResources.h" +#include "EmbeddedLegalResources.h" #include "ApprovedConsoleNativeTransportV6.h" #include "../integration/ApprovedNativeRuntimeSnapshot.h" #include "../integration/ApprovedNativeControlIntent.h" @@ -92,7 +93,8 @@ std::optional assetFor (const juce::String& juce::String mime; // Auto-generated from the SAME approved Pages GUI and PNG-button skin. // Legacy web/index.html and web/console-native.html cannot be served here. - if (! resolveApprovedGuiResource (path, data, size, mime)) + if (! resolveEmbeddedLegalResource (path, data, size, mime) + && ! resolveApprovedGuiResource (path, data, size, mime)) return std::nullopt; juce::WebBrowserComponent::Resource resource; @@ -344,6 +346,17 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr }) .withEventListener ("arMixParameter", [this] (juce::var args) { onParameter (args); }) .withEventListener ("arMixAction", [this] (juce::var args) { onAction (args); }) + .withEventListener ("arMixOpenLegalSource", [] (juce::var) + { + // Exact source for this *binary*; open only on user request, + // never from a mixer callback, startup, or a remote URL. + const juce::String sha (ARMIX_BUILD_SOURCE_SHA); + const auto source = sha.length() == 40 + && sha.containsOnly ("0123456789abcdef") + ? "https://github.com/masarray/arsonmix/tree/" + sha + : "https://github.com/masarray/arsonmix"; + juce::URL (source).launchInDefaultBrowser(); + }) .withResourceProvider (assetFor)) { settingsDirectory().createDirectory(); diff --git a/tests/embedded_legal_center_chromium_smoke.py b/tests/embedded_legal_center_chromium_smoke.py new file mode 100644 index 000000000..92ad0963f --- /dev/null +++ b/tests/embedded_legal_center_chromium_smoke.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: AGPL-3.0-only +"""Real Chromium audit of the native-only embedded legal center. + +Runs the exact assembled desktop DOM with a JUCE transport stub. The tiny +local HTTP server supplies the same exact-source notices that JUCE BinaryData +serves in the production executable. It does not simulate audio or PCM. +""" +from __future__ import annotations + +import importlib.util +from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path +from threading import Thread +from tempfile import TemporaryDirectory +from urllib.parse import urlsplit + +from playwright.sync_api import sync_playwright + +ROOT = Path(__file__).resolve().parents[1] +DOCUMENTS = { + "overview": "LICENSE-NOTICE.txt", + "agpl": "LICENSE", + "hrir": "docs/THIRD_PARTY_8D_SONKU_HRTF.md", + "signalsmith-stretch": "third_party/signalsmith/LICENSE-STRETCH.txt", + "signalsmith-linear": "third_party/signalsmith/LICENSE-LINEAR.txt", + "inter": "web/assets/fonts/OFL-LICENSE-Inter.txt", + "vb-cable": "installer/VB-CABLE-NOTICE.txt", +} + + +def main() -> None: + spec = importlib.util.spec_from_file_location( + "native_bundle", ROOT / "scripts/build_approved_native_gui.py" + ) + assert spec is not None and spec.loader is not None + bundle = importlib.util.module_from_spec(spec) + spec.loader.exec_module(bundle) + with TemporaryDirectory(prefix="arsonmix-legal-") as folder: + stage = Path(folder) + bundle.stage(stage) + + class Handler(SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, directory=str(stage), **kwargs) + + def log_message(self, fmt, *args): + pass + + def do_GET(self): + route = urlsplit(self.path).path + if route.startswith("/legal/"): + path = DOCUMENTS.get(route.removeprefix("/legal/")) + if path is None: + self.send_error(404) + return + data = (ROOT / path).read_bytes() + self.send_response(200) + self.send_header("Content-Type", "text/plain; charset=utf-8") + self.send_header("Content-Length", str(len(data))) + self.end_headers() + self.wfile.write(data) + return + super().do_GET() + + host = ThreadingHTTPServer(("127.0.0.1", 0), Handler) + worker = Thread(target=host.serve_forever, daemon=True) + worker.start() + try: + url = f"http://127.0.0.1:{host.server_port}/index.html" + with sync_playwright() as playwright: + browser = playwright.chromium.launch(headless=True) + for width, height in ((1680, 900), (1100, 650)): + page = browser.new_page(viewport={"width": width, "height": height}) + errors: list[str] = [] + page.on("pageerror", lambda error: errors.append(str(error))) + page.add_init_script("""window.__legalEvents=[]; + window.__JUCE__={backend:{ + emitEvent(name,payload){window.__legalEvents.push({name,payload});}, + addEventListener(){ } + }};""") + page.goto(url) + entry = page.locator("#armix-open-legal") + entry.wait_for(state="attached", timeout=15000) + backdrop = page.locator("#armix-legal-backdrop") + assert not backdrop.is_visible(), "Legal modal must not appear at startup" + assert page.locator("#armix-open-legal").count() == 1 + page.locator("#moreTools > summary").click() + entry.click() + assert backdrop.is_visible(), "About & Licenses did not open" + assert page.locator('#armix-legal-panel[role="dialog"][aria-modal="true"]').count() == 1 + page.wait_for_function("""()=>document.querySelector('#armix-legal-text') + ?.textContent.includes('ArSonMix')""") + page.locator('.armix-legal-tab[data-doc="agpl"]').click() + page.wait_for_function("""()=>document.querySelector('#armix-legal-text') + ?.textContent.includes('END OF TERMS AND CONDITIONS')""") + assert page.locator("#armix-legal-text").text_content().__len__() > 30000 + page.locator('.armix-legal-tab[data-doc="hrir"]').click() + page.wait_for_function("""()=>document.querySelector('#armix-legal-text') + ?.textContent.includes('Bill Gardner')""") + page.locator('.armix-legal-tab[data-doc="inter"]').click() + page.wait_for_function("""()=>document.querySelector('#armix-legal-text') + ?.textContent.includes('SIL OPEN FONT LICENSE')""") + page.locator('.armix-legal-tab[data-doc="overview"]').click() + page.wait_for_function("""()=>document.querySelector('#armix-legal-text') + ?.textContent.includes('WITHOUT ANY WARRANTY')""") + page.locator("#armix-legal-footer button").first.click() + assert page.evaluate("""()=>window.__legalEvents.some( + event=>event.name==='arMixOpenLegalSource')""") + geometry = page.evaluate("""()=>{ + const p=document.getElementById('armix-legal-panel') + .getBoundingClientRect(); + const nav=document.getElementById('armix-legal-nav') + .getBoundingClientRect(); + const b=document.getElementById('armix-legal-backdrop') + .getBoundingClientRect(); + return {panel:p.toJSON(),nav:nav.toJSON(),backdrop:b.toJSON(), + width:innerWidth,height:innerHeight}; + }""") + assert geometry["panel"]["left"] >= 0, geometry + assert geometry["panel"]["right"] <= width, geometry + assert geometry["panel"]["bottom"] <= height, geometry + assert geometry["nav"]["right"] < geometry["panel"]["right"], geometry + page.screenshot(path=str(ROOT / f"arsonmix-legal-center-{width}.png"), + full_page=False) + page.keyboard.press("Escape") + assert not backdrop.is_visible(), "Escape did not close legal modal" + assert page.evaluate("""()=>document.activeElement=== + document.querySelector('#moreTools > summary')"""), ( + "Close must return keyboard focus to a visible control" + ) + assert not errors, (width, errors) + page.close() + browser.close() + finally: + host.shutdown() + host.server_close() + worker.join(timeout=3) + print("PASS: native-only legal center, full notices, two Chromium sizes and accessible close") + + +if __name__ == "__main__": + main() diff --git a/tests/license_distribution_contract.test.mjs b/tests/license_distribution_contract.test.mjs index 98db9da42..0d5fd923e 100644 --- a/tests/license_distribution_contract.test.mjs +++ b/tests/license_distribution_contract.test.mjs @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -// Fast no-compiler check of first-party licence and exact release boundaries. +// Fast no-compiler contract for an OFFLINE legal center and clean distributions. import test from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; @@ -7,69 +7,99 @@ import { readFileSync } from 'node:fs'; const read = path => readFileSync(path, 'utf8'); const full = read('LICENSE'); const notice = read('LICENSE-NOTICE.txt'); -const fx = read('src/NativeBuiltInFx.h'); -test('the repository contains the complete canonical AGPLv3 text', () => { +test('canonical full GNU AGPLv3 and original native FX scope remain intact', () => { assert.match(full, /^GNU AFFERO GENERAL PUBLIC LICENSE\nVersion 3, 19 November 2007/); assert.match(full, /END OF TERMS AND CONDITIONS/); - assert.ok(full.length > 30000, 'full AGPLv3 legal text required'); - assert.match(notice, /SPDX-License-Identifier: AGPL-3\.0-only/); - assert.match(notice, /GNU Affero General Public License, version 3\nonly/); - assert.match(read('README.md'), /AGPL-3\.0-only \(GNU Affero/); + assert.ok(full.length > 30000); + assert.match(notice, /AGPL-3\.0-only/); + assert.match(notice, /Third-party materials are NOT relicensed/); + for(const name of ['Parametric EQ','Compressor','Harmonice','Vocal Delay', + '8D-SonKu','Guitar FX Rig','ImmerSIB']) + assert.ok(notice.includes(name), 'missing source scope '+name); + for(const source of ['src/Main.cpp','src/LiveAudioEngine.h','src/NativeBuiltInFx.h', + 'engine/builtin_fx/ChannelEqProcessor.h', + 'engine/builtin_fx/ChannelCompressorProcessor.h', + 'engine/builtin_fx/ChannelHarmonyProcessor.h', + 'engine/builtin_fx/VocalThrowProcessor.h', + 'engine/builtin_fx/SonKuSpatialProcessor.h', + 'engine/builtin_fx/GuitarRigProcessor.h', + 'engine/builtin_fx/ImerSipP92Processor.h']) + assert.match(read(source).slice(0,300), /SPDX-License-Identifier: AGPL-3\.0-only/,source); + assert.match(read('engine/builtin_fx/sonku/SonKuMeasuredHrir.h').slice(0,100), /SPDX-License-Identifier: MIT/); }); -test('native mixer and built-in effects are AGPL, vendor plugins remain separate', () => { - for (const name of ['Parametric EQ','Compressor','Harmonice','Vocal Delay', - '8D-SonKu','Guitar FX Rig','ImmerSIB']) { - assert.ok(notice.includes(name), 'missing native FX scope: '+name); +test('all exact-source legal documents live inside the one native JUCE binary', () => { + const cmake=read('CMakeLists.txt'); + const hdr=read('src/EmbeddedLegalResources.h'); + const app=read('src/Main.cpp'); + const build=read('scripts/build_approved_native_gui.py'); + const ui=read('web/approved-native-legal.js'); + for(const symbol of ['armixagpl','armixnotice','armixhrirmit', + 'armixsignalsmithstretch','armixsignalsmithlinear','armixinterofl', + 'armixvbcablenotice']){ + assert.ok(cmake.includes('/'+symbol+'.txt'),symbol+' not staged for binary'); + assert.ok(hdr.includes(symbol+'_txt'),symbol+' not mapped to JUCE data'); } - for (const source of [ - 'src/Main.cpp', 'src/LiveAudioEngine.h', 'src/NativeBuiltInFx.h', - 'engine/builtin_fx/ChannelEqProcessor.h', - 'engine/builtin_fx/ChannelCompressorProcessor.h', - 'engine/builtin_fx/ChannelHarmonyProcessor.h', - 'engine/builtin_fx/VocalThrowProcessor.h', - 'engine/builtin_fx/SonKuSpatialProcessor.h', - 'engine/builtin_fx/GuitarRigProcessor.h', - 'engine/builtin_fx/ImerSipP92Processor.h' - ]) assert.match(read(source).slice(0,300), /SPDX-License-Identifier: AGPL-3\.0-only/, source); - assert.match(fx, /static_assert\(validNativeBuiltInFxCatalog\(nativeBuiltInFx\)\)/); - assert.match(notice, /Third-party materials are NOT relicensed/); - assert.match(read('third_party/signalsmith/README.md'), /MIT licensed/); + assert.match(cmake, /\$\{ARMIX_LEGAL_RESOURCE_FILES\}/); + assert.match(cmake, /ARMIX_LEGAL_RESOURCE_COUNT EQUAL 7/); + assert.match(app, /resolveEmbeddedLegalResource \(path, data, size, mime\)/); + assert.match(app, /arMixOpenLegalSource/); + assert.match(app, /ARMIX_BUILD_SOURCE_SHA/); + assert.match(build, /approved-native-legal\.js/); + assert.match(ui, /#moreTools \.more-tools-panel/); + assert.match(ui, /fetch\("\.\/legal\/"/); + assert.match(ui, /aria-modal/); + assert.match(ui, /document\.querySelector\("#moreTools > summary"\)/); + assert.match(read('.github/workflows/ui-smoke.yml'),/tests\/embedded_legal_center_chromium_smoke\.py/); + assert.doesNotMatch(ui, /AudioIODeviceCallback|nativeDSP|setInterval/); + assert.match(read('scripts/verify_embedded_legal.py'), /source not in binary/); }); -test('Windows portable, Inno installer and Linux/macOS embed licence notices', () => { +test('Windows portable ZIP and Inno installer retain zero top-level legal files', () => { const win=read('scripts/package_native_windows.ps1'); const verify=read('scripts/verify_native_windows_artifact.ps1'); const iss=read('installer/ArSonMix.iss'); const fat=read('scripts/build_verify_windows_installer.ps1'); const smoke=read('scripts/test_inno_graceful_update_windows.ps1'); - for (const name of ['LICENSE','LICENSE-NOTICE.txt','LICENSE-SIGNALSMITH-STRETCH.txt', - 'LICENSE-SIGNALSMITH-LINEAR.txt','OFL-LICENSE-Inter.txt']) { - assert.ok(win.includes('"'+name+'"'), 'Windows packager missing '+name); - assert.ok(verify.includes('"'+name+'"'), 'Windows verifier missing '+name); - assert.ok(iss.includes('\\'+name+'"'), 'Inno setup missing '+name); - assert.ok(fat.includes('"'+name+'"'), 'installed FAT missing '+name); - assert.ok(smoke.includes('"'+name+'"'), 'Inno smoke fixture missing '+name); + assert.match(win,/verify_embedded_legal\.py --binary \$destination/); + assert.match(verify,/verify_embedded_legal\.py --binary/); + assert.match(verify,/Compare-Object -ReferenceObject \$expected -DifferenceObject \$actual/); + assert.match(fat,/verify_embedded_legal\.py --binary \$installedExe/); + assert.match(smoke,/Installer left redundant legal file/); + assert.match(iss,/Source: "\.\.\\LICENSE"; Flags: dontcopy/); + assert.match(iss,/Source: "\.\.\\docs\\THIRD_PARTY_8D_SONKU_HRTF\.md"; Flags: dontcopy/); + assert.doesNotMatch(iss,/^LicenseFile=/m); + assert.match(iss,/Flags: dontcopy/); + assert.match(iss,/\[InstallDelete\]/); + for (const legacy of ['LICENSE','LICENSE-NOTICE.txt','LICENSE-SIGNALSMITH-STRETCH.txt', + 'LICENSE-SIGNALSMITH-LINEAR.txt','OFL-LICENSE-Inter.txt', + 'THIRD_PARTY_8D_SONKU_HRTF.md','README.md']) { + assert.ok(iss.includes('Type: files; Name: "{app}\\'+legacy+'"'), + 'legacy upgrade cleanup missing: '+legacy); + } + assert.doesNotMatch(iss,/^Source:.*\\README\.md.*DestDir: "\{app\}"/m); + assert.match(smoke,/Legacy legal file survived upgrade/); + assert.match(fat,/Old loose legal file survived in-place update/); + for(const key of ['licenseTextSha256','licenseNoticeSha256','hrirNoticeSha256', + 'signalsmithStretchLicenseSha256','signalsmithLinearLicenseSha256', + 'interOflLicenseSha256','vbCableNoticeSha256']){ + assert.ok(win.includes(key+' = '),key+' absent from packager manifest'); + assert.ok(verify.includes('"'+key+'"'),key+' absent from verifier'); } - for (const key of ['licenseTextSha256','licenseNoticeSha256', - 'signalsmithStretchLicenseSha256','signalsmithLinearLicenseSha256', - 'interOflLicenseSha256']) { - assert.ok(win.includes(key+' = '), 'manifest missing '+key); - assert.ok(verify.includes('"'+key+'"'), 'independent verifier missing '+key); - assert.ok(fat.includes('"'+key+'"'), 'installer FAT missing '+key); + for(const name of ['LICENSE','LICENSE-NOTICE.txt','OFL-LICENSE-Inter.txt', + 'THIRD_PARTY_8D_SONKU_HRTF.md']){ + assert.doesNotMatch(win,new RegExp('Destination \\(Join-Path \\$OutputDir "'+name.replaceAll('.','\\.')+'"\\)')); } - assert.match(verify, /Full AGPL-3\.0 text absent from distribution/); - assert.match(verify, /Compare-Object -ReferenceObject \$expected -DifferenceObject \$actual/); - assert.match(fat, /Installed licence missing or altered/); - for (const pkg of ['scripts/package_native_linux.sh','scripts/package_native_macos.sh']) { - const s=read(pkg); - assert.match(s, /cp LICENSE "\$tmp\/ArSonMix\/LICENSE"/); - assert.match(s, /cp LICENSE-NOTICE\.txt/); - assert.match(s, /THIRD_PARTY_8D_SONKU_HRTF\.md/); - assert.match(s, /LICENSE-SIGNALSMITH-STRETCH\.txt/); - assert.match(s, /LICENSE-SIGNALSMITH-LINEAR\.txt/); - assert.match(s, /OFL-LICENSE-Inter\.txt/); + assert.match(read('README.md'),/About & Licenses/); +}); + +test('Linux/macOS scan the real native binary without loose AGPL texts', () => { + for(const pkg of ['scripts/package_native_linux.sh','scripts/package_native_macos.sh']){ + const script=read(pkg); + assert.match(script,/python3 scripts\/verify_embedded_legal\.py --binary/); + assert.doesNotMatch(script,/cp LICENSE "\$tmp\/ArSonMix\/LICENSE"/); + assert.doesNotMatch(script,/cp LICENSE-NOTICE\.txt/); } assert.match(read('site/index.html'), /AGPL-3\.0 license<\/a>/); }); diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index b8add8e1d..2d8bcb195 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -28,8 +28,9 @@ test('per-user Inno Setup upgrades the same app and retains private Studio data' assert.doesNotMatch(iss, /taskkill|Stop-Process|TerminateProcess|CloseApplications=force/i); assert.match(iss, /Name: "\{autoprograms\}\\ArSonMix"/); assert.match(iss, /FactoryFX\\\*.*skipifsourcedoesntexist/); - assert.match(ps, /Installed third-party KEMAR\/MIT notice missing or altered/); - assert.match(ps, /THIRD_PARTY_8D_SONKU_HRTF\.md/); + assert.match(ps, /verify_embedded_legal\.py --binary \$installedExe/); + assert.match(ps, /Installer left a redundant top-level legal document/); + assert.match(iss, /Source: "\.\.\\docs\\THIRD_PARTY_8D_SONKU_HRTF\.md"; Flags: dontcopy/); }); test('official standard VB-CABLE ZIP is pinned and checked automatically without elevating ArSonMix', () => { diff --git a/web/approved-native-legal.js b/web/approved-native-legal.js new file mode 100644 index 000000000..a575dd514 --- /dev/null +++ b/web/approved-native-legal.js @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Native-only, on-demand legal center. Never affects the approved mixer +// renderer, user session, PCM, or Pages /preview/ reference. +(() => { + "use strict"; + const backend = window.__JUCE__?.backend; + if (!backend?.emitEvent) return; + const notices = Object.freeze([ + {id:"overview", label:"ArSonMix", caption:"License scope & source"}, + {id:"agpl", label:"GNU AGPLv3", caption:"Complete license · AGPL-3.0-only"}, + {id:"hrir", label:"Measured HRIR", caption:"MIT KEMAR attribution"}, + {id:"signalsmith-stretch", label:"Signalsmith Stretch", caption:"Third-party license"}, + {id:"signalsmith-linear", label:"Signalsmith Linear", caption:"Third-party license"}, + {id:"inter", label:"Inter Typeface", caption:"SIL Open Font License"}, + {id:"vb-cable", label:"VB-CABLE", caption:"Optional third-party driver"} + ]); + const cache = new Map(); + const css = ` +#armix-legal-backdrop{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;background:rgba(3,9,15,.72);padding:20px;box-sizing:border-box;font-family:Inter,system-ui,sans-serif;color:#e8f0f5} +#armix-legal-backdrop[hidden]{display:none!important} +#armix-legal-panel{width:min(790px,96vw);height:min(600px,88vh);min-height:330px;display:flex;flex-direction:column;background:#151f29;border:1px solid #31414e;border-radius:11px;box-shadow:0 22px 80px rgba(0,0,0,.48);overflow:hidden;font-size:13px;font-weight:400} +#armix-legal-header{display:flex;align-items:center;gap:14px;padding:17px 21px;border-bottom:1px solid #2c3945} +#armix-legal-header strong{font-weight:550;font-size:17px;letter-spacing:.1px} +#armix-legal-header small{display:block;color:#9eafbb;font-size:11px;margin-top:3px} +#armix-legal-close{margin-left:auto;border:0;border-radius:6px;background:transparent;color:#b9c9d3;font-size:20px;width:30px;height:30px;cursor:pointer} +#armix-legal-close:hover{background:#283846;color:#fff} +#armix-legal-layout{display:flex;min-height:0;flex:1} +#armix-legal-nav{width:176px;flex:none;overflow-y:auto;background:#111b24;border-right:1px solid #2c3945;padding:12px 8px;box-sizing:border-box} +.armix-legal-tab{display:block;width:100%;background:none;border:0;border-radius:6px;color:#a7b8c5;text-align:left;padding:10px 11px;font:inherit;cursor:pointer} +.armix-legal-tab:hover{background:#21303c;color:#e9f4fa} +.armix-legal-tab[aria-selected=true]{background:#273b49;color:#d6f4ff;box-shadow:inset 2px 0 #63bfd3} +#armix-legal-body{display:flex;flex-direction:column;flex:1;min-width:0} +#armix-legal-subtitle{padding:15px 20px 12px;color:#9db3c1;border-bottom:1px solid #263540;font-size:12px} +#armix-legal-text{margin:0;flex:1;overflow:auto;padding:19px 21px 22px;white-space:pre-wrap;overflow-wrap:anywhere;color:#cfdbe3;font:12px/1.7 ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:4;user-select:text} +#armix-legal-footer{display:flex;align-items:center;gap:10px;padding:12px 18px;border-top:1px solid #2c3945} +#armix-legal-footer span{font-size:11px;color:#91a5b3;flex:1} +.armix-legal-action{background:transparent;border:1px solid #3d5464;color:#d7e8f2;border-radius:6px;padding:7px 12px;font:inherit;cursor:pointer} +.armix-legal-action:hover{border-color:#78bdcf;background:#253845} +.armix-legal-action:focus-visible,.armix-legal-tab:focus-visible,#armix-legal-close:focus-visible{outline:2px solid #77cadb;outline-offset:2px} +@media(max-width:560px){#armix-legal-backdrop{padding:8px}#armix-legal-panel{height:min(600px,95vh)}#armix-legal-nav{width:128px}#armix-legal-text{padding:12px;font-size:11px}#armix-legal-header{padding:12px}} +`; + function element(tag, id, className, text) { + const node = document.createElement(tag); + if (id) node.id = id; + if (className) node.className = className; + if (text !== undefined) node.textContent = text; + return node; + } + function install() { + const menu = document.querySelector("#moreTools .more-tools-panel"); + if (!menu || document.getElementById("armix-open-legal")) return; + const caption = element("span", null, "more-tools-caption", "APPLICATION"); + const entry = element("button", "armix-open-legal", "tool", "About & Licenses"); + entry.type = "button"; + entry.title = "Read ArSonMix license and third-party notices offline"; + menu.append(caption, entry); + + const style = element("style", "armix-legal-style"); + style.textContent = css; document.head.append(style); + const backdrop = element("div", "armix-legal-backdrop"); + backdrop.hidden = true; + const panel = element("section", "armix-legal-panel"); + panel.setAttribute("role", "dialog"); + panel.setAttribute("aria-modal", "true"); + panel.setAttribute("aria-labelledby", "armix-legal-title"); + const header = element("header", "armix-legal-header"); + const identity = element("div"); + identity.append(element("strong", "armix-legal-title", null, "ArSonMix")); + identity.append(element("small", null, null, "About & Licenses · Offline legal documents")); + const close = element("button", "armix-legal-close", null, "×"); + close.type="button"; close.setAttribute("aria-label", "Close legal information"); + header.append(identity, close); + const layout = element("div", "armix-legal-layout"); + const nav = element("nav", "armix-legal-nav"); + nav.setAttribute("aria-label", "Legal documents"); + const body = element("div", "armix-legal-body"); + const subtitle = element("div", "armix-legal-subtitle"); + const content = element("pre", "armix-legal-text"); + content.setAttribute("tabindex", "0"); + body.append(subtitle,content);layout.append(nav,body); + const footer=element("footer","armix-legal-footer"); + const status=element("span", null, null, "© 2026 ArSonMix contributors · AGPL-3.0-only · No warranty"); + const source=element("button",null,"armix-legal-action","View source"); + source.type="button";source.title="Open the source code for this build"; + source.addEventListener("click",()=>backend.emitEvent("arMixOpenLegalSource",{})); + const copy=element("button",null,"armix-legal-action","Copy text"); + copy.type="button"; + copy.addEventListener("click", async()=>{ + try { + await navigator.clipboard.writeText(content.textContent||""); + copy.textContent="Copied"; + copy.blur(); + } catch (_) { + content.focus(); + const selection=window.getSelection(); + const range=document.createRange(); + range.selectNodeContents(content); + selection?.removeAllRanges(); + selection?.addRange(range); + copy.textContent="Select to copy"; + } + }); + footer.append(status,source,copy); + panel.append(header,layout,footer); + backdrop.append(panel); + document.body.append(backdrop); + const buttons=[]; + let origin=null; + let version=0; + async function select(item) { + const current=++version; + buttons.forEach(button=>button.setAttribute("aria-selected",String(button.dataset.doc===item.id))); + subtitle.textContent=item.caption; + content.textContent="Loading embedded notice…"; + content.scrollTop=0; + copy.textContent="Copy text"; + if (cache.has(item.id)) {content.textContent=cache.get(item.id);return;} + try { + const response=await fetch("./legal/"+item.id,{cache:"no-store"}); + if(!response.ok) throw Error("Notice unavailable"); + const text=await response.text(); + if (!text.trim()) throw Error("Empty notice"); + cache.set(item.id,text); + if(current===version) content.textContent=text; + } catch (_) { + if(current===version) content.textContent="Unable to load the embedded legal notice. Please use the source repository."; + } + } + for (const item of notices) { + const tab=element("button",null,"armix-legal-tab",item.label); + tab.type="button";tab.dataset.doc=item.id; + tab.setAttribute("aria-selected","false"); + tab.addEventListener("click",()=>select(item)); + buttons.push(tab);nav.append(tab); + } + const dismiss=()=>{ + if(backdrop.hidden)return; + backdrop.hidden=true; + version++; + origin?.focus?.(); + }; + close.addEventListener("click",dismiss); + backdrop.addEventListener("click",event=>{if(event.target===backdrop)dismiss();}); + document.addEventListener("keydown",event=>{ + if(backdrop.hidden)return; + if(event.key==="Escape"){event.preventDefault();event.stopImmediatePropagation();dismiss();} + if(event.key==="Tab"){ + const focusables=[close,...buttons,content,source,copy]; + const index=focusables.indexOf(document.activeElement); + if(event.shiftKey&&index<=0){event.preventDefault();copy.focus();} + else if(!event.shiftKey&&index===focusables.length-1){event.preventDefault();close.focus();} + } + },true); + entry.addEventListener("click",()=>{ + // Closing
hides entry itself. Restore focus to the still- + // visible summary, never to an invisible menu item. + origin=document.querySelector("#moreTools > summary") || entry; + document.getElementById("moreTools").open=false; + backdrop.hidden=false; + select(notices[0]); + close.focus(); + }); + } + if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",install,{once:true}); + else install(); +})();