From f6478786c238f08aa8007d1c45a121d4b6b708a6 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:39:36 +0200 Subject: [PATCH 01/59] Rename the program to MPRP (Media Player Rich Presence) The mechanical part of the rename: the Go module is github.com/CptPakundo/MPRP, cmd/mpcvibedrpc is cmd/mprp, the MPCRPC_* environment variables are MPRP_*, and every text, log line, window title, tray tooltip, class name, User-Agent, Plex product, Jellyfin/Emby client name, update source, player logo address, release file name, CI script, workflow and doc says MPRP. The exe's description gives the long form, "Media Player Rich Presence". Old changelog entries and the frozen golden data keep the old name. The migrations for existing installs and the old release file names follow in their own commits. Co-Authored-By: Claude Opus 5.5 --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/actions/build-unix/action.yml | 14 ++-- .github/actions/build-windows/action.yml | 16 ++--- .github/workflows/canary.yml | 2 +- .github/workflows/ci.yml | 10 +-- .github/workflows/docs.yml | 2 +- .github/workflows/release.yml | 42 ++++++------ AGENTS.md | 14 ++-- CONTRIBUTING.md | 6 +- README.md | 22 +++---- SECURITY.md | 8 +-- THIRD-PARTY-NOTICES.md | 2 +- cmd/{mpcvibedrpc => mprp}/accounts.go | 8 +-- cmd/{mpcvibedrpc => mprp}/api.go | 18 ++--- cmd/{mpcvibedrpc => mprp}/api_test.go | 14 ++-- cmd/{mpcvibedrpc => mprp}/app.go | 20 +++--- cmd/{mpcvibedrpc => mprp}/changelog_test.go | 4 +- .../e2e_rollback_test.go | 8 +-- cmd/{mpcvibedrpc => mprp}/e2e_test.go | 8 +-- cmd/{mpcvibedrpc => mprp}/handover_test.go | 12 ++-- cmd/{mpcvibedrpc => mprp}/hide_test.go | 6 +- cmd/{mpcvibedrpc => mprp}/ipc_test.go | 0 cmd/{mpcvibedrpc => mprp}/ipc_windows_test.go | 0 cmd/{mpcvibedrpc => mprp}/jellyfin.go | 6 +- cmd/{mpcvibedrpc => mprp}/jellyfin_test.go | 4 +- cmd/{mpcvibedrpc => mprp}/launch_darwin.go | 6 +- cmd/{mpcvibedrpc => mprp}/launch_other.go | 0 cmd/{mpcvibedrpc => mprp}/logger.go | 0 cmd/{mpcvibedrpc => mprp}/logger_test.go | 0 cmd/{mpcvibedrpc => mprp}/main.go | 24 +++---- cmd/{mpcvibedrpc => mprp}/players_doc_test.go | 2 +- cmd/{mpcvibedrpc => mprp}/plex.go | 6 +- cmd/{mpcvibedrpc => mprp}/plex_test.go | 4 +- cmd/{mpcvibedrpc => mprp}/selfcheck.go | 10 +-- cmd/{mpcvibedrpc => mprp}/selfcheck_test.go | 8 +-- cmd/{mpcvibedrpc => mprp}/stremio.go | 6 +- cmd/{mpcvibedrpc => mprp}/stremio_test.go | 4 +- cmd/{mpcvibedrpc => mprp}/tray.go | 8 +-- cmd/{mpcvibedrpc => mprp}/update.go | 10 +-- .../update_sched_test.go | 2 +- cmd/{mpcvibedrpc => mprp}/update_test.go | 8 +-- cmd/{mpcvibedrpc => mprp}/window.go | 2 +- cmd/{mpcvibedrpc => mprp}/window_test.go | 0 docs/ai.md | 4 +- docs/config.md | 8 +-- docs/design/fix-a-match.md | 2 +- docs/development.md | 66 +++++++++---------- docs/how-it-works.md | 4 +- docs/maintaining.md | 6 +- docs/research/discord-rich-presence.md | 2 +- docs/roadmap.md | 8 +-- docs/troubleshooting.md | 10 +-- go.mod | 2 +- internal/artwork/anime_episodes_test.go | 2 +- internal/artwork/artwork.go | 2 +- internal/artwork/cache_days_test.go | 2 +- internal/artwork/disabled.go | 2 +- internal/artwork/disabled_test.go | 2 +- internal/artwork/episodes.go | 2 +- internal/artwork/fixmatch_test.go | 2 +- internal/artwork/fuzz_test.go | 2 +- internal/artwork/jx.go | 2 +- internal/artwork/letterboxd.go | 2 +- internal/artwork/letterboxd_test.go | 2 +- internal/artwork/live_test.go | 8 +-- internal/artwork/match.go | 4 +- internal/artwork/names_test.go | 2 +- internal/artwork/net.go | 2 +- internal/artwork/providers.go | 4 +- internal/artwork/pure_test.go | 2 +- internal/artwork/replay_test.go | 2 +- internal/artwork/seasons.go | 4 +- internal/artwork/specials_test.go | 2 +- internal/artwork/why.go | 2 +- internal/artwork/why_test.go | 2 +- internal/assets/ui.html | 4 +- internal/assets/ui.js | 16 ++--- internal/conns/conns.go | 2 +- internal/conns/conns_test.go | 2 +- internal/core/activity.go | 2 +- internal/core/icons.go | 2 +- internal/core/parse.go | 2 +- internal/core/util.go | 2 +- internal/dbus/dbus_test.go | 4 +- internal/dbus/dbustest/dbustest.go | 2 +- internal/diag/diag.go | 8 +-- internal/diag/diag_test.go | 6 +- internal/discord/discord.go | 2 +- internal/engine/disc_test.go | 2 +- internal/engine/discord.go | 4 +- internal/engine/engine.go | 12 ++-- internal/engine/engine_test.go | 2 +- internal/engine/events.go | 14 ++-- internal/engine/events_test.go | 6 +- internal/engine/fakepipe_windows_test.go | 2 +- internal/engine/folder_test.go | 2 +- internal/engine/jellyfin_test.go | 2 +- internal/engine/kodi_test.go | 2 +- internal/engine/links_test.go | 2 +- internal/engine/live_test.go | 62 ++++++++--------- internal/engine/multios_test.go | 4 +- internal/engine/pace_test.go | 2 +- internal/engine/players.go | 16 ++--- internal/engine/plex_test.go | 2 +- internal/engine/potplayer_test.go | 2 +- internal/engine/probe.go | 8 +-- internal/engine/probe_test.go | 2 +- internal/engine/remote.go | 12 ++-- internal/engine/remotes_test.go | 2 +- internal/engine/rest_test.go | 2 +- internal/engine/sharing_test.go | 2 +- internal/engine/stale_test.go | 4 +- internal/engine/state_test.go | 8 +-- internal/engine/stats_test.go | 2 +- internal/engine/stream_test.go | 2 +- internal/engine/stuck_windows_test.go | 2 +- internal/engine/tick.go | 6 +- internal/engine/where_test.go | 2 +- internal/engine/why.go | 2 +- internal/engine/why_test.go | 2 +- internal/jellyfin/account.go | 4 +- internal/jellyfin/jellyfin_test.go | 6 +- internal/jellyfin/live_test.go | 16 ++--- internal/jellyfin/meta.go | 2 +- internal/jellyfin/watcher.go | 4 +- internal/kodi/kodi.go | 2 +- internal/mpris/mpris.go | 4 +- internal/mpris/mpris_test.go | 6 +- internal/mpris/watch.go | 2 +- internal/mpris/watch_test.go | 4 +- internal/mpvipc/mpvipc.go | 2 +- internal/pipe/dial_windows_test.go | 4 +- internal/pipe/exists_test.go | 2 +- internal/plex/account.go | 4 +- internal/plex/meta.go | 2 +- internal/plex/plex_test.go | 2 +- internal/plex/watcher.go | 4 +- internal/potplayer/live_windows_test.go | 6 +- internal/potplayer/potplayer.go | 2 +- internal/potplayer/potplayer_other.go | 2 +- internal/potplayer/potplayer_windows.go | 4 +- internal/potplayer/potplayer_windows_test.go | 2 +- internal/server/server.go | 4 +- internal/server/server_test.go | 4 +- internal/store/docs_test.go | 2 +- internal/store/schema.go | 6 +- internal/store/store.go | 24 +++---- internal/store/store_test.go | 2 +- internal/store/unreadable_test.go | 2 +- internal/stremio/account.go | 2 +- internal/stremio/watcher.go | 4 +- internal/updater/updater.go | 10 +-- internal/updater/updater_host_test.go | 34 +++++----- internal/updater/updater_test.go | 22 +++---- internal/vlchttp/vlchttp.go | 2 +- internal/winsys/autostart.go | 10 +-- internal/winsys/autostart_test.go | 32 ++++----- internal/winsys/autostart_unix.go | 10 +-- internal/winsys/autostart_windows_test.go | 18 ++--- internal/winsys/browser_other_test.go | 10 +-- internal/winsys/browser_test.go | 4 +- internal/winsys/ini.go | 4 +- internal/winsys/macapp_darwin.go | 6 +- internal/winsys/mpcsetup.go | 2 +- internal/winsys/mpvconf.go | 4 +- internal/winsys/mpvconf_unix_test.go | 2 +- internal/winsys/run.go | 2 +- internal/winsys/setup_unix.go | 2 +- internal/winsys/single_windows.go | 2 +- internal/winsys/taskbar_windows.go | 2 +- internal/winsys/taskbar_windows_test.go | 6 +- internal/winsys/tray_windows.go | 8 +-- internal/winsys/unix_test.go | 42 ++++++------ internal/winsys/window.go | 8 +-- tools/ci/dev-download.sh | 2 +- tools/ci/fake-http.ps1 | 4 +- tools/ci/live-flathub.sh | 6 +- tools/ci/live-jellyfin.sh | 6 +- tools/ci/live-players.sh | 32 ++++----- tools/ci/live-plex.sh | 2 +- tools/ci/live-windows.sh | 6 +- tools/ci/package-macos.sh | 34 +++++----- tools/ci/reproduce.sh | 14 ++-- tools/ci/smoke-unix.sh | 36 +++++----- tools/ci/smoke.ps1 | 40 +++++------ tools/ci/verify-release.ps1 | 20 +++--- tools/ci/version.sh | 8 +-- tools/downloads/main.go | 4 +- tools/downloads/main_test.go | 34 +++++----- tools/mkico/main.go | 2 +- tools/mkrsrc/main.go | 12 ++-- tools/relnotes/main.go | 10 +-- tools/relnotes/main_test.go | 4 +- tools/screenshots/demo.js | 2 +- 195 files changed, 712 insertions(+), 712 deletions(-) rename cmd/{mpcvibedrpc => mprp}/accounts.go (96%) rename cmd/{mpcvibedrpc => mprp}/api.go (94%) rename cmd/{mpcvibedrpc => mprp}/api_test.go (68%) rename cmd/{mpcvibedrpc => mprp}/app.go (93%) rename cmd/{mpcvibedrpc => mprp}/changelog_test.go (91%) rename cmd/{mpcvibedrpc => mprp}/e2e_rollback_test.go (86%) rename cmd/{mpcvibedrpc => mprp}/e2e_test.go (93%) rename cmd/{mpcvibedrpc => mprp}/handover_test.go (92%) rename cmd/{mpcvibedrpc => mprp}/hide_test.go (93%) rename cmd/{mpcvibedrpc => mprp}/ipc_test.go (100%) rename cmd/{mpcvibedrpc => mprp}/ipc_windows_test.go (100%) rename cmd/{mpcvibedrpc => mprp}/jellyfin.go (98%) rename cmd/{mpcvibedrpc => mprp}/jellyfin_test.go (98%) rename cmd/{mpcvibedrpc => mprp}/launch_darwin.go (84%) rename cmd/{mpcvibedrpc => mprp}/launch_other.go (100%) rename cmd/{mpcvibedrpc => mprp}/logger.go (100%) rename cmd/{mpcvibedrpc => mprp}/logger_test.go (100%) rename cmd/{mpcvibedrpc => mprp}/main.go (87%) rename cmd/{mpcvibedrpc => mprp}/players_doc_test.go (95%) rename cmd/{mpcvibedrpc => mprp}/plex.go (98%) rename cmd/{mpcvibedrpc => mprp}/plex_test.go (99%) rename cmd/{mpcvibedrpc => mprp}/selfcheck.go (97%) rename cmd/{mpcvibedrpc => mprp}/selfcheck_test.go (96%) rename cmd/{mpcvibedrpc => mprp}/stremio.go (95%) rename cmd/{mpcvibedrpc => mprp}/stremio_test.go (97%) rename cmd/{mpcvibedrpc => mprp}/tray.go (88%) rename cmd/{mpcvibedrpc => mprp}/update.go (97%) rename cmd/{mpcvibedrpc => mprp}/update_sched_test.go (98%) rename cmd/{mpcvibedrpc => mprp}/update_test.go (95%) rename cmd/{mpcvibedrpc => mprp}/window.go (98%) rename cmd/{mpcvibedrpc => mprp}/window_test.go (100%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index ee9519c..1d90cda 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -32,5 +32,5 @@ body: id: log attributes: label: Relevant log lines (optional) - description: Easiest is **Copy diagnostics** on the Help tab of the settings window (it names what you played; folder paths, sign-ins and keys are left out). Or paste lines from the Help tab or `mpcvibedrpc.log` in the settings folder (**Open settings folder** under Advanced > Maintenance). + description: Easiest is **Copy diagnostics** on the Help tab of the settings window (it names what you played; folder paths, sign-ins and keys are left out). Or paste lines from the Help tab or `mprp.log` in the settings folder (**Open settings folder** under Advanced > Maintenance). render: text \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 2950a4e..2560817 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: Security problem - url: https://github.com/CptPakundo/MPCvibedRPC/security/advisories/new + url: https://github.com/CptPakundo/MPRP/security/advisories/new about: Please report security problems privately here instead of in a public issue. \ No newline at end of file diff --git a/.github/actions/build-unix/action.yml b/.github/actions/build-unix/action.yml index d6c98dd..54a1f3c 100644 --- a/.github/actions/build-unix/action.yml +++ b/.github/actions/build-unix/action.yml @@ -1,6 +1,6 @@ # Builds the Linux programs (on a Linux runner) or the macOS app (on a macOS runner) the way a release is built, then # smoke-tests them for real in a throwaway folder (tools/ci/smoke-unix.sh), for ci.yml and release.yml alike. The job -# must have checked out and set up Go before. Output: dist/ (MPCvibedRPC-linux-amd64 and -arm64, or MPCvibedRPC-macos.zip). +# must have checked out and set up Go before. Output: dist/ (MPRP-linux-amd64 and -arm64, or MPRP-macos.zip). name: Build and smoke-test the Linux or macOS program description: dist/ for this runner's system, then tools/ci/smoke-unix.sh inputs: @@ -18,16 +18,16 @@ runs: run: | mkdir -p dist for arch in amd64 arm64; do - CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=$V" -o dist/MPCvibedRPC-linux-$arch ./cmd/mpcvibedrpc + CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=$V" -o dist/MPRP-linux-$arch ./cmd/mprp done ls -l dist - echo "::notice title=linux-amd64 size::$(stat -c %s dist/MPCvibedRPC-linux-amd64) bytes" + echo "::notice title=linux-amd64 size::$(stat -c %s dist/MPRP-linux-amd64) bytes" - name: Smoke test (Linux) if: runner.os == 'Linux' shell: bash env: V: ${{ inputs.version }} - run: PASSED_FILE="$RUNNER_TEMP/smoke-ok" ./tools/ci/run-annotated.sh "smoke test" ./tools/ci/smoke-unix.sh "$PWD/dist/MPCvibedRPC-linux-amd64" "$V" + run: PASSED_FILE="$RUNNER_TEMP/smoke-ok" ./tools/ci/run-annotated.sh "smoke test" ./tools/ci/smoke-unix.sh "$PWD/dist/MPRP-linux-amd64" "$V" - name: Build (macOS app) if: runner.os == 'macOS' shell: bash @@ -40,6 +40,6 @@ runs: env: V: ${{ inputs.version }} run: | - mkdir -p "$RUNNER_TEMP/app" && ditto -x -k dist/MPCvibedRPC-macos.zip "$RUNNER_TEMP/app" - app="$RUNNER_TEMP/app/MPCvibedRPC.app" - SCREENSHOT="$RUNNER_TEMP/macos-window.png" PASSED_FILE="$RUNNER_TEMP/smoke-ok" ./tools/ci/run-annotated.sh "smoke test" ./tools/ci/smoke-unix.sh "$app/Contents/MacOS/MPCvibedRPC" "$V" "$app" + mkdir -p "$RUNNER_TEMP/app" && ditto -x -k dist/MPRP-macos.zip "$RUNNER_TEMP/app" + app="$RUNNER_TEMP/app/MPRP.app" + SCREENSHOT="$RUNNER_TEMP/macos-window.png" PASSED_FILE="$RUNNER_TEMP/smoke-ok" ./tools/ci/run-annotated.sh "smoke test" ./tools/ci/smoke-unix.sh "$app/Contents/MacOS/MPRP" "$V" "$app" diff --git a/.github/actions/build-windows/action.yml b/.github/actions/build-windows/action.yml index 1e5d645..cd70763 100644 --- a/.github/actions/build-windows/action.yml +++ b/.github/actions/build-windows/action.yml @@ -1,9 +1,9 @@ # Builds the Windows program the way a release is built and smoke-tests it, for ci.yml and release.yml alike: -# dist/MPCvibedRPC.exe (and dist/next.exe, the version after it, which the smoke test updates to) from an LF checkout +# dist/MPRP.exe (and dist/next.exe, the version after it, which the smoke test updates to) from an LF checkout # without cgo, so the Linux rebuild (tools/ci/reproduce.sh) gives the same bytes. The job must have checked out with # core.autocrlf off and set up Go before. name: Build and smoke-test the Windows program -description: dist/MPCvibedRPC.exe and dist/next.exe, then tools/ci/smoke.ps1 +description: dist/MPRP.exe and dist/next.exe, then tools/ci/smoke.ps1 inputs: version: description: the version being built (VERSION from tools/ci/version.sh) @@ -22,12 +22,12 @@ runs: run: | $env:CGO_ENABLED = '0' # no cgo: the exe can be rebuilt anywhere, byte for byte New-Item -ItemType Directory dist -Force | Out-Null - go run ./tools/mkrsrc -version $env:V -out cmd/mpcvibedrpc/rsrc_windows_amd64.syso - go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=$env:V" -o dist/MPCvibedRPC.exe ./cmd/mpcvibedrpc - go run ./tools/mkrsrc -version $env:N -out cmd/mpcvibedrpc/rsrc_windows_amd64.syso - go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=$env:N" -o dist/next.exe ./cmd/mpcvibedrpc + go run ./tools/mkrsrc -version $env:V -out cmd/mprp/rsrc_windows_amd64.syso + go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=$env:V" -o dist/MPRP.exe ./cmd/mprp + go run ./tools/mkrsrc -version $env:N -out cmd/mprp/rsrc_windows_amd64.syso + go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=$env:N" -o dist/next.exe ./cmd/mprp Get-ChildItem dist | Format-Table Name, Length - Write-Host "::notice title=exe size::$((Get-Item dist/MPCvibedRPC.exe).Length) bytes" + Write-Host "::notice title=exe size::$((Get-Item dist/MPRP.exe).Length) bytes" # the checkout must be LF, or the rebuild on Linux cannot match $crlf = git ls-files --eol | Select-String "w/crlf" if ($crlf) { $crlf | Select-Object -First 5; Write-Host "::error title=build::the checkout has CRLF files; the exe would not be reproducible"; exit 1 } @@ -36,4 +36,4 @@ runs: env: V: ${{ inputs.version }} N: ${{ inputs.next }} - run: ./tools/ci/smoke.ps1 -Exe "$PWD/dist/MPCvibedRPC.exe" -NewExe "$PWD/dist/next.exe" -Version $env:V -NextVersion $env:N + run: ./tools/ci/smoke.ps1 -Exe "$PWD/dist/MPRP.exe" -NewExe "$PWD/dist/next.exe" -Version $env:V -NextVersion $env:N diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 93f51b3..6c99203 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 with: { go-version-file: go.mod, cache: false } - name: Live catalog check - run: MPCRPC_LIVE_CATALOGS=1 ./tools/ci/run-annotated.sh "live catalogs" ./tools/ci/must-pass.sh TestLiveCatalogs go test -count=1 -run TestLiveCatalogs -v ./internal/artwork + run: MPRP_LIVE_CATALOGS=1 ./tools/ci/run-annotated.sh "live catalogs" ./tools/ci/must-pass.sh TestLiveCatalogs go test -count=1 -run TestLiveCatalogs -v ./internal/artwork shell: bash # mpv, VLC and Celluloid as their makers release them (Flathub), with the live engine test and a pause from their events. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 090b1e5..030494f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,8 +124,8 @@ jobs: with: { version: "${{ env.VERSION }}", next: "${{ env.NEXT }}" } - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: MPCvibedRPC-windows - path: dist/MPCvibedRPC.exe + name: MPRP-windows + path: dist/MPRP.exe # The exe again, built on Linux from the same files: it must be the same, byte for byte, so anyone can rebuild a # release and check it (release.yml does that for every release before it is published). @@ -143,11 +143,11 @@ jobs: shell: bash - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: - name: MPCvibedRPC-windows + name: MPRP-windows path: windows - name: Rebuild and compare shell: bash - run: ./tools/ci/reproduce.sh "$VERSION" rebuilt && ./tools/ci/reproduce.sh compare windows/MPCvibedRPC.exe rebuilt/MPCvibedRPC.exe + run: ./tools/ci/reproduce.sh "$VERSION" rebuilt && ./tools/ci/reproduce.sh compare windows/MPRP.exe rebuilt/MPRP.exe # The Linux programs and the macOS app as a release builds them (.github/actions/build-unix), started for real in # throwaway folders. @@ -178,7 +178,7 @@ jobs: if-no-files-found: ignore - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: MPCvibedRPC-${{ runner.os == 'macOS' && 'macos' || 'linux' }} + name: MPRP-${{ runner.os == 'macOS' && 'macos' || 'linux' }} path: dist/* # The live jobs below run once per pull request (opened, reopened or marked ready), by hand, and from the canary: not diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d5e3816..d197fdf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 with: { go-version-file: go.mod, cache: false } - run: go test -count=1 -run 'TestEverySettingIsDocumented' ./internal/store - - run: go test -count=1 -run 'TestPlayersAreNamedEverywhere' ./cmd/mpcvibedrpc + - run: go test -count=1 -run 'TestPlayersAreNamedEverywhere' ./cmd/mprp - run: go test -count=1 -run 'TestSecurityListsEveryHost|TestEveryHostIsListed' ./internal/core - run: go test -count=1 ./tools/relnotes - run: go test -count=1 ./tools/doclinks diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f576e9..aea2476 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ -# Publishes a release when a version tag is pushed: git tag -a vX.Y.Z -m "MPCvibedRPC X.Y.Z" && git push origin vX.Y.Z -# The tag must match the version in cmd/mpcvibedrpc/main.go. The program's own updater looks for its file -# (MPCvibedRPC.exe, MPCvibedRPC-linux-amd64, ...) and the .sha256 next to it on the latest release; on macOS it links to +# Publishes a release when a version tag is pushed: git tag -a vX.Y.Z -m "MPRP X.Y.Z" && git push origin vX.Y.Z +# The tag must match the version in cmd/mprp/main.go. The program's own updater looks for its file +# (MPRP.exe, MPRP-linux-amd64, ...) and the .sha256 next to it on the latest release; on macOS it links to # the release page. The release is first a draft; it is made public only once its files check out, and then the update # path is tried on it (tools/ci/verify-release.ps1). name: release @@ -86,23 +86,23 @@ jobs: id: sums shell: pwsh run: | - foreach ($f in 'MPCvibedRPC.exe', 'MPCvibedRPC-linux-amd64', 'MPCvibedRPC-linux-arm64', 'MPCvibedRPC-macos.zip') { + foreach ($f in 'MPRP.exe', 'MPRP-linux-amd64', 'MPRP-linux-arm64', 'MPRP-macos.zip') { $h = (Get-FileHash "dist/$f" -Algorithm SHA256).Hash.ToLower() Set-Content -LiteralPath "dist/$f.sha256" -Value "$h $f`n" -NoNewline - $key = @{ 'MPCvibedRPC.exe' = 'exe'; 'MPCvibedRPC-linux-amd64' = 'linux_amd64'; 'MPCvibedRPC-linux-arm64' = 'linux_arm64' }[$f] + $key = @{ 'MPRP.exe' = 'exe'; 'MPRP-linux-amd64' = 'linux_amd64'; 'MPRP-linux-arm64' = 'linux_arm64' }[$f] if ($key) { Add-Content -LiteralPath $env:GITHUB_OUTPUT -Value "$key=$h" } } Get-ChildItem dist | Format-Table Name, Length # A signed statement that these files were built from this repository by this workflow (no certificate needed). - # Check a download with: gh attestation verify MPCvibedRPC.exe --repo CptPakundo/MPCvibedRPC + # Check a download with: gh attestation verify MPRP.exe --repo CptPakundo/MPRP - name: Attest build provenance uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-path: | - dist/MPCvibedRPC.exe - dist/MPCvibedRPC-linux-amd64 - dist/MPCvibedRPC-linux-arm64 - dist/MPCvibedRPC-macos.zip + dist/MPRP.exe + dist/MPRP-linux-amd64 + dist/MPRP-linux-arm64 + dist/MPRP-macos.zip # A re-run after the release went public would turn it back into a draft and replace its files: refuse. A draft # (or no release at all) is fine. (gh finds a release by its tag only once it is public.) - name: The release must not be public yet @@ -123,14 +123,14 @@ jobs: - uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4 with: files: | - dist/MPCvibedRPC.exe - dist/MPCvibedRPC.exe.sha256 - dist/MPCvibedRPC-linux-amd64 - dist/MPCvibedRPC-linux-amd64.sha256 - dist/MPCvibedRPC-linux-arm64 - dist/MPCvibedRPC-linux-arm64.sha256 - dist/MPCvibedRPC-macos.zip - dist/MPCvibedRPC-macos.zip.sha256 + dist/MPRP.exe + dist/MPRP.exe.sha256 + dist/MPRP-linux-amd64 + dist/MPRP-linux-amd64.sha256 + dist/MPRP-linux-arm64 + dist/MPRP-linux-arm64.sha256 + dist/MPRP-macos.zip + dist/MPRP-macos.zip.sha256 dist/LICENSE dist/THIRD-PARTY-NOTICES.md body_path: ${{ runner.temp }}/release-notes.md @@ -191,9 +191,9 @@ jobs: - name: The rebuild matches the release shell: bash run: | - ./tools/ci/reproduce.sh same MPCvibedRPC.exe '${{ needs.release.outputs.exe }}' '${{ needs.reproduce.outputs.exe }}' - ./tools/ci/reproduce.sh same MPCvibedRPC-linux-amd64 '${{ needs.release.outputs.linux_amd64 }}' '${{ needs.reproduce.outputs.linux_amd64 }}' - ./tools/ci/reproduce.sh same MPCvibedRPC-linux-arm64 '${{ needs.release.outputs.linux_arm64 }}' '${{ needs.reproduce.outputs.linux_arm64 }}' + ./tools/ci/reproduce.sh same MPRP.exe '${{ needs.release.outputs.exe }}' '${{ needs.reproduce.outputs.exe }}' + ./tools/ci/reproduce.sh same MPRP-linux-amd64 '${{ needs.release.outputs.linux_amd64 }}' '${{ needs.reproduce.outputs.linux_amd64 }}' + ./tools/ci/reproduce.sh same MPRP-linux-arm64 '${{ needs.release.outputs.linux_arm64 }}' '${{ needs.reproduce.outputs.linux_arm64 }}' - name: Check the draft shell: pwsh run: ./tools/ci/verify-release.ps1 -Version $env:VERSION -Stage draft diff --git a/AGENTS.md b/AGENTS.md index 975c1e3..772c14e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,7 +3,7 @@ Guidance for any AI coding assistant working on this repository. ## What this is -MPCvibedRPC is a small Windows tray app (Go, standard library only, one exe under 10 MB, nothing to install) that +MPRP is a small Windows tray app (Go, standard library only, one exe under 10 MB, nothing to install) that shows what a video player is playing as a Discord status: "Watching " with a progress bar, cover art, episode titles and the player's logo. It reads the players listed in the [README](README.md#-players), talks to the Discord desktop app over its local IPC pipe, and shows its settings in a local web page. It also runs on macOS (menu bar) and @@ -13,7 +13,7 @@ Linux. Windows is the main system and its behaviour must not change for the othe ```bash go vet ./... go test -count=1 ./... -go build -trimpath -ldflags "-H=windowsgui -s -w -X main.version=X.Y.Z" -o dist/MPCvibedRPC.exe ./cmd/mpcvibedrpc +go build -trimpath -ldflags "-H=windowsgui -s -w -X main.version=X.Y.Z" -o dist/MPRP.exe ./cmd/mprp ``` CI runs the rest (the race detector, the lint gates, macOS and Linux for real): see [development.md > CI](docs/development.md#ci). @@ -24,7 +24,7 @@ CI runs the rest (the race detector, the lint gates, macOS and Linux for real): 2. [docs/development.md](docs/development.md): packages, how players are read, the engine's state, testing, CI, and the checklists for adding a player, setting, catalog or host. Before you run the program or a real player, read [Running the program safely](docs/development.md#running-the-program-safely): a *throwaway copy* is one started - with a data folder of its own (`MPCRPC_HOME`), so it cannot touch an installed copy. + with a data folder of its own (`MPRP_HOME`), so it cannot touch an installed copy. 3. [docs/maintaining.md](docs/maintaining.md): releasing, screenshots, downloading release files. 4. [docs/roadmap.md](docs/roadmap.md) before proposing a feature, a service or a distribution change (don't propose a listed non-goal without saying so), and [docs/decisions.md](docs/decisions.md) before changing listed behaviour. @@ -41,11 +41,11 @@ Read the named sections, make the change, then run the tests named with it (and [Packages](docs/development.md#packages-internal); run `go test ./internal/core` (the golden data must still pass). - **A window or UI fix:** [The window and the menu](docs/how-it-works.md#the-window-and-the-menu) and the `internal/assets` rows in [Packages](docs/development.md#packages-internal) and the window's look in - [design/settings-window.md](docs/design/settings-window.md); run `go test ./internal/assets ./cmd/mpcvibedrpc` + [design/settings-window.md](docs/design/settings-window.md); run `go test ./internal/assets ./cmd/mprp` (`TestPageScriptParses` needs Node.js). - **A new player:** [A new player](docs/development.md#a-new-player) and - [How players are read](docs/development.md#how-players-are-read); run `go test ./internal/engine ./cmd/mpcvibedrpc`. -- **A new setting:** [A new setting](docs/development.md#a-new-setting); run `go test ./internal/store ./cmd/mpcvibedrpc` + [How players are read](docs/development.md#how-players-are-read); run `go test ./internal/engine ./cmd/mprp`. +- **A new setting:** [A new setting](docs/development.md#a-new-setting); run `go test ./internal/store ./cmd/mprp` (`TestEverySettingIsDocumented` fails until `docs/config.md` has its row). ## Invariants: never break these @@ -72,6 +72,6 @@ Read the named sections, make the change, then run the tests named with it (and - The program is AI-generated; the README says so once, near the top, and that is enough. Never present the code as written by the repository maintainer. The idea comes from angeloanan/MPC-DiscordRPC (MIT), credited in the README, `LICENSE` and `THIRD-PARTY-NOTICES.md`. -- Versions are `0.9.x`; the current one is in `cmd/mpcvibedrpc/main.go`. Changelog lines are short, one emoji each. +- Versions are `0.9.x`; the current one is in `cmd/mprp/main.go`. Changelog lines are short, one emoji each. - Merging, tagging and publishing are outward-facing: do them only with the maintainer's go-ahead ([maintaining.md](docs/maintaining.md#rules-for-maintainers)). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0af3d8f..6998799 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,10 +7,10 @@ and testing. Bug reports, reviews and pull requests with tests are welcome all t 1. Install [Go](https://go.dev/dl/) at the version in `go.mod` (the `go` line) and clone the repository. The default branch is `master`. 2. Run the checks: `go vet ./...` and `go test -count=1 ./...`. -3. Build: `go build -trimpath -ldflags "-H=windowsgui -s -w -X main.version=0.0.0" -o dist/MPCvibedRPC.exe ./cmd/mpcvibedrpc` +3. Build: `go build -trimpath -ldflags "-H=windowsgui -s -w -X main.version=0.0.0" -o dist/MPRP.exe ./cmd/mprp` (other systems: [development.md](docs/development.md#building-and-running)). 4. Before you start the program you built, read [Running the program safely](docs/development.md#running-the-program-safely): - a copy with its own data folder (`MPCRPC_HOME`) leaves your installed copy, Discord and players alone. + a copy with its own data folder (`MPRP_HOME`) leaves your installed copy, Discord and players alone. Optional tools: - **Node.js**: `TestPageScriptParses` checks the settings page's script with `node --check`; without Node.js it skips. @@ -23,7 +23,7 @@ Optional tools: Run them as CI does: `govulncheck ./...`, `staticcheck -checks inherit,-ST1005 ./...` and `deadcode -test ./...`. ## How to help -- **Bugs:** use the [issue templates](https://github.com/CptPakundo/MPCvibedRPC/issues/new/choose). On the **Help** tab, +- **Bugs:** use the [issue templates](https://github.com/CptPakundo/MPRP/issues/new/choose). On the **Help** tab, **Copy diagnostics** gives a report to attach; what it contains is in [Troubleshooting](docs/troubleshooting.md#reporting-a-problem). Look through it before you post it. - **Security problems:** report them privately, as described in [SECURITY.md](SECURITY.md), not in a public issue. diff --git a/README.md b/README.md index b21e521..1a3150f 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,22 @@ <img src="docs/images/icon.png" width="96" height="96" alt=""> -# MPCvibedRPC +# MPRP **Show what you're watching on Discord.**<br> A tiny app for MPC-HC, MPC-BE, MPC-QT, mpv, VLC, PotPlayer, IINA, Kodi, Plex, Stremio, Jellyfin and Emby, with clean titles, cover art and a real progress bar. <p> -<a href="https://github.com/CptPakundo/MPCvibedRPC/releases/latest/download/MPCvibedRPC.exe"><img alt="Download for Windows" src="https://img.shields.io/badge/Download_for_Windows-5865f2?style=for-the-badge"></a> -<a href="https://github.com/CptPakundo/MPCvibedRPC/releases/latest/download/MPCvibedRPC-macos.zip"><img alt="Download for macOS" src="https://img.shields.io/badge/Download_for_macOS-5865f2?style=for-the-badge"></a> -<a href="https://github.com/CptPakundo/MPCvibedRPC/releases/latest/download/MPCvibedRPC-linux-amd64"><img alt="Download for Linux" src="https://img.shields.io/badge/Download_for_Linux-5865f2?style=for-the-badge"></a> +<a href="https://github.com/CptPakundo/MPRP/releases/latest/download/MPRP.exe"><img alt="Download for Windows" src="https://img.shields.io/badge/Download_for_Windows-5865f2?style=for-the-badge"></a> +<a href="https://github.com/CptPakundo/MPRP/releases/latest/download/MPRP-macos.zip"><img alt="Download for macOS" src="https://img.shields.io/badge/Download_for_macOS-5865f2?style=for-the-badge"></a> +<a href="https://github.com/CptPakundo/MPRP/releases/latest/download/MPRP-linux-amd64"><img alt="Download for Linux" src="https://img.shields.io/badge/Download_for_Linux-5865f2?style=for-the-badge"></a> </p> -<sub>Linux on ARM: <a href="https://github.com/CptPakundo/MPCvibedRPC/releases/latest/download/MPCvibedRPC-linux-arm64">MPCvibedRPC-linux-arm64</a> ยท <a href="https://github.com/CptPakundo/MPCvibedRPC/releases/latest">All files and what's new</a></sub> +<sub>Linux on ARM: <a href="https://github.com/CptPakundo/MPRP/releases/latest/download/MPRP-linux-arm64">MPRP-linux-arm64</a> ยท <a href="https://github.com/CptPakundo/MPRP/releases/latest">All files and what's new</a></sub> <p> -<a href="https://github.com/CptPakundo/MPCvibedRPC/releases"><img alt="Downloads" title="GitHub's count of release downloads (it includes the project's own release checks)" src="https://img.shields.io/github/downloads/CptPakundo/MPCvibedRPC/total?color=444"></a> -<a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/CptPakundo/MPCvibedRPC?color=444"></a> +<a href="https://github.com/CptPakundo/MPRP/releases"><img alt="Downloads" title="GitHub's count of release downloads (it includes the project's own release checks)" src="https://img.shields.io/github/downloads/CptPakundo/MPRP/total?color=444"></a> +<a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/CptPakundo/MPRP?color=444"></a> </p> <p> @@ -47,19 +47,19 @@ A tiny app for MPC-HC, MPC-BE, MPC-QT, mpv, VLC, PotPlayer, IINA, Kodi, Plex, St Every system needs the **Discord desktop app** with *User Settings > Activity Privacy > "Share my activity"* turned on (Activity Privacy is in the *Games & Apps* section, called *Activity Settings* in older Discord versions). **Windows 10/11** -1. Download **MPCvibedRPC.exe** and run it. There is nothing to install. SmartScreen may warn, because the program +1. Download **MPRP.exe** and run it. There is nothing to install. SmartScreen may warn, because the program isn't code-signed: choose *More info > Run anyway*. 2. Play something. If your player isn't found yet, press **Set up the player connection** in the window. 3. Optional: **Start with Windows** (General tab) starts it quietly in the tray when you log in. **macOS 13 or later** (Apple silicon and Intel) -1. Download **MPCvibedRPC-macos.zip**, open it and move the app to Applications. +1. Download **MPRP-macos.zip**, open it and move the app to Applications. 2. The app isn't notarized by Apple, so the first time it won't open: go to *System Settings > Privacy & Security* and choose **Open Anyway**. 3. It lives in the menu bar. For IINA, press **Set up the player connection** once and reopen IINA. **Linux** (x64 and ARM64) -1. Download **MPCvibedRPC-linux-amd64** (or `-arm64`), run `chmod +x` on it and start it. +1. Download **MPRP-linux-amd64** (or `-arm64`), run `chmod +x` on it and start it. 2. VLC, Celluloid, Haruna and most other video players are found by themselves. mpv: press **Set up the player connection** (it adds one line to `mpv.conf`); the mpv-mpris script works too. 3. There's no tray icon, and closing the window with its X quits the program. Keep the window open or minimised, or @@ -121,7 +121,7 @@ after you confirm. Exactly what each player needs, and how it is read, is in 4. The status line at the top of the window says what is missing, for example "No player found". **Reporting a problem:** on the **Help** tab, **Copy diagnostics** copies a report to paste into a -[new issue](https://github.com/CptPakundo/MPCvibedRPC/issues/new/choose); what it contains is in [Troubleshooting](docs/troubleshooting.md#reporting-a-problem). +[new issue](https://github.com/CptPakundo/MPRP/issues/new/choose); what it contains is in [Troubleshooting](docs/troubleshooting.md#reporting-a-problem). More problems, by player and service, plus updates and uninstalling: [Troubleshooting](docs/troubleshooting.md). diff --git a/SECURITY.md b/SECURITY.md index 71149ba..369eca5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -79,7 +79,7 @@ limits it to this computer, which keeps other devices out but not web pages you ## Reporting a problem If you find a security problem, please report it **privately** through -[GitHub's private vulnerability reporting](https://github.com/CptPakundo/MPCvibedRPC/security/advisories/new) +[GitHub's private vulnerability reporting](https://github.com/CptPakundo/MPRP/security/advisories/new) rather than in a public issue. There is no guaranteed response time or fix, but reports are read. ## How updates are checked @@ -92,14 +92,14 @@ manifest, immutable releases) is an open decision in the ## Checking a download Release files come with a SHA-256 checksum and a signed build record from GitHub. To check that a downloaded -`MPCvibedRPC.exe` (or `MPCvibedRPC-macos.zip`, `MPCvibedRPC-linux-amd64`, ...) was built from this repository by its +`MPRP.exe` (or `MPRP-macos.zip`, `MPRP-linux-amd64`, ...) was built from this repository by its release workflow: ``` -gh attestation verify MPCvibedRPC.exe --repo CptPakundo/MPCvibedRPC --signer-workflow CptPakundo/MPCvibedRPC/.github/workflows/release.yml +gh attestation verify MPRP.exe --repo CptPakundo/MPRP --signer-workflow CptPakundo/MPRP/.github/workflows/release.yml ``` -You can also rebuild `MPCvibedRPC.exe` and the Linux programs yourself and compare: every release is published only +You can also rebuild `MPRP.exe` and the Linux programs yourself and compare: every release is published only after a second runner rebuilt them from the tag byte for byte. Check out the tag with the files as committed (LF line endings, for example `git clone -c core.autocrlf=false`), install the Go version named in `go.mod` (the `go` line), run `tools/ci/reproduce.sh X.Y.Z out` and compare the files' SHA-256 with the diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md index c93ba68..6cefe90 100644 --- a/THIRD-PARTY-NOTICES.md +++ b/THIRD-PARTY-NOTICES.md @@ -2,7 +2,7 @@ - **MPC-DiscordRPC** by Christopher Angelo - https://github.com/angeloanan/MPC-DiscordRPC - MIT License (see LICENSE). This project started from it and keeps its copyright notice. -- **The Go programming language and standard library** (linked into MPCvibedRPC.exe) - https://go.dev - +- **The Go programming language and standard library** (linked into MPRP.exe) - https://go.dev - BSD 3-Clause License, Copyright 2009 The Go Authors. Full text: https://go.dev/LICENSE - Unicode data used for text normalisation (`internal/jsre/nfd_table.go`, `nfc_table.go`) is derived from the Unicode Character Database - https://www.unicode.org/license.txt diff --git a/cmd/mpcvibedrpc/accounts.go b/cmd/mprp/accounts.go similarity index 96% rename from cmd/mpcvibedrpc/accounts.go rename to cmd/mprp/accounts.go index fbb5dc3..90b8321 100644 --- a/cmd/mpcvibedrpc/accounts.go +++ b/cmd/mprp/accounts.go @@ -8,10 +8,10 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/server" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/server" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/winsys" ) // approval is the part the Plex, Stremio and Jellyfin sign-ins share: a sign-in that waits until the user approves it diff --git a/cmd/mpcvibedrpc/api.go b/cmd/mprp/api.go similarity index 94% rename from cmd/mpcvibedrpc/api.go rename to cmd/mprp/api.go index 7dc6aab..cbaea15 100644 --- a/cmd/mpcvibedrpc/api.go +++ b/cmd/mprp/api.go @@ -9,15 +9,15 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/assets" - "github.com/CptPakundo/MPCvibedRPC/internal/conns" - "github.com/CptPakundo/MPCvibedRPC/internal/diag" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/server" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/assets" + "github.com/CptPakundo/MPRP/internal/conns" + "github.com/CptPakundo/MPRP/internal/diag" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/server" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/updater" + "github.com/CptPakundo/MPRP/internal/winsys" ) // fn adapts a handler that needs no request body and cannot fail. diff --git a/cmd/mpcvibedrpc/api_test.go b/cmd/mprp/api_test.go similarity index 68% rename from cmd/mpcvibedrpc/api_test.go rename to cmd/mprp/api_test.go index 4efe7dd..cc9c6fd 100644 --- a/cmd/mpcvibedrpc/api_test.go +++ b/cmd/mprp/api_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/assets" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" + "github.com/CptPakundo/MPRP/internal/assets" + "github.com/CptPakundo/MPRP/internal/engine" ) // Every endpoint the settings page calls exists. @@ -37,11 +37,11 @@ func TestTrayTooltip(t *testing.T) { s engine.Status want string }{ - {engine.Status{}, "MPCvibedRPC - Not showing on Discord"}, - {engine.Status{Running: true, NowPlaying: &title}, "MPCvibedRPC - Sample Show S01E02"}, - {engine.Status{Running: true, Discord: "standby"}, "MPCvibedRPC - Ready"}, - {engine.Status{Running: true, Discord: "waiting"}, "MPCvibedRPC - Waiting for Discord"}, - {engine.Status{Running: true, NowPlaying: &long}, ("MPCvibedRPC - " + long)[:62]}, + {engine.Status{}, "MPRP - Not showing on Discord"}, + {engine.Status{Running: true, NowPlaying: &title}, "MPRP - Sample Show S01E02"}, + {engine.Status{Running: true, Discord: "standby"}, "MPRP - Ready"}, + {engine.Status{Running: true, Discord: "waiting"}, "MPRP - Waiting for Discord"}, + {engine.Status{Running: true, NowPlaying: &long}, ("MPRP - " + long)[:62]}, } { if got := trayTooltip(c.s); got != c.want { t.Errorf("tooltip %q, want %q", got, c.want) diff --git a/cmd/mpcvibedrpc/app.go b/cmd/mprp/app.go similarity index 93% rename from cmd/mpcvibedrpc/app.go rename to cmd/mprp/app.go index e2b1115..3ed6c82 100644 --- a/cmd/mpcvibedrpc/app.go +++ b/cmd/mprp/app.go @@ -12,13 +12,13 @@ import ( "syscall" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/assets" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/server" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/assets" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/server" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/updater" + "github.com/CptPakundo/MPRP/internal/winsys" ) // app is the running program: the settings, the engine, the local server the window talks to, and the tray. @@ -94,7 +94,7 @@ func run() error { token: server.NewToken(), quitDone: make(chan struct{})} a.busy() - msg := fmt.Sprintf("MPCvibedRPC %s starting", version) + msg := fmt.Sprintf("MPRP %s starting", version) // An automatic update leaves a marker for the copy it starts: that copy starts quietly in the tray and says so once. // A start without --after-update that finds one is a start by hand after that copy never got going: the marker is // stale and goes, so a later update by hand is not taken for an automatic one. @@ -163,10 +163,10 @@ func run() error { a.tray = t a.mu.Unlock() if failedUpdate != "" && t != nil { - t.Balloon("MPCvibedRPC could not update to "+failedUpdate, "The new version did not start, so "+version+" is back.") + t.Balloon("MPRP could not update to "+failedUpdate, "The new version did not start, so "+version+" is back.") } if autoFrom != "" && t != nil { - if !t.Balloon("MPCvibedRPC updated to "+version, "Installed by itself (you had "+autoFrom+"). Click here to see what's new.") { + if !t.Balloon("MPRP updated to "+version, "Installed by itself (you had "+autoFrom+"). Click here to see what's new.") { a.log("INFO", "No notice of the automatic update was shown (no tray notifications here).") } } diff --git a/cmd/mpcvibedrpc/changelog_test.go b/cmd/mprp/changelog_test.go similarity index 91% rename from cmd/mpcvibedrpc/changelog_test.go rename to cmd/mprp/changelog_test.go index 5b45a96..9ef9b1f 100644 --- a/cmd/mpcvibedrpc/changelog_test.go +++ b/cmd/mprp/changelog_test.go @@ -6,8 +6,8 @@ import ( "testing" "unicode/utf8" - "github.com/CptPakundo/MPCvibedRPC/internal/assets" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" + "github.com/CptPakundo/MPRP/internal/assets" + "github.com/CptPakundo/MPRP/internal/updater" ) // The changelog's newest entry is this version (a release cannot ship without one), the entries run newest first, diff --git a/cmd/mpcvibedrpc/e2e_rollback_test.go b/cmd/mprp/e2e_rollback_test.go similarity index 86% rename from cmd/mpcvibedrpc/e2e_rollback_test.go rename to cmd/mprp/e2e_rollback_test.go index d89878b..3217915 100644 --- a/cmd/mpcvibedrpc/e2e_rollback_test.go +++ b/cmd/mprp/e2e_rollback_test.go @@ -55,12 +55,12 @@ func TestEndToEndUpdateRollback(t *testing.T) { rel = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch { case strings.HasSuffix(r.URL.Path, "/releases/latest"): - fmt.Fprintf(w, `{"tag_name":"v3.0.1","body":"notes","html_url":"x","assets":[{"name":"MPCvibedRPC-linux-amd64","browser_download_url":"%[1]s/dl"},{"name":"MPCvibedRPC-linux-amd64.sha256","browser_download_url":"%[1]s/sha"},{"name":"MPCvibedRPC-linux-arm64","browser_download_url":"%[1]s/dl"},{"name":"MPCvibedRPC-linux-arm64.sha256","browser_download_url":"%[1]s/sha"}]}`, rel.URL) + fmt.Fprintf(w, `{"tag_name":"v3.0.1","body":"notes","html_url":"x","assets":[{"name":"MPRP-linux-amd64","browser_download_url":"%[1]s/dl"},{"name":"MPRP-linux-amd64.sha256","browser_download_url":"%[1]s/sha"},{"name":"MPRP-linux-arm64","browser_download_url":"%[1]s/dl"},{"name":"MPRP-linux-arm64.sha256","browser_download_url":"%[1]s/sha"}]}`, rel.URL) case r.URL.Path == "/dl": w.Write(newBytes) case r.URL.Path == "/sha": sum := sha256.Sum256(newBytes) - fmt.Fprintf(w, "%x MPCvibedRPC\n", sum) + fmt.Fprintf(w, "%x MPRP\n", sum) } })) defer rel.Close() @@ -69,7 +69,7 @@ func TestEndToEndUpdateRollback(t *testing.T) { os.MkdirAll(home, 0o755) // nothing is asked and nothing is shown: only the update is under test os.WriteFile(filepath.Join(home, "config.json"), []byte(`{"port":1,"showArtwork":false,"mpris":false,"app":{"startPresence":false,"checkUpdates":false,"autoUpdate":false,"welcomeSeen":true}}`), 0o644) - env := append(os.Environ(), "MPCRPC_HOME="+home, "XDG_RUNTIME_DIR="+filepath.Join(dir, "run"), "MPCRPC_UPDATE_API="+rel.URL, "DISPLAY=", "PATH=/nonexistent", "MPCRPC_BROWSER=none", "MPCRPC_FOREGROUND=1") + env := append(os.Environ(), "MPRP_HOME="+home, "XDG_RUNTIME_DIR="+filepath.Join(dir, "run"), "MPRP_UPDATE_API="+rel.URL, "DISPLAY=", "PATH=/nonexistent", "MPRP_BROWSER=none", "MPRP_FOREGROUND=1") cmd := exec.Command(exe, "--background") cmd.Env = env var out bytes.Buffer @@ -120,7 +120,7 @@ func TestEndToEndUpdateRollback(t *testing.T) { if v, _ := os.ReadFile(filepath.Join(home, failedMarker)); strings.TrimSpace(string(v)) != "3.0.1" { t.Errorf("the failed version was not remembered: %q", v) } - logText, _ := os.ReadFile(filepath.Join(home, "mpcvibedrpc.log")) + logText, _ := os.ReadFile(filepath.Join(home, "mprp.log")) for _, want := range []string{"The new version 3.0.1 did not start", "The update to 3.0.1 did not start, so 3.0.0 is back"} { if !strings.Contains(string(logText), want) { t.Errorf("the log lacks %q:\n%s", want, logText) diff --git a/cmd/mpcvibedrpc/e2e_test.go b/cmd/mprp/e2e_test.go similarity index 93% rename from cmd/mpcvibedrpc/e2e_test.go rename to cmd/mprp/e2e_test.go index 0cc349f..99ec736 100644 --- a/cmd/mpcvibedrpc/e2e_test.go +++ b/cmd/mprp/e2e_test.go @@ -179,12 +179,12 @@ func TestEndToEnd(t *testing.T) { rel = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch { case strings.HasSuffix(r.URL.Path, "/releases/latest"): - fmt.Fprintf(w, `{"tag_name":"v3.0.1","body":"notes","html_url":"x","assets":[{"name":"MPCvibedRPC.exe","browser_download_url":"%[1]s/dl"},{"name":"MPCvibedRPC.exe.sha256","browser_download_url":"%[1]s/sha"},{"name":"MPCvibedRPC-linux-amd64","browser_download_url":"%[1]s/dl"},{"name":"MPCvibedRPC-linux-amd64.sha256","browser_download_url":"%[1]s/sha"},{"name":"MPCvibedRPC-linux-arm64","browser_download_url":"%[1]s/dl"},{"name":"MPCvibedRPC-linux-arm64.sha256","browser_download_url":"%[1]s/sha"}]}`, rel.URL) + fmt.Fprintf(w, `{"tag_name":"v3.0.1","body":"notes","html_url":"x","assets":[{"name":"MPRP.exe","browser_download_url":"%[1]s/dl"},{"name":"MPRP.exe.sha256","browser_download_url":"%[1]s/sha"},{"name":"MPRP-linux-amd64","browser_download_url":"%[1]s/dl"},{"name":"MPRP-linux-amd64.sha256","browser_download_url":"%[1]s/sha"},{"name":"MPRP-linux-arm64","browser_download_url":"%[1]s/dl"},{"name":"MPRP-linux-arm64.sha256","browser_download_url":"%[1]s/sha"}]}`, rel.URL) case r.URL.Path == "/dl": w.Write(newBytes) case r.URL.Path == "/sha": // the program only installs a release with a checksum file sum := sha256.Sum256(newBytes) - fmt.Fprintf(w, "%x MPCvibedRPC\n", sum) + fmt.Fprintf(w, "%x MPRP\n", sum) } })) defer rel.Close() @@ -194,7 +194,7 @@ func TestEndToEnd(t *testing.T) { cfg := fmt.Sprintf(`{"port":%d,"pollInterval":250,"showArtwork":false,"clientId":"1","app":{"autoUpdate":false}}`, mpcPort) os.WriteFile(filepath.Join(home, "config.json"), []byte(cfg), 0o644) - env := append(os.Environ(), "MPCRPC_HOME="+home, "XDG_RUNTIME_DIR="+xdg, "MPCRPC_UPDATE_API="+rel.URL, "DISPLAY=", "PATH=/nonexistent", "MPCRPC_BROWSER=none", "MPCRPC_FOREGROUND=1") + env := append(os.Environ(), "MPRP_HOME="+home, "XDG_RUNTIME_DIR="+xdg, "MPRP_UPDATE_API="+rel.URL, "DISPLAY=", "PATH=/nonexistent", "MPRP_BROWSER=none", "MPRP_FOREGROUND=1") cmd := exec.Command(exe, "--background") cmd.Env = env var out bytes.Buffer @@ -270,7 +270,7 @@ func TestEndToEnd(t *testing.T) { } if code, dg := a.call(t, "GET", "diagnostics", ""); code != 200 { t.Fatalf("diagnostics: %d", code) - } else if text, _ := dg["text"].(string); !strings.Contains(text, "MPCvibedRPC diagnostics") || !strings.Contains(text, "pollInterval = 2000") || + } else if text, _ := dg["text"].(string); !strings.Contains(text, "MPRP diagnostics") || !strings.Contains(text, "pollInterval = 2000") || !strings.Contains(text, `"Sample.Movie.2001.1080p.mkv"`) || strings.Contains(text, "/movies/") || strings.Contains(text, home) { // the file name is kept (a wrong title is traced back to it); its folder path and the data folder are not t.Fatalf("diagnostics text is wrong or leaks: %s", text) diff --git a/cmd/mpcvibedrpc/handover_test.go b/cmd/mprp/handover_test.go similarity index 92% rename from cmd/mpcvibedrpc/handover_test.go rename to cmd/mprp/handover_test.go index 0728454..ae20816 100644 --- a/cmd/mpcvibedrpc/handover_test.go +++ b/cmd/mprp/handover_test.go @@ -10,22 +10,22 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/updater" ) -// TestCopyStandIn is not a test of its own: started with MPCRPC_TEST_COPY set, the test program plays a new copy of +// TestCopyStandIn is not a test of its own: started with MPRP_TEST_COPY set, the test program plays a new copy of // the program after an update. "up" writes ipc.json as a copy that came up does, "exit" ends at once, "hang" neither // ends nor comes up. func TestCopyStandIn(t *testing.T) { - switch os.Getenv("MPCRPC_TEST_COPY") { + switch os.Getenv("MPRP_TEST_COPY") { case "exit": os.Exit(3) case "hang": time.Sleep(time.Minute) os.Exit(0) case "up": - os.WriteFile(os.Getenv("MPCRPC_TEST_IPC"), []byte(fmt.Sprintf(`{"port":1,"token":"x","pid":%d}`, os.Getpid())), 0o600) + os.WriteFile(os.Getenv("MPRP_TEST_IPC"), []byte(fmt.Sprintf(`{"port":1,"token":"x","pid":%d}`, os.Getpid())), 0o600) time.Sleep(time.Minute) os.Exit(0) } @@ -35,7 +35,7 @@ func TestCopyStandIn(t *testing.T) { func standIn(t *testing.T, mode, ipcFile string) *os.Process { t.Helper() c := exec.Command(os.Args[0], "-test.run=^TestCopyStandIn$") - c.Env = append(os.Environ(), "MPCRPC_TEST_COPY="+mode, "MPCRPC_TEST_IPC="+ipcFile) + c.Env = append(os.Environ(), "MPRP_TEST_COPY="+mode, "MPRP_TEST_IPC="+ipcFile) if err := c.Start(); err != nil { t.Fatal(err) } diff --git a/cmd/mpcvibedrpc/hide_test.go b/cmd/mprp/hide_test.go similarity index 93% rename from cmd/mpcvibedrpc/hide_test.go rename to cmd/mprp/hide_test.go index 2026d59..a506eb6 100644 --- a/cmd/mpcvibedrpc/hide_test.go +++ b/cmd/mprp/hide_test.go @@ -5,9 +5,9 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/capture" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/capture" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" ) // "Hide what I'm watching" from the tray or the menu bar is saved like the switch in the window and reaches the engine. diff --git a/cmd/mpcvibedrpc/ipc_test.go b/cmd/mprp/ipc_test.go similarity index 100% rename from cmd/mpcvibedrpc/ipc_test.go rename to cmd/mprp/ipc_test.go diff --git a/cmd/mpcvibedrpc/ipc_windows_test.go b/cmd/mprp/ipc_windows_test.go similarity index 100% rename from cmd/mpcvibedrpc/ipc_windows_test.go rename to cmd/mprp/ipc_windows_test.go diff --git a/cmd/mpcvibedrpc/jellyfin.go b/cmd/mprp/jellyfin.go similarity index 98% rename from cmd/mpcvibedrpc/jellyfin.go rename to cmd/mprp/jellyfin.go index 444de0b..c308a4f 100644 --- a/cmd/mpcvibedrpc/jellyfin.go +++ b/cmd/mprp/jellyfin.go @@ -6,9 +6,9 @@ import ( "fmt" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/jellyfin" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/jellyfin" + "github.com/CptPakundo/MPRP/internal/store" ) // jellyfinSignIn are the settings the Jellyfin / Emby sign-in writes and a sign-out forgets; jellyfinDevice, this diff --git a/cmd/mpcvibedrpc/jellyfin_test.go b/cmd/mprp/jellyfin_test.go similarity index 98% rename from cmd/mpcvibedrpc/jellyfin_test.go rename to cmd/mprp/jellyfin_test.go index 4ea35a1..ae15f87 100644 --- a/cmd/mpcvibedrpc/jellyfin_test.go +++ b/cmd/mprp/jellyfin_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" ) // fakeJellyfinServer is a Jellyfin server (Emby: under /emby, no Quick Connect) for the sign-in. Quick Connect is diff --git a/cmd/mpcvibedrpc/launch_darwin.go b/cmd/mprp/launch_darwin.go similarity index 84% rename from cmd/mpcvibedrpc/launch_darwin.go rename to cmd/mprp/launch_darwin.go index 9a92c62..c258917 100644 --- a/cmd/mpcvibedrpc/launch_darwin.go +++ b/cmd/mprp/launch_darwin.go @@ -7,7 +7,7 @@ import ( "os/exec" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/proc" + "github.com/CptPakundo/MPRP/internal/proc" ) // prepareSystem gives a copy started at login the user's temporary folder: launchd starts programs without TMPDIR, @@ -27,9 +27,9 @@ func prepareSystem() { // Dock, the program is "running" for macOS for as long as this process lives, and opening it again would only bring // it to the front (which a program without windows of its own ignores). So this process hands over to a detached copy // and leaves; opening the app again starts a new short-lived copy, which finds the running one and asks it for its -// window. Started at login (--background) or with MPCRPC_FOREGROUND set, the program simply runs. +// window. Started at login (--background) or with MPRP_FOREGROUND set, the program simply runs. func detach() bool { - if background || serve || afterUpdate || os.Getenv("MPCRPC_FOREGROUND") != "" { + if background || serve || afterUpdate || os.Getenv("MPRP_FOREGROUND") != "" { return false } exe, err := os.Executable() diff --git a/cmd/mpcvibedrpc/launch_other.go b/cmd/mprp/launch_other.go similarity index 100% rename from cmd/mpcvibedrpc/launch_other.go rename to cmd/mprp/launch_other.go diff --git a/cmd/mpcvibedrpc/logger.go b/cmd/mprp/logger.go similarity index 100% rename from cmd/mpcvibedrpc/logger.go rename to cmd/mprp/logger.go diff --git a/cmd/mpcvibedrpc/logger_test.go b/cmd/mprp/logger_test.go similarity index 100% rename from cmd/mpcvibedrpc/logger_test.go rename to cmd/mprp/logger_test.go diff --git a/cmd/mpcvibedrpc/main.go b/cmd/mprp/main.go similarity index 87% rename from cmd/mpcvibedrpc/main.go rename to cmd/mprp/main.go index 5be6859..9ac6269 100644 --- a/cmd/mpcvibedrpc/main.go +++ b/cmd/mprp/main.go @@ -1,4 +1,4 @@ -// MPCvibedRPC: shows what MPC-HC, MPC-BE, MPC-QT, mpv, VLC or PotPlayer (on macOS also IINA; on Linux any video player +// MPRP: shows what MPC-HC, MPC-BE, MPC-QT, mpv, VLC or PotPlayer (on macOS also IINA; on Linux any video player // that offers MPRIS), Kodi, or Plex, Jellyfin, Emby or Stremio once signed in, is playing as a Discord Rich Presence. Runs from // the tray on Windows and in the background on macOS and Linux; the settings are a small local web page opened in an // app-style window. @@ -19,12 +19,12 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/capture" - "github.com/CptPakundo/MPCvibedRPC/internal/conns" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/capture" + "github.com/CptPakundo/MPRP/internal/conns" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/updater" + "github.com/CptPakundo/MPRP/internal/winsys" ) // version is set at build time (-ldflags "-X main.version=..."). @@ -45,9 +45,9 @@ func main() { args := os.Args[1:] for i := 0; i < len(args); i++ { switch args[i] { - case "--home": // a data folder of its own, as MPCRPC_HOME gives (Windows run-at-login passes it this way) + case "--home": // a data folder of its own, as MPRP_HOME gives (Windows run-at-login passes it this way) if i+1 < len(args) { - os.Setenv("MPCRPC_HOME", args[i+1]) + os.Setenv("MPRP_HOME", args[i+1]) i++ } case "--background": @@ -69,7 +69,7 @@ func main() { if detach() { return } - if v := os.Getenv("MPCRPC_UPDATE_API"); v != "" { // tests and self-hosted mirrors + if v := os.Getenv("MPRP_UPDATE_API"); v != "" { // tests and self-hosted mirrors updater.APIBase = strings.TrimRight(v, "/") updater.WebBase = updater.APIBase } @@ -89,7 +89,7 @@ func main() { } func crash(msg string) { - f, err := os.OpenFile(filepath.Join(os.TempDir(), "mpcvibedrpc-crash.log"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600) + f, err := os.OpenFile(filepath.Join(os.TempDir(), "mprp-crash.log"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600) if err == nil { fmt.Fprintf(f, "%s %s\n", time.Now().UTC().Format(time.RFC3339), msg) f.Close() @@ -123,7 +123,7 @@ func pingExisting(ipcFile string) *ipcInfo { App string `json:"app"` Pid int `json:"pid"` } - if res.StatusCode != 200 || json.NewDecoder(io.LimitReader(res.Body, 4096)).Decode(&p) != nil || p.App != "MPCvibedRPC" { + if res.StatusCode != 200 || json.NewDecoder(io.LimitReader(res.Body, 4096)).Decode(&p) != nil || p.App != "MPRP" { return nil } // A file left by a copy that crashed can name a port that another copy (one with its own data folder) answers on diff --git a/cmd/mpcvibedrpc/players_doc_test.go b/cmd/mprp/players_doc_test.go similarity index 95% rename from cmd/mpcvibedrpc/players_doc_test.go rename to cmd/mprp/players_doc_test.go index c89618d..8c4f2e3 100644 --- a/cmd/mpcvibedrpc/players_doc_test.go +++ b/cmd/mprp/players_doc_test.go @@ -14,7 +14,7 @@ func TestPlayersAreNamedEverywhere(t *testing.T) { files := []string{ "README.md", "SECURITY.md", "docs/how-it-works.md", "docs/troubleshooting.md", "docs/development.md", "docs/config.md", - "cmd/mpcvibedrpc/main.go", // the header comment + "cmd/mprp/main.go", // the header comment "tools/mkrsrc/main.go", // the exe's file description "internal/assets/ui.js", // the welcome and help texts "internal/engine/engine.go", // the package comment and Status.Player diff --git a/cmd/mpcvibedrpc/plex.go b/cmd/mprp/plex.go similarity index 98% rename from cmd/mpcvibedrpc/plex.go rename to cmd/mprp/plex.go index 74f8dbb..be35f4f 100644 --- a/cmd/mpcvibedrpc/plex.go +++ b/cmd/mprp/plex.go @@ -6,9 +6,9 @@ import ( "fmt" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/plex" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/plex" + "github.com/CptPakundo/MPRP/internal/store" ) // plexSignIn are the settings a Plex sign-in writes and a sign-out forgets; plexClient, this install's identifier on diff --git a/cmd/mpcvibedrpc/plex_test.go b/cmd/mprp/plex_test.go similarity index 99% rename from cmd/mpcvibedrpc/plex_test.go rename to cmd/mprp/plex_test.go index 603def6..19dafa7 100644 --- a/cmd/mpcvibedrpc/plex_test.go +++ b/cmd/mprp/plex_test.go @@ -13,8 +13,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" ) // fakePlexTV hands out a sign-in code that is approved on the third check (or never, when approve is false). diff --git a/cmd/mpcvibedrpc/selfcheck.go b/cmd/mprp/selfcheck.go similarity index 97% rename from cmd/mpcvibedrpc/selfcheck.go rename to cmd/mprp/selfcheck.go index 7549adb..de924c6 100644 --- a/cmd/mpcvibedrpc/selfcheck.go +++ b/cmd/mprp/selfcheck.go @@ -9,11 +9,11 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/capture" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" + "github.com/CptPakundo/MPRP/internal/capture" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/updater" ) // checkItem is one line of "Run a check" (Help tab). Its text never holds a title or a file name. diff --git a/cmd/mpcvibedrpc/selfcheck_test.go b/cmd/mprp/selfcheck_test.go similarity index 96% rename from cmd/mpcvibedrpc/selfcheck_test.go rename to cmd/mprp/selfcheck_test.go index 242e65c..3b717b6 100644 --- a/cmd/mpcvibedrpc/selfcheck_test.go +++ b/cmd/mprp/selfcheck_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/updater" ) // checkApp is an app whose engine sees no player, no Discord and no catalog on this computer. diff --git a/cmd/mpcvibedrpc/stremio.go b/cmd/mprp/stremio.go similarity index 95% rename from cmd/mpcvibedrpc/stremio.go rename to cmd/mprp/stremio.go index 18e4b03..cd76999 100644 --- a/cmd/mpcvibedrpc/stremio.go +++ b/cmd/mprp/stremio.go @@ -6,9 +6,9 @@ import ( "fmt" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/stremio" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/stremio" ) // stremioAccount drives "Sign in to Stremio": a code the user approves on stremio.com in their browser, after which diff --git a/cmd/mpcvibedrpc/stremio_test.go b/cmd/mprp/stremio_test.go similarity index 97% rename from cmd/mpcvibedrpc/stremio_test.go rename to cmd/mprp/stremio_test.go index 2f38f3c..ab7d6f8 100644 --- a/cmd/mpcvibedrpc/stremio_test.go +++ b/cmd/mprp/stremio_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" ) // fakeStremioLink hands out a sign-in code that is approved on the third check, and ends sessions on logout. diff --git a/cmd/mpcvibedrpc/tray.go b/cmd/mprp/tray.go similarity index 88% rename from cmd/mpcvibedrpc/tray.go rename to cmd/mprp/tray.go index ac06f07..fb25c89 100644 --- a/cmd/mpcvibedrpc/tray.go +++ b/cmd/mprp/tray.go @@ -1,9 +1,9 @@ package main import ( - "github.com/CptPakundo/MPCvibedRPC/internal/assets" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/assets" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/winsys" ) // startTray puts up the tray icon (Windows) or the menu bar icon (macOS); elsewhere there is none. @@ -31,7 +31,7 @@ func (a *app) startTray() *winsys.Tray { // trayTooltip is the icon's tooltip and the menu's status line (Windows cuts tooltips at 63 characters). func trayTooltip(s engine.Status) string { - t := "MPCvibedRPC - " + t := "MPRP - " switch { case !s.Running: t += "Not showing on Discord" diff --git a/cmd/mpcvibedrpc/update.go b/cmd/mprp/update.go similarity index 97% rename from cmd/mpcvibedrpc/update.go rename to cmd/mprp/update.go index c9bde7e..a55c956 100644 --- a/cmd/mpcvibedrpc/update.go +++ b/cmd/mprp/update.go @@ -12,10 +12,10 @@ import ( "sync/atomic" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/proc" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/proc" + "github.com/CptPakundo/MPRP/internal/updater" + "github.com/CptPakundo/MPRP/internal/winsys" ) // updates is what the program knows about newer versions. @@ -69,7 +69,7 @@ func (a *app) checkUpdates(manual bool) (*updater.Info, error) { a.upd.mu.Unlock() t := a.getTray() if first && t != nil && winsys.IsWindows { // the macOS menu bar icon has no notifications - if t.Balloon("MPCvibedRPC "+r.Latest+" is available", "You have "+version+". Click here to see what's new and install it.") { + if t.Balloon("MPRP "+r.Latest+" is available", "You have "+version+". Click here to see what's new and install it.") { a.log("INFO", "Showed an update notice next to the tray icon.") } else { a.log("WARN", "Windows did not show the update notice.") diff --git a/cmd/mpcvibedrpc/update_sched_test.go b/cmd/mprp/update_sched_test.go similarity index 98% rename from cmd/mpcvibedrpc/update_sched_test.go rename to cmd/mprp/update_sched_test.go index 1d38624..a3d9ef5 100644 --- a/cmd/mpcvibedrpc/update_sched_test.go +++ b/cmd/mprp/update_sched_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" + "github.com/CptPakundo/MPRP/internal/updater" ) // The check by itself follows the wall clock: due at once when none went out yet, six hours after one that diff --git a/cmd/mpcvibedrpc/update_test.go b/cmd/mprp/update_test.go similarity index 95% rename from cmd/mpcvibedrpc/update_test.go rename to cmd/mprp/update_test.go index 8cdd186..b6302bb 100644 --- a/cmd/mpcvibedrpc/update_test.go +++ b/cmd/mprp/update_test.go @@ -8,10 +8,10 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/store" - "github.com/CptPakundo/MPCvibedRPC/internal/updater" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/store" + "github.com/CptPakundo/MPRP/internal/updater" ) // An automatic update only restarts the program when that interrupts nobody: nothing shown on Discord (a cleared diff --git a/cmd/mpcvibedrpc/window.go b/cmd/mprp/window.go similarity index 98% rename from cmd/mpcvibedrpc/window.go rename to cmd/mprp/window.go index cd25b89..0e90f01 100644 --- a/cmd/mpcvibedrpc/window.go +++ b/cmd/mprp/window.go @@ -4,7 +4,7 @@ import ( "runtime" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/winsys" + "github.com/CptPakundo/MPRP/internal/winsys" ) // The settings window's X quits the program, and minimising it sends it to the tray (minimizeToTray, Windows). diff --git a/cmd/mpcvibedrpc/window_test.go b/cmd/mprp/window_test.go similarity index 100% rename from cmd/mpcvibedrpc/window_test.go rename to cmd/mprp/window_test.go diff --git a/docs/ai.md b/docs/ai.md index f39f491..ce7186b 100644 --- a/docs/ai.md +++ b/docs/ai.md @@ -1,6 +1,6 @@ # How AI was used -MPCvibedRPC is AI-generated ("vibe coded"). This page says what that means here, so you can judge it for yourself. +MPRP is AI-generated ("vibe coded"). This page says what that means here, so you can judge it for yourself. ## Who did what - **The AI** (Claude, by Anthropic) wrote the code, the tests, the CI workflows and the @@ -51,4 +51,4 @@ What has held up while developing this project with AI agents (any tool, any mod - macOS and Linux are mostly tested on CI runners, not on real desktops; Stremio has only been tested against fakes built from its source code. - AI-written code can be wrong in ways tests do not catch. If you find such a case, please - [open an issue](https://github.com/CptPakundo/MPCvibedRPC/issues/new/choose). + [open an issue](https://github.com/CptPakundo/MPRP/issues/new/choose). diff --git a/docs/config.md b/docs/config.md index 7b0da31..07b308d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2,9 +2,9 @@ Every setting with its default and what it does, grouped by the settings window's tabs. The window covers the main ones and saves them as you change them. The others go in `config.json`: -- Windows: `%LOCALAPPDATA%\MPCvibedRPC\config.json` -- macOS: `~/Library/Application Support/MPCvibedRPC/config.json` -- Linux: `~/.local/share/MPCvibedRPC/config.json` +- Windows: `%LOCALAPPDATA%\MPRP\config.json` +- macOS: `~/Library/Application Support/MPRP/config.json` +- Linux: `~/.local/share/MPRP/config.json` `config.json` is JSON: use the names below and write values as the Default column does, for example `{"artworkSources": ["imdb", "tvmaze"]}`. The settings of the General tab go inside `"app"`: @@ -23,7 +23,7 @@ These live under `"app"` in `config.json`. The update switches and **Check now** | `startPresence` | `true` | **Show on Discord when the app opens.** Otherwise it waits until you press Show on Discord. | | `checkUpdates` | `true` | **Check for updates automatically:** as the program starts, then every six hours ([how updates work](troubleshooting.md#updates)). | | `autoUpdate` | `true` | **Install updates automatically** (Windows and Linux, with `checkUpdates` on): a found update installs itself once nothing is playing and no settings window is open (the program runs minimised to the tray or started at login; closing the window quits it on Windows and Linux). Off: the window and a tray notice offer it, and **Install** installs it. | -| `updateRepo` | `"CptPakundo/MPCvibedRPC"` | *(config.json only)* The GitHub repository (`owner/repo`) that publishes releases. A release is only installed when it carries a `.sha256` checksum file for the download; otherwise the window links to its page. | +| `updateRepo` | `"CptPakundo/MPRP"` | *(config.json only)* The GitHub repository (`owner/repo`) that publishes releases. A release is only installed when it carries a `.sha256` checksum file for the download; otherwise the window links to its page. | ## Players diff --git a/docs/design/fix-a-match.md b/docs/design/fix-a-match.md index 0fc335f..fb4d91c 100644 --- a/docs/design/fix-a-match.md +++ b/docs/design/fix-a-match.md @@ -135,7 +135,7 @@ fix saved by a new version is not seen by an older one; the changelog says so. not Wikipedia, Jikan or Bulbapedia; deduplicated; cached); page addresses resolved by ID so episode titles work from the pinned entry; `Covers(entry)`; fixes still read before the `media.Junk` return; the offset applied where season and episode reach the catalogs. -3. `cmd/mpcvibedrpc` API: POST `match-search` and `match-covers`, each answer carrying a request number so the window +3. `cmd/mprp` API: POST `match-search` and `match-covers`, each answer carrying a request number so the window drops answers to older keystrokes; the status carries the read title, the file's base name, season, episode and the closest results (no folders); the Tell the project text is built from the same data. 4. `internal/assets`: the dialog and the list replace the two text boxes; `why.go` says "Matched as you chose: ...". diff --git a/docs/development.md b/docs/development.md index 155032b..d178f3a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,6 +1,6 @@ # Development -How MPCvibedRPC is built, tested and kept working. For using it, see the [README](../README.md); for the rules that +How MPRP is built, tested and kept working. For using it, see the [README](../README.md); for the rules that apply to every change, [CONTRIBUTING.md](../CONTRIBUTING.md) (and [AGENTS.md](../AGENTS.md) for AI tools); for releasing and screenshots, [maintaining.md](maintaining.md). @@ -14,7 +14,7 @@ Terms these docs use: | standby | "Discord on standby": showing is on, but nothing plays yet, so Discord has not been contacted. | | resting | Discord is closed and no settings window is open: a check only looks whether Discord has started. | | golden data | Recorded reference outputs in `internal/*/testdata/*.gz` that the parsers and lookups are checked against. Frozen: never regenerate it. | -| throwaway copy | A copy of the program run with a data folder of its own (`MPCRPC_HOME`), so it cannot touch an installed copy. See [Running the program safely](#running-the-program-safely). | +| throwaway copy | A copy of the program run with a data folder of its own (`MPRP_HOME`), so it cannot touch an installed copy. See [Running the program safely](#running-the-program-safely). | | smoke test | CI starts the real built program on its own system and checks it from outside (`tools/ci/smoke.ps1`, `smoke-unix.sh`). | | live jobs | CI jobs that install real players and media servers on a throwaway runner and run the engine against them. | | canary | The weekly CI run against the newest players, server images and catalog services; it opens an issue when something outside changed. | @@ -26,15 +26,15 @@ version in `go.mod` (the `go` line) and no internet beyond that. Windows (the resource step adds the icon and version details; it is optional): - go run ./tools/mkrsrc -version X.Y.Z -out cmd/mpcvibedrpc/rsrc_windows_amd64.syso - go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=X.Y.Z" -o MPCvibedRPC.exe ./cmd/mpcvibedrpc + go run ./tools/mkrsrc -version X.Y.Z -out cmd/mprp/rsrc_windows_amd64.syso + go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=X.Y.Z" -o MPRP.exe ./cmd/mprp `-H=windowsgui` makes it a windowed program, so no console flashes up. You can build it from any OS (`GOOS=windows`). Linux: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=X.Y.Z" -o MPCvibedRPC-linux-amd64 ./cmd/mpcvibedrpc + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=X.Y.Z" -o MPRP-linux-amd64 ./cmd/mprp macOS: the app is built on a Mac **with cgo** by `tools/ci/package-macos.sh VERSION OUTDIR` (`CGO_ENABLED=1`; both processor types in one program, the app icon, an ad-hoc signature, a zip). The menu bar icon and the settings window @@ -46,7 +46,7 @@ Flags of the program: | Flag | What it does | |---|---| | `--background` | Start in the tray. | -| `--home <folder>` | A data folder of its own, like `MPCRPC_HOME`. | +| `--home <folder>` | A data folder of its own, like `MPRP_HOME`. | | `--after-update` | Set on the copy an update started. | | `--update-failed` | Set on the old copy that an update put back (see [Updates](#updates)). | | `--version` | Print the version and exit. | @@ -56,14 +56,14 @@ Flags of the program: Never touch a real setup while testing ([the rule](../CONTRIBUTING.md#ground-rules)). Use throwaway copies and the fakes below. -- **A throwaway copy.** `MPCRPC_HOME=<scratch folder>` (or `--home <folder>`) gives a copy its own data folder **and +- **A throwaway copy.** `MPRP_HOME=<scratch folder>` (or `--home <folder>`) gives a copy its own data folder **and its own autostart value name**, so it never touches an installed copy. A config such as `{"app":{"openWindow":false,"startPresence":false,"checkUpdates":false,"welcomeSeen":true}}` keeps it quiet. - **Keep `checkUpdates` off in test copies.** With it on, a copy without a window installs what its update server offers ten seconds after its start and shows a real operating-system notification. To try the update dialog, start with it off, open the page, then switch it on there (that checks at once), or trigger a check through `api/update-check`. -- **The page.** The API port and token are in `<MPCRPC_HOME>/ipc.json`; the page is +- **The page.** The API port and token are in `<MPRP_HOME>/ipc.json`; the page is `http://127.0.0.1:<port>/?t=<token>`. (The program itself opens its window with a one-time code, `?c=`, so the token is not on the browser's command line; the page keeps the token in `sessionStorage` and takes it out of its address.) To test window states without Discord, override `window.fetch` for `/api/status` (or `/api/plex*`, @@ -73,11 +73,11 @@ fakes below. `vlcPassword` empty. - **Resting.** A throwaway copy rests whenever Discord is closed and its window is closed (no player is asked then). To test players with Discord closed, keep the window open. -- **Update checks.** `MPCRPC_UPDATE_API=http://127.0.0.1:<port>` with `tools/ci/fake-http.ps1` (on CI). On a Windows +- **Update checks.** `MPRP_UPDATE_API=http://127.0.0.1:<port>` with `tools/ci/fake-http.ps1` (on CI). On a Windows PC its HttpListener may be refused without admin rights; a small Go server in a scratch folder can serve the same three answers. -- **Other variables.** `MPCRPC_BROWSER=none` opens no window (tests, CI); any other value names the browser to show - the window in (one that understands `--app`). `MPCRPC_FOREGROUND=1` keeps a macOS copy from handing over to a +- **Other variables.** `MPRP_BROWSER=none` opens no window (tests, CI); any other value names the browser to show + the window in (one that understands `--app`). `MPRP_FOREGROUND=1` keeps a macOS copy from handing over to a detached one. - **Portable players.** Use portable builds in a scratch folder and verify their published checksums: MPC-QT (`portable.txt`), MPC-BE (an ini next to the exe), mpv (`portable_config\`), VLC (a `portable\` folder next to @@ -85,9 +85,9 @@ fakes below. `%APPDATA%`, `%LOCALAPPDATA%` and `HKCU\Software` afterwards. Make test videos with mpv's encoder from `lavfi` test sources, with generic names. - **Accounts.** Never sign in to a real account ([the rule](../CONTRIBUTING.md#ground-rules)). Every reader has fakes: - Plex in `internal/plex`, `cmd/mpcvibedrpc/plex_test.go` and `internal/engine/plex_test.go`; Stremio in - `internal/stremio`, `cmd/mpcvibedrpc/stremio_test.go` and `internal/engine/rest_test.go`; Jellyfin / Emby in - `internal/jellyfin`, `cmd/mpcvibedrpc/jellyfin_test.go` and `internal/engine/jellyfin_test.go`. A small fake server on + Plex in `internal/plex`, `cmd/mprp/plex_test.go` and `internal/engine/plex_test.go`; Stremio in + `internal/stremio`, `cmd/mprp/stremio_test.go` and `internal/engine/rest_test.go`; Jellyfin / Emby in + `internal/jellyfin`, `cmd/mprp/jellyfin_test.go` and `internal/engine/jellyfin_test.go`. A small fake server on 127.0.0.1 can drive the window's sign-in in a throwaway copy (keep showing on Discord off). - **Leave nothing running.** Quit test copies, stop only processes you started, delete scratch tests before a full test run, and check the real data folders afterwards. @@ -97,23 +97,23 @@ These skip unless their variable is set. CI sets them for its throwaway players | Test | Variables | What it does | |---|---|---| -| `TestLivePlayer` (`internal/engine`) | `MPCRPC_LIVE_PLAYER` (the name shown: mpv, IINA, VLC, Celluloid, Plex, ...), `MPCRPC_LIVE_TITLE` | Runs the engine against a real player, with the test's own fake Discord. | -| | `MPCRPC_LIVE_PORT`, `MPCRPC_LIVE_MPV_PIPE`, `MPCRPC_LIVE_IINA_PIPE` | The MPC port and the mpv / IINA pipe to ask. | -| | `MPCRPC_LIVE_VLC_PASSWORD`, `MPCRPC_LIVE_VLC_PORT` | VLC's web interface. | -| | `MPCRPC_LIVE_KODI_PASSWORD`, `MPCRPC_LIVE_KODI_ADDRESS` | Kodi's web server (the address is optional). | -| | `MPCRPC_LIVE_PLEX_ADDRESS`, `MPCRPC_LIVE_PLEX_TOKEN` | A Plex server. | -| | `MPCRPC_LIVE_JELLYFIN_ADDRESS`, `_USER`, `_PASSWORD` | Signs in to a Jellyfin or Emby server with the password. | -| | `MPCRPC_LIVE_EVENTS` (`pipe`, `kodi` or `mpris`) | **Changes the player's state:** pauses the real player and wants the pause shown at once from the player's own event, then resumes it. | -| `TestLiveJellyfin` (`internal/jellyfin`) | `MPCRPC_LIVE_JELLYFIN_ADDRESS`, `_USER`, `_PASSWORD`, `_PRODUCT` (`Jellyfin` or `Emby`), `MPCRPC_LIVE_TITLE` | Signs in to a real server (a wrong password first, then the password, and Quick Connect on Jellyfin), follows what the user plays, signs out. | -| `TestLivePotPlayer` (`internal/potplayer`, Windows) | `MPCRPC_LIVE_POTPLAYER=1` | Asks a real PotPlayer that plays a local file and checks that it sends the file's path. | -| `TestLiveCatalogs` (`internal/artwork`) | `MPCRPC_LIVE_CATALOGS=1` | One long-known title per keyless catalog, through the program's own search and episode code (the canary; the real titles are kept in that file). | -| `TestAutostartRegistryRoundTrip` (`internal/winsys`, Windows) | `MPCRPC_TEST_REGISTRY=1` | **Touches the real setup:** writes a real `HKCU\...\Run` value (for a throwaway data folder's value name, never the plain `MPCvibedRPC` one) and removes it again. | - -Example: `MPCRPC_LIVE_PLAYER=mpv MPCRPC_LIVE_TITLE="Sample Movie" go test -count=1 -run TestLivePlayer -v ./internal/engine` +| `TestLivePlayer` (`internal/engine`) | `MPRP_LIVE_PLAYER` (the name shown: mpv, IINA, VLC, Celluloid, Plex, ...), `MPRP_LIVE_TITLE` | Runs the engine against a real player, with the test's own fake Discord. | +| | `MPRP_LIVE_PORT`, `MPRP_LIVE_MPV_PIPE`, `MPRP_LIVE_IINA_PIPE` | The MPC port and the mpv / IINA pipe to ask. | +| | `MPRP_LIVE_VLC_PASSWORD`, `MPRP_LIVE_VLC_PORT` | VLC's web interface. | +| | `MPRP_LIVE_KODI_PASSWORD`, `MPRP_LIVE_KODI_ADDRESS` | Kodi's web server (the address is optional). | +| | `MPRP_LIVE_PLEX_ADDRESS`, `MPRP_LIVE_PLEX_TOKEN` | A Plex server. | +| | `MPRP_LIVE_JELLYFIN_ADDRESS`, `_USER`, `_PASSWORD` | Signs in to a Jellyfin or Emby server with the password. | +| | `MPRP_LIVE_EVENTS` (`pipe`, `kodi` or `mpris`) | **Changes the player's state:** pauses the real player and wants the pause shown at once from the player's own event, then resumes it. | +| `TestLiveJellyfin` (`internal/jellyfin`) | `MPRP_LIVE_JELLYFIN_ADDRESS`, `_USER`, `_PASSWORD`, `_PRODUCT` (`Jellyfin` or `Emby`), `MPRP_LIVE_TITLE` | Signs in to a real server (a wrong password first, then the password, and Quick Connect on Jellyfin), follows what the user plays, signs out. | +| `TestLivePotPlayer` (`internal/potplayer`, Windows) | `MPRP_LIVE_POTPLAYER=1` | Asks a real PotPlayer that plays a local file and checks that it sends the file's path. | +| `TestLiveCatalogs` (`internal/artwork`) | `MPRP_LIVE_CATALOGS=1` | One long-known title per keyless catalog, through the program's own search and episode code (the canary; the real titles are kept in that file). | +| `TestAutostartRegistryRoundTrip` (`internal/winsys`, Windows) | `MPRP_TEST_REGISTRY=1` | **Touches the real setup:** writes a real `HKCU\...\Run` value (for a throwaway data folder's value name, never the plain `MPRP` one) and removes it again. | + +Example: `MPRP_LIVE_PLAYER=mpv MPRP_LIVE_TITLE="Sample Movie" go test -count=1 -run TestLivePlayer -v ./internal/engine` ## Where things are -### The program: `cmd/mpcvibedrpc` +### The program: `cmd/mprp` | File | Job | |---|---| | `main.go` | flags, single instance, `var version` | @@ -229,7 +229,7 @@ reads what plays. - Tests set `Options.KodiEvents` and `Options.MPRISBus`, so no real Kodi or bus is reached. ### Plex -- **Sign-in** (`cmd/mpcvibedrpc/plex.go`): a token through a plex.tv PIN the user approves in their browser; the +- **Sign-in** (`cmd/mprp/plex.go`): a token through a plex.tv PIN the user approves in their browser; the window never receives the token. - **Server:** the watcher looks the chosen server up on plex.tv (`clients.plex.tv/api/v2/resources`, or uses `plexAddress`) and checks `/identity` without the token. The token goes only to the server that answered with the @@ -334,7 +334,7 @@ Tests: `internal/engine/state_test.go`. `TestStatusConverges` runs random orders against the fakes and checks that Discord ends up showing exactly what the player's last state calls for. After a change to the check loop, run it with more orders: - MPCRPC_CONVERGE_SEEDS=500 go test -count=1 -run TestStatusConverges ./internal/engine + MPRP_CONVERGE_SEEDS=500 go test -count=1 -run TestStatusConverges ./internal/engine ## The stream title `streamTitle` ("auto", "always", "off"): Discord names a stream after a Playing activity only, so the engine builds the @@ -361,7 +361,7 @@ Playing form while Discord shares the screen ([users' view](how-it-works.md#on-y - **Automatic install** (`autoUpdate`, on by default; Windows and Linux): at a quiet moment (`quietMoment`: nothing shown on Discord, no settings window; never in the first ten seconds after the start or after a window was asked for, `settle`). The new copy starts in the tray (`auto-updated` marker in the data folder) and says so once. -- **Hand-over** (`handOverTo` in `cmd/mpcvibedrpc/update.go`): the old copy frees the window, tray, port and +- **Hand-over** (`handOverTo` in `cmd/mprp/update.go`): the old copy frees the window, tray, port and single-instance lock and waits for the new copy's `ipc.json`. If it does not come, it puts the old program file back, writes `update-failed` (the version, which is not installed by itself again) and starts itself again with `--update-failed`. @@ -414,11 +414,11 @@ run a copy or a real player without touching an installed setup: [Running the pr **Tests that tie texts to the code** (keep them passing; they fail when a doc falls behind): - `TestEverySettingIsDocumented` (`internal/store`): every setting has its row and default in [config.md](config.md). -- `TestPlayersAreNamedEverywhere` (`cmd/mpcvibedrpc`): every text that lists the players names them all. +- `TestPlayersAreNamedEverywhere` (`cmd/mprp`): every text that lists the players names them all. - `TestEveryHostIsListed` and `TestSecurityListsEveryHost` (`internal/core`): every outside address the code and the page name is in `core.Hosts` or `core.Sources`, and `SECURITY.md` names each. - `TestPageScriptParses` (`internal/assets`): `node --check` on `ui.js` (skips without Node.js). -- `TestChangelog` (`cmd/mpcvibedrpc`): the newest changelog entry is the version in `main.go`. +- `TestChangelog` (`cmd/mprp`): the newest changelog entry is the version in `main.go`. - `tools/relnotes`'s test: the release text renders from `internal/assets/changelog.json`. - `TestLinksResolve` (`tools/doclinks`): every relative link and `#anchor` in every Markdown file resolves (GitHub's anchor rules; links to other websites are not followed). diff --git a/docs/how-it-works.md b/docs/how-it-works.md index d2a65bc..b474e60 100644 --- a/docs/how-it-works.md +++ b/docs/how-it-works.md @@ -66,7 +66,7 @@ tray. number at the top shows every version's. - **Updates.** The program looks for a new version as it starts and every six hours, and asks or installs it by itself: see [Troubleshooting > Updates](troubleshooting.md#updates). -- The log is `mpcvibedrpc.log` (also on the **Help** tab). +- The log is `mprp.log` (also on the **Help** tab). ## Titles and covers @@ -275,7 +275,7 @@ What was tried with which player, and how, is in [What has been tried](#what-has ### Plex - **Signing in:** **Players > Sign in to Plex** opens plex.tv in your browser, and you approve the sign-in there (the - program never sees your password). The program introduces itself to Plex as "MPCvibedRPC" and keeps the sign-in in + program never sees your password). The program introduces itself to Plex as "MPRP" and keeps the sign-in in `config.json`; **Sign out** or **Restore defaults** asks plex.tv to end the sign-in, then removes it from this computer (also when plex.tv does not answer). The program may stay listed on Plex's *Authorized Devices* page, where its entry can be deleted. diff --git a/docs/maintaining.md b/docs/maintaining.md index 961d8cb..03836bb 100644 --- a/docs/maintaining.md +++ b/docs/maintaining.md @@ -1,6 +1,6 @@ # Maintaining -For maintainers: how MPCvibedRPC is released, how its screenshots are taken, how the README is previewed and how +For maintainers: how MPRP is released, how its screenshots are taken, how the README is previewed and how release files are downloaded. Building, testing and running the program safely are in [development.md](development.md); the rules for everyone are in [CONTRIBUTING.md](../CONTRIBUTING.md). @@ -26,7 +26,7 @@ Steps 1-2 are done where the change was made. Steps 3-4 (from the merge to the v version and the maintainer's go-ahead. 1. **Branch and change.** - - Bump `var version` in `cmd/mpcvibedrpc/main.go`. Nothing else carries the version: the workflows run + - Bump `var version` in `cmd/mprp/main.go`. Nothing else carries the version: the workflows run `tools/ci/version.sh`, which reads it from `main.go`, works out `NEXT` (the next patch version, which the smoke test's self-update installs) and, on a tag, fails when the tag does not match. Docs use `X.Y.Z`. - Add the version's entry at the top of `internal/assets/changelog.json` (short lines, one emoji each, at most 130 @@ -53,7 +53,7 @@ version and the maintainer's go-ahead. commits (seen once with merged helper branches): use `--merge` then, or rebase the branch locally first. 3. **Tag** the merged commit with an annotated tag and push it. An annotated tag stores the tagger's name and email, so tag with the same neutral identity used for commits, never a personal email: - `git -c user.name="<name>" -c user.email="<noreply address>" tag -a vX.Y.Z -m "MPCvibedRPC X.Y.Z"`, then + `git -c user.name="<name>" -c user.email="<noreply address>" tag -a vX.Y.Z -m "MPRP X.Y.Z"`, then `git push origin vX.Y.Z`. 4. **The release workflow** (`.github/workflows/release.yml`) checks the tag against `main.go`, runs the tests, builds the programs on Windows, Linux and macOS runners and smoke-tests each on its own system (Windows: tray, diff --git a/docs/research/discord-rich-presence.md b/docs/research/discord-rich-presence.md index 765c461..7667a14 100644 --- a/docs/research/discord-rich-presence.md +++ b/docs/research/discord-rich-presence.md @@ -1,4 +1,4 @@ -# Discord Rich Presence: what the card can show and what MPCvibedRPC sends +# Discord Rich Presence: what the card can show and what MPRP sends A research report, written 2026-11-21 and checked against the code on 2026-11-25. Its sources are Discord's public developer documentation, what was seen on real profiles and streams, and this repository. Nothing here comes from diff --git a/docs/roadmap.md b/docs/roadmap.md index dc14051..340e446 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap -Where MPCvibedRPC is heading, what it deliberately leaves out, and the outside changes it has to watch. It comes from +Where MPRP is heading, what it deliberately leaves out, and the outside changes it has to watch. It comes from a research pass over Discord's documentation, the projects the program reads from, similar presence tools and their users, and distribution channels (last reviewed 2026-11-25, with 0.9.58). @@ -28,7 +28,7 @@ done. (Work in progress is a branch and pull request: [CONTRIBUTING](../CONTRIBU change that touches no player or Discord setting leaves the connection open (an engine test against the fake Discord). 2. **Behaviour tests for the settings page's script** (`internal/assets/ui.js`): a few tests with a stubbed `fetch` for the saver and the status sync. Today only `TestPageScriptParses` (`node --check`) covers it. -3. **Tests for how the window's X quits** (`cmd/mpcvibedrpc/window.go`): the order of the dropped `/api/alive` +3. **Tests for how the window's X quits** (`cmd/mprp/window.go`): the order of the dropped `/api/alive` connection and the window-handle polling. Also check whether `inTray` stays true when closing the window fails; if it does, a later X would not quit. 4. **Historic names in the code.** The API's `mpc-web`, `winsys.EnableMpcWebInterface` and `Status.MPC` cover every @@ -45,7 +45,7 @@ done. (Work in progress is a branch and pull request: [CONTRIBUTING](../CONTRIBU canary uses it. Add a retry or another source ([known flaky checks](development.md#known-flaky-checks)). 10. **Fix a match, first version** (settled 2026-11-25; part of version 0.9.60). Build what [design/fix-a-match.md](design/fix-a-match.md) describes: the dialog and the list with the scope choice, covers from - the other catalogs, offsets and "Tell the project". *Where:* `internal/artwork`, the `cmd/mpcvibedrpc` API, + the other catalogs, offsets and "Tell the project". *Where:* `internal/artwork`, the `cmd/mprp` API, `internal/assets` (the window), `core.Config` and the store schema (`matchFixes`), the docs. Done when the dialog and the list replace the two text boxes, old `artworkAliases` and `artworkOverrides` lines still act as before (they become fixes once), and the tests the design names pass. @@ -56,7 +56,7 @@ done. (Work in progress is a branch and pull request: [CONTRIBUTING](../CONTRIBU golden data byte for byte, Custom lines show on the card, and the tests the design names pass. 12. **The update notices on Linux and macOS** (settled 2026-11-25; part of version 0.9.60). Windows already shows three native notifications through the tray (`Tray.Balloon`): "updated to <version>" once after an automatic update - (`cmd/mpcvibedrpc/app.go`, `autoFrom`), "could not update to ..." after a rollback, and "<version> is available" + (`cmd/mprp/app.go`, `autoFrom`), "could not update to ..." after a rollback, and "<version> is available" when automatic installs are off (`update.go`). Linux and macOS show none (`Balloon` returns false in `internal/winsys/tray_other.go` and `macapp_darwin.go`). Bring the same three there: Linux through the desktop notification service over D-Bus (`org.freedesktop.Notifications`, with `internal/dbus`), macOS through the menu bar diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 0f8c4fd..4a2ec7e 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -11,7 +11,7 @@ is listed in [All settings](config.md). **Help > Run a check** tells you in a fe - IINA isn't found: after setting it up, quit IINA completely (IINA > Quit IINA) and open it again. - MPC-QT needs no setup (it is read through its own connection); MPC-BE is set up like MPC-HC, with the same button. - macOS 15 or later: a Plex, Jellyfin, Emby or Kodi server on your home network can't be reached until you allow it. - Answer **Allow** when macOS asks, or turn MPCvibedRPC on under System Settings > Privacy & Security > Local Network. + Answer **Allow** when macOS asks, or turn MPRP on under System Settings > Privacy & Security > Local Network. - "Discord on standby" is normal: showing is on, and the program contacts Discord only once something plays. If it stays on "Waiting for Discord" while a video plays, use the Discord desktop app (not the browser) and check that "Share my activity" is on ([where](../README.md#-getting-started)). @@ -123,7 +123,7 @@ stays in the menu bar); minimizing it on Windows sends it to the tray. ## Wrong title or no cover -The log (**Help** tab, or `mpcvibedrpc.log` in the settings folder) shows each title next to the file name it was read +The log (**Help** tab, or `mprp.log` in the settings folder) shows each title next to the file name it was read from, for example `Playing: Sample Show ยท S01E02 (MPC-HC: "Sample.Show.S01E02.1080p.mkv")`, and lists what each catalog returned. Under **Titles & art > Fix a match** you can search under another name or pin your own cover image: start each line with the title as the log shows it after `Playing:` ([an example](how-it-works.md#fixing-a-match)). A free @@ -132,8 +132,8 @@ cover the first time: TVmaze answers a search slowly until it has it cached. ## Where are my settings? How do I remove it? -Everything is in `%LOCALAPPDATA%\MPCvibedRPC` (macOS: `~/Library/Application Support/MPCvibedRPC`; Linux: -`~/.local/share/MPCvibedRPC`): settings, log, cover cache, your stats, and the window's own browser profile (your +Everything is in `%LOCALAPPDATA%\MPRP` (macOS: `~/Library/Application Support/MPRP`; Linux: +`~/.local/share/MPRP`): settings, log, cover cache, your stats, and the window's own browser profile (your regular browser is left alone). **Open settings folder** (**Advanced > Maintenance**) opens it. Every setting with its default is in [docs/config.md](config.md). @@ -178,4 +178,4 @@ them. On the **Help** tab, **Copy diagnostics** copies the version, the settings you changed, how the current title was found (the file name, what was read from it, which catalog matched) and the recent log. It names the titles and file names you played (that is how a wrong title is traced); folder paths, sign-ins and keys are left out. Paste it into a -[new issue](https://github.com/CptPakundo/MPCvibedRPC/issues/new/choose). +[new issue](https://github.com/CptPakundo/MPRP/issues/new/choose). diff --git a/go.mod b/go.mod index b06e926..7a94224 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/CptPakundo/MPCvibedRPC +module github.com/CptPakundo/MPRP go 1.27.4 diff --git a/internal/artwork/anime_episodes_test.go b/internal/artwork/anime_episodes_test.go index 5201597..c0f923a 100644 --- a/internal/artwork/anime_episodes_test.go +++ b/internal/artwork/anime_episodes_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // fakeAnimeCatalogs answers like TVmaze, Jikan (MyAnimeList) and Cinemeta for a long-running anime, "Sample Saga" diff --git a/internal/artwork/artwork.go b/internal/artwork/artwork.go index 364c547..318765b 100644 --- a/internal/artwork/artwork.go +++ b/internal/artwork/artwork.go @@ -15,7 +15,7 @@ import ( "net/http" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Options configures an Artwork finder. diff --git a/internal/artwork/cache_days_test.go b/internal/artwork/cache_days_test.go index afa25ca..0027dac 100644 --- a/internal/artwork/cache_days_test.go +++ b/internal/artwork/cache_days_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // cacheTestFinder makes a finder on a temp file whose clock is the returned day. diff --git a/internal/artwork/disabled.go b/internal/artwork/disabled.go index 68efb86..d6b2f24 100644 --- a/internal/artwork/disabled.go +++ b/internal/artwork/disabled.go @@ -3,7 +3,7 @@ package artwork import ( "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // blockedHostFilter returns a function that reports whether a host belongs to a service switched off in the diff --git a/internal/artwork/disabled_test.go b/internal/artwork/disabled_test.go index 451e51b..e34454d 100644 --- a/internal/artwork/disabled_test.go +++ b/internal/artwork/disabled_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func TestBaseHost(t *testing.T) { diff --git a/internal/artwork/episodes.go b/internal/artwork/episodes.go index cc4de62..68e4fd4 100644 --- a/internal/artwork/episodes.go +++ b/internal/artwork/episodes.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Looks up the real title of the episode being watched when the filename doesn't carry one diff --git a/internal/artwork/fixmatch_test.go b/internal/artwork/fixmatch_test.go index 5a8295d..07b925b 100644 --- a/internal/artwork/fixmatch_test.go +++ b/internal/artwork/fixmatch_test.go @@ -3,7 +3,7 @@ package artwork import ( "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // A junk name (a bare number such as a Blu-ray's "00062") is never looked up, unless the user gave it a pinned diff --git a/internal/artwork/fuzz_test.go b/internal/artwork/fuzz_test.go index 1acb12c..79c1b74 100644 --- a/internal/artwork/fuzz_test.go +++ b/internal/artwork/fuzz_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func TestFuzzAgainstJS(t *testing.T) { diff --git a/internal/artwork/jx.go b/internal/artwork/jx.go index 9384230..370a2b4 100644 --- a/internal/artwork/jx.go +++ b/internal/artwork/jx.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsonx" ) // OMap is an order-preserving JSON object (see jsonx). diff --git a/internal/artwork/letterboxd.go b/internal/artwork/letterboxd.go index 567da23..12a22ec 100644 --- a/internal/artwork/letterboxd.go +++ b/internal/artwork/letterboxd.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Letterboxd (letterboxdLink): letterboxd.com/imdb/<id>/ and, for films, /tmdb/<id>/ redirect to the title's page diff --git a/internal/artwork/letterboxd_test.go b/internal/artwork/letterboxd_test.go index 70ed0ac..7323349 100644 --- a/internal/artwork/letterboxd_test.go +++ b/internal/artwork/letterboxd_test.go @@ -9,7 +9,7 @@ import ( "sync" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // fakeLetterboxd is Cinemeta with one film (tt0000001) and Letterboxd answering with lb (the status for that id: diff --git a/internal/artwork/live_test.go b/internal/artwork/live_test.go index 1adf253..2e184ce 100644 --- a/internal/artwork/live_test.go +++ b/internal/artwork/live_test.go @@ -7,13 +7,13 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // The weekly canary (.github/workflows/canary.yml) asks every keyless catalog about one long-known title, through the // same search and episode code the program uses, and fails when a service stops answering or changes the shape of // its answer: no match, a wrong year, no link, no cover, no episode names. It contacts the real services, so it is -// opt-in (MPCRPC_LIVE_CATALOGS=1). TMDB needs a key and the public Jikan closed, so neither is asked. +// opt-in (MPRP_LIVE_CATALOGS=1). TMDB needs a key and the public Jikan closed, so neither is asked. // // A catalog check needs real titles: these are chosen because they are old, listed by every catalog, and unlikely to // be renamed. @@ -29,8 +29,8 @@ var ( ) func TestLiveCatalogs(t *testing.T) { - if os.Getenv("MPCRPC_LIVE_CATALOGS") != "1" { - t.Skip("set MPCRPC_LIVE_CATALOGS=1 to ask the real catalog services") + if os.Getenv("MPRP_LIVE_CATALOGS") != "1" { + t.Skip("set MPRP_LIVE_CATALOGS=1 to ask the real catalog services") } cfg := core.DefaultConfig() // ask retries a service that is down or slow twice, half a minute apart, each time with a fresh finder (a failing diff --git a/internal/artwork/match.go b/internal/artwork/match.go index aad4f09..1b9b438 100644 --- a/internal/artwork/match.go +++ b/internal/artwork/match.go @@ -8,8 +8,8 @@ import ( "strings" "unicode/utf16" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/jsre" ) func re(p, flags string) *jsre.Regexp { return jsre.MustCompile(p, flags) } diff --git a/internal/artwork/names_test.go b/internal/artwork/names_test.go index c24fcc1..f6396e5 100644 --- a/internal/artwork/names_test.go +++ b/internal/artwork/names_test.go @@ -9,7 +9,7 @@ import ( "sync" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // A film named "<Title>: A <Franchise> Mystery" loses its colon in a file name; the catalogs list "<Title>". diff --git a/internal/artwork/net.go b/internal/artwork/net.go index 17b6de7..b797141 100644 --- a/internal/artwork/net.go +++ b/internal/artwork/net.go @@ -25,7 +25,7 @@ import ( // six hours itself. // userAgent is what every request says it is (Wikipedia answers 403 to Go's default client string). -const userAgent = "MPCvibedRPC (Discord Rich Presence for video players; https://github.com/CptPakundo/MPCvibedRPC)" +const userAgent = "MPRP (Discord Rich Presence for media players; https://github.com/CptPakundo/MPRP)" const ( respTTL = 10 * time.Minute diff --git a/internal/artwork/providers.go b/internal/artwork/providers.go index 2eb1d28..48b29bf 100644 --- a/internal/artwork/providers.go +++ b/internal/artwork/providers.go @@ -6,8 +6,8 @@ import ( "strconv" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/jsre" ) var ( diff --git a/internal/artwork/pure_test.go b/internal/artwork/pure_test.go index 8917886..7acff49 100644 --- a/internal/artwork/pure_test.go +++ b/internal/artwork/pure_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // recCand is a candidate as the recorded data writes it. diff --git a/internal/artwork/replay_test.go b/internal/artwork/replay_test.go index 611ffb0..d3829f7 100644 --- a/internal/artwork/replay_test.go +++ b/internal/artwork/replay_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) type recResp struct { diff --git a/internal/artwork/seasons.go b/internal/artwork/seasons.go index 43ed813..60e60ae 100644 --- a/internal/artwork/seasons.go +++ b/internal/artwork/seasons.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/jsre" ) // ---- seasons that are really separate titles ----------------------------------------- diff --git a/internal/artwork/specials_test.go b/internal/artwork/specials_test.go index d598e6a..310237a 100644 --- a/internal/artwork/specials_test.go +++ b/internal/artwork/specials_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // fakeSpecials answers like Cinemeta for "Sample Show" (tt0000555): two specials as season 0, then a season of six. diff --git a/internal/artwork/why.go b/internal/artwork/why.go index 2a48525..8facd3b 100644 --- a/internal/artwork/why.go +++ b/internal/artwork/why.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Explain says in a few lines how the catalogs answered for media, for "Why this title?" in Copy diagnostics: which diff --git a/internal/artwork/why_test.go b/internal/artwork/why_test.go index 322bda8..78708e3 100644 --- a/internal/artwork/why_test.go +++ b/internal/artwork/why_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func TestExplain(t *testing.T) { diff --git a/internal/assets/ui.html b/internal/assets/ui.html index 9b5e599..c44d120 100644 --- a/internal/assets/ui.html +++ b/internal/assets/ui.html @@ -5,7 +5,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="referrer" content="no-referrer"> <meta name="token" content="__TOKEN__"> -<title>MPCvibedRPC +MPRP @@ -98,7 +98,7 @@

Your stats

TMDB This product uses the TMDB API but is not endorsed or certified by TMDB.
-
TV data from TVmaze, under CC BY-SA 4.0. Titles, covers and episode names also come from IMDb, Cinemeta, AniList, Kitsu, Wikipedia and Bulbapedia. Third-party notices
+
TV data from TVmaze, under CC BY-SA 4.0. Titles, covers and episode names also come from IMDb, Cinemeta, AniList, Kitsu, Wikipedia and Bulbapedia. Third-party notices
diff --git a/internal/assets/ui.js b/internal/assets/ui.js index cf0f38c..14c70ab 100644 --- a/internal/assets/ui.js +++ b/internal/assets/ui.js @@ -303,7 +303,7 @@ } function leavesBox() { const all = el('li', {}, document.createTextNode('Every address the program reaches is listed in '), - el('a', { href: 'https://github.com/CptPakundo/MPCvibedRPC/blob/master/SECURITY.md#where-it-connects', target: '_blank', rel: 'noopener', textContent: 'SECURITY.md' }), + el('a', { href: 'https://github.com/CptPakundo/MPRP/blob/master/SECURITY.md#where-it-connects', target: '_blank', rel: 'noopener', textContent: 'SECURITY.md' }), document.createTextNode('.')); // MPC-HC is Windows-only; its web interface answers every web page (no password, any origin) const mpc = osText() ? [] : ["MPC-HC's web interface has no password, and web pages you open can read it and control the player while it is on. Switch it off in MPC-HC when you stop using this program."]; @@ -628,7 +628,7 @@ const on = !!(u && u.newer); updInfo = on ? u : null; $('updBanner').classList.toggle('hidden', !on); - if (on) $('updBannerText').textContent = 'MPCvibedRPC ' + u.latest + ' is available.'; + if (on) $('updBannerText').textContent = 'MPRP ' + u.latest + ' is available.'; } $('updBannerBtn').onclick = async () => { if (!await askUpdate(updInfo, true)) { showTab('general'); $('updates').scrollIntoView({ block: 'start' }); } }; @@ -636,7 +636,7 @@ // port that another program, or the next start, may listen on by then). function closeWindow() { gone = true; timers.forEach(clearInterval); - document.body.innerHTML = '

MPCvibedRPC has quit. You can close this window.

'; + document.body.innerHTML = '

MPRP has quit. You can close this window.

'; try { window.close(); } catch (_) {} } let polling = false; @@ -793,7 +793,7 @@ const self = install && model && model.os !== 'darwin' && model.app.checkUpdates && model.app.autoUpdate; const hint = el('p', { textContent: 'Not now: it installs by itself later, once nothing is playing and the app runs without this window.' }); if (self) body.append(hint); - await modal('MPCvibedRPC ' + u.latest + ' is available', body, [['Not now'], [install ? 'Update now' : 'Open the download page', 'primary']], true, { + await modal('MPRP ' + u.latest + ' is available', body, [['Not now'], [install ? 'Update now' : 'Open the download page', 'primary']], true, { focus: 1, hold: async (i) => { if (i !== 1) return true; @@ -808,7 +808,7 @@ } // Install: download, check, swap, restart. say gets the progress, and the reason when it fails. async function installUpdate(say) { - $('installUpd').disabled = true; say('Downloadingโ€ฆ MPCvibedRPC restarts by itself.'); + $('installUpd').disabled = true; say('Downloadingโ€ฆ MPRP restarts by itself.'); try { await api('update-install', {}); return true; } catch (e) { say('Could not update: ' + e.message); $('installUpd').disabled = false; return false; } } $('checkUpd').onclick = async () => { @@ -841,7 +841,7 @@ msg.textContent = ok ? 'Copied. Look it over before you post it: it names what you played (folder paths, sign-ins and keys are left out).' : 'Select the text below and copy it (' + (osText() ? osText().copyKey : 'Ctrl+C') + ').'; } catch (e) { msg.textContent = 'Could not build it: ' + e.message; } }; - $('reportBtn').onclick = () => window.open('https://github.com/CptPakundo/MPCvibedRPC/issues/new/choose', '_blank', 'noopener'); + $('reportBtn').onclick = () => window.open('https://github.com/CptPakundo/MPRP/issues/new/choose', '_blank', 'noopener'); $('ver').onclick = () => showChangelog(true); // the preview's "Wrong title or cover?": the place where a match is fixed (another name to search under, a pinned cover) $('fixMatch').onclick = () => { @@ -853,9 +853,9 @@ if (!await ask('Reset your stats?', 'The counts start again from today.', 'Reset', true)) return; try { paintStats(await api('stats-reset', {})); } catch (e) { note(e.message, true); } }; - $('quit').onclick = async () => { if (await ask('Quit MPCvibedRPC?', 'Discord stops showing what you watch.', 'Quit', true)) { try { await api('quit', {}); } catch (_) {} closeWindow(); } }; + $('quit').onclick = async () => { if (await ask('Quit MPRP?', 'Discord stops showing what you watch.', 'Quit', true)) { try { await api('quit', {}); } catch (_) {} closeWindow(); } }; - if (!TOKEN) { document.body.replaceChildren(el('main', {}, el('p', { textContent: 'Open MPCvibedRPC from its tray icon or by launching the program again.' }))); return; } + if (!TOKEN) { document.body.replaceChildren(el('main', {}, el('p', { textContent: 'Open MPRP from its tray icon or by launching the program again.' }))); return; } watchAlive(); api('state').then((m) => { fill(m); paint(m.status); diff --git a/internal/conns/conns.go b/internal/conns/conns.go index ffa81a0..a7a7934 100644 --- a/internal/conns/conns.go +++ b/internal/conns/conns.go @@ -11,7 +11,7 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Entry is one host. diff --git a/internal/conns/conns_test.go b/internal/conns/conns_test.go index f4a3ae1..d193e52 100644 --- a/internal/conns/conns_test.go +++ b/internal/conns/conns_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // reset empties the list between tests. diff --git a/internal/core/activity.go b/internal/core/activity.go index 580c199..43d61d1 100644 --- a/internal/core/activity.go +++ b/internal/core/activity.go @@ -8,7 +8,7 @@ import ( "strings" "unicode/utf16" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/jsre" ) // ---- Discord wire format ------------------------------------------------------------- diff --git a/internal/core/icons.go b/internal/core/icons.go index b43258b..008879f 100644 --- a/internal/core/icons.go +++ b/internal/core/icons.go @@ -4,7 +4,7 @@ import "strings" // PlayerIconBase is where the player logos in docs/players are served from. Discord fetches the small icon of a // status by its address (through its own image proxy), so nothing is uploaded and nothing about the user is sent. -const PlayerIconBase = "https://raw.githubusercontent.com/CptPakundo/MPCvibedRPC/master/docs/players/" +const PlayerIconBase = "https://raw.githubusercontent.com/CptPakundo/MPRP/master/docs/players/" // playerIcons names the logo file of each player that has one. The MPC family has its own too: the default Discord // application has no mpc-hc image (its assets are default, pause_small, play_small, stop_small and mpcbe_logo, checked diff --git a/internal/core/parse.go b/internal/core/parse.go index 30f1bb7..ae5a3bb 100644 --- a/internal/core/parse.go +++ b/internal/core/parse.go @@ -3,7 +3,7 @@ package core import ( "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/jsre" ) // ---- MPC-HC variables.html --------------------------------------------------------- diff --git a/internal/core/util.go b/internal/core/util.go index 8253c06..fd43497 100644 --- a/internal/core/util.go +++ b/internal/core/util.go @@ -7,7 +7,7 @@ import ( "unicode" "unicode/utf16" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/jsre" ) // NA marks "no value" for the optional numbers (season, episode, year, ...), like null/undefined in JavaScript. diff --git a/internal/dbus/dbus_test.go b/internal/dbus/dbus_test.go index c722c71..cbf27f4 100644 --- a/internal/dbus/dbus_test.go +++ b/internal/dbus/dbus_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus/dbustest" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/dbus/dbustest" ) func TestRoundTrip(t *testing.T) { diff --git a/internal/dbus/dbustest/dbustest.go b/internal/dbus/dbustest/dbustest.go index b86b7f4..49b8f08 100644 --- a/internal/dbus/dbustest/dbustest.go +++ b/internal/dbus/dbustest/dbustest.go @@ -12,7 +12,7 @@ import ( "sync" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" + "github.com/CptPakundo/MPRP/internal/dbus" ) // Reply is what a handler answers: values with their signature, or an error name. diff --git a/internal/diag/diag.go b/internal/diag/diag.go index dbeb8c4..28e1a88 100644 --- a/internal/diag/diag.go +++ b/internal/diag/diag.go @@ -12,9 +12,9 @@ import ( "sort" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" ) // Input is everything the report is made from. @@ -192,7 +192,7 @@ func yn(b bool) string { func Report(in Input) string { var b strings.Builder w := func(f string, a ...any) { fmt.Fprintf(&b, f+"\n", a...) } - w("MPCvibedRPC diagnostics") + w("MPRP diagnostics") w("Version: %s", in.Version) w("System: %s", in.System) if len(in.Players) > 0 { diff --git a/internal/diag/diag_test.go b/internal/diag/diag_test.go index 8966a96..ed65378 100644 --- a/internal/diag/diag_test.go +++ b/internal/diag/diag_test.go @@ -5,9 +5,9 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/engine" - "github.com/CptPakundo/MPCvibedRPC/internal/store" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/engine" + "github.com/CptPakundo/MPRP/internal/store" ) func TestRedact(t *testing.T) { diff --git a/internal/discord/discord.go b/internal/discord/discord.go index d046d59..3432c37 100644 --- a/internal/discord/discord.go +++ b/internal/discord/discord.go @@ -16,7 +16,7 @@ import ( "sync/atomic" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/pipe" ) // Opcodes of the IPC protocol. diff --git a/internal/engine/disc_test.go b/internal/engine/disc_test.go index ce65e14..53a7a67 100644 --- a/internal/engine/disc_test.go +++ b/internal/engine/disc_test.go @@ -5,7 +5,7 @@ import ( "path/filepath" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func TestDiscNamesItself(t *testing.T) { diff --git a/internal/engine/discord.go b/internal/engine/discord.go index 94139f1..3735cb4 100644 --- a/internal/engine/discord.go +++ b/internal/engine/discord.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/discord" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/discord" ) func (e *Engine) connectDiscord(r *run) { diff --git a/internal/engine/engine.go b/internal/engine/engine.go index 6698ba3..ca2a5c0 100644 --- a/internal/engine/engine.go +++ b/internal/engine/engine.go @@ -12,12 +12,12 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/artwork" - "github.com/CptPakundo/MPCvibedRPC/internal/capture" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/discord" - "github.com/CptPakundo/MPCvibedRPC/internal/kodi" - "github.com/CptPakundo/MPCvibedRPC/internal/vlchttp" + "github.com/CptPakundo/MPRP/internal/artwork" + "github.com/CptPakundo/MPRP/internal/capture" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/discord" + "github.com/CptPakundo/MPRP/internal/kodi" + "github.com/CptPakundo/MPRP/internal/vlchttp" ) // Options are the engine's collaborators; all of them are optional. diff --git a/internal/engine/engine_test.go b/internal/engine/engine_test.go index ecf88bd..4435708 100644 --- a/internal/engine/engine_test.go +++ b/internal/engine/engine_test.go @@ -16,7 +16,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) type mpc struct { diff --git a/internal/engine/events.go b/internal/engine/events.go index 970e22e..4db2c32 100644 --- a/internal/engine/events.go +++ b/internal/engine/events.go @@ -7,13 +7,13 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/conns" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/kodi" - "github.com/CptPakundo/MPCvibedRPC/internal/mpris" - "github.com/CptPakundo/MPCvibedRPC/internal/mpvipc" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/conns" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/kodi" + "github.com/CptPakundo/MPRP/internal/mpris" + "github.com/CptPakundo/MPRP/internal/mpvipc" + "github.com/CptPakundo/MPRP/internal/pipe" ) var ( diff --git a/internal/engine/events_test.go b/internal/engine/events_test.go index f30b0e2..5f96d7b 100644 --- a/internal/engine/events_test.go +++ b/internal/engine/events_test.go @@ -14,9 +14,9 @@ import ( "testing/synctest" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus/dbustest" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/dbus/dbustest" ) // With mpv's events, a pause shows at once although the next regular check is a minute away. diff --git a/internal/engine/fakepipe_windows_test.go b/internal/engine/fakepipe_windows_test.go index c5c1c82..d01f2e4 100644 --- a/internal/engine/fakepipe_windows_test.go +++ b/internal/engine/fakepipe_windows_test.go @@ -42,7 +42,7 @@ func fakePath(string) string { pipeCounterMu.Lock() defer pipeCounterMu.Unlock() pipeCounter++ - return fmt.Sprintf(`\\.\pipe\mpcvibedrpc-test-%d-%d`, os.Getpid(), pipeCounter) + return fmt.Sprintf(`\\.\pipe\mprp-test-%d-%d`, os.Getpid(), pipeCounter) } type pipeListener struct { diff --git a/internal/engine/folder_test.go b/internal/engine/folder_test.go index ea52844..87760f1 100644 --- a/internal/engine/folder_test.go +++ b/internal/engine/folder_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // seasonFolder makes a folder of episodes named with a running production code, from..to. diff --git a/internal/engine/jellyfin_test.go b/internal/engine/jellyfin_test.go index d1cd32a..b3b5f21 100644 --- a/internal/engine/jellyfin_test.go +++ b/internal/engine/jellyfin_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // fakeJellyfin is a Jellyfin (or Emby) server whose session list shows the user's episode, shaped like Jellyfin's diff --git a/internal/engine/kodi_test.go b/internal/engine/kodi_test.go index 68cde12..d1e99ff 100644 --- a/internal/engine/kodi_test.go +++ b/internal/engine/kodi_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // newFakeKodi is Kodi's JSON-RPC web server playing a library episode (user kodi, password secret). diff --git a/internal/engine/links_test.go b/internal/engine/links_test.go index c4dd408..275b556 100644 --- a/internal/engine/links_test.go +++ b/internal/engine/links_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // linkSetup plays a movie that a fake Cinemeta knows, so the activity has a cover and a catalog page. diff --git a/internal/engine/live_test.go b/internal/engine/live_test.go index 372e6e6..30d7f0c 100644 --- a/internal/engine/live_test.go +++ b/internal/engine/live_test.go @@ -10,70 +10,70 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/jellyfin" - "github.com/CptPakundo/MPCvibedRPC/internal/kodi" - "github.com/CptPakundo/MPCvibedRPC/internal/mpris" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/jellyfin" + "github.com/CptPakundo/MPRP/internal/kodi" + "github.com/CptPakundo/MPRP/internal/mpris" + "github.com/CptPakundo/MPRP/internal/pipe" ) // TestLivePlayer runs against a real player on this computer (MPC-QT, mpv, VLC, IINA or a Linux player that offers // MPRIS, set up as their docs say) and the test's own fake Discord. It only runs on request: // -// MPCRPC_LIVE_PLAYER=mpv MPCRPC_LIVE_TITLE="Sample Movie" go test -run TestLivePlayer ./internal/engine +// MPRP_LIVE_PLAYER=mpv MPRP_LIVE_TITLE="Sample Movie" go test -run TestLivePlayer ./internal/engine // -// MPCRPC_LIVE_PORT optionally names a web-interface port to ask first (default: none). For VLC, set -// MPCRPC_LIVE_VLC_PASSWORD (and MPCRPC_LIVE_VLC_PORT when it is not 8080). MPCRPC_LIVE_MPV_PIPE and -// MPCRPC_LIVE_IINA_PIPE replace the default connection names of mpv and IINA. For Plex, MPCRPC_LIVE_PLEX_ADDRESS is the -// server (followed without plex.tv; MPCRPC_LIVE_PLEX_TOKEN is its token, if it needs one). For Jellyfin or -// Emby, MPCRPC_LIVE_JELLYFIN_ADDRESS, MPCRPC_LIVE_JELLYFIN_USER and MPCRPC_LIVE_JELLYFIN_PASSWORD sign in to the server. For Kodi, MPCRPC_LIVE_KODI_PASSWORD -// (and MPCRPC_LIVE_KODI_ADDRESS when it is not 127.0.0.1:8080; the user is kodi). PotPlayer needs nothing. MPCRPC_LIVE_PLAYER is the +// MPRP_LIVE_PORT optionally names a web-interface port to ask first (default: none). For VLC, set +// MPRP_LIVE_VLC_PASSWORD (and MPRP_LIVE_VLC_PORT when it is not 8080). MPRP_LIVE_MPV_PIPE and +// MPRP_LIVE_IINA_PIPE replace the default connection names of mpv and IINA. For Plex, MPRP_LIVE_PLEX_ADDRESS is the +// server (followed without plex.tv; MPRP_LIVE_PLEX_TOKEN is its token, if it needs one). For Jellyfin or +// Emby, MPRP_LIVE_JELLYFIN_ADDRESS, MPRP_LIVE_JELLYFIN_USER and MPRP_LIVE_JELLYFIN_PASSWORD sign in to the server. For Kodi, MPRP_LIVE_KODI_PASSWORD +// (and MPRP_LIVE_KODI_ADDRESS when it is not 127.0.0.1:8080; the user is kodi). PotPlayer needs nothing. MPRP_LIVE_PLAYER is the // name the player is shown under: MPC-QT, mpv, VLC, IINA, PotPlayer, Kodi, Celluloid, Plex, ... func TestLivePlayer(t *testing.T) { - want := os.Getenv("MPCRPC_LIVE_PLAYER") + want := os.Getenv("MPRP_LIVE_PLAYER") if want == "" { - t.Skip("set MPCRPC_LIVE_PLAYER to run against a real player") + t.Skip("set MPRP_LIVE_PLAYER to run against a real player") } port := deadPort(t) - if p := os.Getenv("MPCRPC_LIVE_PORT"); p != "" { + if p := os.Getenv("MPRP_LIVE_PORT"); p != "" { port = atoiOr(p, port) } e, d, l := pipeEngine(t, port, nil) e.opts.Pipes, e.opts.MPRIS, e.opts.PotPlayer, e.opts.KodiEvents = nil, nil, nil, "" // the real ones: MPC-QT's, mpv's, IINA's (macOS), MPRIS (Linux), PotPlayer (Windows) - if p := os.Getenv("MPCRPC_LIVE_MPV_PIPE"); p != "" { + if p := os.Getenv("MPRP_LIVE_MPV_PIPE"); p != "" { e.cfg.MpvPipe = p } - if p := os.Getenv("MPCRPC_LIVE_IINA_PIPE"); p != "" { + if p := os.Getenv("MPRP_LIVE_IINA_PIPE"); p != "" { e.cfg.IinaPipe = p } - if a := os.Getenv("MPCRPC_LIVE_PLEX_ADDRESS"); a != "" { - e.cfg.PlexAddress, e.cfg.PlexToken = a, os.Getenv("MPCRPC_LIVE_PLEX_TOKEN") + if a := os.Getenv("MPRP_LIVE_PLEX_ADDRESS"); a != "" { + e.cfg.PlexAddress, e.cfg.PlexToken = a, os.Getenv("MPRP_LIVE_PLEX_TOKEN") if e.cfg.PlexToken == "" { e.cfg.PlexToken = "none" // a server that lets this computer in without signing in ignores it } } - if a := os.Getenv("MPCRPC_LIVE_JELLYFIN_ADDRESS"); a != "" { + if a := os.Getenv("MPRP_LIVE_JELLYFIN_ADDRESS"); a != "" { c := &jellyfin.Client{Base: a, DeviceID: "ci-engine", Version: "0.0.0"} srv, err := c.Find(context.Background()) if err != nil { t.Fatal(err) } - auth, err := c.SignIn(context.Background(), os.Getenv("MPCRPC_LIVE_JELLYFIN_USER"), os.Getenv("MPCRPC_LIVE_JELLYFIN_PASSWORD")) + auth, err := c.SignIn(context.Background(), os.Getenv("MPRP_LIVE_JELLYFIN_USER"), os.Getenv("MPRP_LIVE_JELLYFIN_PASSWORD")) if err != nil { t.Fatal(err) } e.cfg.JellyfinAddress, e.cfg.JellyfinToken, e.cfg.JellyfinUser, e.cfg.JellyfinProduct, e.cfg.JellyfinDevice = c.Base, auth.Token, auth.UserID, srv.Product, c.DeviceID } - if pw := os.Getenv("MPCRPC_LIVE_KODI_PASSWORD"); pw != "" { + if pw := os.Getenv("MPRP_LIVE_KODI_PASSWORD"); pw != "" { e.cfg.KodiPassword = pw - if a := os.Getenv("MPCRPC_LIVE_KODI_ADDRESS"); a != "" { + if a := os.Getenv("MPRP_LIVE_KODI_ADDRESS"); a != "" { e.cfg.KodiAddress = a } } - if pw := os.Getenv("MPCRPC_LIVE_VLC_PASSWORD"); pw != "" { + if pw := os.Getenv("MPRP_LIVE_VLC_PASSWORD"); pw != "" { e.cfg.VlcPassword = pw - if p := os.Getenv("MPCRPC_LIVE_VLC_PORT"); p != "" { + if p := os.Getenv("MPRP_LIVE_VLC_PORT"); p != "" { e.cfg.VlcPort = atoiOr(p, e.cfg.VlcPort) } } @@ -85,7 +85,7 @@ func TestLivePlayer(t *testing.T) { act := d.list()[len(d.list())-1]["activity"].(map[string]any) t.Logf("status: player=%s playing=%v paused=%v", s.Player, *s.NowPlaying, s.Paused) t.Logf("activity: %v", act) - if title := os.Getenv("MPCRPC_LIVE_TITLE"); title != "" && !strings.Contains(*s.NowPlaying, title) { + if title := os.Getenv("MPRP_LIVE_TITLE"); title != "" && !strings.Contains(*s.NowPlaying, title) { t.Errorf("expected %q in %q", title, *s.NowPlaying) } if !l.has(want + " detected.") { @@ -101,15 +101,15 @@ func TestLivePlayer(t *testing.T) { if !l.has(`(` + want + `: "`) { t.Error("the log should name what the player played") } - if how := os.Getenv("MPCRPC_LIVE_EVENTS"); how != "" { + if how := os.Getenv("MPRP_LIVE_EVENTS"); how != "" { livePauseEvent(t, e, d, want, how) } } // livePauseEvent pauses the real player and wants the pause shown at once, from the player's own event, while the // regular checks are a minute apart. how says how the player is paused: "pipe" (mpv, IINA: their IPC), "kodi" (its -// JSON-RPC, as user kodi with MPCRPC_LIVE_KODI_PASSWORD) or "mpris" (D-Bus). It changes the player's state, so it is -// opt-in (MPCRPC_LIVE_EVENTS; CI sets it for its throwaway players), and it resumes the player afterwards. +// JSON-RPC, as user kodi with MPRP_LIVE_KODI_PASSWORD) or "mpris" (D-Bus). It changes the player's state, so it is +// opt-in (MPRP_LIVE_EVENTS; CI sets it for its throwaway players), and it resumes the player afterwards. func livePauseEvent(t *testing.T, e *Engine, d *disc, name, how string) { e.Stop() e.cfg.PollInterval = 60000 @@ -212,6 +212,6 @@ func livePauser(t *testing.T, cfg core.Config, name, how string) func(paused boo t.Fatalf("%s is not on the bus", name) } } - t.Fatalf("MPCRPC_LIVE_EVENTS=%q: want pipe, kodi or mpris", how) + t.Fatalf("MPRP_LIVE_EVENTS=%q: want pipe, kodi or mpris", how) return nil } diff --git a/internal/engine/multios_test.go b/internal/engine/multios_test.go index f7574d5..d5e1998 100644 --- a/internal/engine/multios_test.go +++ b/internal/engine/multios_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/pipe" ) func largeText(d *disc) any { diff --git a/internal/engine/pace_test.go b/internal/engine/pace_test.go index 09a91f8..49a6b42 100644 --- a/internal/engine/pace_test.go +++ b/internal/engine/pace_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // A Discord that refuses every status is not asked at every check: the engine waits longer after each failure, names diff --git a/internal/engine/players.go b/internal/engine/players.go index 927e3ae..649aeea 100644 --- a/internal/engine/players.go +++ b/internal/engine/players.go @@ -11,14 +11,14 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/kodi" - "github.com/CptPakundo/MPCvibedRPC/internal/mpris" - "github.com/CptPakundo/MPCvibedRPC/internal/mpvipc" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" - "github.com/CptPakundo/MPCvibedRPC/internal/potplayer" - "github.com/CptPakundo/MPCvibedRPC/internal/vlchttp" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/kodi" + "github.com/CptPakundo/MPRP/internal/mpris" + "github.com/CptPakundo/MPRP/internal/mpvipc" + "github.com/CptPakundo/MPRP/internal/pipe" + "github.com/CptPakundo/MPRP/internal/potplayer" + "github.com/CptPakundo/MPRP/internal/vlchttp" ) // PlayerPipe is an mpv-style IPC endpoint and the name of the player behind it. diff --git a/internal/engine/plex_test.go b/internal/engine/plex_test.go index a02d09e..70793ff 100644 --- a/internal/engine/plex_test.go +++ b/internal/engine/plex_test.go @@ -8,7 +8,7 @@ import ( "sync" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // fakePlex is plex.tv (the account's one server) and that Plex Media Server, in one test server. The answers are diff --git a/internal/engine/potplayer_test.go b/internal/engine/potplayer_test.go index 92e42ca..14f1f6e 100644 --- a/internal/engine/potplayer_test.go +++ b/internal/engine/potplayer_test.go @@ -4,7 +4,7 @@ import ( "sync" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // fakePot stands in for the PotPlayer windows on this computer. diff --git a/internal/engine/probe.go b/internal/engine/probe.go index a5f80bb..454fe01 100644 --- a/internal/engine/probe.go +++ b/internal/engine/probe.go @@ -8,10 +8,10 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/kodi" - "github.com/CptPakundo/MPCvibedRPC/internal/potplayer" - "github.com/CptPakundo/MPCvibedRPC/internal/vlchttp" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/kodi" + "github.com/CptPakundo/MPRP/internal/potplayer" + "github.com/CptPakundo/MPRP/internal/vlchttp" ) // Probe states of a player that answers. diff --git a/internal/engine/probe_test.go b/internal/engine/probe_test.go index 9e29706..570b05d 100644 --- a/internal/engine/probe_test.go +++ b/internal/engine/probe_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func probeNamed(ps []PlayerProbe, part string) *PlayerProbe { diff --git a/internal/engine/remote.go b/internal/engine/remote.go index 43c6e74..6b16cc1 100644 --- a/internal/engine/remote.go +++ b/internal/engine/remote.go @@ -4,12 +4,12 @@ import ( "context" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/discord" - "github.com/CptPakundo/MPCvibedRPC/internal/jellyfin" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" - "github.com/CptPakundo/MPCvibedRPC/internal/plex" - "github.com/CptPakundo/MPCvibedRPC/internal/stremio" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/discord" + "github.com/CptPakundo/MPRP/internal/jellyfin" + "github.com/CptPakundo/MPRP/internal/pipe" + "github.com/CptPakundo/MPRP/internal/plex" + "github.com/CptPakundo/MPRP/internal/stremio" ) // watcher follows one account or server for what is playing on it (Plex, Stremio, Jellyfin or Emby). diff --git a/internal/engine/remotes_test.go b/internal/engine/remotes_test.go index 2866805..0d957a1 100644 --- a/internal/engine/remotes_test.go +++ b/internal/engine/remotes_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // remoteRig is an engine that follows one remote (Plex, Stremio, Jellyfin or Emby) whose fake shows "Sample Show". diff --git a/internal/engine/rest_test.go b/internal/engine/rest_test.go index 66c1ff9..4ac7261 100644 --- a/internal/engine/rest_test.go +++ b/internal/engine/rest_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func (m *mpc) count() int { m.mu.Lock(); defer m.mu.Unlock(); return m.asked } diff --git a/internal/engine/sharing_test.go b/internal/engine/sharing_test.go index 1f05c9e..e574250 100644 --- a/internal/engine/sharing_test.go +++ b/internal/engine/sharing_test.go @@ -5,7 +5,7 @@ import ( "sync/atomic" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // No test reads this computer's record of Discord's screen capture: a test that wants a stream sets Options.Sharing. diff --git a/internal/engine/stale_test.go b/internal/engine/stale_test.go index a863c53..d1d2cd5 100644 --- a/internal/engine/stale_test.go +++ b/internal/engine/stale_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/discord" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/discord" ) // clears counts the SET_ACTIVITY calls without an activity (a cleared status) from the n-th call on. diff --git a/internal/engine/state_test.go b/internal/engine/state_test.go index c4227c1..3293e19 100644 --- a/internal/engine/state_test.go +++ b/internal/engine/state_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/discord" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/discord" ) // count is how many log lines contain sub. @@ -196,10 +196,10 @@ func TestSettingsChangeDuringASendLeavesNoError(t *testing.T) { // restarts; the settings change; the engine is stopped and started), once things are quiet Discord must show // exactly what the player's last state calls for: one status for the file that plays, or none. // -// Eight fixed orders run every time. MPCRPC_CONVERGE_SEEDS=500 tries that many (for a hunt after a change to the tick). +// Eight fixed orders run every time. MPRP_CONVERGE_SEEDS=500 tries that many (for a hunt after a change to the tick). func TestStatusConverges(t *testing.T) { seeds := int64(8) - if n, err := strconv.ParseInt(os.Getenv("MPCRPC_CONVERGE_SEEDS"), 10, 64); err == nil && n > 0 { + if n, err := strconv.ParseInt(os.Getenv("MPRP_CONVERGE_SEEDS"), 10, 64); err == nil && n > 0 { seeds = n } for seed := int64(1); seed <= seeds; seed++ { diff --git a/internal/engine/stats_test.go b/internal/engine/stats_test.go index 8862137..80beaec 100644 --- a/internal/engine/stats_test.go +++ b/internal/engine/stats_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) func TestStatsCountWhatIsShownAndStayOnThisComputer(t *testing.T) { diff --git a/internal/engine/stream_test.go b/internal/engine/stream_test.go index 4c89867..5c20946 100644 --- a/internal/engine/stream_test.go +++ b/internal/engine/stream_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // The stream title is for videos: a song stays "Listening to" with it on. diff --git a/internal/engine/stuck_windows_test.go b/internal/engine/stuck_windows_test.go index 878faf7..fe8afeb 100644 --- a/internal/engine/stuck_windows_test.go +++ b/internal/engine/stuck_windows_test.go @@ -11,7 +11,7 @@ import ( "time" "unsafe" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // A Discord that answers the handshake and then stops reading, on an unbuffered pipe: our next write blocks inside diff --git a/internal/engine/tick.go b/internal/engine/tick.go index 0fe7ae2..2c1e358 100644 --- a/internal/engine/tick.go +++ b/internal/engine/tick.go @@ -6,9 +6,9 @@ import ( "math" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/artwork" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/discord" + "github.com/CptPakundo/MPRP/internal/artwork" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/discord" ) // appNameFor gives the default app name the playing player's name: the default describes Media Player Classic, other diff --git a/internal/engine/where_test.go b/internal/engine/where_test.go index 955039a..d90a417 100644 --- a/internal/engine/where_test.go +++ b/internal/engine/where_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // The Never show list also matches where a server keeps the item: a Plex library's name, or a folder of the file's diff --git a/internal/engine/why.go b/internal/engine/why.go index ff8a025..4d0f0a7 100644 --- a/internal/engine/why.go +++ b/internal/engine/why.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // readAs is the start of "Why this title?": the name the player gave and what was read from it. The folder path is diff --git a/internal/engine/why_test.go b/internal/engine/why_test.go index 506680f..92caf61 100644 --- a/internal/engine/why_test.go +++ b/internal/engine/why_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // "Why this title?" names the file and what was read from it while it shows, never the folder path, and is gone diff --git a/internal/jellyfin/account.go b/internal/jellyfin/account.go index 81c91cf..8f4d49a 100644 --- a/internal/jellyfin/account.go +++ b/internal/jellyfin/account.go @@ -16,7 +16,7 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/remote" + "github.com/CptPakundo/MPRP/internal/remote" ) var ( @@ -88,7 +88,7 @@ func Address(s string) (string, error) { // Authorization header ("MediaBrowser" scheme); Emby reads X-Emby-Authorization ("Emby" scheme) and X-Emby-Token. func (c *Client) auth(req *http.Request, token string) { q := func(s string) string { return `"` + strings.NewReplacer(`"`, "", ",", " ").Replace(s) + `"` } - parts := `Client=` + q("MPCvibedRPC") + `, Device=` + q("MPCvibedRPC on "+remote.OSName()) + `, DeviceId=` + q(c.DeviceID) + `, Version=` + q(c.Version) + parts := `Client=` + q("MPRP") + `, Device=` + q("MPRP on "+remote.OSName()) + `, DeviceId=` + q(c.DeviceID) + `, Version=` + q(c.Version) if token != "" { parts += `, Token=` + q(token) req.Header.Set("X-Emby-Token", token) diff --git a/internal/jellyfin/jellyfin_test.go b/internal/jellyfin/jellyfin_test.go index e797d57..5ebd31f 100644 --- a/internal/jellyfin/jellyfin_test.go +++ b/internal/jellyfin/jellyfin_test.go @@ -74,7 +74,7 @@ func newFake(t *testing.T, emby bool) *fakeServer { } else if f.qcOff { w.WriteHeader(401) } else { - fmt.Fprint(w, `{"Authenticated":false,"Secret":"qc-secret","Code":"123456","DeviceId":"d","DeviceName":"n","AppName":"MPCvibedRPC","AppVersion":"0.9.21","DateAdded":"2026-10-11T10:00:00Z"}`) + fmt.Fprint(w, `{"Authenticated":false,"Secret":"qc-secret","Code":"123456","DeviceId":"d","DeviceName":"n","AppName":"MPRP","AppVersion":"0.9.21","DateAdded":"2026-10-11T10:00:00Z"}`) } case path == "/QuickConnect/Connect" && r.URL.Query().Get("secret") == "qc-secret": f.checks++ @@ -131,7 +131,7 @@ func TestFindJellyfinAndEmby(t *testing.T) { if err != nil || s.Product != "Jellyfin" || s.Name != "Sample Server" || c.Base != f.URL { t.Fatalf("Jellyfin: %+v %v base %s", s, err, c.Base) } - if !strings.HasPrefix(f.auth, "MediaBrowser ") || !strings.Contains(f.auth, `DeviceId="sample-device"`) || !strings.Contains(f.auth, `Client="MPCvibedRPC"`) { + if !strings.HasPrefix(f.auth, "MediaBrowser ") || !strings.Contains(f.auth, `DeviceId="sample-device"`) || !strings.Contains(f.auth, `Client="MPRP"`) { t.Fatalf("the client describes itself: %q", f.auth) } e := newFake(t, true) @@ -240,7 +240,7 @@ func sessionsJSON(checkIn time.Time, paused bool) string { "NowPlayingItem":{"Name":"Sample Movie","Id":"i3","Type":"Movie","MediaType":"Video","ProductionYear":2020,"RunTimeTicks":72000000000}}, {"PlayState":{"PositionTicks":6000000000,"IsPaused":%[3]t},"Id":"s4","UserId":"%[2]s","Client":"Jellyfin Web","LastPlaybackCheckIn":"%[1]s", "NowPlayingItem":{"Name":"The Sample","Id":"i4","Type":"Episode","MediaType":"Video","SeriesName":"Sample Show","ParentIndexNumber":1,"IndexNumber":2,"RunTimeTicks":14400000000}}, - {"Id":"s5","UserId":"%[2]s","Client":"MPCvibedRPC","LastPlaybackCheckIn":"0001-01-01T00:00:00.0000000Z","PlayState":{}} + {"Id":"s5","UserId":"%[2]s","Client":"MPRP","LastPlaybackCheckIn":"0001-01-01T00:00:00.0000000Z","PlayState":{}} ]`, ci, "6c8f0a0b-1c2d-4e5f-8a9b-0c1d2e3f4a5b", paused) } diff --git a/internal/jellyfin/live_test.go b/internal/jellyfin/live_test.go index 6c288bb..d1054db 100644 --- a/internal/jellyfin/live_test.go +++ b/internal/jellyfin/live_test.go @@ -12,20 +12,20 @@ import ( // TestLiveJellyfin runs against a real Jellyfin or Emby server (tools/ci/live-jellyfin.sh starts the official images on // CI, with a stand-in player that plays a sample episode). It only runs on request: // -// MPCRPC_LIVE_JELLYFIN_ADDRESS=http://127.0.0.1:8096 MPCRPC_LIVE_JELLYFIN_USER=... MPCRPC_LIVE_JELLYFIN_PASSWORD=... -// MPCRPC_LIVE_JELLYFIN_PRODUCT=Jellyfin MPCRPC_LIVE_TITLE="Sample Show" go test -run TestLiveJellyfin ./internal/jellyfin +// MPRP_LIVE_JELLYFIN_ADDRESS=http://127.0.0.1:8096 MPRP_LIVE_JELLYFIN_USER=... MPRP_LIVE_JELLYFIN_PASSWORD=... +// MPRP_LIVE_JELLYFIN_PRODUCT=Jellyfin MPRP_LIVE_TITLE="Sample Show" go test -run TestLiveJellyfin ./internal/jellyfin // // It signs in with the password (and, on Jellyfin, with Quick Connect, approved with the first sign-in), follows what // the user plays, and signs out again. func TestLiveJellyfin(t *testing.T) { - addr := os.Getenv("MPCRPC_LIVE_JELLYFIN_ADDRESS") + addr := os.Getenv("MPRP_LIVE_JELLYFIN_ADDRESS") if addr == "" { - t.Skip("set MPCRPC_LIVE_JELLYFIN_ADDRESS to run against a real Jellyfin or Emby server") + t.Skip("set MPRP_LIVE_JELLYFIN_ADDRESS to run against a real Jellyfin or Emby server") } - user, pw, product := os.Getenv("MPCRPC_LIVE_JELLYFIN_USER"), os.Getenv("MPCRPC_LIVE_JELLYFIN_PASSWORD"), os.Getenv("MPCRPC_LIVE_JELLYFIN_PRODUCT") + user, pw, product := os.Getenv("MPRP_LIVE_JELLYFIN_USER"), os.Getenv("MPRP_LIVE_JELLYFIN_PASSWORD"), os.Getenv("MPRP_LIVE_JELLYFIN_PRODUCT") ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() - c := &Client{Base: addr, DeviceID: "ci-mpcvibedrpc", Version: "0.0.0"} + c := &Client{Base: addr, DeviceID: "ci-mprp", Version: "0.0.0"} srv, err := c.Find(ctx) if err != nil { t.Fatal(err) @@ -44,7 +44,7 @@ func TestLiveJellyfin(t *testing.T) { t.Logf("signed in as %s (%s)", a.UserName, a.UserID) if srv.Product == "Jellyfin" { - qc := &Client{Base: c.Base, DeviceID: "ci-mpcvibedrpc-qc", Version: "0.0.0"} + qc := &Client{Base: c.Base, DeviceID: "ci-mprp-qc", Version: "0.0.0"} p, err := qc.StartQuickConnect(ctx) if err != nil { t.Fatalf("Quick Connect: %v", err) @@ -86,7 +86,7 @@ func TestLiveJellyfin(t *testing.T) { } } w := &Watcher{Client: c, Token: a.Token, UserID: a.UserID, Product: srv.Product} - title := os.Getenv("MPCRPC_LIVE_TITLE") + title := os.Getenv("MPRP_LIVE_TITLE") for { if err := w.poll(ctx); err != nil { t.Fatal(err) diff --git a/internal/jellyfin/meta.go b/internal/jellyfin/meta.go index 9763f80..b710ba6 100644 --- a/internal/jellyfin/meta.go +++ b/internal/jellyfin/meta.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Item is what the server says about what a session plays (the parts used). diff --git a/internal/jellyfin/watcher.go b/internal/jellyfin/watcher.go index 38f5720..150ad79 100644 --- a/internal/jellyfin/watcher.go +++ b/internal/jellyfin/watcher.go @@ -8,8 +8,8 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/remote" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/remote" ) // Watcher asks one server's session list what the user plays there, every few seconds. Run it in a goroutine; Now is diff --git a/internal/kodi/kodi.go b/internal/kodi/kodi.go index 9da434c..5d4c7ab 100644 --- a/internal/kodi/kodi.go +++ b/internal/kodi/kodi.go @@ -12,7 +12,7 @@ import ( "net/http" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) var ( diff --git a/internal/mpris/mpris.go b/internal/mpris/mpris.go index 6b062f2..3606f52 100644 --- a/internal/mpris/mpris.go +++ b/internal/mpris/mpris.go @@ -13,8 +13,8 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/dbus" ) const ( diff --git a/internal/mpris/mpris_test.go b/internal/mpris/mpris_test.go index 8992b36..3fb1774 100644 --- a/internal/mpris/mpris_test.go +++ b/internal/mpris/mpris_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus/dbustest" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/dbus/dbustest" ) func TestPlayerName(t *testing.T) { diff --git a/internal/mpris/watch.go b/internal/mpris/watch.go index dd62101..571783d 100644 --- a/internal/mpris/watch.go +++ b/internal/mpris/watch.go @@ -3,7 +3,7 @@ package mpris import ( "time" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" + "github.com/CptPakundo/MPRP/internal/dbus" ) // changeProps are the player properties whose change is news: playing or paused, another file, another speed. diff --git a/internal/mpris/watch_test.go b/internal/mpris/watch_test.go index 38af06e..fe084b8 100644 --- a/internal/mpris/watch_test.go +++ b/internal/mpris/watch_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus" - "github.com/CptPakundo/MPCvibedRPC/internal/dbus/dbustest" + "github.com/CptPakundo/MPRP/internal/dbus" + "github.com/CptPakundo/MPRP/internal/dbus/dbustest" ) // Watch reports a player that pauses, seeks or changes file, and nothing else, and returns when the bus goes away. diff --git a/internal/mpvipc/mpvipc.go b/internal/mpvipc/mpvipc.go index 6caebb5..d27e902 100644 --- a/internal/mpvipc/mpvipc.go +++ b/internal/mpvipc/mpvipc.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // The properties asked for, by request id. diff --git a/internal/pipe/dial_windows_test.go b/internal/pipe/dial_windows_test.go index de0396c..8c9937a 100644 --- a/internal/pipe/dial_windows_test.go +++ b/internal/pipe/dial_windows_test.go @@ -17,7 +17,7 @@ func TestDialWaitsForAFreeInstance(t *testing.T) { busyWait = 10 * time.Second t.Cleanup(func() { busyWait = old }) - path := `\\?\pipe\mpcvibedrpc-test-busy-` + strconv.Itoa(os.Getpid()) + path := `\\?\pipe\mprp-test-busy-` + strconv.Itoa(os.Getpid()) defer listenPipe(t, path)() a, err := Dial(path) if err != nil { @@ -61,7 +61,7 @@ func TestDialGivesUpOnABusyPipe(t *testing.T) { busyWait = 300 * time.Millisecond t.Cleanup(func() { busyWait = old }) - path := `\\?\pipe\mpcvibedrpc-test-full-` + strconv.Itoa(os.Getpid()) + path := `\\?\pipe\mprp-test-full-` + strconv.Itoa(os.Getpid()) defer listenPipe(t, path)() a, err := Dial(path) if err != nil { diff --git a/internal/pipe/exists_test.go b/internal/pipe/exists_test.go index 27e77ee..a9c3856 100644 --- a/internal/pipe/exists_test.go +++ b/internal/pipe/exists_test.go @@ -11,7 +11,7 @@ import ( ) func TestExists(t *testing.T) { - name := "mpcvibedrpc-test-" + strconv.Itoa(os.Getpid()) + "-" + strconv.FormatInt(time.Now().UnixNano(), 36) + name := "mprp-test-" + strconv.Itoa(os.Getpid()) + "-" + strconv.FormatInt(time.Now().UnixNano(), 36) var path string if runtime.GOOS == "windows" { path = `\\?\pipe\` + name diff --git a/internal/plex/account.go b/internal/plex/account.go index 4f34954..8941251 100644 --- a/internal/plex/account.go +++ b/internal/plex/account.go @@ -15,11 +15,11 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/remote" + "github.com/CptPakundo/MPRP/internal/remote" ) // Product is how the program introduces itself to Plex (it is shown in the account's list of authorized devices). -const Product = "MPCvibedRPC" +const Product = "MPRP" var ( // ErrPinExpired means the sign-in code ran out before it was approved (or plex.tv no longer knows it). diff --git a/internal/plex/meta.go b/internal/plex/meta.go index 6649706..5242c1a 100644 --- a/internal/plex/meta.go +++ b/internal/plex/meta.go @@ -3,7 +3,7 @@ package plex import ( "regexp" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Item is what the server says about the video being played (library metadata; only the parts used). diff --git a/internal/plex/plex_test.go b/internal/plex/plex_test.go index f03aa4f..3a1444a 100644 --- a/internal/plex/plex_test.go +++ b/internal/plex/plex_test.go @@ -56,7 +56,7 @@ func fakeTV(t *testing.T, resources string) (*httptest.Server, *int) { } switch { case r.Method == "POST" && r.URL.Path == "/api/v2/pins" && r.URL.Query().Get("strong") == "true": - fmt.Fprint(w, `{"id":4242,"code":"samplecode","product":"MPCvibedRPC","trusted":false,"clientIdentifier":"test-client","expiresIn":1800,"authToken":null,"newRegistration":null}`) + fmt.Fprint(w, `{"id":4242,"code":"samplecode","product":"MPRP","trusted":false,"clientIdentifier":"test-client","expiresIn":1800,"authToken":null,"newRegistration":null}`) case r.Method == "GET" && r.URL.Path == "/api/v2/pins/4242": checks++ if checks < 3 { diff --git a/internal/plex/watcher.go b/internal/plex/watcher.go index 10818ad..24c4fcb 100644 --- a/internal/plex/watcher.go +++ b/internal/plex/watcher.go @@ -13,8 +13,8 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/remote" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/remote" ) // How long a player may stay silent before what it played is forgotten (players report every few seconds while they diff --git a/internal/potplayer/live_windows_test.go b/internal/potplayer/live_windows_test.go index f6226ee..9c09527 100644 --- a/internal/potplayer/live_windows_test.go +++ b/internal/potplayer/live_windows_test.go @@ -6,11 +6,11 @@ import ( "testing" ) -// TestLivePotPlayer asks a real PotPlayer on this computer (opt-in: MPCRPC_LIVE_POTPLAYER=1, with a local file playing) +// TestLivePotPlayer asks a real PotPlayer on this computer (opt-in: MPRP_LIVE_POTPLAYER=1, with a local file playing) // and checks that it sends the file's path, so the Never show list can match folders. func TestLivePotPlayer(t *testing.T) { - if os.Getenv("MPCRPC_LIVE_POTPLAYER") == "" { - t.Skip("set MPCRPC_LIVE_POTPLAYER=1 with PotPlayer playing a local file") + if os.Getenv("MPRP_LIVE_POTPLAYER") == "" { + t.Skip("set MPRP_LIVE_POTPLAYER=1 with PotPlayer playing a local file") } found := Query() for _, in := range found { diff --git a/internal/potplayer/potplayer.go b/internal/potplayer/potplayer.go index b7f4b92..f774c32 100644 --- a/internal/potplayer/potplayer.go +++ b/internal/potplayer/potplayer.go @@ -6,7 +6,7 @@ package potplayer import ( "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // The messages PotPlayer is asked with are in potplayer_windows.go; info below only needs their answers. diff --git a/internal/potplayer/potplayer_other.go b/internal/potplayer/potplayer_other.go index 8518cb3..467bdef 100644 --- a/internal/potplayer/potplayer_other.go +++ b/internal/potplayer/potplayer_other.go @@ -2,7 +2,7 @@ package potplayer -import "github.com/CptPakundo/MPCvibedRPC/internal/core" +import "github.com/CptPakundo/MPRP/internal/core" // Query finds no PotPlayer outside Windows. func Query() []*core.Info { return nil } diff --git a/internal/potplayer/potplayer_windows.go b/internal/potplayer/potplayer_windows.go index 38324ea..2fa88a3 100644 --- a/internal/potplayer/potplayer_windows.go +++ b/internal/potplayer/potplayer_windows.go @@ -9,7 +9,7 @@ import ( "time" "unsafe" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // The messages, sent as WM_USER with one of these in wParam. The answers come back as the result, except the file @@ -96,7 +96,7 @@ var ( func setup() { hinst, _, _ = pGetModuleHandle.Call(0) - replyCls, _ = syscall.UTF16PtrFromString("MPCvibedRPC.PotPlayerReply") + replyCls, _ = syscall.UTF16PtrFromString("MPRP.PotPlayerReply") wc := wndClassEx{lpfnWndProc: syscall.NewCallback(replyProc), hInstance: hinst, lpszClassName: replyCls} wc.cbSize = uint32(unsafe.Sizeof(wc)) pRegisterClassEx.Call(uintptr(unsafe.Pointer(&wc))) diff --git a/internal/potplayer/potplayer_windows_test.go b/internal/potplayer/potplayer_windows_test.go index 833888a..f6a839f 100644 --- a/internal/potplayer/potplayer_windows_test.go +++ b/internal/potplayer/potplayer_windows_test.go @@ -7,7 +7,7 @@ import ( "testing" "unsafe" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) var ( diff --git a/internal/server/server.go b/internal/server/server.go index ffc5429..e9b3ef2 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -20,7 +20,7 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsonx" ) // NewToken makes a random token. @@ -143,7 +143,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { p := r.URL.Path switch { case r.Method == "GET" && p == "/api/ping": - send(w, 200, map[string]any{"app": "MPCvibedRPC", "version": s.o.Version, "pid": os.Getpid()}, jsonType) + send(w, 200, map[string]any{"app": "MPRP", "version": s.o.Version, "pid": os.Getpid()}, jsonType) return case r.Method == "GET" && p == "/icon.ico": send(w, 200, s.o.Icon, "image/x-icon") diff --git a/internal/server/server_test.go b/internal/server/server_test.go index 4d2e4b5..58b6ff1 100644 --- a/internal/server/server_test.go +++ b/internal/server/server_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsonx" ) type valErr struct{} @@ -62,7 +62,7 @@ func TestServer(t *testing.T) { _ = s tok := map[string]string{"X-Token": "tok"} - if c, b, h := do(t, "GET", base+"/api/ping", "", nil, ""); c != 200 || b != fmt.Sprintf(`{"app":"MPCvibedRPC","pid":%d,"version":"9.9.9"}`, os.Getpid()) || h.Get("X-Content-Type-Options") != "nosniff" || h.Get("Content-Security-Policy") == "" { + if c, b, h := do(t, "GET", base+"/api/ping", "", nil, ""); c != 200 || b != fmt.Sprintf(`{"app":"MPRP","pid":%d,"version":"9.9.9"}`, os.Getpid()) || h.Get("X-Content-Type-Options") != "nosniff" || h.Get("Content-Security-Policy") == "" { t.Fatal(c, b) } if c, b, _ := do(t, "GET", base+"/icon.ico", "", nil, ""); c != 200 || b != "ICO" { diff --git a/internal/store/docs_test.go b/internal/store/docs_test.go index 5fc8603..33fbe94 100644 --- a/internal/store/docs_test.go +++ b/internal/store/docs_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) // Every setting, with its default, has a row in docs/config.md: the program's settings (core.Config) and its own diff --git a/internal/store/schema.go b/internal/store/schema.go index 35aaaea..f7559c6 100644 --- a/internal/store/schema.go +++ b/internal/store/schema.go @@ -7,9 +7,9 @@ import ( "strconv" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsre" ) // Field is one setting shown in the window. type: bool | int | text | secret | choice | map ("name = value" per line) | diff --git a/internal/store/store.go b/internal/store/store.go index 83b73fe..3ebaaef 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -13,23 +13,23 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" - "github.com/CptPakundo/MPCvibedRPC/internal/jsre" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsre" ) // DataDir is where everything lives: // -// Windows: %LOCALAPPDATA%\MPCvibedRPC (override with MPCRPC_HOME) -// macOS: ~/Library/Application Support/MPCvibedRPC -// Linux: $XDG_DATA_HOME/MPCvibedRPC, else ~/.local/share/MPCvibedRPC -// config.json settings mpcvibedrpc.log log artwork-cache.json cover cache +// Windows: %LOCALAPPDATA%\MPRP (override with MPRP_HOME) +// macOS: ~/Library/Application Support/MPRP +// Linux: $XDG_DATA_HOME/MPRP, else ~/.local/share/MPRP +// config.json settings mprp.log log artwork-cache.json cover cache // stats.json local counts ipc.json the running copy's port and token instance.lock single instance (macOS, Linux) func DataDir() string { - if v := os.Getenv("MPCRPC_HOME"); v != "" { + if v := os.Getenv("MPRP_HOME"); v != "" { return v } - const name = "MPCvibedRPC" + const name = "MPRP" home, _ := os.UserHomeDir() switch runtime.GOOS { case "windows": @@ -54,7 +54,7 @@ type App struct { StartPresence bool `json:"startPresence"` // begin sending presence as soon as the app opens CheckUpdates bool `json:"checkUpdates"` // look for a newer release at start, then every six hours AutoUpdate bool `json:"autoUpdate"` // install a found update by itself at a quiet moment (needs checkUpdates; Windows and Linux) - UpdateRepo string `json:"updateRepo"` // "owner/repo" on GitHub that publishes releases with MPCvibedRPC.exe + UpdateRepo string `json:"updateRepo"` // "owner/repo" on GitHub that publishes releases with MPRP.exe WelcomeSeen bool `json:"welcomeSeen"` // the first-run welcome card was dismissed (existing installs count as having seen it) OpenWindow bool `json:"openWindow"` // show the window when the program is started by hand (it always starts in the tray at login) MinimizeToTray bool `json:"minimizeToTray"` // a minimised settings window goes to the tray instead of the taskbar (Windows) @@ -62,7 +62,7 @@ type App struct { } // DefaultUpdateRepo is where releases of this program are published. -const DefaultUpdateRepo = "CptPakundo/MPCvibedRPC" +const DefaultUpdateRepo = "CptPakundo/MPRP" var appKeys = []string{"autoStart", "startPresence", "checkUpdates", "autoUpdate", "updateRepo", "openWindow", "minimizeToTray", "welcomeSeen", "seenVersion"} @@ -126,7 +126,7 @@ func New(dir string) (*Store, error) { } func (s *Store) CachePath() string { return filepath.Join(s.Dir, "artwork-cache.json") } -func (s *Store) LogPath() string { return filepath.Join(s.Dir, "mpcvibedrpc.log") } +func (s *Store) LogPath() string { return filepath.Join(s.Dir, "mprp.log") } func (s *Store) IPCPath() string { return filepath.Join(s.Dir, "ipc.json") } func (s *Store) StatsPath() string { return filepath.Join(s.Dir, "stats.json") } diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 5e80969..eb805d6 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -11,7 +11,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsonx" ) type goldenStep struct { diff --git a/internal/store/unreadable_test.go b/internal/store/unreadable_test.go index e64e549..30e9888 100644 --- a/internal/store/unreadable_test.go +++ b/internal/store/unreadable_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/jsonx" + "github.com/CptPakundo/MPRP/internal/jsonx" ) func patchOf(t *testing.T, js string) *jsonx.Obj { diff --git a/internal/stremio/account.go b/internal/stremio/account.go index 5566c7a..b2bc10d 100644 --- a/internal/stremio/account.go +++ b/internal/stremio/account.go @@ -16,7 +16,7 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/remote" + "github.com/CptPakundo/MPRP/internal/remote" ) var ( diff --git a/internal/stremio/watcher.go b/internal/stremio/watcher.go index d8a7e4c..d9e55ca 100644 --- a/internal/stremio/watcher.go +++ b/internal/stremio/watcher.go @@ -10,8 +10,8 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/core" - "github.com/CptPakundo/MPCvibedRPC/internal/remote" + "github.com/CptPakundo/MPRP/internal/core" + "github.com/CptPakundo/MPRP/internal/remote" ) // How often Stremio's player updates the library entry of what it plays (stremio-core's PUSH_TO_LIBRARY_EVERY): diff --git a/internal/updater/updater.go b/internal/updater/updater.go index 8089cee..dcb9de3 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -1,5 +1,5 @@ // Package updater updates the program from GitHub Releases. Publish a release whose tag is a version ("v1.2.0") -// with the program for each system (MPCvibedRPC.exe, MPCvibedRPC-linux-amd64, ...; see AssetFor) and a .sha256 next +// with the program for each system (MPRP.exe, MPRP-linux-amd64, ...; see AssetFor) and a .sha256 next // to each (without one the app only links to the release); the app offers it, downloads it and swaps itself in. The // files must come from GitHub (see allowedHost). On macOS it only offers the release page. package updater @@ -28,13 +28,13 @@ import ( // program is an app bundle, and the user is sent to the release page instead). var Asset = AssetFor(runtime.GOOS, runtime.GOARCH) -// AssetFor names the release file of a system: MPCvibedRPC.exe, MPCvibedRPC-linux-amd64, ... +// AssetFor names the release file of a system: MPRP.exe, MPRP-linux-amd64, ... func AssetFor(goos, goarch string) string { switch { case goos == "windows": - return "MPCvibedRPC.exe" + return "MPRP.exe" case goos == "linux" && (goarch == "amd64" || goarch == "arm64"): - return "MPCvibedRPC-linux-" + goarch + return "MPRP-linux-" + goarch } return "" } @@ -151,7 +151,7 @@ func get(ctx context.Context, client *http.Client, addr, accept, etag string) (* if err != nil { return nil, err } - req.Header.Set("User-Agent", "MPCvibedRPC") + req.Header.Set("User-Agent", "MPRP") if accept != "" { req.Header.Set("Accept", accept) } diff --git a/internal/updater/updater_host_test.go b/internal/updater/updater_host_test.go index c9c1faf..f068e75 100644 --- a/internal/updater/updater_host_test.go +++ b/internal/updater/updater_host_test.go @@ -15,21 +15,21 @@ func TestAllowedHost(t *testing.T) { APIBase, WebBase = "http://127.0.0.1:5555", "http://127.0.0.1:5555" defer func() { APIBase, WebBase = oldAPI, oldWeb }() for addr, want := range map[string]bool{ - "https://github.com/o/r/releases/download/v1/MPCvibedRPC.exe": true, - "https://GitHub.com/o/r/releases/download/v1/MPCvibedRPC.exe": true, - "https://objects.githubusercontent.com/x": true, - "https://release-assets.githubusercontent.com/x": true, - "http://127.0.0.1:5555/dl": true, // the base itself is plain http - "http://127.0.0.1:6666/dl": false, - "https://127.0.0.1:5555/dl": false, // another scheme than the base - "http://github.com/o/r/x": false, // not https - "https://evil.example/github.com": false, - "https://github.com.evil.example/x": false, - "https://evilgithubusercontent.com/x": false, - "https://githubusercontent.com/x": false, - "https://github.com:8443/x": false, - "https://user:pw@github.com/x": false, - "https://api.github.com/repos/o/r/releases/assets/1": false, // not a base here + "https://github.com/o/r/releases/download/v1/MPRP.exe": true, + "https://GitHub.com/o/r/releases/download/v1/MPRP.exe": true, + "https://objects.githubusercontent.com/x": true, + "https://release-assets.githubusercontent.com/x": true, + "http://127.0.0.1:5555/dl": true, // the base itself is plain http + "http://127.0.0.1:6666/dl": false, + "https://127.0.0.1:5555/dl": false, // another scheme than the base + "http://github.com/o/r/x": false, // not https + "https://evil.example/github.com": false, + "https://github.com.evil.example/x": false, + "https://evilgithubusercontent.com/x": false, + "https://githubusercontent.com/x": false, + "https://github.com:8443/x": false, + "https://user:pw@github.com/x": false, + "https://api.github.com/repos/o/r/releases/assets/1": false, // not a base here } { u, err := url.Parse(addr) if err != nil { @@ -55,7 +55,7 @@ func TestDownloadRefusesForeignHosts(t *testing.T) { otherHost := strings.TrimPrefix(other.URL, "http://") // the "API" lives under a name that differs from the other server's host, though both are local api := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, `{"tag_name":"v3.1.0","html_url":"https://example/rel","assets":[{"name":"MPCvibedRPC.exe","browser_download_url":"%s/exe"},{"name":"MPCvibedRPC.exe.sha256","browser_download_url":"%s/sha"}]}`, other.URL, other.URL) + fmt.Fprintf(w, `{"tag_name":"v3.1.0","html_url":"https://example/rel","assets":[{"name":"MPRP.exe","browser_download_url":"%s/exe"},{"name":"MPRP.exe.sha256","browser_download_url":"%s/sha"}]}`, other.URL, other.URL) })) defer api.Close() old := APIBase @@ -117,7 +117,7 @@ func TestCheckIsConditional(t *testing.T) { return } w.Header().Set("ETag", `"abc"`) - fmt.Fprint(w, `{"tag_name":"v3.1.0","body":"Notes.","html_url":"https://example/rel","assets":[{"name":"MPCvibedRPC.exe","browser_download_url":"x"},{"name":"MPCvibedRPC.exe.sha256","browser_download_url":"y"}]}`) + fmt.Fprint(w, `{"tag_name":"v3.1.0","body":"Notes.","html_url":"https://example/rel","assets":[{"name":"MPRP.exe","browser_download_url":"x"},{"name":"MPRP.exe.sha256","browser_download_url":"y"}]}`) })) defer srv.Close() old := APIBase diff --git a/internal/updater/updater_test.go b/internal/updater/updater_test.go index f34146c..15df84e 100644 --- a/internal/updater/updater_test.go +++ b/internal/updater/updater_test.go @@ -13,7 +13,7 @@ import ( "testing" ) -func init() { Asset, Magic = "MPCvibedRPC.exe", "MZ" } // the Windows release, whatever system runs the tests +func init() { Asset, Magic = "MPRP.exe", "MZ" } // the Windows release, whatever system runs the tests func TestCompare(t *testing.T) { cases := []struct { @@ -40,17 +40,17 @@ func setup(t *testing.T, exe []byte, sha string, notes string) (*httptest.Server mux := http.NewServeMux() var srv *httptest.Server mux.HandleFunc("/repos/o/r/releases/latest", func(w http.ResponseWriter, r *http.Request) { - if r.Header.Get("User-Agent") != "MPCvibedRPC" { + if r.Header.Get("User-Agent") != "MPRP" { t.Error("missing UA") } shaAsset := "" if sha != "" { - shaAsset = fmt.Sprintf(`,{"name":"MPCvibedRPC.exe.sha256","browser_download_url":"%s/sha"}`, srv.URL) + shaAsset = fmt.Sprintf(`,{"name":"MPRP.exe.sha256","browser_download_url":"%s/sha"}`, srv.URL) } - fmt.Fprintf(w, `{"tag_name":"v3.1.0","body":%q,"html_url":"https://example/rel","assets":[{"name":"other.zip","browser_download_url":"x"},{"name":"MPCvibedRPC.exe","browser_download_url":"%s/exe"}%s]}`, notes, srv.URL, shaAsset) + fmt.Fprintf(w, `{"tag_name":"v3.1.0","body":%q,"html_url":"https://example/rel","assets":[{"name":"other.zip","browser_download_url":"x"},{"name":"MPRP.exe","browser_download_url":"%s/exe"}%s]}`, notes, srv.URL, shaAsset) }) mux.HandleFunc("/exe", func(w http.ResponseWriter, r *http.Request) { w.Write(exe) }) - mux.HandleFunc("/sha", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, sha+" MPCvibedRPC.exe\n") }) + mux.HandleFunc("/sha", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, sha+" MPRP.exe\n") }) srv = httptest.NewServer(mux) old := APIBase APIBase = srv.URL @@ -249,9 +249,9 @@ func TestRestorePutsTheOldProgramBack(t *testing.T) { func TestAssetFor(t *testing.T) { cases := map[[2]string]string{ - {"windows", "amd64"}: "MPCvibedRPC.exe", - {"linux", "amd64"}: "MPCvibedRPC-linux-amd64", - {"linux", "arm64"}: "MPCvibedRPC-linux-arm64", + {"windows", "amd64"}: "MPRP.exe", + {"linux", "amd64"}: "MPRP-linux-amd64", + {"linux", "arm64"}: "MPRP-linux-arm64", {"linux", "386"}: "", {"darwin", "arm64"}: "", // an app bundle: the release page is offered instead {"freebsd", "amd64"}: "", @@ -266,7 +266,7 @@ func TestAssetFor(t *testing.T) { // Where the program cannot install a release itself, Check still reports it, with only the page to go to. func TestCheckWithoutAsset(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"tag_name":"v3.1.0","html_url":"https://example/rel","assets":[{"name":"MPCvibedRPC.exe","browser_download_url":"x"}]}`) + fmt.Fprint(w, `{"tag_name":"v3.1.0","html_url":"https://example/rel","assets":[{"name":"MPRP.exe","browser_download_url":"x"}]}`) })) defer srv.Close() old, oldAPI := Asset, APIBase @@ -311,7 +311,7 @@ func TestCheckFallsBackToTheWebsite(t *testing.T) { t.Fatal(err) } if !info.Newer || info.Latest != "3.1.0" || !info.CanInstall || info.Page != srv.URL+"/o/r/releases/tag/v3.1.0" || - info.URL != srv.URL+"/o/r/releases/download/v3.1.0/MPCvibedRPC.exe" || info.ShaURL != info.URL+".sha256" { + info.URL != srv.URL+"/o/r/releases/download/v3.1.0/MPRP.exe" || info.ShaURL != info.URL+".sha256" { t.Fatalf("got %+v", info) } if info, err := Check(nil, "o/r", "3.1.0"); err != nil || info.Newer { @@ -326,7 +326,7 @@ func TestCheckFallsBackToTheWebsite(t *testing.T) { } func TestWhatsNew(t *testing.T) { - notes := "## MPCvibedRPC 9.9.9\r\n\r\n**Sample feature.**\r\n\r\n- One thing.\r\n- Another.\r\n\r\n### Get it\r\n- Download it.\r\n\r\n### Good to know\r\n- More." + notes := "## MPRP 9.9.9\r\n\r\n**Sample feature.**\r\n\r\n- One thing.\r\n- Another.\r\n\r\n### Get it\r\n- Download it.\r\n\r\n### Good to know\r\n- More." if got := whatsNew(notes); got != "**Sample feature.**\n\n- One thing.\n- Another." { t.Errorf("got %q", got) } diff --git a/internal/vlchttp/vlchttp.go b/internal/vlchttp/vlchttp.go index 928fae7..2202e15 100644 --- a/internal/vlchttp/vlchttp.go +++ b/internal/vlchttp/vlchttp.go @@ -14,7 +14,7 @@ import ( "strings" "sync" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) var ( diff --git a/internal/winsys/autostart.go b/internal/winsys/autostart.go index 95df684..2393789 100644 --- a/internal/winsys/autostart.go +++ b/internal/winsys/autostart.go @@ -8,15 +8,15 @@ import ( ) // runNameBase is the name of the registry value that starts the program at login. -const runNameBase = "MPCvibedRPC" +const runNameBase = "MPRP" -// runName is the registry value for run-at-login. A copy that uses a data folder of its own (MPCRPC_HOME: a portable +// runName is the registry value for run-at-login. A copy that uses a data folder of its own (MPRP_HOME: a portable // setup, a test, a development build) gets a value of its own, derived from that folder, so it can never switch the // installed program's run-at-login on or off. -func runName() string { return runNameFor(os.Getenv("MPCRPC_HOME")) } +func runName() string { return runNameFor(os.Getenv("MPRP_HOME")) } // runCommand is the registry value's command line. A copy with its own data folder passes it on with --home, so the -// copy started at login uses that folder too (the registry cannot set MPCRPC_HOME the way a LaunchAgent can). +// copy started at login uses that folder too (the registry cannot set MPRP_HOME the way a LaunchAgent can). func runCommand(exe, home string) string { cmd := `"` + exe + `" --background` if home = strings.TrimRight(strings.TrimSpace(home), `\/`); home != "" { @@ -74,7 +74,7 @@ func runEntryNames(command, exe string) bool { // writeRunValue makes the Run value name start exe. A value that is already right is left alone: no helper process // at every start of the program. func writeRunValue(name, exe string) bool { - want := runCommand(exe, os.Getenv("MPCRPC_HOME")) + want := runCommand(exe, os.Getenv("MPRP_HOME")) if cur, found := registryRunValue(name); found && cur == want { return true } diff --git a/internal/winsys/autostart_test.go b/internal/winsys/autostart_test.go index 4c29dd1..ad9390f 100644 --- a/internal/winsys/autostart_test.go +++ b/internal/winsys/autostart_test.go @@ -3,22 +3,22 @@ package winsys import "testing" func TestRunName(t *testing.T) { - // values computed independently in PowerShell: tools/ci/smoke.ps1 derives the same name for its own data folder + // values computed independently (PowerShell, sha256sum): tools/ci/smoke.ps1 derives the same name for its own data folder for _, c := range []struct{ home, want, why string }{ - {"", "MPCvibedRPC", "the installed program keeps the plain name"}, - {" ", "MPCvibedRPC", "blank counts as unset"}, - {`C:\Temp\Home`, "MPCvibedRPC-3e950f5e", "a custom folder"}, - {`C:\Temp\HOME\`, "MPCvibedRPC-3e950f5e", "case and a trailing separator do not matter"}, - {`c:\temp\home/`, "MPCvibedRPC-3e950f5e", "case and a trailing separator do not matter"}, - {`D:\Portable\MPCvibedRPC\data`, "MPCvibedRPC-649c6423", "another custom folder"}, + {"", "MPRP", "the installed program keeps the plain name"}, + {" ", "MPRP", "blank counts as unset"}, + {`C:\Temp\Home`, "MPRP-3e950f5e", "a custom folder"}, + {`C:\Temp\HOME\`, "MPRP-3e950f5e", "case and a trailing separator do not matter"}, + {`c:\temp\home/`, "MPRP-3e950f5e", "case and a trailing separator do not matter"}, + {`D:\Portable\MPRP\data`, "MPRP-dd9ad258", "another custom folder"}, } { if got := runNameFor(c.home); got != c.want { t.Errorf("runNameFor(%q) = %q, want %q (%s)", c.home, got, c.want, c.why) } // the name follows the environment - t.Setenv("MPCRPC_HOME", c.home) + t.Setenv("MPRP_HOME", c.home) if got := runName(); got != c.want { - t.Errorf("runName() with MPCRPC_HOME=%q = %q, want %q (%s)", c.home, got, c.want, c.why) + t.Errorf("runName() with MPRP_HOME=%q = %q, want %q (%s)", c.home, got, c.want, c.why) } } if runNameFor(`C:\a`) == runNameFor(`C:\b`) { @@ -31,11 +31,11 @@ func TestRunEntryNames(t *testing.T) { command, exe string want bool }{ - {`"C:\Apps\MPCvibedRPC.exe" --background`, `C:\Other\MPCvibedRPC.exe`, true}, // the folder is not compared - {`"c:\apps\mpcvibedrpc.EXE" --background`, `MPCvibedRPC.exe`, true}, // case does not matter - {`"D:\Portable\MPCvibedRPC.exe" --background --home "D:\Portable\data"`, `MPCvibedRPC.exe`, true}, - {`"C:\Apps\OtherProgram.exe" --background`, `MPCvibedRPC.exe`, false}, - {``, `MPCvibedRPC.exe`, false}, + {`"C:\Apps\MPRP.exe" --background`, `C:\Other\MPRP.exe`, true}, // the folder is not compared + {`"c:\apps\mprp.EXE" --background`, `MPRP.exe`, true}, // case does not matter + {`"D:\Portable\MPRP.exe" --background --home "D:\Portable\data"`, `MPRP.exe`, true}, + {`"C:\Apps\OtherProgram.exe" --background`, `MPRP.exe`, false}, + {``, `MPRP.exe`, false}, } { if got := runEntryNames(c.command, c.exe); got != c.want { t.Errorf("runEntryNames(%q, %q) = %v, want %v", c.command, c.exe, got, c.want) @@ -45,8 +45,8 @@ func TestRunEntryNames(t *testing.T) { func TestRunCommandCarriesTheDataFolder(t *testing.T) { for _, c := range []struct{ name, exe, home, want string }{ - {"default copy", `C:\Apps\MPCvibedRPC.exe`, "", `"C:\Apps\MPCvibedRPC.exe" --background`}, - {"own data folder", `D:\Portable\MPCvibedRPC.exe`, `D:\Portable\data\`, `"D:\Portable\MPCvibedRPC.exe" --background --home "D:\Portable\data"`}, + {"default copy", `C:\Apps\MPRP.exe`, "", `"C:\Apps\MPRP.exe" --background`}, + {"own data folder", `D:\Portable\MPRP.exe`, `D:\Portable\data\`, `"D:\Portable\MPRP.exe" --background --home "D:\Portable\data"`}, } { if got := runCommand(c.exe, c.home); got != c.want { t.Errorf("%s: %s", c.name, got) diff --git a/internal/winsys/autostart_unix.go b/internal/winsys/autostart_unix.go index 01e19cb..531613b 100644 --- a/internal/winsys/autostart_unix.go +++ b/internal/winsys/autostart_unix.go @@ -9,7 +9,7 @@ import ( ) // Run at login on macOS (a LaunchAgent) and Linux (an XDG autostart entry, which every desktop reads). The file is the -// source of truth, as the registry value is on Windows; a copy with its own MPCRPC_HOME gets a file of its own. +// source of truth, as the registry value is on Windows; a copy with its own MPRP_HOME gets a file of its own. // loginItemPath is where the login item of this copy lives on goos ("" when the home folder is unknown). func loginItemPath(goos, home, xdgConfig string) string { @@ -47,16 +47,16 @@ func loginItem(goos, exe, mpcHome string) string { `) if mpcHome != "" { - b.WriteString("\tEnvironmentVariables\n\t\n\t\tMPCRPC_HOME\n\t\t" + x(mpcHome) + "\n\t\n") + b.WriteString("\tEnvironmentVariables\n\t\n\t\tMPRP_HOME\n\t\t" + x(mpcHome) + "\n\t\n") } b.WriteString("\tRunAtLoad\n\t\n\tProcessType\n\tInteractive\n\n\n") return b.String() } cmd := execQuote(exe) + " --background" if mpcHome != "" { - cmd = "env " + execQuote("MPCRPC_HOME="+mpcHome) + " " + cmd + cmd = "env " + execQuote("MPRP_HOME="+mpcHome) + " " + cmd } - return "[Desktop Entry]\nType=Application\nName=MPCvibedRPC\nComment=Shows what your video player is playing on Discord\n" + + return "[Desktop Entry]\nType=Application\nName=MPRP\nComment=Shows what your video player is playing on Discord\n" + "Exec=" + cmd + "\nTerminal=false\nX-GNOME-Autostart-enabled=true\n" } @@ -126,5 +126,5 @@ func setLoginItem(enabled bool, exe string) bool { if os.MkdirAll(filepath.Dir(p), 0o755) != nil { return false } - return os.WriteFile(p, []byte(loginItem(runtime.GOOS, exe, os.Getenv("MPCRPC_HOME"))), 0o644) == nil + return os.WriteFile(p, []byte(loginItem(runtime.GOOS, exe, os.Getenv("MPRP_HOME"))), 0o644) == nil } diff --git a/internal/winsys/autostart_windows_test.go b/internal/winsys/autostart_windows_test.go index f5d0339..26ec56c 100644 --- a/internal/winsys/autostart_windows_test.go +++ b/internal/winsys/autostart_windows_test.go @@ -8,10 +8,10 @@ import ( // The registry read gives what `reg query` gave. Read-only: it only looks at values, and never writes. func TestRegistryRunValueMatchesRegExe(t *testing.T) { - if _, ok := registryRunValue("MPCvibedRPC-test-no-such-value"); ok { + if _, ok := registryRunValue("MPRP-test-no-such-value"); ok { t.Error("a value that does not exist was found") } - for _, name := range []string{"MPCvibedRPC", "MPCvibedRPC-test-no-such-value"} { + for _, name := range []string{"MPRP", "MPRP-test-no-such-value"} { r := run("reg", "query", runKey, "/v", name) data, ok := registryRunValue(name) if ok != r.ok { @@ -26,16 +26,16 @@ func TestRegistryRunValueMatchesRegExe(t *testing.T) { } // End to end against the real registry: opt-in, because it writes the Run value that belongs to a throwaway data -// folder (MPCRPC_HOME) and removes it again. It never touches the plain "MPCvibedRPC" value. +// folder (MPRP_HOME) and removes it again. It never touches the plain "MPRP" value. func TestAutostartRegistryRoundTrip(t *testing.T) { - if os.Getenv("MPCRPC_TEST_REGISTRY") != "1" { - t.Skip("set MPCRPC_TEST_REGISTRY=1 to write and remove a Run value for a throwaway data folder") + if os.Getenv("MPRP_TEST_REGISTRY") != "1" { + t.Skip("set MPRP_TEST_REGISTRY=1 to write and remove a Run value for a throwaway data folder") } - t.Setenv("MPCRPC_HOME", t.TempDir()) + t.Setenv("MPRP_HOME", t.TempDir()) if runName() == runNameBase { t.Fatal("the test must use a value name of its own") } - exe := `C:\Test\MPCvibedRPC.exe` + exe := `C:\Test\MPRP.exe` t.Cleanup(func() { SetAutoStart(false, exe) }) if GetAutoStart(exe) { t.Fatal("on before it was set") @@ -50,8 +50,8 @@ func TestAutostartRegistryRoundTrip(t *testing.T) { t.Error("a different program name must not match") } data, ok := registryRunValue(runName()) - if !ok || data != runCommand(exe, os.Getenv("MPCRPC_HOME")) { - t.Errorf("stored command %q, want %q", data, runCommand(exe, os.Getenv("MPCRPC_HOME"))) + if !ok || data != runCommand(exe, os.Getenv("MPRP_HOME")) { + t.Errorf("stored command %q, want %q", data, runCommand(exe, os.Getenv("MPRP_HOME"))) } SetAutoStart(false, exe) if GetAutoStart(exe) { diff --git a/internal/winsys/browser_other_test.go b/internal/winsys/browser_other_test.go index e43170e..17dbdc5 100644 --- a/internal/winsys/browser_other_test.go +++ b/internal/winsys/browser_other_test.go @@ -9,14 +9,14 @@ import ( func TestProfilePids(t *testing.T) { ps := ` 1 /sbin/init - 200 /opt/google/chrome/chrome --app=http://127.0.0.1:47654/?t=x --user-data-dir=/home/someone/.local/share/MPCvibedRPC/window --no-first-run - 201 /opt/google/chrome/chrome --type=renderer --user-data-dir=/home/someone/.local/share/MPCvibedRPC/window --lang=en - 202 /opt/google/chrome/chrome --user-data-dir=/home/someone/.local/share/MPCvibedRPC/window2 + 200 /opt/google/chrome/chrome --app=http://127.0.0.1:47654/?t=x --user-data-dir=/home/someone/.local/share/MPRP/window --no-first-run + 201 /opt/google/chrome/chrome --type=renderer --user-data-dir=/home/someone/.local/share/MPRP/window --lang=en + 202 /opt/google/chrome/chrome --user-data-dir=/home/someone/.local/share/MPRP/window2 203 /opt/google/chrome/chrome - 300 /home/someone/MPCvibedRPC --user-data-dir=/home/someone/.local/share/MPCvibedRPC/window + 300 /home/someone/MPRP --user-data-dir=/home/someone/.local/share/MPRP/window bad line ` - got := profilePids(ps, "/home/someone/.local/share/MPCvibedRPC/window", 300) + got := profilePids(ps, "/home/someone/.local/share/MPRP/window", 300) if !reflect.DeepEqual(got, []int{200, 201}) { t.Errorf("got %v, want [200 201] (not another profile, not the user's browser, not ourselves)", got) } diff --git a/internal/winsys/browser_test.go b/internal/winsys/browser_test.go index 4bc9d15..ada8010 100644 --- a/internal/winsys/browser_test.go +++ b/internal/winsys/browser_test.go @@ -10,7 +10,7 @@ import ( ) func TestUsesProfile(t *testing.T) { - const p = `C:\Users\Someone\AppData\Local\MPCvibedRPC\window` + const p = `C:\Users\Someone\AppData\Local\MPRP\window` cases := []struct { cmd string want bool @@ -19,7 +19,7 @@ func TestUsesProfile(t *testing.T) { {`msedge.exe --type=gpu-process --user-data-dir=` + p + ` --lang=en-GB`, true}, {`msedge.exe --user-data-dir=` + p, true}, {`msedge.exe --user-data-dir=` + p + `\`, true}, - {`msedge.exe --USER-data-DIR=` + `c:\users\someone\appdata\local\mpcvibedrpc\WINDOW`, true}, + {`msedge.exe --USER-data-DIR=` + `c:\users\someone\appdata\local\mprp\WINDOW`, true}, {`msedge.exe --user-data-dir=` + p + `2 --lang=en`, false}, // a different folder with the same prefix {`msedge.exe --user-data-dir=` + p + `-old`, false}, // likewise {`msedge.exe --user-data-dir=C:\Users\Someone\Other`, false}, // another profile diff --git a/internal/winsys/ini.go b/internal/winsys/ini.go index 9ec2405..8be8d11 100644 --- a/internal/winsys/ini.go +++ b/internal/winsys/ini.go @@ -7,7 +7,7 @@ import ( "strings" "unicode/utf16" - "github.com/CptPakundo/MPCvibedRPC/internal/core" + "github.com/CptPakundo/MPRP/internal/core" ) var ( @@ -112,7 +112,7 @@ func writeFileAtomic(file string, data []byte) error { return os.WriteFile(file, data, perm) } } - tmp := file + ".mpcvibedrpc.tmp" + tmp := file + ".mprp.tmp" if err := os.WriteFile(tmp, data, perm); err != nil { _ = os.Remove(tmp) // a part may have been written return os.WriteFile(file, data, perm) diff --git a/internal/winsys/macapp_darwin.go b/internal/winsys/macapp_darwin.go index ebe7b42..abd85f5 100644 --- a/internal/winsys/macapp_darwin.go +++ b/internal/winsys/macapp_darwin.go @@ -130,7 +130,7 @@ static void macTrayCreate(const void *png, int len, const char *tip) { hideItem = menuItem(m, @"Hide what I'm watching", @"", 4); streamItem = menuItem(m, @"Show the title on my streams", @"", 5); [m addItem:[NSMenuItem separatorItem]]; - menuItem(m, @"Quit MPCvibedRPC", @"q", 3); + menuItem(m, @"Quit MPRP", @"q", 3); item.menu = m; }); } @@ -178,7 +178,7 @@ static void macShowWindow(const char *url) { styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]; window.releasedWhenClosed = NO; - window.title = @"MPCvibedRPC"; + window.title = @"MPRP"; window.delegate = controller; window.minSize = NSMakeSize(420, 400); // minimized, the window shows in the Dock as the app's logo (a web view's snapshot comes out blank) @@ -279,7 +279,7 @@ type menuState struct { } func (t *Tray) state() menuState { - st := menuState{tip: "MPCvibedRPC"} + st := menuState{tip: "MPRP"} if t.o.Tooltip != nil { st.tip = t.o.Tooltip() } diff --git a/internal/winsys/mpcsetup.go b/internal/winsys/mpcsetup.go index 4a3da36..1c2ba4d 100644 --- a/internal/winsys/mpcsetup.go +++ b/internal/winsys/mpcsetup.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/proc" + "github.com/CptPakundo/MPRP/internal/proc" ) // WebResult is the answer of EnableMpcWebInterface. diff --git a/internal/winsys/mpvconf.go b/internal/winsys/mpvconf.go index f9b48cb..f9f9c76 100644 --- a/internal/winsys/mpvconf.go +++ b/internal/winsys/mpvconf.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/pipe" ) const mpvIPCKey = "input-ipc-server" @@ -43,7 +43,7 @@ func addMpvConfLine(text, key, value string) string { if strings.Contains(text, "\r\n") || (text == "" && IsWindows) { eol = "\r\n" } - return bom + "# added by MPCvibedRPC, so it can see what mpv plays" + eol + key + "=" + value + eol + text + return bom + "# added by MPRP, so it can see what mpv plays" + eol + key + "=" + value + eol + text } // mpvConfPaths lists where mpv reads its settings, most specific first: portable_config next to a known mpv.exe, diff --git a/internal/winsys/mpvconf_unix_test.go b/internal/winsys/mpvconf_unix_test.go index a995831..98bb15b 100644 --- a/internal/winsys/mpvconf_unix_test.go +++ b/internal/winsys/mpvconf_unix_test.go @@ -7,7 +7,7 @@ import ( "path/filepath" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/pipe" ) // mpv's macOS and Linux layout: ~/.config/mpv (or $XDG_CONFIG_HOME/mpv), and the socket written as a full path. diff --git a/internal/winsys/run.go b/internal/winsys/run.go index 246b477..72e7ff2 100644 --- a/internal/winsys/run.go +++ b/internal/winsys/run.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/proc" + "github.com/CptPakundo/MPRP/internal/proc" ) type result struct { diff --git a/internal/winsys/setup_unix.go b/internal/winsys/setup_unix.go index 24f9be8..7effcd1 100644 --- a/internal/winsys/setup_unix.go +++ b/internal/winsys/setup_unix.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/pipe" ) // "Set up the player connection" on macOS and Linux. There is no MPC-HC or MPC-BE there. mpv gets input-ipc-server diff --git a/internal/winsys/single_windows.go b/internal/winsys/single_windows.go index 9102c0a..476931e 100644 --- a/internal/winsys/single_windows.go +++ b/internal/winsys/single_windows.go @@ -14,7 +14,7 @@ var instanceMutex syscall.Handle // data folder dir is used by the other systems, which lock a file in it.) The handle stays open: Windows releases the // mutex when the process ends, and that is what keeps a second copy out until then (or until ReleaseSingleInstance). func AcquireSingleInstance(dir string) bool { - // The default install keeps the name it always had; a copy with a data folder of its own (MPCRPC_HOME) gets its + // The default install keeps the name it always had; a copy with a data folder of its own (MPRP_HOME) gets its // own, like its autostart value, so it can run next to an installed copy. name, _ := syscall.UTF16PtrFromString(`Local\` + runName() + `-single-instance`) h, _, err := kernel32.NewProc("CreateMutexW").Call(0, 0, uintptr(unsafe.Pointer(name))) diff --git a/internal/winsys/taskbar_windows.go b/internal/winsys/taskbar_windows.go index 6f9e2c9..dc07ec0 100644 --- a/internal/winsys/taskbar_windows.go +++ b/internal/winsys/taskbar_windows.go @@ -79,7 +79,7 @@ func NameWindow(profileDir string) bool { if err != nil || profileDir == "" { return false } - id, name, command, icon := windowIdentity(exe, os.Getenv("MPCRPC_HOME")) + id, name, command, icon := windowIdentity(exe, os.Getenv("MPRP_HOME")) for deadline := time.Now().Add(nameWindowFor); ; time.Sleep(nameWindowEvery) { if w, ok := findWindow(profileDir); ok { // the ID first: the other three belong to it diff --git a/internal/winsys/taskbar_windows_test.go b/internal/winsys/taskbar_windows_test.go index b44dc7c..2fce320 100644 --- a/internal/winsys/taskbar_windows_test.go +++ b/internal/winsys/taskbar_windows_test.go @@ -3,9 +3,9 @@ package winsys import "testing" func TestWindowIdentity(t *testing.T) { - const exe = `C:\Programs\Sample\MPCvibedRPC.exe` + const exe = `C:\Programs\Sample\MPRP.exe` id, name, command, icon := windowIdentity(exe, "") - if id != "MPCvibedRPC" || name != "MPCvibedRPC" || command != `"`+exe+`"` || icon != exe+",0" { + if id != "MPRP" || name != "MPRP" || command != `"`+exe+`"` || icon != exe+",0" { t.Errorf("the installed copy: id %q, name %q, command %q, icon %q", id, name, command, icon) } // a copy with a data folder of its own: another button group, and a pinned button starts it with that folder @@ -13,7 +13,7 @@ func TestWindowIdentity(t *testing.T) { if id2 == id || id2 != runNameFor(`D:\Portable\data`) { t.Errorf("a copy with its own folder has the ID %q (the installed one: %q)", id2, id) } - if name2 != "MPCvibedRPC" || command2 != `"`+exe+`" --home "D:\Portable\data"` { + if name2 != "MPRP" || command2 != `"`+exe+`" --home "D:\Portable\data"` { t.Errorf("a copy with its own folder: name %q, command %q", name2, command2) } } diff --git a/internal/winsys/tray_windows.go b/internal/winsys/tray_windows.go index d6d57fa..b83c335 100644 --- a/internal/winsys/tray_windows.go +++ b/internal/winsys/tray_windows.go @@ -80,7 +80,7 @@ const ( cmdHide = 4 cmdStream = 5 timerID = 1 - className = "MPCvibedRPC.Tray" + className = "MPRP.Tray" ) type wndClassEx struct { @@ -181,7 +181,7 @@ func (t *Tray) loop() { t.o.Log("WARN", "Tray icon could not start (RegisterClass: "+err.Error()+"). Open the app again to reach the settings.") return } - hwnd, _, err := pCreateWindowEx.Call(0, uintptr(unsafe.Pointer(cls)), uintptr(unsafe.Pointer(utf16Ptr("MPCvibedRPC"))), 0, 0, 0, 0, 0, 0, 0, hinst, 0) + hwnd, _, err := pCreateWindowEx.Call(0, uintptr(unsafe.Pointer(cls)), uintptr(unsafe.Pointer(utf16Ptr("MPRP"))), 0, 0, 0, 0, 0, 0, 0, hinst, 0) if hwnd == 0 { t.o.Log("WARN", "Tray icon could not start (CreateWindow: "+err.Error()+"). Open the app again to reach the settings.") return @@ -243,7 +243,7 @@ func (t *Tray) tooltip() string { if t.o.Tooltip != nil { return t.o.Tooltip() } - return "MPCvibedRPC" + return "MPRP" } func (t *Tray) notify(action uintptr) bool { @@ -300,7 +300,7 @@ func (t *Tray) showMenu() { toggle = "Stop showing on Discord" } // the first line says what the program is doing (the icon's tooltip, without the program's name) - status := strings.TrimPrefix(t.tooltip(), "MPCvibedRPC - ") + status := strings.TrimPrefix(t.tooltip(), "MPRP - ") pAppendMenu.Call(menu, mfString|mfDisabled|mfGrayed, 0, uintptr(unsafe.Pointer(utf16Ptr(status)))) pAppendMenu.Call(menu, mfSeparator, 0, 0) pAppendMenu.Call(menu, mfString, cmdOpen, uintptr(unsafe.Pointer(utf16Ptr("Open settings")))) diff --git a/internal/winsys/unix_test.go b/internal/winsys/unix_test.go index b046623..4bde6b1 100644 --- a/internal/winsys/unix_test.go +++ b/internal/winsys/unix_test.go @@ -7,66 +7,66 @@ import ( "strings" "testing" - "github.com/CptPakundo/MPCvibedRPC/internal/pipe" + "github.com/CptPakundo/MPRP/internal/pipe" ) func TestLoginItemPaths(t *testing.T) { - t.Setenv("MPCRPC_HOME", "") + t.Setenv("MPRP_HOME", "") home := filepath.Join("home", "someone") - if got, want := loginItemPath("darwin", home, ""), filepath.Join(home, "Library", "LaunchAgents", "io.github.cptpakundo.mpcvibedrpc.plist"); got != want { + if got, want := loginItemPath("darwin", home, ""), filepath.Join(home, "Library", "LaunchAgents", "io.github.cptpakundo.mprp.plist"); got != want { t.Errorf("macOS: %s, want %s", got, want) } - if got, want := loginItemPath("linux", home, ""), filepath.Join(home, ".config", "autostart", "mpcvibedrpc.desktop"); got != want { + if got, want := loginItemPath("linux", home, ""), filepath.Join(home, ".config", "autostart", "mprp.desktop"); got != want { t.Errorf("Linux: %s, want %s", got, want) } - if got, want := loginItemPath("linux", home, filepath.Join("cfg")), filepath.Join("cfg", "autostart", "mpcvibedrpc.desktop"); got != want { + if got, want := loginItemPath("linux", home, filepath.Join("cfg")), filepath.Join("cfg", "autostart", "mprp.desktop"); got != want { t.Errorf("Linux with XDG_CONFIG_HOME: %s, want %s", got, want) } if loginItemPath("linux", "", "") != "" || loginItemPath("darwin", "", "x") != "" { t.Error("no home folder, no login item") } // a copy with a data folder of its own gets a login item of its own - t.Setenv("MPCRPC_HOME", filepath.Join("tmp", "test-copy")) + t.Setenv("MPRP_HOME", filepath.Join("tmp", "test-copy")) p := loginItemPath("linux", home, "") - if !strings.Contains(p, "mpcvibedrpc-") || p == filepath.Join(home, ".config", "autostart", "mpcvibedrpc.desktop") { + if !strings.Contains(p, "mprp-") || p == filepath.Join(home, ".config", "autostart", "mprp.desktop") { t.Errorf("isolated copy: %s", p) } } func TestLoginItemContent(t *testing.T) { - t.Setenv("MPCRPC_HOME", "") - plist := loginItem("darwin", "/Applications/MPCvibedRPC.app/Contents/MacOS/MPCvibedRPC", "") - for _, want := range []string{"io.github.cptpakundo.mpcvibedrpc", - "/Applications/MPCvibedRPC.app/Contents/MacOS/MPCvibedRPC", "--background", "RunAtLoad\n\t"} { + t.Setenv("MPRP_HOME", "") + plist := loginItem("darwin", "/Applications/MPRP.app/Contents/MacOS/MPRP", "") + for _, want := range []string{"io.github.cptpakundo.mprp", + "/Applications/MPRP.app/Contents/MacOS/MPRP", "--background", "RunAtLoad\n\t"} { if !strings.Contains(plist, want) { t.Errorf("plist lacks %q:\n%s", want, plist) } } - if strings.Contains(plist, "MPCRPC_HOME") { + if strings.Contains(plist, "MPRP_HOME") { t.Error("no data folder of its own, no environment") } if v, err := parsePlist(strings.NewReader(plist)); err != nil || v.(map[string]any)["RunAtLoad"] != true { t.Errorf("the plist must be readable: %v %v", v, err) } // odd characters are escaped - plist = loginItem("darwin", "/Apps/A & B /MPCvibedRPC", "/data/My \"copy\"") - if !strings.Contains(plist, "A & B <x>") || !strings.Contains(plist, "MPCRPC_HOME") { + plist = loginItem("darwin", "/Apps/A & B /MPRP", "/data/My \"copy\"") + if !strings.Contains(plist, "A & B <x>") || !strings.Contains(plist, "MPRP_HOME") { t.Errorf("escaping:\n%s", plist) } if v, err := parsePlist(strings.NewReader(plist)); err != nil { t.Errorf("escaped plist unreadable: %v", err) - } else if args := v.(map[string]any)["ProgramArguments"].([]any); args[0] != "/Apps/A & B /MPCvibedRPC" { + } else if args := v.(map[string]any)["ProgramArguments"].([]any); args[0] != "/Apps/A & B /MPRP" { t.Errorf("program: %v", args) } - desktop := loginItem("linux", "/opt/MPCvibedRPC/MPCvibedRPC", "") - for _, want := range []string{"[Desktop Entry]\n", "Type=Application\n", `Exec="/opt/MPCvibedRPC/MPCvibedRPC" --background` + "\n", "Name=MPCvibedRPC\n"} { + desktop := loginItem("linux", "/opt/MPRP/MPRP", "") + for _, want := range []string{"[Desktop Entry]\n", "Type=Application\n", `Exec="/opt/MPRP/MPRP" --background` + "\n", "Name=MPRP\n"} { if !strings.Contains(desktop, want) { t.Errorf("desktop entry lacks %q:\n%s", want, desktop) } } - desktop = loginItem("linux", "/opt/a b/MPCvibedRPC", "/data/x") - if !strings.Contains(desktop, `Exec=env "MPCRPC_HOME=/data/x" "/opt/a b/MPCvibedRPC" --background`) { + desktop = loginItem("linux", "/opt/a b/MPRP", "/data/x") + if !strings.Contains(desktop, `Exec=env "MPRP_HOME=/data/x" "/opt/a b/MPRP" --background`) { t.Errorf("with a data folder:\n%s", desktop) } } @@ -235,10 +235,10 @@ func TestMpvConfPathsUnix(t *testing.T) { } func TestTranslocatedAppGetsNoLoginItem(t *testing.T) { - if !translocated("/private/var/folders/ab/xyz/T/AppTranslocation/0A1B/d/MPCvibedRPC.app/Contents/MacOS/MPCvibedRPC") { + if !translocated("/private/var/folders/ab/xyz/T/AppTranslocation/0A1B/d/MPRP.app/Contents/MacOS/MPRP") { t.Error("a translocated app must be recognised") } - if translocated("/Applications/MPCvibedRPC.app/Contents/MacOS/MPCvibedRPC") { + if translocated("/Applications/MPRP.app/Contents/MacOS/MPRP") { t.Error("an app in Applications is not translocated") } } diff --git a/internal/winsys/window.go b/internal/winsys/window.go index 7affd20..120fb4e 100644 --- a/internal/winsys/window.go +++ b/internal/winsys/window.go @@ -7,7 +7,7 @@ import ( "path/filepath" "runtime" - "github.com/CptPakundo/MPCvibedRPC/internal/proc" + "github.com/CptPakundo/MPRP/internal/proc" ) // findBrowser returns Edge/Chrome/Brave/Vivaldi if installed. @@ -50,17 +50,17 @@ func start(c *exec.Cmd) bool { // OpenWindow shows the page in an app-style window (no tabs or address bar) when Edge/Chrome is there, else in the // default browser. It returns "app", "browser" or "" (nothing could be started). With a profileDir the window // gets a browser profile of its own, so the user's regular profile is left alone and no background browser outlives -// the window; CloseWindowBrowser(profileDir) ends it. MPCRPC_BROWSER names the browser to use instead, or "none". +// the window; CloseWindowBrowser(profileDir) ends it. MPRP_BROWSER names the browser to use instead, or "none". func OpenWindow(url, profileDir string) string { b := findBrowser() - switch v := os.Getenv("MPCRPC_BROWSER"); v { + switch v := os.Getenv("MPRP_BROWSER"); v { case "": case "none": return "" // no window (a computer without a screen, a test) default: b = v // a browser of the user's choice; it has to understand --app } - if macApp && os.Getenv("MPCRPC_BROWSER") == "" && openNativeWindow(url) { + if macApp && os.Getenv("MPRP_BROWSER") == "" && openNativeWindow(url) { return "app" // the macOS app shows the page in a window of its own } if b != "" { diff --git a/tools/ci/dev-download.sh b/tools/ci/dev-download.sh index 93fe2ae..38efae7 100755 --- a/tools/ci/dev-download.sh +++ b/tools/ci/dev-download.sh @@ -6,7 +6,7 @@ # dev-download.sh record BY TAG/FILE[=N] ... records downloads made another way (the program's own updater) # BY says who downloaded ("release check v0.9.39 draft", "an automated agent"). Needs gh signed in with write access. set -euo pipefail -repo="${GITHUB_REPOSITORY:-CptPakundo/MPCvibedRPC}" +repo="${GITHUB_REPOSITORY:-CptPakundo/MPRP}" record() { local by="$1"; shift diff --git a/tools/ci/fake-http.ps1 b/tools/ci/fake-http.ps1 index 1a8f30d..8f09d88 100644 --- a/tools/ci/fake-http.ps1 +++ b/tools/ci/fake-http.ps1 @@ -16,13 +16,13 @@ while ($l.IsListening) { $html = '

Sample.Movie.2001.1080p.mkv

C:\Movies\Sample.Movie.2001.1080p.mkv

' + $state + '

' + (1000 + [int]$clock.ElapsedMilliseconds) + '

7500000

1

' $bytes = [Text.Encoding]::UTF8.GetBytes($html); $res.ContentType = 'text/html' } elseif ($p -like '*/releases/latest') { - $json = '{"tag_name":"v' + $Tag + '","body":"test release","html_url":"http://x","assets":[{"name":"MPCvibedRPC.exe","browser_download_url":"http://127.0.0.1:' + $Port + '/dl"},{"name":"MPCvibedRPC.exe.sha256","browser_download_url":"http://127.0.0.1:' + $Port + '/sha"}]}' + $json = '{"tag_name":"v' + $Tag + '","body":"test release","html_url":"http://x","assets":[{"name":"MPRP.exe","browser_download_url":"http://127.0.0.1:' + $Port + '/dl"},{"name":"MPRP.exe.sha256","browser_download_url":"http://127.0.0.1:' + $Port + '/sha"}]}' $bytes = [Text.Encoding]::UTF8.GetBytes($json); $res.ContentType = 'application/json' } elseif ($p -eq '/dl') { $bytes = [IO.File]::ReadAllBytes($NewExe); $res.ContentType = 'application/octet-stream' } elseif ($p -eq '/sha') { # the program only installs a release with a checksum file $sum = (Get-FileHash -Algorithm SHA256 $NewExe).Hash.ToLower() - $bytes = [Text.Encoding]::UTF8.GetBytes("$sum MPCvibedRPC.exe`n"); $res.ContentType = 'text/plain' + $bytes = [Text.Encoding]::UTF8.GetBytes("$sum MPRP.exe`n"); $res.ContentType = 'text/plain' } else { $res.StatusCode = 404; $bytes = [Text.Encoding]::UTF8.GetBytes('not found') } diff --git a/tools/ci/live-flathub.sh b/tools/ci/live-flathub.sh index 129e6a7..5e1a7b1 100755 --- a/tools/ci/live-flathub.sh +++ b/tools/ci/live-flathub.sh @@ -15,8 +15,8 @@ trap cleanup EXIT live() { local name="$1"; shift echo "== $name ($(flatpak info "$app" | sed -n 's/^ *Version: //p'))" - bash "$(dirname "$0")/must-pass.sh" TestLivePlayer env MPCRPC_LIVE_PLAYER="$name" MPCRPC_LIVE_TITLE="Sample Show" \ - MPCRPC_LIVE_MPV_PIPE=/nonexistent/none MPCRPC_LIVE_EVENTS=mpris ${1+"$@"} go test -count=1 -timeout 5m -run TestLivePlayer -v ./internal/engine + bash "$(dirname "$0")/must-pass.sh" TestLivePlayer env MPRP_LIVE_PLAYER="$name" MPRP_LIVE_TITLE="Sample Show" \ + MPRP_LIVE_MPV_PIPE=/nonexistent/none MPRP_LIVE_EVENTS=mpris ${1+"$@"} go test -count=1 -timeout 5m -run TestLivePlayer -v ./internal/engine } stop_last() { flatpak kill "$app" 2> /dev/null || true; app=""; sleep 2; } @@ -40,7 +40,7 @@ app=io.mpv.Mpv xvfb-run -a flatpak run --filesystem="$videos:ro" --filesystem="$sockdir" "$app" --no-config --vo=null --ao=null \ --loop-file=inf --input-ipc-server="$sockdir/mpvsocket" "$video" > /dev/null 2>&1 & wait_socket "$sockdir/mpvsocket" -live mpv MPCRPC_LIVE_MPV_PIPE="$sockdir/mpvsocket" MPCRPC_LIVE_EVENTS=pipe +live mpv MPRP_LIVE_MPV_PIPE="$sockdir/mpvsocket" MPRP_LIVE_EVENTS=pipe stop_last app=org.videolan.VLC diff --git a/tools/ci/live-jellyfin.sh b/tools/ci/live-jellyfin.sh index 5191e6c..49c82c1 100755 --- a/tools/ci/live-jellyfin.sh +++ b/tools/ci/live-jellyfin.sh @@ -105,9 +105,9 @@ call POST /Sessions/Playing "{\"ItemId\":\"$item\",\"MediaSourceId\":\"$item\",\ feed=$! sleep 4 -export MPCRPC_LIVE_JELLYFIN_ADDRESS="$S" MPCRPC_LIVE_JELLYFIN_USER="$user" MPCRPC_LIVE_JELLYFIN_PASSWORD="$pass" -export MPCRPC_LIVE_JELLYFIN_PRODUCT="$product" MPCRPC_LIVE_TITLE="Example Show" +export MPRP_LIVE_JELLYFIN_ADDRESS="$S" MPRP_LIVE_JELLYFIN_USER="$user" MPRP_LIVE_JELLYFIN_PASSWORD="$pass" +export MPRP_LIVE_JELLYFIN_PRODUCT="$product" MPRP_LIVE_TITLE="Example Show" bash "$(dirname "$0")/must-pass.sh" TestLiveJellyfin go test -count=1 -timeout 3m -run TestLiveJellyfin -v ./internal/jellyfin -MPCRPC_LIVE_PLAYER="$product" bash "$(dirname "$0")/must-pass.sh" TestLivePlayer go test -count=1 -timeout 3m -run TestLivePlayer -v ./internal/engine +MPRP_LIVE_PLAYER="$product" bash "$(dirname "$0")/must-pass.sh" TestLivePlayer go test -count=1 -timeout 3m -run TestLivePlayer -v ./internal/engine done_file diff --git a/tools/ci/live-players.sh b/tools/ci/live-players.sh index b61f89f..23bd36f 100755 --- a/tools/ci/live-players.sh +++ b/tools/ci/live-players.sh @@ -18,7 +18,7 @@ trap cleanup EXIT live() { local name="$1"; shift echo "== $name" - bash "$(dirname "$0")/must-pass.sh" TestLivePlayer env MPCRPC_LIVE_PLAYER="$name" MPCRPC_LIVE_TITLE="Sample Show" ${1+"$@"} go test -count=1 -timeout 5m -run TestLivePlayer -v ./internal/engine + bash "$(dirname "$0")/must-pass.sh" TestLivePlayer env MPRP_LIVE_PLAYER="$name" MPRP_LIVE_TITLE="Sample Show" ${1+"$@"} go test -count=1 -timeout 5m -run TestLivePlayer -v ./internal/engine } stop_last() { kill "$pid" 2> /dev/null || true; wait "$pid" 2> /dev/null || true; pid=""; sleep 1; } @@ -26,44 +26,44 @@ stop_last() { kill "$pid" 2> /dev/null || true; wait "$pid" 2> /dev/null || true mpv --no-config --vo=null --ao=null --loop-file=inf --input-ipc-server="$tmp/mpvsocket" "$video" > /dev/null 2>&1 & pid=$! wait_socket "$tmp/mpvsocket" -live mpv MPCRPC_LIVE_EVENTS=pipe # also: a pause shows at once, from mpv's event +live mpv MPRP_LIVE_EVENTS=pipe # also: a pause shows at once, from mpv's event stop_last if [ "$os" = Linux ]; then - none="MPCRPC_LIVE_MPV_PIPE=/nonexistent/none" # so that mpv can only be found through MPRIS below + none="MPRP_LIVE_MPV_PIPE=/nonexistent/none" # so that mpv can only be found through MPRIS below cvlc --intf dummy --extraintf dbus --no-video --aout dummy --loop "$video" > /dev/null 2>&1 & pid=$! wait_bus org.mpris.MediaPlayer2.vlc - live VLC "$none" MPCRPC_LIVE_EVENTS=mpris + live VLC "$none" MPRP_LIVE_EVENTS=mpris stop_last mpv --vo=null --ao=null --loop-file=inf "$video" > /dev/null 2>&1 & # the mpv-mpris script is loaded from /etc/mpv/scripts pid=$! wait_bus org.mpris.MediaPlayer2.mpv - live mpv "$none" MPCRPC_LIVE_EVENTS=mpris + live mpv "$none" MPRP_LIVE_EVENTS=mpris stop_last xvfb-run -a celluloid --mpv-options="--ao=null --loop-file=inf" "$video" > /dev/null 2>&1 & pid=$! wait_bus "org.mpris.MediaPlayer2.*[Cc]elluloid" 240 # Celluloid's first start on a fresh runner once took over 20 s - live Celluloid "$none" MPCRPC_LIVE_EVENTS=mpris + live Celluloid "$none" MPRP_LIVE_EVENTS=mpris stop_last pkill -x celluloid || true # xvfb-run does not pass the signal on else echo "== IINA: the real program sets it up" - go build -o "$work/MPCvibedRPC" ./cmd/mpcvibedrpc - export MPCRPC_HOME="$work/home" MPCRPC_BROWSER=none MPCRPC_FOREGROUND=1 - mkdir -p "$MPCRPC_HOME" - printf '%s' '{"app":{"openWindow":false,"startPresence":false,"checkUpdates":false,"welcomeSeen":true},"port":1}' > "$MPCRPC_HOME/config.json" + go build -o "$work/MPRP" ./cmd/mprp + export MPRP_HOME="$work/home" MPRP_BROWSER=none MPRP_FOREGROUND=1 + mkdir -p "$MPRP_HOME" + printf '%s' '{"app":{"openWindow":false,"startPresence":false,"checkUpdates":false,"welcomeSeen":true},"port":1}' > "$MPRP_HOME/config.json" app="" port="" token="" # every wait below has a limit: a CI machine has nobody to answer a dialog start_app() { - "$work/MPCvibedRPC" & + "$work/MPRP" & app=$! - for _ in $(seq 1 60); do [ -s "$MPCRPC_HOME/ipc.json" ] && break; sleep 0.25; done - [ -s "$MPCRPC_HOME/ipc.json" ] || { echo "the program did not start"; exit 1; } - port="$(jq -r .port "$MPCRPC_HOME/ipc.json")"; token="$(jq -r .token "$MPCRPC_HOME/ipc.json")" + for _ in $(seq 1 60); do [ -s "$MPRP_HOME/ipc.json" ] && break; sleep 0.25; done + [ -s "$MPRP_HOME/ipc.json" ] || { echo "the program did not start"; exit 1; } + port="$(jq -r .port "$MPRP_HOME/ipc.json")"; token="$(jq -r .token "$MPRP_HOME/ipc.json")" } api() { curl -sf -m 60 -H "X-Token: $token" -H 'Content-Type: application/json' -X POST --data "$2" "http://127.0.0.1:$port/api/$1"; } stop_app() { @@ -84,7 +84,7 @@ else cat "$work/setup2.json"; echo stop_app grep -q "IINA was already set up" "$work/setup2.json" || { echo "the second setup should find IINA set up"; exit 1; } - unset MPCRPC_HOME MPCRPC_BROWSER MPCRPC_FOREGROUND + unset MPRP_HOME MPRP_BROWSER MPRP_FOREGROUND echo "-- opening IINA" # by its path, not its name: a freshly installed app is not always registered with LaunchServices yet ("Unable to @@ -92,7 +92,7 @@ else open -a /Applications/IINA.app "$video" & pid=$! wait_socket "$tmp/iina-mpvsocket" || { pgrep -lf IINA || echo "IINA is not running"; ls -la "$tmp"; exit 1; } - live IINA MPCRPC_LIVE_EVENTS=pipe + live IINA MPRP_LIVE_EVENTS=pipe pkill -x IINA || true # not AppleScript: macOS would ask whether this may control IINA, and nobody can answer fi echo "live player tests passed" diff --git a/tools/ci/live-plex.sh b/tools/ci/live-plex.sh index 51397b9..9a1fa17 100755 --- a/tools/ci/live-plex.sh +++ b/tools/ci/live-plex.sh @@ -48,7 +48,7 @@ echo "sample episode: $rk" ) & feed=$! -MPCRPC_LIVE_PLAYER=Plex MPCRPC_LIVE_TITLE="Sample Show - S01E02" MPCRPC_LIVE_PLEX_ADDRESS="$P" \ +MPRP_LIVE_PLAYER=Plex MPRP_LIVE_TITLE="Sample Show - S01E02" MPRP_LIVE_PLEX_ADDRESS="$P" \ bash "$(dirname "$0")/must-pass.sh" TestLivePlayer go test -count=1 -timeout 3m -run TestLivePlayer -v ./internal/engine done_file diff --git a/tools/ci/live-windows.sh b/tools/ci/live-windows.sh index be303ce..480a84f 100755 --- a/tools/ci/live-windows.sh +++ b/tools/ci/live-windows.sh @@ -21,7 +21,7 @@ win_video="$(cygpath -w "$video")" live() { # live NAME [VAR=value ...]: the live engine test, which must really run and pass local name="$1"; shift - env MPCRPC_LIVE_PLAYER="$name" MPCRPC_LIVE_TITLE="Sample Movie" "$@" \ + env MPRP_LIVE_PLAYER="$name" MPRP_LIVE_TITLE="Sample Movie" "$@" \ "$here/must-pass.sh" TestLivePlayer go test -count=1 -v -run TestLivePlayer ./internal/engine } @@ -31,7 +31,7 @@ pot="$(ls /c/Program\ Files/DAUM/PotPlayer/PotPlayerMini64.exe /c/Program\ Files "$pot" "$win_video" & sleep 10 live PotPlayer -MPCRPC_LIVE_POTPLAYER=1 "$here/must-pass.sh" TestLivePotPlayer go test -count=1 -v -run TestLivePotPlayer ./internal/potplayer +MPRP_LIVE_POTPLAYER=1 "$here/must-pass.sh" TestLivePotPlayer go test -count=1 -v -run TestLivePotPlayer ./internal/potplayer taskkill //F //IM "$(basename "$pot")" > /dev/null || true echo "::endgroup::" @@ -60,7 +60,7 @@ file_json="$(printf '%s' "$win_video" | sed 's/\\/\\\\/g')" rpc "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"Player.Open\",\"params\":{\"item\":{\"file\":\"$file_json\"}}}" echo sleep 8 -live Kodi MPCRPC_LIVE_KODI_PASSWORD=ci-secret MPCRPC_LIVE_EVENTS=kodi # also: a pause shows at once, from Kodi's notification +live Kodi MPRP_LIVE_KODI_PASSWORD=ci-secret MPRP_LIVE_EVENTS=kodi # also: a pause shows at once, from Kodi's notification taskkill //F //IM kodi.exe > /dev/null || true echo "::endgroup::" diff --git a/tools/ci/package-macos.sh b/tools/ci/package-macos.sh index 56f047f..bfca5d1 100755 --- a/tools/ci/package-macos.sh +++ b/tools/ci/package-macos.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# Builds MPCvibedRPC.app, one program for Apple silicon and Intel Macs, and zips it as OUTDIR/MPCvibedRPC-macos.zip. +# Builds MPRP.app, one program for Apple silicon and Intel Macs, and zips it as OUTDIR/MPRP-macos.zip. # Runs on macOS (it needs lipo, codesign and ditto). usage: package-macos.sh VERSION OUTDIR set -euo pipefail version="$1"; out="$2" work="$(mktemp -d)" -app="$work/MPCvibedRPC.app" +app="$work/MPRP.app" mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$out" out="$(cd "$out" && pwd)" # the zip is written from inside $work @@ -12,12 +12,12 @@ out="$(cd "$out" && pwd)" # the zip is written from inside $work for arch in arm64 amd64; do carch="$arch"; [ "$arch" = amd64 ] && carch=x86_64 CGO_ENABLED=1 GOOS=darwin GOARCH="$arch" CC="clang -arch $carch" MACOSX_DEPLOYMENT_TARGET=13.0 \ - go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=$version" -o "$work/MPCvibedRPC-$arch" ./cmd/mpcvibedrpc + go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=$version" -o "$work/MPRP-$arch" ./cmd/mprp # the Cocoa part must be in both: a build without it would quietly fall back to the browser and no menu bar icon - otool -L "$work/MPCvibedRPC-$arch" | grep -q WebKit.framework || { echo "the $arch build lacks the macOS app code"; exit 1; } + otool -L "$work/MPRP-$arch" | grep -q WebKit.framework || { echo "the $arch build lacks the macOS app code"; exit 1; } done -lipo -create -output "$app/Contents/MacOS/MPCvibedRPC" "$work/MPCvibedRPC-arm64" "$work/MPCvibedRPC-amd64" -go run ./tools/mkico -icns "$app/Contents/Resources/MPCvibedRPC.icns" +lipo -create -output "$app/Contents/MacOS/MPRP" "$work/MPRP-arm64" "$work/MPRP-amd64" +go run ./tools/mkico -icns "$app/Contents/Resources/MPRP.icns" # LSUIElement: no Dock icon or menu bar of its own (the program has no windows besides the settings page). cat > "$app/Contents/Info.plist" < "$app/Contents/Info.plist" <CFBundleDevelopmentRegion en CFBundleDisplayName - MPCvibedRPC + MPRP CFBundleExecutable - MPCvibedRPC + MPRP CFBundleIconFile - MPCvibedRPC + MPRP CFBundleIdentifier - io.github.cptpakundo.mpcvibedrpc + io.github.cptpakundo.mprp CFBundleInfoDictionaryVersion 6.0 CFBundleName - MPCvibedRPC + MPRP CFBundlePackageType APPL CFBundleShortVersionString @@ -50,7 +50,7 @@ cat > "$app/Contents/Info.plist" <LSUIElement NSLocalNetworkUsageDescription - MPCvibedRPC reads what plays on the Plex, Jellyfin, Emby or Kodi server you set up on your network, to show it on Discord. + MPRP reads what plays on the Plex, Jellyfin, Emby or Kodi server you set up on your network, to show it on Discord. NSHumanReadableCopyright MIT License. Made with AI (vibe coded). @@ -62,7 +62,7 @@ plutil -lint "$app/Contents/Info.plist" plutil -extract NSLocalNetworkUsageDescription raw "$app/Contents/Info.plist" > /dev/null [ "$(plutil -extract LSMinimumSystemVersion raw "$app/Contents/Info.plist")" = 13.0 ] || { echo "LSMinimumSystemVersion is not 13.0"; exit 1; } for arch in arm64 amd64; do - minos="$(otool -l "$work/MPCvibedRPC-$arch" | awk '/LC_BUILD_VERSION/ { b = 1 } b && $1 == "minos" { print $2; exit }')" + minos="$(otool -l "$work/MPRP-$arch" | awk '/LC_BUILD_VERSION/ { b = 1 } b && $1 == "minos" { print $2; exit }')" echo "$arch build: minimum macOS $minos" [ -n "$minos" ] && [ "${minos%%.*}" -le 13 ] || { echo "the $arch build needs macOS $minos, above the app's 13.0"; exit 1; } done @@ -71,8 +71,8 @@ done # macOS asks the user to confirm the first start (see the README). codesign --force --sign - --timestamp=none "$app" codesign --verify --strict --verbose=2 "$app" -lipo -archs "$app/Contents/MacOS/MPCvibedRPC" +lipo -archs "$app/Contents/MacOS/MPRP" -rm -f "$out/MPCvibedRPC-macos.zip" -(cd "$work" && ditto -c -k --keepParent MPCvibedRPC.app "$out/MPCvibedRPC-macos.zip") -ls -l "$out/MPCvibedRPC-macos.zip" +rm -f "$out/MPRP-macos.zip" +(cd "$work" && ditto -c -k --keepParent MPRP.app "$out/MPRP-macos.zip") +ls -l "$out/MPRP-macos.zip" diff --git a/tools/ci/reproduce.sh b/tools/ci/reproduce.sh index 418855e..5c0352a 100755 --- a/tools/ci/reproduce.sh +++ b/tools/ci/reproduce.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Rebuilds the release files the way the release builds them, so a release can be checked byte for byte. -# reproduce.sh builds MPCvibedRPC.exe, MPCvibedRPC-linux-amd64 and -arm64 into out-dir +# reproduce.sh builds MPRP.exe, MPRP-linux-amd64 and -arm64 into out-dir # reproduce.sh compare fails unless both files are the same # reproduce.sh hash fails unless the file has that SHA-256 # reproduce.sh sums prints exe=, linux_amd64= and linux_arm64= with the SHA-256 of the files built there @@ -35,9 +35,9 @@ case "${1:-}" in fi ;; sums) - echo "exe=$(sha "$2/MPCvibedRPC.exe")" - echo "linux_amd64=$(sha "$2/MPCvibedRPC-linux-amd64")" - echo "linux_arm64=$(sha "$2/MPCvibedRPC-linux-arm64")" + echo "exe=$(sha "$2/MPRP.exe")" + echo "linux_amd64=$(sha "$2/MPRP-linux-amd64")" + echo "linux_arm64=$(sha "$2/MPRP-linux-arm64")" ;; same) echo "$2: release $3, rebuilt $4" @@ -50,12 +50,12 @@ case "${1:-}" in v="$1"; out="$2" mkdir -p "$out" export CGO_ENABLED=0 - syso=cmd/mpcvibedrpc/rsrc_windows_amd64.syso + syso=cmd/mprp/rsrc_windows_amd64.syso go run ./tools/mkrsrc -version "$v" -out "$syso" - GOOS=windows GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=$v" -o "$out/MPCvibedRPC.exe" ./cmd/mpcvibedrpc + GOOS=windows GOARCH=amd64 go build -trimpath -buildvcs=false -ldflags "-H=windowsgui -s -w -X main.version=$v" -o "$out/MPRP.exe" ./cmd/mprp rm -f "$syso" for arch in amd64 arm64; do - GOOS=linux GOARCH=$arch go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=$v" -o "$out/MPCvibedRPC-linux-$arch" ./cmd/mpcvibedrpc + GOOS=linux GOARCH=$arch go build -trimpath -buildvcs=false -ldflags "-s -w -X main.version=$v" -o "$out/MPRP-linux-$arch" ./cmd/mprp done ls -l "$out" ;; diff --git a/tools/ci/smoke-unix.sh b/tools/ci/smoke-unix.sh index a40aab2..62a4f24 100755 --- a/tools/ci/smoke-unix.sh +++ b/tools/ci/smoke-unix.sh @@ -7,21 +7,21 @@ set -euo pipefail exe="$1"; version="$2"; app="${3:-}" os="$(uname -s)" work="$(mktemp -d)" -export MPCRPC_HOME="$work/home" MPCRPC_BROWSER=none MPCRPC_FOREGROUND=1 +export MPRP_HOME="$work/home" MPRP_BROWSER=none MPRP_FOREGROUND=1 export XDG_CONFIG_HOME="$work/config" # mpv.conf and the Linux autostart entry are written here, not in the real home -mkdir -p "$MPCRPC_HOME" "$XDG_CONFIG_HOME/mpv" # an mpv folder: mpv counts as present for the setup +mkdir -p "$MPRP_HOME" "$XDG_CONFIG_HOME/mpv" # an mpv folder: mpv counts as present for the setup quiet='{"app":{"openWindow":false,"startPresence":false,"checkUpdates":false,"welcomeSeen":true},"port":1}' -printf '%s' "$quiet" > "$MPCRPC_HOME/config.json" +printf '%s' "$quiet" > "$MPRP_HOME/config.json" -fail() { echo "::error title=smoke-unix::$*"; [ -f "$MPCRPC_HOME/mpcvibedrpc.log" ] && tail -n 40 "$MPCRPC_HOME/mpcvibedrpc.log"; exit 1; } +fail() { echo "::error title=smoke-unix::$*"; [ -f "$MPRP_HOME/mprp.log" ] && tail -n 40 "$MPRP_HOME/mprp.log"; exit 1; } wait_for() { # wait_for "what" command... local what="$1"; shift for _ in $(seq 1 60); do "$@" && return 0; sleep 0.25; done fail "timed out waiting for $what" } -have_ipc() { [ -s "$MPCRPC_HOME/ipc.json" ] && curl -sf "http://127.0.0.1:$(jq -r .port "$MPCRPC_HOME/ipc.json")/api/ping" > /dev/null; } +have_ipc() { [ -s "$MPRP_HOME/ipc.json" ] && curl -sf "http://127.0.0.1:$(jq -r .port "$MPRP_HOME/ipc.json")/api/ping" > /dev/null; } port=""; token="" -read_ipc() { port="$(jq -r .port "$MPCRPC_HOME/ipc.json")"; token="$(jq -r .token "$MPCRPC_HOME/ipc.json")"; } +read_ipc() { port="$(jq -r .port "$MPRP_HOME/ipc.json")"; token="$(jq -r .token "$MPRP_HOME/ipc.json")"; } get() { curl -sf -m 60 -H "X-Token: $token" "http://127.0.0.1:$port/api/$1"; } post() { curl -sf -m 60 -H "X-Token: $token" -H 'Content-Type: application/json' -X POST --data "${2:-"{}"}" "http://127.0.0.1:$port/api/$1"; } gone() { ! kill -0 "$1" 2> /dev/null; } @@ -47,13 +47,13 @@ fi echo "state ok ($want_os)" echo "== run at login" -if [ "$want_os" = darwin ]; then item_dir="$HOME/Library/LaunchAgents"; item_glob="io.github.cptpakundo.mpcvibedrpc-*.plist" -else item_dir="$XDG_CONFIG_HOME/autostart"; item_glob="mpcvibedrpc-*.desktop"; fi +if [ "$want_os" = darwin ]; then item_dir="$HOME/Library/LaunchAgents"; item_glob="io.github.cptpakundo.mprp-*.plist" +else item_dir="$XDG_CONFIG_HOME/autostart"; item_glob="mprp-*.desktop"; fi [ "$(post save '{"app":{"autoStart":true}}' | jq -r .autoStart)" = true ] || fail "autoStart did not switch on" item="$(find "$item_dir" -name "$item_glob" 2> /dev/null | head -n 1)" [ -n "$item" ] || fail "no login item in $item_dir" grep -qF -- "--background" "$item" || fail "the login item does not start in the background" -grep -qF -- "$MPCRPC_HOME" "$item" || fail "the login item does not keep the data folder" +grep -qF -- "$MPRP_HOME" "$item" || fail "the login item does not keep the data folder" if [ "$want_os" = darwin ]; then plutil -lint "$item" elif command -v desktop-file-validate > /dev/null; then desktop-file-validate "$item" else echo "::warning title=smoke test::desktop-file-validate is not installed here, so the login item was not validated"; fi @@ -75,7 +75,7 @@ jq -e '.message | contains("already set up")' <<< "$r" > /dev/null || fail "a se echo "== diagnostics" diag="$(get diagnostics | jq -r .text)" -grep -q "MPCvibedRPC diagnostics" <<< "$diag" || fail "diagnostics" +grep -q "MPRP diagnostics" <<< "$diag" || fail "diagnostics" ! grep -qF "$work" <<< "$diag" || fail "diagnostics leak a path" grep -m1 -i "system" <<< "$diag" || true @@ -90,20 +90,20 @@ echo "== presence on and off (nothing plays: Discord stays on standby)" echo "== quit" post quit > /dev/null wait_for "the program to quit" gone "$pid" -[ ! -e "$MPCRPC_HOME/ipc.json" ] || fail "ipc.json left behind" +[ ! -e "$MPRP_HOME/ipc.json" ] || fail "ipc.json left behind" if [ -n "$app" ]; then echo "== macOS: open the app like the Finder does" - unset MPCRPC_FOREGROUND MPCRPC_BROWSER # the app's own window this time + unset MPRP_FOREGROUND MPRP_BROWSER # the app's own window this time swift tools/ci/windows.swift > /dev/null # compiled once, so the checks below are quick windows() { swift tools/ci/windows.swift | awk -F'\t' -v p="$1" -v l="$2" '$1 == p && $2 == l' | wc -l | tr -d ' '; } icons() { swift tools/ci/windows.swift | awk -F' ' '$2 == 25' | wc -l | tr -d ' '; } # menu bar icons, whoever draws them (macOS 26: Control Center) shot="${SCREENSHOT:-$work/screen.png}" icons_before="$(icons)" - open --env "MPCRPC_HOME=$MPCRPC_HOME" "$app" + open --env "MPRP_HOME=$MPRP_HOME" "$app" wait_for "the app to answer" have_ipc read_ipc - server="$(jq -r .pid "$MPCRPC_HOME/ipc.json")" + server="$(jq -r .pid "$MPRP_HOME/ipc.json")" sleep 5 kill -0 "$server" || fail "the program did not keep running after the launcher left" ps -o args= -p "$server" | grep -q -- "--serve" || fail "the running copy should be the --serve one" @@ -118,17 +118,17 @@ if [ -n "$app" ]; then echo "== macOS: the settings window" open "$app" # opening the app again: macOS tells the running app, which shows its window sleep 5 - [ "$(jq -r .pid "$MPCRPC_HOME/ipc.json")" = "$server" ] || fail "opening the app again started another copy" - n="$(pgrep -f "MPCvibedRPC.app/Contents/MacOS/MPCvibedRPC" | wc -l | tr -d ' ')" + [ "$(jq -r .pid "$MPRP_HOME/ipc.json")" = "$server" ] || fail "opening the app again started another copy" + n="$(pgrep -f "MPRP.app/Contents/MacOS/MPRP" | wc -l | tr -d ' ')" [ "$n" = 1 ] || fail "$n copies are running" [ "$(windows "$server" 0)" = 1 ] || { swift tools/ci/windows.swift; fail "the app should show exactly one window of its own"; } - ! pgrep -f -- "--user-data-dir=$MPCRPC_HOME/window" > /dev/null || fail "a browser was started for the window" + ! pgrep -f -- "--user-data-dir=$MPRP_HOME/window" > /dev/null || fail "a browser was started for the window" post open > /dev/null # once more: the same window comes forward, no second one sleep 2 [ "$(windows "$server" 0)" = 1 ] || fail "a second window was opened" if screencapture -x "$shot" 2> /dev/null; then echo "screenshot: $shot"; fi echo "window ok" - grep -c "starting" "$MPCRPC_HOME/mpcvibedrpc.log" || true + grep -c "starting" "$MPRP_HOME/mprp.log" || true post quit > /dev/null wait_for "the app to quit" gone "$server" fi diff --git a/tools/ci/smoke.ps1 b/tools/ci/smoke.ps1 index 017b025..a734161 100644 --- a/tools/ci/smoke.ps1 +++ b/tools/ci/smoke.ps1 @@ -12,13 +12,13 @@ if ($env:GITHUB_ACTIONS -ne 'true') { Write-Host 'smoke.ps1 only runs on a GitHu $work = Join-Path $env:RUNNER_TEMP ('smoke-' + [guid]::NewGuid().ToString('N').Substring(0, 8)) New-Item -ItemType Directory -Path $work | Out-Null $home_ = Join-Path $work 'home'; New-Item -ItemType Directory -Path $home_ | Out-Null -$app = Join-Path $work 'MPCvibedRPC.exe' +$app = Join-Path $work 'MPRP.exe' Copy-Item $Exe $app -$env:MPCRPC_HOME = $home_ +$env:MPRP_HOME = $home_ # A copy with its own data folder gets its own run-at-login value (see winsys/autostart.go), so this test can never touch an installed program's. -$runName = 'MPCvibedRPC-' + ([BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash([Text.Encoding]::UTF8.GetBytes($home_.TrimEnd('\','/').ToLower()))).Replace('-','').Substring(0,8).ToLower()) +$runName = 'MPRP-' + ([BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash([Text.Encoding]::UTF8.GetBytes($home_.TrimEnd('\','/').ToLower()))).Replace('-','').Substring(0,8).ToLower()) $port = 13591 -$env:MPCRPC_UPDATE_API = "http://127.0.0.1:$port" +$env:MPRP_UPDATE_API = "http://127.0.0.1:$port" $stateFile = Join-Path $work 'state.txt'; Set-Content $stateFile '2' $discordLog = Join-Path $work 'discord.log' $failures = New-Object System.Collections.ArrayList @@ -39,7 +39,7 @@ function Api([string]$method, [string]$name, $body = $null) { if ($method -eq 'Post') { $args_.Body = if ($null -eq $body) { '{}' } else { $body | ConvertTo-Json -Depth 6 }; $args_.ContentType = 'application/json' } Invoke-RestMethod @args_ } -function Dump { Write-Host '--- app log ---'; Get-Content (Join-Path $home_ 'mpcvibedrpc.log') -ErrorAction SilentlyContinue | Write-Host; Write-Host '--- fake discord log ---'; Get-Content $discordLog -ErrorAction SilentlyContinue | Write-Host } +function Dump { Write-Host '--- app log ---'; Get-Content (Join-Path $home_ 'mprp.log') -ErrorAction SilentlyContinue | Write-Host; Write-Host '--- fake discord log ---'; Get-Content $discordLog -ErrorAction SilentlyContinue | Write-Host } Add-Type -Namespace W -Name U -MemberDefinition @' [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] public static extern System.IntPtr FindWindow(string c, string t); @@ -47,7 +47,7 @@ Add-Type -Namespace W -Name U -MemberDefinition @' [System.Runtime.InteropServices.DllImport("shcore.dll")] public static extern int GetProcessDpiAwareness(System.IntPtr p, out int a); '@ function StartFakeDiscord { Start-Process pwsh -PassThru -WindowStyle Hidden -ArgumentList '-NoProfile', '-File', (Join-Path $PSScriptRoot 'fake-discord.ps1'), '-Log', $discordLog } -function AppLog { Get-Content (Join-Path $home_ 'mpcvibedrpc.log') -Raw -ErrorAction SilentlyContinue } +function AppLog { Get-Content (Join-Path $home_ 'mprp.log') -Raw -ErrorAction SilentlyContinue } try { # fakes @@ -63,7 +63,7 @@ try { # the program carries its version details and icon $vi = (Get-Item $app).VersionInfo - Check ($vi.ProductVersion -eq $Version -and $vi.ProductName -eq 'MPCvibedRPC' -and $vi.FileDescription -like 'MPCvibedRPC*') "exe carries version details ($($vi.ProductVersion))" + Check ($vi.ProductVersion -eq $Version -and $vi.ProductName -eq 'MPRP' -and $vi.FileDescription -like 'MPRP*') "exe carries version details ($($vi.ProductVersion))" Add-Type -AssemblyName System.Drawing $ico = [System.Drawing.Icon]::ExtractAssociatedIcon($app) $bmp = $ico.ToBitmap(); $px = @(); foreach ($pt in @(@(8, 8), @(16, 16), @(24, 24), @(8, 24))) { $px += $bmp.GetPixel($pt[0], $pt[1]).ToArgb() } @@ -76,7 +76,7 @@ try { Check (WaitFor { $null -ne (Ipc) } 20 'ipc.json') 'program started and published ipc.json' $i = Ipc $ping = Invoke-RestMethod "http://127.0.0.1:$($i.port)/api/ping" - Check ($ping.app -eq 'MPCvibedRPC' -and $ping.version -eq $Version) 'ping answers with the version' + Check ($ping.app -eq 'MPRP' -and $ping.version -eq $Version) 'ping answers with the version' $aware = -1; [void][W.U]::GetProcessDpiAwareness($p.Handle, [ref]$aware) Check ($aware -eq 2) "the program is per-monitor DPI-aware (awareness $aware)" $state = Api 'Get' 'state' @@ -108,7 +108,7 @@ try { Set-Content $stateFile '2' # tray: its hidden window exists and understands the menu commands (1 open, 2 toggle, 3 quit) - $hwnd = [W.U]::FindWindow('MPCvibedRPC.Tray', [NullString]::Value) + $hwnd = [W.U]::FindWindow('MPRP.Tray', [NullString]::Value) Check ($hwnd -ne [IntPtr]::Zero) 'tray window exists' [void][W.U]::PostMessage($hwnd, 0x0111, [UIntPtr]2, [IntPtr]::Zero) Check (WaitFor { -not (Api 'Get' 'status').running } 10 'toggle off') 'tray menu "Stop showing on Discord" works' @@ -116,15 +116,15 @@ try { Check (WaitFor { (Api 'Get' 'status').running } 10 'toggle on') 'tray menu "Show on Discord" works' # run at login - $plainBefore = (reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' /v MPCvibedRPC 2>&1) -join "`n" + $plainBefore = (reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' /v MPRP 2>&1) -join "`n" Api 'Post' 'save' @{ app = @{ autoStart = $true } } | Out-Null $reg = (reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' /v $runName 2>&1) -join "`n" - Check ($reg -match 'MPCvibedRPC\.exe" --background --home "') 'autostart writes the Run entry (under the name for this data folder, passing that folder on)' + Check ($reg -match 'MPRP\.exe" --background --home "') 'autostart writes the Run entry (under the name for this data folder, passing that folder on)' Check ((Api 'Get' 'state').autoStart -eq $true) 'state reports autostart on' Api 'Post' 'save' @{ app = @{ autoStart = $false } } | Out-Null $reg = (reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' /v $runName 2>&1) -join "`n" - Check ($reg -notmatch 'MPCvibedRPC\.exe') 'autostart removes the Run entry' - $plain = (reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' /v MPCvibedRPC 2>&1) -join "`n" + Check ($reg -notmatch 'MPRP\.exe') 'autostart removes the Run entry' + $plain = (reg query 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run' /v MPRP 2>&1) -join "`n" # compared without regard to whitespace: PowerShell orders the lines of a failed lookup differently from run to run Check (($plain -replace '\s+',' ').Trim() -eq ($plainBefore -replace '\s+',' ').Trim()) ("the plain (installed program) Run value was never touched (before=[$($plainBefore -replace '\s+',' ')] after=[$($plain -replace '\s+',' ')])") @@ -169,10 +169,10 @@ try { Check (WaitFor { ([regex]::Matches((Get-Content $discordLog -Raw), '(?> "$GITHUB_ENV" echo "NEXT=$next" >> "$GITHUB_ENV" diff --git a/tools/downloads/main.go b/tools/downloads/main.go index b288b11..ebbd0eb 100644 --- a/tools/downloads/main.go +++ b/tools/downloads/main.go @@ -33,7 +33,7 @@ type asset struct { Count int `json:"download_count"` } -// baseline is the count of every release file when counting started ("v0.9.38/MPCvibedRPC.exe": 3). +// baseline is the count of every release file when counting started ("v0.9.38/MPRP.exe": 3). type baseline struct { At string `json:"at"` Counts map[string]int `json:"counts"` @@ -57,7 +57,7 @@ type summary struct { // isProgram: the files people download to run the program. func isProgram(name string) bool { - return strings.HasPrefix(name, "MPCvibedRPC") && !strings.HasSuffix(name, ".sha256") + return strings.HasPrefix(name, "MPRP") && !strings.HasSuffix(name, ".sha256") } func readJSON(path string, v any) error { diff --git a/tools/downloads/main_test.go b/tools/downloads/main_test.go index 062d729..d73c394 100644 --- a/tools/downloads/main_test.go +++ b/tools/downloads/main_test.go @@ -19,23 +19,23 @@ func rel(tag string, counts ...any) release { // and notices never count, drafts are left out, and a recorded download GitHub has not counted yet never goes below 0. func TestCount(t *testing.T) { rels := []release{ - rel("v0.9.1", "MPCvibedRPC.exe", 9, "MPCvibedRPC.exe.sha256", 5, "LICENSE", 4), - rel("v0.9.2", "MPCvibedRPC.exe", 7, "MPCvibedRPC-macos.zip", 3, "MPCvibedRPC-linux-amd64", 2, "MPCvibedRPC.exe.sha256", 6), - {Tag: "v0.9.3", Draft: true, Assets: []asset{{Name: "MPCvibedRPC.exe", Count: 2}}}, + rel("v0.9.1", "MPRP.exe", 9, "MPRP.exe.sha256", 5, "LICENSE", 4), + rel("v0.9.2", "MPRP.exe", 7, "MPRP-macos.zip", 3, "MPRP-linux-amd64", 2, "MPRP.exe.sha256", 6), + {Tag: "v0.9.3", Draft: true, Assets: []asset{{Name: "MPRP.exe", Count: 2}}}, } - base := baseline{At: "2026-01-01T00:00:00Z", Counts: map[string]int{"v0.9.1/MPCvibedRPC.exe": 4, "v0.9.1/LICENSE": 4}} + base := baseline{At: "2026-01-01T00:00:00Z", Counts: map[string]int{"v0.9.1/MPRP.exe": 4, "v0.9.1/LICENSE": 4}} dev := map[string]int{ - "v0.9.1/MPCvibedRPC.exe": 3, // 9 - 4 - 3 = 2 people - "v0.9.2/MPCvibedRPC.exe": 4, // a release after the baseline: 7 - 4 = 3 people - "v0.9.2/MPCvibedRPC-macos.zip": 3, - "v0.9.2/MPCvibedRPC-linux-amd64": 5, // GitHub has counted 2 of 5 so far - "v0.9.2/MPCvibedRPC.exe.sha256": 6, + "v0.9.1/MPRP.exe": 3, // 9 - 4 - 3 = 2 people + "v0.9.2/MPRP.exe": 4, // a release after the baseline: 7 - 4 = 3 people + "v0.9.2/MPRP-macos.zip": 3, + "v0.9.2/MPRP-linux-amd64": 5, // GitHub has counted 2 of 5 so far + "v0.9.2/MPRP.exe.sha256": 6, } s := count(rels, base, dev) if s.People != 5 || s.Development != 12 || s.NotCountedYet != 3 { t.Fatalf("people %d, development %d, not counted yet %d; want 5, 12, 3", s.People, s.Development, s.NotCountedYet) } - if s.ByFile["MPCvibedRPC.exe"] != 5 || s.ByRelease["v0.9.1"] != 2 || s.ByRelease["v0.9.2"] != 3 || len(s.ByFile) != 1 { + if s.ByFile["MPRP.exe"] != 5 || s.ByRelease["v0.9.1"] != 2 || s.ByRelease["v0.9.2"] != 3 || len(s.ByFile) != 1 { t.Errorf("by file %v, by release %v", s.ByFile, s.ByRelease) } if b := badge(s); b["message"] != "5" || b["schemaVersion"] != 1 { @@ -47,8 +47,8 @@ func TestCount(t *testing.T) { // page), and every ledger file added up. func TestFiles(t *testing.T) { dir := t.TempDir() - pages := `[{"tag_name":"v0.9.1","assets":[{"name":"MPCvibedRPC.exe","download_count":4}]}] -[{"tag_name":"v0.9.2","assets":[{"name":"MPCvibedRPC.exe","download_count":6}]}]` + pages := `[{"tag_name":"v0.9.1","assets":[{"name":"MPRP.exe","download_count":4}]}] +[{"tag_name":"v0.9.2","assets":[{"name":"MPRP.exe","download_count":6}]}]` relFile := filepath.Join(dir, "releases.json") os.WriteFile(relFile, []byte(pages), 0o644) rels, err := readReleases(relFile) @@ -56,16 +56,16 @@ func TestFiles(t *testing.T) { t.Fatalf("releases %v, %v", rels, err) } b := newBaseline(rels[:1], time.Unix(0, 0)) - if b.Counts["v0.9.1/MPCvibedRPC.exe"] != 4 { + if b.Counts["v0.9.1/MPRP.exe"] != 4 { t.Fatalf("baseline %v", b) } os.MkdirAll(filepath.Join(dir, "ledger"), 0o755) - os.WriteFile(filepath.Join(dir, "ledger", "a.json"), []byte(`{"by":"release check","at":"2026-01-02T10:00:00Z","files":{"v0.9.2/MPCvibedRPC.exe":2}}`), 0o644) - os.WriteFile(filepath.Join(dir, "ledger", "b.json"), []byte(`{"by":"agent","at":"2026-01-03T10:00:00Z","files":{"v0.9.2/MPCvibedRPC.exe":1}}`), 0o644) + os.WriteFile(filepath.Join(dir, "ledger", "a.json"), []byte(`{"by":"release check","at":"2026-01-02T10:00:00Z","files":{"v0.9.2/MPRP.exe":2}}`), 0o644) + os.WriteFile(filepath.Join(dir, "ledger", "b.json"), []byte(`{"by":"agent","at":"2026-01-03T10:00:00Z","files":{"v0.9.2/MPRP.exe":1}}`), 0o644) // before the baseline: already in its counts - os.WriteFile(filepath.Join(dir, "ledger", "c.json"), []byte(`{"by":"agent","at":"2026-01-01T10:00:00Z","files":{"v0.9.2/MPCvibedRPC.exe":5}}`), 0o644) + os.WriteFile(filepath.Join(dir, "ledger", "c.json"), []byte(`{"by":"agent","at":"2026-01-01T10:00:00Z","files":{"v0.9.2/MPRP.exe":5}}`), 0o644) dev, err := ledger(filepath.Join(dir, "ledger"), "2026-01-02T00:00:00Z") - if err != nil || dev["v0.9.2/MPCvibedRPC.exe"] != 3 { + if err != nil || dev["v0.9.2/MPRP.exe"] != 3 { t.Fatalf("ledger %v, %v", dev, err) } if s := count(rels, b, dev); s.People != 3 || s.Development != 3 { diff --git a/tools/mkico/main.go b/tools/mkico/main.go index 6859d76..89423f5 100644 --- a/tools/mkico/main.go +++ b/tools/mkico/main.go @@ -2,7 +2,7 @@ // size Windows asks for from 100% to 250% scaling (16, 24, 32, 40, 48, 64 pixels, 32-bit BMP frames). // // go run ./tools/mkico -out internal/assets/icon.ico -// go run ./tools/mkico -icns MPCvibedRPC.icns (the macOS app icon, made when the app is packaged) +// go run ./tools/mkico -icns MPRP.icns (the macOS app icon, made when the app is packaged) // go run ./tools/mkico -png docs/images/icon.png (a 256-pixel logo for the README) // go run ./tools/mkico -dot -out internal/assets/icon-update.ico (the tray icon while an update is waiting) package main diff --git a/tools/mkrsrc/main.go b/tools/mkrsrc/main.go index 5364163..e54510f 100644 --- a/tools/mkrsrc/main.go +++ b/tools/mkrsrc/main.go @@ -1,8 +1,8 @@ // mkrsrc writes a Windows resource object (.syso) holding the program's icon, version information and application manifest (per-monitor DPI awareness), so the -// finished MPCvibedRPC.exe has an icon in Explorer and proper details in Task Manager. The Go linker picks the +// finished MPRP.exe has an icon in Explorer and proper details in Task Manager. The Go linker picks the // .syso up automatically when it sits next to the main package. Standard library only. // -// go run ./tools/mkrsrc -icon internal/assets/icon.ico -version X.Y.Z -out cmd/mpcvibedrpc/rsrc_windows_amd64.syso +// go run ./tools/mkrsrc -icon internal/assets/icon.ico -version X.Y.Z -out cmd/mprp/rsrc_windows_amd64.syso package main import ( @@ -286,12 +286,12 @@ func versionInfo(version string) ([]byte, error) { for _, kv := range [][2]string{ {"CompanyName", ""}, {"Comments", "Made with AI (vibe coded). MIT License, no warranty."}, - {"FileDescription", "MPCvibedRPC - Discord Rich Presence for MPC-HC, MPC-BE, MPC-QT, mpv, VLC, PotPlayer, IINA, Kodi, Plex, Stremio, Jellyfin and Emby"}, + {"FileDescription", "MPRP - Media Player Rich Presence: Discord status for MPC-HC, MPC-BE, MPC-QT, mpv, VLC, PotPlayer, IINA, Kodi, Plex, Stremio, Jellyfin and Emby"}, {"FileVersion", version}, - {"InternalName", "MPCvibedRPC"}, + {"InternalName", "MPRP"}, {"LegalCopyright", "MIT License"}, - {"OriginalFilename", "MPCvibedRPC.exe"}, - {"ProductName", "MPCvibedRPC"}, + {"OriginalFilename", "MPRP.exe"}, + {"ProductName", "MPRP"}, {"ProductVersion", version}, } { strs = append(strs, str(kv[0], kv[1])) diff --git a/tools/relnotes/main.go b/tools/relnotes/main.go index c7f51ce..d9bd2c4 100644 --- a/tools/relnotes/main.go +++ b/tools/relnotes/main.go @@ -70,7 +70,7 @@ func build(version, changelogPath, advisoryPath string) (string, error) { // render lays the text out: heading, the changelog's lines as a list, the hand-written block, the footer. func render(e entry, extra string) string { var b strings.Builder - fmt.Fprintf(&b, "## MPCvibedRPC %s\n\n", e.Version) + fmt.Fprintf(&b, "## MPRP %s\n\n", e.Version) b.WriteString("### What's new\n") for _, it := range e.Items { b.WriteString("- " + strings.TrimSpace(it) + "\n") @@ -87,13 +87,13 @@ Nothing to do: the update installs itself (Windows and Linux, unless you switche sign-ins are kept. ### Get it -- **Windows:** download **` + "`MPCvibedRPC.exe`" + `** and run it, or install it from the Updates section of the version you +- **Windows:** download **` + "`MPRP.exe`" + `** and run it, or install it from the Updates section of the version you have. Your settings are kept. -- **macOS 13 or later:** download **` + "`MPCvibedRPC-macos.zip`" + `** and move the app to Applications (the first time, +- **macOS 13 or later:** download **` + "`MPRP-macos.zip`" + `** and move the app to Applications (the first time, System Settings > Privacy & Security > **Open Anyway**). -- **Linux:** download **` + "`MPCvibedRPC-linux-amd64`" + `** (or ` + "`-arm64`" + `), ` + "`chmod +x`" + ` it and run it. +- **Linux:** download **` + "`MPRP-linux-amd64`" + `** (or ` + "`-arm64`" + `), ` + "`chmod +x`" + ` it and run it. Every system needs the Discord desktop app with User Settings > Activity Privacy > "Share my activity" on (Activity Privacy is in the Games & Apps section, called Activity Settings in older Discord versions). To check a download, see -[SECURITY.md](https://github.com/CptPakundo/MPCvibedRPC/blob/master/SECURITY.md). +[SECURITY.md](https://github.com/CptPakundo/MPRP/blob/master/SECURITY.md). ` diff --git a/tools/relnotes/main_test.go b/tools/relnotes/main_test.go index 3f82c19..f050e23 100644 --- a/tools/relnotes/main_test.go +++ b/tools/relnotes/main_test.go @@ -22,7 +22,7 @@ func TestBuild(t *testing.T) { if err != nil { t.Fatal(err) } - for _, want := range []string{"## MPCvibedRPC 9.9.9\n", "- ๐Ÿงน Sample line one.\n- ๐Ÿ”’ Sample line two.\n", "### Get it", "MPCvibedRPC.exe"} { + for _, want := range []string{"## MPRP 9.9.9\n", "- ๐Ÿงน Sample line one.\n- ๐Ÿ”’ Sample line two.\n", "### Get it", "MPRP.exe"} { if !strings.Contains(text, want) { t.Errorf("missing %q in:\n%s", want, text) } @@ -59,7 +59,7 @@ func TestRealChangelogRenders(t *testing.T) { v := string(raw[i+len(`"version": "`):]) v = v[:strings.Index(v, `"`)] text, err := build(v, path, filepath.Join(t.TempDir(), "none.md")) - if err != nil || !strings.HasPrefix(text, "## MPCvibedRPC "+v+"\n") { + if err != nil || !strings.HasPrefix(text, "## MPRP "+v+"\n") { t.Fatalf("%v\n%s", err, text) } } diff --git a/tools/screenshots/demo.js b/tools/screenshots/demo.js index c6982d1..5f336e8 100644 --- a/tools/screenshots/demo.js +++ b/tools/screenshots/demo.js @@ -11,7 +11,7 @@ preview: { watching: true, name: 'Sample Show', details: 'S01E02 ยท Episode title', state: 'Drama, Mystery ยท โ˜… 8.1', largeText: 'Season 1, Episode 2', start, end: start + 2880000, button: 'View on IMDb', button2: 'View on TVmaze', - smallImage: 'https://raw.githubusercontent.com/CptPakundo/MPCvibedRPC/master/docs/players/mpc-hc.png', smallText: 'Media Player Classic', + smallImage: 'https://raw.githubusercontent.com/CptPakundo/MPRP/master/docs/players/mpc-hc.png', smallText: 'Media Player Classic', }, }; const stats = { since: '2026-10-01', videos: 14, matched: 11, watchedMs: 19260000, players: { 'MPC-HC': 9, Plex: 4, VLC: 1 } }; From 0906b6725ebeb8162f3ac726f90cccb3452898a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:45:22 +0200 Subject: [PATCH 02/59] Carry installs made under the former name over to MPRP - Data folder: at the start, when only the former name's folder is there, it is renamed to the new name (the log files with it); when the rename fails (a file held open) it is copied through a temporary folder and the old one left in place; when that fails too, the old folder is used this time. Never with MPRP_HOME. During an update from the former version (--after-update, --update-failed) the folder stays where the old copy watches for ipc.json and moves at a later start. A copy of the former version that still runs is shown instead, and nothing moves. - Start with Windows: a Run value of the former name is replaced by one of the new name for this program file; a start switched off in Task Manager stays off (the StartupApproved value comes along first). macOS LaunchAgent and Linux autostart file: the same for their names. - One running copy: /api/ping answers of the former name count as this program, and on Windows the former name's mutex is held too, so the new copy waits for the old one during the update hand-over as before. - The saved former default update source reads as the new one. Tests: temporary folders for the data folder (on Windows also a real held file forcing the copy), a map in place of the registry, temporary home folders for the login items; the real-registry test stays opt-in. Co-Authored-By: Claude Opus 5.5 --- cmd/mprp/app.go | 22 ++- cmd/mprp/main.go | 34 +++- cmd/mprp/rename_test.go | 106 +++++++++++++ internal/core/name.go | 9 ++ internal/server/server.go | 3 +- internal/store/move.go | 119 ++++++++++++++ internal/store/move_test.go | 180 ++++++++++++++++++++++ internal/store/store.go | 31 +++- internal/winsys/autostart.go | 93 ++++++++++- internal/winsys/autostart_test.go | 144 ++++++++++++++++- internal/winsys/autostart_unix.go | 44 +++++- internal/winsys/autostart_windows_test.go | 36 +++++ internal/winsys/single_windows.go | 58 ++++--- 13 files changed, 840 insertions(+), 39 deletions(-) create mode 100644 cmd/mprp/rename_test.go create mode 100644 internal/core/name.go create mode 100644 internal/store/move.go create mode 100644 internal/store/move_test.go diff --git a/cmd/mprp/app.go b/cmd/mprp/app.go index 3ed6c82..185c973 100644 --- a/cmd/mprp/app.go +++ b/cmd/mprp/app.go @@ -54,7 +54,12 @@ type app struct { } func run() error { - st, err := store.New(store.DataDir()) + dir, other, moved := chooseDataDir(store.DataDir(), store.FormerDataDir(), afterUpdate || updateFailed, pingExisting) + if other != nil { + handOver(other) // a copy of the former version runs: it is the one to show + return nil + } + st, err := store.New(dir) if err != nil { return err } @@ -110,6 +115,9 @@ func run() error { msg += " in the background" } a.log("INFO", msg+".") + if moved != "" { + a.log("INFO", moved) + } failedUpdate := "" if updateFailed { if failedUpdate = failedVersion(st.Dir); failedUpdate != "" { @@ -172,9 +180,15 @@ func run() error { } // The registry is the source of truth for "start with Windows"; keep its path pointing at this copy of the program. - if st.App().AutoStart { - engine.Go(a.log, "The run-at-login entry", func() { winsys.RefreshAutoStart(exe) }) - } + // An entry of the program's former name is carried over first (it does nothing when there is none). + engine.Go(a.log, "The run-at-login entry", func() { + if note := winsys.MigrateAutoStart(exe); note != "" { + a.log("INFO", note) + } + if st.App().AutoStart { + winsys.RefreshAutoStart(exe) + } + }) if st.App().StartPresence { a.eng.Start() } diff --git a/cmd/mprp/main.go b/cmd/mprp/main.go index 9ac6269..e2b015b 100644 --- a/cmd/mprp/main.go +++ b/cmd/mprp/main.go @@ -21,6 +21,7 @@ import ( "github.com/CptPakundo/MPRP/internal/capture" "github.com/CptPakundo/MPRP/internal/conns" + "github.com/CptPakundo/MPRP/internal/core" "github.com/CptPakundo/MPRP/internal/engine" "github.com/CptPakundo/MPRP/internal/store" "github.com/CptPakundo/MPRP/internal/updater" @@ -123,7 +124,7 @@ func pingExisting(ipcFile string) *ipcInfo { App string `json:"app"` Pid int `json:"pid"` } - if res.StatusCode != 200 || json.NewDecoder(io.LimitReader(res.Body, 4096)).Decode(&p) != nil || p.App != "MPRP" { + if res.StatusCode != 200 || json.NewDecoder(io.LimitReader(res.Body, 4096)).Decode(&p) != nil || !isOurApp(p.App) { return nil } // A file left by a copy that crashed can name a port that another copy (one with its own data folder) answers on @@ -208,3 +209,34 @@ func setHideTitle(st *store.Store, eng *engine.Engine, log func(level, msg strin log("INFO", "Hide what I'm watching turned off from the menu.") } } + +// isOurApp says whether the app name a local server gave (/api/ping) is this program's, under its current name or +// its former one: a copy of the former version that still runs is another copy of this program. +func isOurApp(name string) bool { return name == core.Name || name == core.FormerName } + +// chooseDataDir picks the data folder at the start: dir, the folder of the program's name, unless only the former +// name's folder (former; "" for a copy with a data folder of its own) is there. Then: +// - after an update (updating), the former version that started this copy watches ipc.json in that folder to see +// that this copy came up, so the folder is used where it is this time and moved at a later start; +// - when a copy that uses it still runs (ping finds it), that copy is given back (other), to be shown as for any +// second start, and nothing is moved; +// - otherwise it is moved (or copied) to dir, and note says so for the log. +func chooseDataDir(dir, former string, updating bool, ping func(ipcFile string) *ipcInfo) (use string, other *ipcInfo, note string) { + if former == "" { + return dir, nil, "" + } + if _, err := os.Stat(dir); err == nil { + return dir, nil, "" + } + if fi, err := os.Stat(former); err != nil || !fi.IsDir() { + return dir, nil, "" + } + if updating { + return former, nil, "The data folder " + former + " is used where it is during the update; a later start moves it to " + dir + "." + } + if o := ping(filepath.Join(former, "ipc.json")); o != nil { + return dir, o, "" + } + use, note = store.MoveFormerData(former, dir) + return use, nil, note +} diff --git a/cmd/mprp/rename_test.go b/cmd/mprp/rename_test.go new file mode 100644 index 0000000..f380520 --- /dev/null +++ b/cmd/mprp/rename_test.go @@ -0,0 +1,106 @@ +package main + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "os" + "path/filepath" + "strconv" + "strings" + "testing" +) + +// The carrying over of an install made under the program's former name, at the start. +func TestChooseDataDir(t *testing.T) { + noCopy := func(string) *ipcInfo { return nil } + setup := func(t *testing.T, withFormer, withNew bool) (dir, former string) { + base := t.TempDir() + dir, former = filepath.Join(base, "MPRP"), filepath.Join(base, "MPCvibedRPC") + if withFormer { + os.MkdirAll(former, 0o700) + os.WriteFile(filepath.Join(former, "config.json"), []byte(`{"port":13580}`), 0o600) + } + if withNew { + os.MkdirAll(dir, 0o700) + } + return dir, former + } + + t.Run("a new install", func(t *testing.T) { + dir, former := setup(t, false, false) + if use, other, note := chooseDataDir(dir, former, false, noCopy); use != dir || other != nil || note != "" { + t.Errorf("use %q other %v note %q", use, other, note) + } + }) + t.Run("a copy with a data folder of its own never moves anything", func(t *testing.T) { + dir, former := setup(t, true, false) + if use, _, note := chooseDataDir(dir, "", false, noCopy); use != dir || note != "" { + t.Errorf("use %q note %q", use, note) + } + if _, err := os.Stat(former); err != nil { + t.Error("the former folder was touched") + } + }) + t.Run("already moved", func(t *testing.T) { + dir, former := setup(t, true, true) + if use, _, note := chooseDataDir(dir, former, false, noCopy); use != dir || note != "" { + t.Errorf("use %q note %q", use, note) + } + }) + t.Run("the first start under the new name moves the folder", func(t *testing.T) { + dir, former := setup(t, true, false) + use, other, note := chooseDataDir(dir, former, false, noCopy) + if use != dir || other != nil || !strings.HasPrefix(note, "Moved the data folder") { + t.Fatalf("use %q other %v note %q", use, other, note) + } + if b, err := os.ReadFile(filepath.Join(dir, "config.json")); err != nil || string(b) != `{"port":13580}` { + t.Error("the settings did not come along") + } + }) + t.Run("during an update from the former version the folder stays where the old copy looks", func(t *testing.T) { + dir, former := setup(t, true, false) + asked := false + use, other, note := chooseDataDir(dir, former, true, func(string) *ipcInfo { asked = true; return nil }) + if use != former || other != nil || !strings.Contains(note, "during the update") || asked { + t.Errorf("use %q other %v note %q asked %v", use, other, note, asked) + } + if _, err := os.Stat(dir); err == nil { + t.Error("the new folder was made during the update") + } + }) + t.Run("a copy of the former version still runs: it is shown and nothing moves", func(t *testing.T) { + dir, former := setup(t, true, false) + running := &ipcInfo{Port: 1234, Token: "t", Pid: 42} + var askedFor string + use, other, note := chooseDataDir(dir, former, false, func(f string) *ipcInfo { askedFor = f; return running }) + if other != running || note != "" || askedFor != filepath.Join(former, "ipc.json") { + t.Errorf("use %q other %v note %q asked for %q", use, other, note, askedFor) + } + if _, err := os.Stat(dir); err == nil { + t.Error("the folder was moved from under a running copy") + } + }) +} + +// A running copy answers /api/ping with its name: the current one and the former one both count as this program. +func TestPingExistingKnowsTheFormerName(t *testing.T) { + for _, c := range []struct { + app string + want bool + }{{"MPRP", true}, {"MPCvibedRPC", true}, {"SomethingElse", false}, {"", false}} { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + json.NewEncoder(w).Encode(map[string]any{"app": c.app, "pid": 7}) + })) + u, _ := url.Parse(srv.URL) + port, _ := strconv.Atoi(u.Port()) + f := filepath.Join(t.TempDir(), "ipc.json") + b, _ := json.Marshal(ipcInfo{Port: port, Token: "t", Pid: 7}) + os.WriteFile(f, b, 0o600) + if got := pingExisting(f) != nil; got != c.want { + t.Errorf("app %q: found %v, want %v", c.app, got, c.want) + } + srv.Close() + } +} diff --git a/internal/core/name.go b/internal/core/name.go new file mode 100644 index 0000000..ef8ae51 --- /dev/null +++ b/internal/core/name.go @@ -0,0 +1,9 @@ +package core + +// Name is the program's name: its data folder, run-at-login entry, window identity and the answer of its local API +// ("app" in /api/ping) carry it. +const Name = "MPRP" + +// FormerName is the name the program had before it was renamed. Only the steps that carry an existing install over +// use it: the data folder, the run-at-login entry and the check for a copy of the former version that still runs. +const FormerName = "MPCvibedRPC" diff --git a/internal/server/server.go b/internal/server/server.go index e9b3ef2..9ea81cc 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -20,6 +20,7 @@ import ( "sync" "time" + "github.com/CptPakundo/MPRP/internal/core" "github.com/CptPakundo/MPRP/internal/jsonx" ) @@ -143,7 +144,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { p := r.URL.Path switch { case r.Method == "GET" && p == "/api/ping": - send(w, 200, map[string]any{"app": "MPRP", "version": s.o.Version, "pid": os.Getpid()}, jsonType) + send(w, 200, map[string]any{"app": core.Name, "version": s.o.Version, "pid": os.Getpid()}, jsonType) return case r.Method == "GET" && p == "/icon.ico": send(w, 200, s.o.Icon, "image/x-icon") diff --git a/internal/store/move.go b/internal/store/move.go new file mode 100644 index 0000000..cb04f24 --- /dev/null +++ b/internal/store/move.go @@ -0,0 +1,119 @@ +package store + +import ( + "fmt" + "io" + "os" + "path/filepath" + "strings" + + "github.com/CptPakundo/MPRP/internal/core" +) + +// logName is the log file's name in the data folder. +var logName = strings.ToLower(core.Name) + ".log" + +// formerLogs are the log file names under the program's former name, and what they are called now (LogPath). +var formerLogs = [][2]string{ + {formerLog, logName}, + {formerLog + ".old", logName + ".old"}, // the log moved aside when it grew full +} + +// formerLog is the log file's name under the program's former name. +var formerLog = strings.ToLower(core.FormerName) + ".log" + +// MoveFormerData carries the data folder of the program's former name (from) over to its own (to), once: only when +// to does not exist yet and from is a folder. The folder is renamed; when that fails (a file in it is held open, or +// the two are on different volumes) it is copied and from is left as it is. A copy goes to a temporary folder first, +// so a half-made one never passes for the real thing. When the copy fails too, nothing is changed and the program +// runs on from this time (the next start tries again). +// +// It gives the folder to use and a sentence for the log ("" when there was nothing to do). +func MoveFormerData(from, to string) (dir, note string) { + if from == "" || to == "" || exists(to) { + return to, "" + } + if fi, err := os.Stat(from); err != nil || !fi.IsDir() { + return to, "" + } + if err := os.MkdirAll(filepath.Dir(to), 0o700); err != nil { + return from, fmt.Sprintf("The data folder %s could not be moved to %s (%v); it is used where it is, and the next start tries again.", from, to, err) + } + err := os.Rename(from, to) + if err == nil { + renameLogs(to) + return to, fmt.Sprintf("Moved the data folder %s to %s (the program's new name).", from, to) + } + tmp := to + ".moving" + _ = os.RemoveAll(tmp) // a copy that an earlier start did not finish + if cerr := copyDir(from, tmp); cerr != nil { + _ = os.RemoveAll(tmp) + return from, fmt.Sprintf("The data folder %s could not be moved to %s (%v) or copied (%v); it is used where it is, and the next start tries again.", from, to, err, cerr) + } + if rerr := os.Rename(tmp, to); rerr != nil { + _ = os.RemoveAll(tmp) + return from, fmt.Sprintf("The data folder %s could not be moved to %s (%v); it is used where it is, and the next start tries again.", from, to, rerr) + } + renameLogs(to) + return to, fmt.Sprintf("Copied the data folder %s to %s (the program's new name); it could not be moved (%v), so the old folder is left in place.", from, to, err) +} + +// exists says whether anything is at path. +func exists(path string) bool { + _, err := os.Lstat(path) + return err == nil +} + +// renameLogs gives the log files of the former name the current one (where no file of that name is there yet). +func renameLogs(dir string) { + for _, l := range formerLogs { + old, cur := filepath.Join(dir, l[0]), filepath.Join(dir, l[1]) + if exists(old) && !exists(cur) { + _ = os.Rename(old, cur) + } + } +} + +// copyDir copies the folder from, with everything in it, to a new folder to. Links are not followed (a data folder +// has none of its own). +func copyDir(from, to string) error { + return filepath.WalkDir(from, func(path string, d os.DirEntry, err error) error { + if err != nil { + return err + } + rel, err := filepath.Rel(from, path) + if err != nil || strings.HasPrefix(rel, "..") { + return fmt.Errorf("%s is outside %s", path, from) + } + target := filepath.Join(to, rel) + switch { + case d.IsDir(): + return os.MkdirAll(target, 0o700) + case d.Type().IsRegular(): + return copyFile(path, target) + } + return nil // a link or another special file: left out + }) +} + +// copyFile copies one file, keeping its permission bits. +func copyFile(from, to string) error { + in, err := os.Open(from) + if err != nil { + return err + } + defer in.Close() + fi, err := in.Stat() + if err != nil { + return err + } + out, err := os.OpenFile(to, os.O_CREATE|os.O_EXCL|os.O_WRONLY, fi.Mode().Perm()) + if err != nil { + return err + } + if _, err := io.Copy(out, in); err != nil { + out.Close() + return err + } + return out.Close() +} diff --git a/internal/store/move_test.go b/internal/store/move_test.go new file mode 100644 index 0000000..c4f38bb --- /dev/null +++ b/internal/store/move_test.go @@ -0,0 +1,180 @@ +package store + +import ( + "os" + "path/filepath" + "runtime" + "strings" + "testing" +) + +// formerFolder makes a data folder as the former version left it: settings, a log and a browser profile folder. +func formerFolder(t *testing.T, dir string) { + t.Helper() + for name, text := range map[string]string{ + "config.json": `{"port":13580}`, + formerLog: "a log line\n", + filepath.Join("window", "Default", "Preferences"): "{}", + } { + p := filepath.Join(dir, name) + if err := os.MkdirAll(filepath.Dir(p), 0o700); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(p, []byte(text), 0o600); err != nil { + t.Fatal(err) + } + } +} + +func readText(t *testing.T, p string) string { + t.Helper() + b, err := os.ReadFile(p) + if err != nil { + t.Fatalf("%s: %v", p, err) + } + return string(b) +} + +func TestMoveFormerDataRenames(t *testing.T) { + base := t.TempDir() + from, to := filepath.Join(base, "Old"), filepath.Join(base, "New") + formerFolder(t, from) + dir, note := MoveFormerData(from, to) + if dir != to || !strings.HasPrefix(note, "Moved the data folder") { + t.Fatalf("dir %q, note %q", dir, note) + } + if exists(from) { + t.Error("the former folder is still there after a move") + } + if readText(t, filepath.Join(to, "config.json")) != `{"port":13580}` || readText(t, filepath.Join(to, "window", "Default", "Preferences")) != "{}" { + t.Error("the settings or the window's profile did not come along") + } + if readText(t, filepath.Join(to, logName)) != "a log line\n" || exists(filepath.Join(to, formerLog)) { + t.Error("the log was not given its new name") + } + // once: a second start finds the new folder and leaves everything alone + if dir, note := MoveFormerData(from, to); dir != to || note != "" { + t.Errorf("second start: dir %q, note %q", dir, note) + } +} + +func TestMoveFormerDataNothingToDo(t *testing.T) { + base := t.TempDir() + from, to := filepath.Join(base, "Old"), filepath.Join(base, "New") + // no former folder + if dir, note := MoveFormerData(from, to); dir != to || note != "" || exists(to) { + t.Errorf("no former folder: dir %q, note %q", dir, note) + } + // MPRP_HOME: FormerDataDir gives "" + if dir, note := MoveFormerData("", to); dir != to || note != "" { + t.Errorf("no former folder name: dir %q, note %q", dir, note) + } + // both there: the new one is used and the former one left alone + formerFolder(t, from) + os.MkdirAll(to, 0o700) + os.WriteFile(filepath.Join(to, "config.json"), []byte(`{"port":1}`), 0o600) + if dir, note := MoveFormerData(from, to); dir != to || note != "" { + t.Errorf("both there: dir %q, note %q", dir, note) + } + if readText(t, filepath.Join(to, "config.json")) != `{"port":1}` || !exists(filepath.Join(from, "config.json")) { + t.Error("a folder was changed although the new one existed") + } + // a file of the former name is not a data folder + f := filepath.Join(base, "File") + os.WriteFile(f, []byte("x"), 0o600) + if dir, note := MoveFormerData(f, filepath.Join(base, "New2")); note != "" || dir != filepath.Join(base, "New2") { + t.Errorf("a file: dir %q, note %q", dir, note) + } +} + +func TestFormerDataDirNeverWithOwnHome(t *testing.T) { + t.Setenv("MPRP_HOME", t.TempDir()) + if d := FormerDataDir(); d != "" { + t.Errorf("FormerDataDir with MPRP_HOME = %q, want none", d) + } +} + +func TestDataDirNames(t *testing.T) { + t.Setenv("MPRP_HOME", "") + t.Setenv("LOCALAPPDATA", filepath.Join("C:", "Local")) + t.Setenv("XDG_DATA_HOME", filepath.Join(string(filepath.Separator), "xdg")) + now, former := DataDir(), FormerDataDir() + if filepath.Base(now) != "MPRP" || filepath.Base(former) != "MPCvibedRPC" || filepath.Dir(now) != filepath.Dir(former) { + t.Errorf("data folder %q, former %q: want the two names side by side", now, former) + } +} + +// The copy that is made when the folder cannot be renamed: everything comes along, the former folder stays. +func TestCopyDir(t *testing.T) { + base := t.TempDir() + from, to := filepath.Join(base, "Old"), filepath.Join(base, "New.moving") + formerFolder(t, from) + if err := copyDir(from, to); err != nil { + t.Fatal(err) + } + if readText(t, filepath.Join(to, "config.json")) != `{"port":13580}` || readText(t, filepath.Join(to, "window", "Default", "Preferences")) != "{}" { + t.Error("the copy is incomplete") + } + if !exists(filepath.Join(from, "config.json")) { + t.Error("the copy changed the former folder") + } + // a file that is there already is never overwritten + if err := copyDir(from, to); err == nil { + t.Error("copying over an existing copy should fail") + } +} + +// A former folder that cannot be renamed (here: the new name's parent is a file, so neither rename nor copy can +// work) is used where it is, untouched. +func TestMoveFormerDataFallsBack(t *testing.T) { + base := t.TempDir() + from := filepath.Join(base, "Old") + formerFolder(t, from) + blocker := filepath.Join(base, "blocker") + os.WriteFile(blocker, []byte("x"), 0o600) + dir, note := MoveFormerData(from, filepath.Join(blocker, "New")) + if dir != from || !strings.Contains(note, "used where it is") { + t.Fatalf("dir %q, note %q", dir, note) + } + if readText(t, filepath.Join(from, "config.json")) != `{"port":13580}` { + t.Error("the former folder was changed") + } +} + +func TestFormerUpdateSourceReadsAsTheCurrentOne(t *testing.T) { + s := openStore(t, t.TempDir()) + os.WriteFile(s.File, []byte(`{"app":{"updateRepo":"CptPakundo/MPCvibedRPC"}}`), 0o600) + if r := s.App().UpdateRepo; r != DefaultUpdateRepo { + t.Errorf("former default reads as %q, want %q", r, DefaultUpdateRepo) + } + os.WriteFile(s.File, []byte(`{"app":{"updateRepo":"someone/fork"}}`), 0o600) + if r := s.App().UpdateRepo; r != "someone/fork" { + t.Errorf("a fork reads as %q", r) + } +} + +// On Windows a folder with a file held open cannot be renamed (the case of a copy of the former version that still +// runs, or a scanner): the folder is copied instead and the former one left in place. +func TestMoveFormerDataCopiesWhenAFileIsHeld(t *testing.T) { + if runtime.GOOS != "windows" { + t.Skip("only Windows refuses to rename a folder with an open file") + } + base := t.TempDir() + from, to := filepath.Join(base, "Old"), filepath.Join(base, "New") + formerFolder(t, from) + held, err := os.Open(filepath.Join(from, formerLog)) + if err != nil { + t.Fatal(err) + } + defer held.Close() + dir, note := MoveFormerData(from, to) + if dir != to || !strings.HasPrefix(note, "Copied the data folder") { + t.Fatalf("dir %q, note %q", dir, note) + } + if readText(t, filepath.Join(to, "config.json")) != `{"port":13580}` || readText(t, filepath.Join(to, logName)) != "a log line\n" { + t.Error("the copy is incomplete") + } + if !exists(filepath.Join(from, "config.json")) || exists(to+".moving") { + t.Error("the former folder should stay and the temporary copy should be gone") + } +} diff --git a/internal/store/store.go b/internal/store/store.go index 3ebaaef..da515cc 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -29,7 +29,20 @@ func DataDir() string { if v := os.Getenv("MPRP_HOME"); v != "" { return v } - const name = "MPRP" + return dataDirNamed(core.Name) +} + +// FormerDataDir is the data folder the program used under its former name (core.FormerName), which MoveFormerData +// carries over; "" for a copy with a data folder of its own (MPRP_HOME), which never moves anything. +func FormerDataDir() string { + if os.Getenv("MPRP_HOME") != "" { + return "" + } + return dataDirNamed(core.FormerName) +} + +// dataDirNamed is the system's place for the data folder of a program called name. +func dataDirNamed(name string) string { home, _ := os.UserHomeDir() switch runtime.GOOS { case "windows": @@ -64,6 +77,18 @@ type App struct { // DefaultUpdateRepo is where releases of this program are published. const DefaultUpdateRepo = "CptPakundo/MPRP" +// formerUpdateRepo is the default update source under the program's former name. config.json holds the default once +// any program setting was saved, so an install from before the rename has it; it reads as DefaultUpdateRepo. +const formerUpdateRepo = "CptPakundo/" + core.FormerName + +// updateRepo is the update source as saved, with the former default read as the current one. +func updateRepo(saved string) string { + if strings.EqualFold(saved, formerUpdateRepo) { + return DefaultUpdateRepo + } + return saved +} + var appKeys = []string{"autoStart", "startPresence", "checkUpdates", "autoUpdate", "updateRepo", "openWindow", "minimizeToTray", "welcomeSeen", "seenVersion"} // defaultApp is the program's own settings before anything is saved. @@ -126,7 +151,7 @@ func New(dir string) (*Store, error) { } func (s *Store) CachePath() string { return filepath.Join(s.Dir, "artwork-cache.json") } -func (s *Store) LogPath() string { return filepath.Join(s.Dir, "mprp.log") } +func (s *Store) LogPath() string { return filepath.Join(s.Dir, logName) } func (s *Store) IPCPath() string { return filepath.Join(s.Dir, "ipc.json") } func (s *Store) StatsPath() string { return filepath.Join(s.Dir, "stats.json") } @@ -320,7 +345,7 @@ func (s *Store) App() App { StartPresence: boolOr(cur, "startPresence", d.StartPresence), CheckUpdates: boolOr(cur, "checkUpdates", d.CheckUpdates), AutoUpdate: boolOr(cur, "autoUpdate", d.AutoUpdate), - UpdateRepo: strOr(cur, "updateRepo", d.UpdateRepo), + UpdateRepo: updateRepo(strOr(cur, "updateRepo", d.UpdateRepo)), WelcomeSeen: boolOr(cur, "welcomeSeen", d.WelcomeSeen), OpenWindow: boolOr(cur, "openWindow", d.OpenWindow), MinimizeToTray: boolOr(cur, "minimizeToTray", d.MinimizeToTray), diff --git a/internal/winsys/autostart.go b/internal/winsys/autostart.go index 2393789..9402779 100644 --- a/internal/winsys/autostart.go +++ b/internal/winsys/autostart.go @@ -4,11 +4,14 @@ import ( "crypto/sha256" "encoding/hex" "os" + "runtime" "strings" + + "github.com/CptPakundo/MPRP/internal/core" ) // runNameBase is the name of the registry value that starts the program at login. -const runNameBase = "MPRP" +const runNameBase = core.Name // runName is the registry value for run-at-login. A copy that uses a data folder of its own (MPRP_HOME: a portable // setup, a test, a development build) gets a value of its own, derived from that folder, so it can never switch the @@ -25,13 +28,19 @@ func runCommand(exe, home string) string { return cmd } -func runNameFor(home string) string { +func runNameFor(home string) string { return nameFor(runNameBase, home) } + +// formerRunName is the run-at-login value (and login item) of this copy under the program's former name. +func formerRunName() string { return nameFor(core.FormerName, os.Getenv("MPRP_HOME")) } + +// nameFor is the name base, for the copy with the data folder home ("": the default one). +func nameFor(base, home string) string { home = strings.ToLower(strings.TrimRight(strings.TrimSpace(home), `\/`)) if home == "" { - return runNameBase + return base } sum := sha256.Sum256([]byte(home)) - return runNameBase + "-" + hex.EncodeToString(sum[:4]) + return base + "-" + hex.EncodeToString(sum[:4]) } // runKey is the registry key whose values start programs at login. @@ -112,3 +121,79 @@ func SetAutoStart(enabled bool, exe string) bool { } return true } + +// runRegistry is what the run-at-login migration needs of the registry: the Run values and Windows' own startup +// switch for each (StartupApproved\Run). systemRegistry is the real one; the tests pass a map. +type runRegistry struct { + run func(name string) (string, bool) + approved func(name string) ([]byte, bool) + setRun func(name, command string) bool + setApproved func(name string, data []byte) bool + deleteRun func(name string) bool + deleteApproved func(name string) bool +} + +var systemRegistry = runRegistry{ + run: registryRunValue, + approved: registryStartupApproved, + setRun: func(name, command string) bool { + return run("reg", "add", runKey, "/v", name, "/t", "REG_SZ", "/d", command, "/f").ok + }, + setApproved: func(name string, data []byte) bool { + return run("reg", "add", startupApprovedKey, "/v", name, "/t", "REG_BINARY", "/d", hex.EncodeToString(data), "/f").ok + }, + deleteRun: func(name string) bool { return run("reg", "delete", runKey, "/v", name, "/f").ok }, + deleteApproved: func(name string) bool { return run("reg", "delete", startupApprovedKey, "/v", name, "/f").ok }, +} + +// MigrateAutoStart carries run-at-login over from the program's former name: the Run value (Windows), the +// LaunchAgent (macOS) or the autostart entry (Linux) of that name is replaced by one of the current name that starts +// this program file. On Windows a start switched off in Task Manager stays switched off. The program calls it at every +// start; it does nothing when there is no entry of the former name. It gives a sentence for the log ("" when there was +// nothing to do). +func MigrateAutoStart(exe string) string { + home := os.Getenv("MPRP_HOME") + if !IsWindows { + h, _ := os.UserHomeDir() + return migrateLoginItem(runtime.GOOS, h, os.Getenv("XDG_CONFIG_HOME"), exe, home) + } + return migrateRunValue(systemRegistry, formerRunName(), runName(), runCommand(exe, home)) +} + +// migrateRunValue moves the Run value from (and its startup switch) to the name to, with command as its command line. +// A value of that name that is there already is kept. When the new entry cannot be written, the former one is left as +// it is: a start at login that still works beats none. +func migrateRunValue(r runRegistry, from, to, command string) string { + _, hasRun := r.run(from) + approved, hasApproved := r.approved(from) + if !hasRun && !hasApproved { + return "" + } + if !hasRun { // a switch left without its value: Windows' leftover + r.deleteApproved(from) + return "Removed the leftover Task Manager entry " + from + " of the program's former name." + } + // the switch first: a start the user switched off must never come back on, even for a moment + wroteApproved := false + if _, has := r.approved(to); hasApproved && len(approved) > 0 && !has { + if !r.setApproved(to, approved) { + return "Could not carry the run-at-login entry " + from + " over to " + to + "; it is left as it was." + } + wroteApproved = true + } + if _, has := r.run(to); !has && !r.setRun(to, command) { + if wroteApproved { + r.deleteApproved(to) + } + return "Could not carry the run-at-login entry " + from + " over to " + to + "; it is left as it was." + } + r.deleteRun(from) + if hasApproved { + r.deleteApproved(from) + } + note := "Moved the run-at-login entry " + from + " to " + to + " (the program's new name)" + if startupDisabled(approved) { + note += "; it stays switched off in Task Manager" + } + return note + "." +} diff --git a/internal/winsys/autostart_test.go b/internal/winsys/autostart_test.go index ad9390f..d17b39b 100644 --- a/internal/winsys/autostart_test.go +++ b/internal/winsys/autostart_test.go @@ -1,6 +1,12 @@ package winsys -import "testing" +import ( + "os" + "path/filepath" + "reflect" + "strings" + "testing" +) func TestRunName(t *testing.T) { // values computed independently (PowerShell, sha256sum): tools/ci/smoke.ps1 derives the same name for its own data folder @@ -53,3 +59,139 @@ func TestRunCommandCarriesTheDataFolder(t *testing.T) { } } } + +// fakeRegistry is a runRegistry over two maps, as the migration sees the Run key and StartupApproved\Run. +type fakeRegistry struct { + runs map[string]string + approvals map[string][]byte + refuse bool // every write fails +} + +func (f *fakeRegistry) registry() runRegistry { + return runRegistry{ + run: func(n string) (string, bool) { v, ok := f.runs[n]; return v, ok }, + approved: func(n string) ([]byte, bool) { v, ok := f.approvals[n]; return v, ok }, + setRun: func(n, c string) bool { + if f.refuse { + return false + } + f.runs[n] = c + return true + }, + setApproved: func(n string, d []byte) bool { + if f.refuse { + return false + } + f.approvals[n] = d + return true + }, + deleteRun: func(n string) bool { delete(f.runs, n); return true }, + deleteApproved: func(n string) bool { delete(f.approvals, n); return true }, + } +} + +func TestFormerRunName(t *testing.T) { + t.Setenv("MPRP_HOME", "") + if n := formerRunName(); n != "MPCvibedRPC" { + t.Errorf("formerRunName() = %q", n) + } + t.Setenv("MPRP_HOME", `C:\Temp\Home`) + if n := formerRunName(); n != "MPCvibedRPC-3e950f5e" { // the same folder gives the same suffix as runNameFor + t.Errorf("formerRunName() with a data folder = %q", n) + } +} + +func TestMigrateRunValue(t *testing.T) { + const cmd = `"C:\Apps\MPRP.exe" --background` + disabled, enabled := []byte{3, 0, 0, 0}, []byte{2, 0, 0, 0} + for _, c := range []struct { + name string + runs map[string]string + approvals map[string][]byte + refuse bool + wantRuns map[string]string + wantApprovals map[string][]byte + wantNote string + }{ + {name: "nothing of the former name", + runs: map[string]string{"Other": "x"}, wantRuns: map[string]string{"Other": "x"}}, + {name: "on: moved, pointing at this program file", + runs: map[string]string{"MPCvibedRPC": `"C:\Old\MPCvibedRPC.exe" --background`}, + wantRuns: map[string]string{"MPRP": cmd}, wantNote: "Moved the run-at-login entry MPCvibedRPC to MPRP"}, + {name: "switched off in Task Manager: stays off", + runs: map[string]string{"MPCvibedRPC": "x"}, approvals: map[string][]byte{"MPCvibedRPC": disabled}, + wantRuns: map[string]string{"MPRP": cmd}, wantApprovals: map[string][]byte{"MPRP": disabled}, + wantNote: "stays switched off"}, + {name: "switched on in Task Manager: the switch comes along", + runs: map[string]string{"MPCvibedRPC": "x"}, approvals: map[string][]byte{"MPCvibedRPC": enabled}, + wantRuns: map[string]string{"MPRP": cmd}, wantApprovals: map[string][]byte{"MPRP": enabled}, + wantNote: "Moved"}, + {name: "a value of the new name is kept", + runs: map[string]string{"MPCvibedRPC": "old", "MPRP": "mine"}, + wantRuns: map[string]string{"MPRP": "mine"}, wantNote: "Moved"}, + {name: "a leftover switch without its value goes", + approvals: map[string][]byte{"MPCvibedRPC": disabled}, wantNote: "leftover"}, + {name: "writing fails: the former entry stays as it was", + runs: map[string]string{"MPCvibedRPC": "x"}, approvals: map[string][]byte{"MPCvibedRPC": disabled}, refuse: true, + wantRuns: map[string]string{"MPCvibedRPC": "x"}, wantApprovals: map[string][]byte{"MPCvibedRPC": disabled}, + wantNote: "left as it was"}, + } { + f := &fakeRegistry{runs: map[string]string{}, approvals: map[string][]byte{}, refuse: c.refuse} + for k, v := range c.runs { + f.runs[k] = v + } + for k, v := range c.approvals { + f.approvals[k] = v + } + note := migrateRunValue(f.registry(), "MPCvibedRPC", "MPRP", cmd) + if (c.wantNote == "") != (note == "") || !strings.Contains(note, c.wantNote) { + t.Errorf("%s: note %q, want one with %q", c.name, note, c.wantNote) + } + if c.wantRuns == nil { + c.wantRuns = map[string]string{} + } + if c.wantApprovals == nil { + c.wantApprovals = map[string][]byte{} + } + if !reflect.DeepEqual(f.runs, c.wantRuns) || !reflect.DeepEqual(f.approvals, c.wantApprovals) { + t.Errorf("%s: runs %v approvals %v, want %v %v", c.name, f.runs, f.approvals, c.wantRuns, c.wantApprovals) + } + } +} + +func TestMigrateLoginItem(t *testing.T) { + for _, goos := range []string{"linux", "darwin"} { + t.Setenv("MPRP_HOME", "") + home := t.TempDir() + exe := "/opt/MPRP/MPRP" + from := loginItemPathNamed("MPCvibedRPC", goos, home, "") + to := loginItemPath(goos, home, "") + if note := migrateLoginItem(goos, home, "", exe, ""); note != "" { + t.Errorf("%s: nothing to move, but %q", goos, note) + } + os.MkdirAll(filepath.Dir(from), 0o755) + os.WriteFile(from, []byte("the former login item"), 0o644) + note := migrateLoginItem(goos, home, "", exe, "") + if !strings.HasPrefix(note, "Moved the login item") { + t.Fatalf("%s: note %q", goos, note) + } + if _, err := os.Stat(from); err == nil { + t.Errorf("%s: the former login item is still there", goos) + } + b, err := os.ReadFile(to) + if err != nil || string(b) != loginItem(goos, exe, "") { + t.Errorf("%s: new login item %q (%v)", goos, b, err) + } + // a translocated macOS app cannot be started at login: the former item stays + if goos == "darwin" { + os.Remove(to) + os.WriteFile(from, []byte("the former login item"), 0o644) + if note := migrateLoginItem(goos, home, "", "/private/var/folders/x/AppTranslocation/y/MPRP.app/Contents/MacOS/MPRP", ""); !strings.Contains(note, "left as it was") { + t.Errorf("translocated: note %q", note) + } + if _, err := os.Stat(from); err != nil { + t.Error("translocated: the former login item was removed") + } + } + } +} diff --git a/internal/winsys/autostart_unix.go b/internal/winsys/autostart_unix.go index 531613b..3f966b7 100644 --- a/internal/winsys/autostart_unix.go +++ b/internal/winsys/autostart_unix.go @@ -6,6 +6,8 @@ import ( "path/filepath" "runtime" "strings" + + "github.com/CptPakundo/MPRP/internal/core" ) // Run at login on macOS (a LaunchAgent) and Linux (an XDG autostart entry, which every desktop reads). The file is the @@ -13,7 +15,12 @@ import ( // loginItemPath is where the login item of this copy lives on goos ("" when the home folder is unknown). func loginItemPath(goos, home, xdgConfig string) string { - name := strings.ToLower(runName()) + return loginItemPathNamed(runName(), goos, home, xdgConfig) +} + +// loginItemPathNamed is where the login item called name lives on goos. +func loginItemPathNamed(name, goos, home, xdgConfig string) string { + name = strings.ToLower(name) if goos == "darwin" { if home == "" { return "" @@ -30,7 +37,7 @@ func loginItemPath(goos, home, xdgConfig string) string { } // loginItem is the content of the login item that starts exe in the background (with this copy's data folder). -func loginItem(goos, exe, mpcHome string) string { +func loginItem(goos, exe, dataHome string) string { if goos == "darwin" { x := html.EscapeString var b strings.Builder @@ -46,15 +53,15 @@ func loginItem(goos, exe, mpcHome string) string { --background `) - if mpcHome != "" { - b.WriteString("\tEnvironmentVariables\n\t\n\t\tMPRP_HOME\n\t\t" + x(mpcHome) + "\n\t\n") + if dataHome != "" { + b.WriteString("\tEnvironmentVariables\n\t\n\t\tMPRP_HOME\n\t\t" + x(dataHome) + "\n\t\n") } b.WriteString("\tRunAtLoad\n\t\n\tProcessType\n\tInteractive\n\n\n") return b.String() } cmd := execQuote(exe) + " --background" - if mpcHome != "" { - cmd = "env " + execQuote("MPRP_HOME="+mpcHome) + " " + cmd + if dataHome != "" { + cmd = "env " + execQuote("MPRP_HOME="+dataHome) + " " + cmd } return "[Desktop Entry]\nType=Application\nName=MPRP\nComment=Shows what your video player is playing on Discord\n" + "Exec=" + cmd + "\nTerminal=false\nX-GNOME-Autostart-enabled=true\n" @@ -128,3 +135,28 @@ func setLoginItem(enabled bool, exe string) bool { } return os.WriteFile(p, []byte(loginItem(runtime.GOOS, exe, os.Getenv("MPRP_HOME"))), 0o644) == nil } + +// migrateLoginItem replaces the login item of the program's former name (macOS: io.github.cptpakundo..plist; Linux: .desktop) with one of the current name that starts exe, and removes the former +// one. A login item of the current name that is there already is kept. When the new one cannot be written (a +// translocated app, an unwritable folder) the former one is left as it is. +func migrateLoginItem(goos, home, xdgConfig, exe, mprpHome string) string { + from := loginItemPathNamed(nameFor(core.FormerName, mprpHome), goos, home, xdgConfig) + to := loginItemPathNamed(nameFor(runNameBase, mprpHome), goos, home, xdgConfig) + if from == "" || to == "" { + return "" + } + if _, err := os.Stat(from); err != nil { + return "" + } + if _, err := os.Stat(to); err != nil { + if translocated(exe) || os.MkdirAll(filepath.Dir(to), 0o755) != nil || + os.WriteFile(to, []byte(loginItem(goos, exe, mprpHome)), 0o644) != nil { + return "Could not carry the login item " + from + " over to " + to + "; it is left as it was." + } + } + if err := os.Remove(from); err != nil { + return "Wrote the login item " + to + " but could not remove " + from + ": " + err.Error() + } + return "Moved the login item " + from + " to " + to + " (the program's new name)." +} diff --git a/internal/winsys/autostart_windows_test.go b/internal/winsys/autostart_windows_test.go index 26ec56c..a3709a2 100644 --- a/internal/winsys/autostart_windows_test.go +++ b/internal/winsys/autostart_windows_test.go @@ -58,3 +58,39 @@ func TestAutostartRegistryRoundTrip(t *testing.T) { t.Error("still on after removing it") } } + +// The migration from the former name against the real registry: opt-in like the test above, and only with the values +// of a throwaway data folder (never the plain "MPRP" or former-name values). +func TestAutostartMigrationRegistry(t *testing.T) { + if os.Getenv("MPRP_TEST_REGISTRY") != "1" { + t.Skip("set MPRP_TEST_REGISTRY=1 to write and remove Run values for a throwaway data folder") + } + t.Setenv("MPRP_HOME", t.TempDir()) + from, to := formerRunName(), runName() + if to == runNameBase || !strings.Contains(from, "-") { + t.Fatal("the test must use value names of its own") + } + exe := `C:\Test\MPRP.exe` + r := systemRegistry + t.Cleanup(func() { + for _, n := range []string{from, to} { + r.deleteRun(n) + r.deleteApproved(n) + } + }) + if !r.setRun(from, `"C:\Test\Old.exe" --background`) || !r.setApproved(from, []byte{3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) { + t.Fatal("could not write the former values") + } + if note := MigrateAutoStart(exe); !strings.Contains(note, "stays switched off") { + t.Errorf("note %q", note) + } + if _, ok := registryRunValue(from); ok { + t.Error("the former Run value is still there") + } + if data, ok := registryRunValue(to); !ok || data != runCommand(exe, os.Getenv("MPRP_HOME")) { + t.Errorf("new Run value %q (%v)", data, ok) + } + if !startupDisabled(approvedData(to)) || GetAutoStart(exe) { + t.Error("the start switched off in Task Manager came back on") + } +} diff --git a/internal/winsys/single_windows.go b/internal/winsys/single_windows.go index 476931e..e0f9fe4 100644 --- a/internal/winsys/single_windows.go +++ b/internal/winsys/single_windows.go @@ -7,33 +7,53 @@ import ( "unsafe" ) -// instanceMutex is the mutex this copy holds (0: none). -var instanceMutex syscall.Handle +// instanceMutexes are the mutexes this copy holds (none: nil). +var instanceMutexes []syscall.Handle -// AcquireSingleInstance takes a process-wide named mutex. It returns false when another copy already holds it. (The -// data folder dir is used by the other systems, which lock a file in it.) The handle stays open: Windows releases the -// mutex when the process ends, and that is what keeps a second copy out until then (or until ReleaseSingleInstance). +// instanceNames are the names of the mutexes that keep a second copy out. The default install uses the program's name; +// a copy with a data folder of its own (MPRP_HOME) gets its own, like its autostart value, so it can run +// next to an installed copy. The name under the program's former name is held too: a copy of the former version that +// updates itself to this one releases that mutex as it hands over, and this copy waits for it as it always did. +func instanceNames() []string { + return []string{`Local\` + runName() + `-single-instance`, `Local\` + formerRunName() + `-single-instance`} +} + +// AcquireSingleInstance takes the process-wide named mutexes. It returns false when another copy already holds one of +// them. (The data folder dir is used by the other systems, which lock a file in it.) The handles stay open: Windows +// releases the mutexes when the process ends, and that is what keeps a second copy out until then (or until +// ReleaseSingleInstance). func AcquireSingleInstance(dir string) bool { - // The default install keeps the name it always had; a copy with a data folder of its own (MPRP_HOME) gets its - // own, like its autostart value, so it can run next to an installed copy. - name, _ := syscall.UTF16PtrFromString(`Local\` + runName() + `-single-instance`) - h, _, err := kernel32.NewProc("CreateMutexW").Call(0, 0, uintptr(unsafe.Pointer(name))) - if h == 0 { - return true // cannot tell: do not lock ourselves out + if instanceMutexes != nil { + return true + } + var held []syscall.Handle + for _, n := range instanceNames() { + name, _ := syscall.UTF16PtrFromString(n) + h, _, err := kernel32.NewProc("CreateMutexW").Call(0, 0, uintptr(unsafe.Pointer(name))) + if h == 0 { + continue // cannot tell: do not lock ourselves out + } + if errno, ok := err.(syscall.Errno); ok && errno == 183 { // ERROR_ALREADY_EXISTS + syscall.CloseHandle(syscall.Handle(h)) + for _, o := range held { + syscall.CloseHandle(o) + } + return false + } + held = append(held, syscall.Handle(h)) } - if errno, ok := err.(syscall.Errno); ok && errno == 183 { // ERROR_ALREADY_EXISTS - syscall.CloseHandle(syscall.Handle(h)) - return false + instanceMutexes = held + if instanceMutexes == nil { + instanceMutexes = []syscall.Handle{} } - instanceMutex = syscall.Handle(h) return true } // ReleaseSingleInstance lets another copy start while this one still runs: after an update the old copy stays for a -// moment to see that the new one comes up, and the new one waits for the mutex. +// moment to see that the new one comes up, and the new one waits for the mutexes. func ReleaseSingleInstance() { - if instanceMutex != 0 { - syscall.CloseHandle(instanceMutex) - instanceMutex = 0 + for _, h := range instanceMutexes { + syscall.CloseHandle(h) } + instanceMutexes = nil } From 644ea2d447d8b28e9e474d1fbc15e8422bd33ca0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:48:38 +0200 Subject: [PATCH 03/59] Release: publish the program files under the former name too Copies installed before the rename look for their update as MPCvibedRPC.exe, MPCvibedRPC-linux-amd64, MPCvibedRPC-linux-arm64 (and the page links MPCvibedRPC-macos.zip). Every release now also carries a byte-identical copy of each program file under that name, with its own .sha256 and build record. The names are in one list, tools/ci/former-names.txt, which says the maintainer decides when they go. - release.yml makes the copies after the checksums; attest and upload take the program files by pattern, so both names are covered. - verify-release.ps1 expects 18 files instead of 10, checks each copy is the same file as its current-name original (so the rebuild comparison covers it), checks its checksum and build record, and runs the self-update from a previous release of the former name with its exe name and its environment variables (MPCRPC_HOME, MPCRPC_BROWSER). - tools/downloads counts the former name's files as the program. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 44 ++++++++++++++++++++++----------- docs/development.md | 2 ++ docs/maintaining.md | 11 ++++++--- tools/ci/former-names.txt | 18 ++++++++++++++ tools/ci/verify-release.ps1 | 46 ++++++++++++++++++++++++++++------- tools/downloads/main.go | 14 ++++++++++- tools/downloads/main_test.go | 18 ++++++++++++++ 7 files changed, 125 insertions(+), 28 deletions(-) create mode 100644 tools/ci/former-names.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aea2476..460f1c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ # Publishes a release when a version tag is pushed: git tag -a vX.Y.Z -m "MPRP X.Y.Z" && git push origin vX.Y.Z # The tag must match the version in cmd/mprp/main.go. The program's own updater looks for its file # (MPRP.exe, MPRP-linux-amd64, ...) and the .sha256 next to it on the latest release; on macOS it links to -# the release page. The release is first a draft; it is made public only once its files check out, and then the update -# path is tried on it (tools/ci/verify-release.ps1). +# the release page. Each program file is also published under the program's former name, for copies installed +# before the rename (tools/ci/former-names.txt). The release is first a draft; it is made public only once its files +# check out, and then the update path is tried on it (tools/ci/verify-release.ps1). name: release on: push: @@ -92,17 +93,30 @@ jobs: $key = @{ 'MPRP.exe' = 'exe'; 'MPRP-linux-amd64' = 'linux_amd64'; 'MPRP-linux-arm64' = 'linux_arm64' }[$f] if ($key) { Add-Content -LiteralPath $env:GITHUB_OUTPUT -Value "$key=$h" } } + # Copies installed before the rename look for their update under the former file names: each program file is + # published under that name too, byte for byte the same, with its own checksum file (tools/ci/former-names.txt). + - name: Copies under the former names + shell: pwsh + run: | + foreach ($line in Get-Content tools/ci/former-names.txt) { + $w = $line.Trim() -split '\s+' + if ($w[0] -ne 'file') { continue } + Copy-Item "dist/$($w[1])" "dist/$($w[2])" + $h = (Get-FileHash "dist/$($w[2])" -Algorithm SHA256).Hash.ToLower() + Set-Content -LiteralPath "dist/$($w[2]).sha256" -Value "$h $($w[2])`n" -NoNewline + } Get-ChildItem dist | Format-Table Name, Length # A signed statement that these files were built from this repository by this workflow (no certificate needed). # Check a download with: gh attestation verify MPRP.exe --repo CptPakundo/MPRP + # (the patterns take in the copies under the former names, never the .sha256 files) - name: Attest build provenance uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-path: | - dist/MPRP.exe - dist/MPRP-linux-amd64 - dist/MPRP-linux-arm64 - dist/MPRP-macos.zip + dist/*.exe + dist/*-linux-amd64 + dist/*-linux-arm64 + dist/*-macos.zip # A re-run after the release went public would turn it back into a draft and replace its files: refuse. A draft # (or no release at all) is fine. (gh finds a release by its tag only once it is public.) - name: The release must not be public yet @@ -122,15 +136,17 @@ jobs: fi - uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4 with: + # the program files with their checksums, under the current and the former names (verify-release.ps1 + # checks that exactly these are there) files: | - dist/MPRP.exe - dist/MPRP.exe.sha256 - dist/MPRP-linux-amd64 - dist/MPRP-linux-amd64.sha256 - dist/MPRP-linux-arm64 - dist/MPRP-linux-arm64.sha256 - dist/MPRP-macos.zip - dist/MPRP-macos.zip.sha256 + dist/*.exe + dist/*.exe.sha256 + dist/*-linux-amd64 + dist/*-linux-amd64.sha256 + dist/*-linux-arm64 + dist/*-linux-arm64.sha256 + dist/*-macos.zip + dist/*-macos.zip.sha256 dist/LICENSE dist/THIRD-PARTY-NOTICES.md body_path: ${{ runner.temp }}/release-notes.md diff --git a/docs/development.md b/docs/development.md index d178f3a..4f6d767 100644 --- a/docs/development.md +++ b/docs/development.md @@ -188,6 +188,8 @@ on every system. - `reproduce.sh`: rebuilds the programs from a tag and compares them byte for byte (`sums` and `same` give the release workflow's comparison). - `verify-release.ps1`: checks a release, first its draft, then the public one. +- `former-names.txt`: the release file names (and environment variables) of the program's former name, which every + release still carries for copies installed before the rename, until the maintainer drops them. - `version.sh`: the version from `main.go` (see [maintaining.md](maintaining.md#releasing)). - `dev-download.sh`: every development download of a release file, recorded in the ledger. - `canary-report.sh`: the canary's issue. `package-macos.sh`: the .app. diff --git a/docs/maintaining.md b/docs/maintaining.md index 03836bb..8b57da5 100644 --- a/docs/maintaining.md +++ b/docs/maintaining.md @@ -59,13 +59,16 @@ version and the maintainer's go-ahead. builds the programs on Windows, Linux and macOS runners and smoke-tests each on its own system (Windows: tray, Discord pipe, resting while Discord is closed, DPI awareness, version details, autostart, a self-update against a fake server; macOS and Linux: the API, login item, player setup, a second start, and on macOS opening the app - like the Finder does). It writes the `.sha256` files, attests the builds and publishes a **draft**. + like the Finder does). It writes the `.sha256` files, adds a byte-identical copy of each program file under the + former name for copies installed before the rename (`tools/ci/former-names.txt`, which says when they go), + attests the builds and publishes a **draft**. 5. **`reproduce`** rebuilds the exe and both Linux programs from the tag on another runner at the same time (`tools/ci/reproduce.sh`); only `verify` waits for it. 6. **`verify`** checks that the rebuilt files' checksums equal the release's (byte for byte), then runs - `tools/ci/verify-release.ps1` on the draft: the ten assets, every checksum and build record, the exe's version. - Only if these pass is the release made public (and latest). Then come the checks that need it public: that it is - the latest release, and a real self-update from the previous release. + `tools/ci/verify-release.ps1` on the draft: the eighteen assets (the copies under the former name the same files + byte for byte), every checksum and build record, the exe's version. Only if these pass is the release made + public (and latest). Then come the checks that need it public: that it is the latest release, and a real + self-update from the previous release. 7. **A draft that fails** stays a draft (nobody's updater sees it): fix, then delete the draft and the tag, or publish it by hand once checked. 4. **Read the `verify` job's log** (`gh run view --log`) and report. Nothing needs re-running locally after a release. diff --git a/tools/ci/former-names.txt b/tools/ci/former-names.txt new file mode 100644 index 0000000..7b78470 --- /dev/null +++ b/tools/ci/former-names.txt @@ -0,0 +1,18 @@ +# The program's former name, where releases still need it. The one list: release.yml and verify-release.ps1 read it. +# +# file +# Copies installed before the rename look for their update under the former file name, so every release also +# publishes a byte-identical copy of each program file under that name, with its own .sha256 and build record. +# The program itself looks only for the current names. +# env +# The environment variables the former version reads: the release check runs the release before this one, which +# may still be one of the former name. +# +# The maintainer decides when the former names are dropped (when no copy that needs them is in use any more). Then +# delete the file lines (or this whole file and its uses in release.yml and verify-release.ps1). +file MPRP.exe MPCvibedRPC.exe +file MPRP-linux-amd64 MPCvibedRPC-linux-amd64 +file MPRP-linux-arm64 MPCvibedRPC-linux-arm64 +file MPRP-macos.zip MPCvibedRPC-macos.zip +env MPRP_HOME MPCRPC_HOME +env MPRP_BROWSER MPCRPC_BROWSER diff --git a/tools/ci/verify-release.ps1 b/tools/ci/verify-release.ps1 index 48059f2..43a8b05 100644 --- a/tools/ci/verify-release.ps1 +++ b/tools/ci/verify-release.ps1 @@ -1,5 +1,6 @@ # Checks a release the way a user gets it, in two stages (release.yml runs both, making the release public between them). -# -Stage draft: the ten files, each program's checksum and build record, the exe's version details. +# -Stage draft: the eighteen files (the program files also under the former name), each program's checksum and +# build record, the exe's version details. # -Stage public: that it is the latest release, and a real self-update from the release before it (in a data folder # of its own, with no window and presence off); this needs the release to be public. param([Parameter(Mandatory)][string]$Version, [ValidateSet('draft', 'public')][string]$Stage = 'public') @@ -13,7 +14,7 @@ function Check([bool]$ok, [string]$what) { if ($ok) { Write-Host "PASS $what" } else { Write-Host "FAIL $what"; [void]$failures.Add($what) } } # only the copies started from this check's folder (an installed program is never touched) -function Ours { Get-Process -Name 'MPRP' -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path.StartsWith($work) } } +function Ours { Get-Process -Name $procNames -ErrorAction SilentlyContinue | Where-Object { $_.Path -and $_.Path.StartsWith($work) } } function WaitFor([scriptblock]$cond, [int]$seconds, [string]$what) { $end = (Get-Date).AddSeconds($seconds) while ((Get-Date) -lt $end) { try { if (& $cond) { return $true } } catch {}; Start-Sleep -Milliseconds 500 } @@ -21,6 +22,16 @@ function WaitFor([scriptblock]$cond, [int]$seconds, [string]$what) { } $programs = 'MPRP.exe', 'MPRP-linux-amd64', 'MPRP-linux-arm64', 'MPRP-macos.zip' +# the program's former name (tools/ci/former-names.txt): each program file is published under it too, and the release +# before this one may still read the former environment variables +$formerFile = @{}; $formerEnv = @{} +foreach ($line in Get-Content (Join-Path $PSScriptRoot 'former-names.txt')) { + $w = $line.Trim() -split '\s+' + if ($w[0] -eq 'file') { $formerFile[$w[1]] = $w[2] } elseif ($w[0] -eq 'env') { $formerEnv[$w[1]] = $w[2] } +} +$formerPrograms = @($programs | Where-Object { $formerFile.ContainsKey($_) } | ForEach-Object { $formerFile[$_] }) +# the process names of the copies this check starts (a copy updated from the former version keeps its file name) +$procNames = @('MPRP') + @($formerFile.Values | Where-Object { $_ -like '*.exe' } | ForEach-Object { $_ -replace '\.exe$', '' }) $rel = Join-Path $work 'release' # every download of a release file is recorded in the download ledger, so the download counter leaves it out $ledger = Join-Path $PSScriptRoot 'dev-download.sh' @@ -30,10 +41,17 @@ function Fetch([string]$t, [string]$dir, [string]$pattern) { try { Fetch $tag $rel '' if ($Stage -eq 'draft') { - $want = @($programs + ($programs | ForEach-Object { "$_.sha256" }) + 'LICENSE', 'THIRD-PARTY-NOTICES.md') | Sort-Object + $all = @($programs + $formerPrograms) + $want = @($all + ($all | ForEach-Object { "$_.sha256" }) + 'LICENSE', 'THIRD-PARTY-NOTICES.md') | Sort-Object $got = @(Get-ChildItem $rel | ForEach-Object Name) | Sort-Object Check (($want -join ',') -eq ($got -join ',')) "the release has its $($want.Count) files ($($got -join ', '))" + # the copies under the former names are the program files byte for byte (so the rebuild comparison covers them) foreach ($f in $programs) { + if (-not $formerFile.ContainsKey($f)) { continue } + $same = (Get-FileHash (Join-Path $rel $f)).Hash -eq (Get-FileHash (Join-Path $rel $formerFile[$f])).Hash + Check $same "$($formerFile[$f]) is the same file as $f" + } + foreach ($f in $all) { $path = Join-Path $rel $f $line = (Get-Content "$path.sha256" -Raw).Trim() $hash = (Get-FileHash $path -Algorithm SHA256).Hash.ToLower() @@ -51,12 +69,21 @@ try { $prev = gh release list --repo $repo --exclude-drafts --exclude-pre-releases --limit 20 --json tagName --jq '.[].tagName' | Where-Object { $_ -ne $tag } | Select-Object -First 1 Write-Host "previous release: $prev" $dir = Join-Path $work 'update' - Fetch $prev $dir 'MPRP.exe' - $app = Join-Path $dir 'MPRP.exe' + # the previous release may still be one of the former name: its exe then has the former file name, and it fetches + # this release's copy under that name when it updates itself + $exeName = 'MPRP.exe' + $prevFiles = @(gh release view $prev --repo $repo --json assets --jq '.assets[].name') + if ($prevFiles -notcontains $exeName -and $formerFile.ContainsKey($exeName)) { $exeName = $formerFile[$exeName] } + Write-Host "previous release's exe: $exeName" + Fetch $prev $dir $exeName + $app = Join-Path $dir $exeName $home_ = Join-Path $work 'home'; New-Item -ItemType Directory -Path $home_ | Out-Null Set-Content (Join-Path $home_ 'config.json') '{"app":{"openWindow":false,"startPresence":false,"checkUpdates":false,"welcomeSeen":true}}' - $env:MPRP_HOME = $home_ - $env:MPRP_BROWSER = 'none' + # the same data folder for the previous version and the updated one, under both names of each variable + foreach ($v in @{ MPRP_HOME = $home_; MPRP_BROWSER = 'none' }.GetEnumerator()) { + Set-Item "env:$($v.Key)" $v.Value + if ($formerEnv.ContainsKey($v.Key)) { Set-Item "env:$($formerEnv[$v.Key])" $v.Value } + } function Ipc { $f = Join-Path $home_ 'ipc.json'; if (Test-Path $f) { try { return Get-Content $f -Raw | ConvertFrom-Json } catch {} }; return $null } function Api([string]$name) { $i = Ipc @@ -70,14 +97,15 @@ try { Api 'update-install' | Out-Null $exited = $p.WaitForExit(60000) # the updater downloads the exe and its checksum file (both before it exits) - if ($exited) { bash $ledger record "release check $tag self-update" "$tag/MPRP.exe" "$tag/MPRP.exe.sha256" } + if ($exited) { bash $ledger record "release check $tag self-update" "$tag/$exeName" "$tag/$exeName.sha256" } Check $exited "$prev exits to update" Check (WaitFor { (Ping) -eq $Version } 60 'new version up') "$Version runs after the update" Check ((Get-FileHash $app).Hash -eq (Get-FileHash (Join-Path $rel 'MPRP.exe')).Hash) 'the updated file is the released exe' try { Api 'quit' | Out-Null } catch {} Check (WaitFor { -not (Ours) } 20 'quit') 'the updated program quits' Write-Host '--- log of the updated copy ---' - Get-Content (Join-Path $home_ 'mprp.log') -ErrorAction SilentlyContinue | Write-Host + # (the previous version logs under its own name, which may be the former one) + Get-ChildItem $home_ -Filter '*.log' | ForEach-Object { Write-Host "[$($_.Name)]"; Get-Content $_.FullName | Write-Host } } } catch { Write-Host "ERROR $_"; [void]$failures.Add("exception: $_") } diff --git a/tools/downloads/main.go b/tools/downloads/main.go index ebbd0eb..170fcc1 100644 --- a/tools/downloads/main.go +++ b/tools/downloads/main.go @@ -55,9 +55,21 @@ type summary struct { ByRelease map[string]int `json:"byRelease"` } +// programPrefixes start the names of the program files: the current name, and the former one (the files of every +// release before the rename, and the copies under that name that later releases carry for installs from before it). +var programPrefixes = []string{"MPRP", "MPCvibedRPC"} + // isProgram: the files people download to run the program. func isProgram(name string) bool { - return strings.HasPrefix(name, "MPRP") && !strings.HasSuffix(name, ".sha256") + if strings.HasSuffix(name, ".sha256") { + return false + } + for _, p := range programPrefixes { + if strings.HasPrefix(name, p) { + return true + } + } + return false } func readJSON(path string, v any) error { diff --git a/tools/downloads/main_test.go b/tools/downloads/main_test.go index d73c394..97ba239 100644 --- a/tools/downloads/main_test.go +++ b/tools/downloads/main_test.go @@ -72,3 +72,21 @@ func TestFiles(t *testing.T) { t.Errorf("people %d, development %d; want 3, 3", s.People, s.Development) } } + +// The files of the releases before the rename, and the copies under the former name that later releases carry, count +// as the program like the current files; their checksums never do. +func TestFormerNamesCount(t *testing.T) { + for name, want := range map[string]bool{ + "MPRP.exe": true, "MPRP-linux-arm64": true, "MPRP-macos.zip": true, + "MPCvibedRPC.exe": true, "MPCvibedRPC-linux-amd64": true, "MPCvibedRPC-macos.zip": true, + "MPRP.exe.sha256": false, "MPCvibedRPC.exe.sha256": false, "LICENSE": false, "THIRD-PARTY-NOTICES.md": false, + } { + if got := isProgram(name); got != want { + t.Errorf("isProgram(%q) = %v, want %v", name, got, want) + } + } + s := count([]release{rel("v1.0.0", "MPRP.exe", 3, "MPCvibedRPC.exe", 2, "MPCvibedRPC.exe.sha256", 9)}, baseline{}, nil) + if s.People != 5 || s.ByFile["MPRP.exe"] != 3 || s.ByFile["MPCvibedRPC.exe"] != 2 { + t.Errorf("people %d, by file %v", s.People, s.ByFile) + } +} From acac5797e78e1dfb45a84de46edcde9a77434fb3 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:50:16 +0200 Subject: [PATCH 04/59] Name the player setup and the player status for what they do Names that said MPC for things that serve every player: - API mpc-web -> player-setup, its closeMpc field -> closePlayers - winsys.EnableMpcWebInterface -> winsys.SetUpPlayers, WebResult -> SetupResult, enableUnix -> setUpUnix, mpcsetup.go -> playersetup.go - engine.Status.MPC ("mpc") -> Status.PlayerAnswers ("playerAnswers") - the window's mpcHelp card -> playerHelp The page and the server ship together; the smoke and live scripts use the new names. Names that mean MPC-HC/BE/QT stay. Roadmap Next up 4 is done and removed (the list renumbered). Co-Authored-By: Claude Opus 5.5 --- cmd/mprp/api.go | 30 +++++++++---------- docs/development.md | 8 ++--- docs/roadmap.md | 23 +++++++------- internal/assets/ui.html | 4 +-- internal/assets/ui.js | 16 +++++----- internal/diag/diag.go | 4 +-- internal/diag/diag_test.go | 2 +- internal/engine/engine.go | 14 ++++----- internal/engine/engine_test.go | 6 ++-- internal/engine/players_test.go | 6 ++-- internal/engine/plex_test.go | 4 +-- internal/engine/rest_test.go | 4 +-- internal/engine/vlc_test.go | 8 ++--- internal/winsys/hardening_test.go | 2 +- .../winsys/{mpcsetup.go => playersetup.go} | 22 +++++++------- internal/winsys/setup_unix.go | 8 ++--- internal/winsys/unix.go | 2 +- tools/ci/live-players.sh | 4 +-- tools/ci/smoke-unix.sh | 4 +-- tools/ci/smoke.ps1 | 24 +++++++-------- 20 files changed, 96 insertions(+), 99 deletions(-) rename internal/winsys/{mpcsetup.go => playersetup.go} (94%) diff --git a/cmd/mprp/api.go b/cmd/mprp/api.go index cbaea15..a21b3da 100644 --- a/cmd/mprp/api.go +++ b/cmd/mprp/api.go @@ -38,19 +38,19 @@ func (a *app) handlers() map[string]server.Handler { Config: eng.Config(), App: a.st.App(), Status: eng.Status(), Log: a.lg.last(100), })} })}, - "start": {Fn: fn(func() any { eng.Start(); return eng.Status() })}, - "stop": {Fn: fn(func() any { eng.Stop(); return eng.Status() })}, - "open": {Fn: fn(func() any { a.openWindow(); return nil })}, - "quit": {Fn: fn(func() any { time.AfterFunc(100*time.Millisecond, a.quit); return nil })}, - "open-folder": {Fn: fn(func() any { winsys.OpenFolder(a.st.Dir); return nil })}, - "clear-cache": {Fn: fn(func() any { eng.ClearArtworkCache(); log("INFO", "Cover cache cleared."); return nil })}, - "stats": {Get: true, Fn: fn(func() any { return eng.Stats() })}, - "connections": {Get: true, Fn: fn(func() any { return map[string]any{"hosts": conns.List()} })}, - "stats-reset": {Fn: fn(func() any { eng.ResetStats(); log("INFO", "Stats reset."); return eng.Stats() })}, - "save": {Fn: a.save}, - "reset": {Fn: func(*jsonx.Obj) (any, error) { return a.reset() }}, - "mpc-web": {Fn: a.setUpPlayers}, - "selfcheck": {Fn: a.selfCheck}, + "start": {Fn: fn(func() any { eng.Start(); return eng.Status() })}, + "stop": {Fn: fn(func() any { eng.Stop(); return eng.Status() })}, + "open": {Fn: fn(func() any { a.openWindow(); return nil })}, + "quit": {Fn: fn(func() any { time.AfterFunc(100*time.Millisecond, a.quit); return nil })}, + "open-folder": {Fn: fn(func() any { winsys.OpenFolder(a.st.Dir); return nil })}, + "clear-cache": {Fn: fn(func() any { eng.ClearArtworkCache(); log("INFO", "Cover cache cleared."); return nil })}, + "stats": {Get: true, Fn: fn(func() any { return eng.Stats() })}, + "connections": {Get: true, Fn: fn(func() any { return map[string]any{"hosts": conns.List()} })}, + "stats-reset": {Fn: fn(func() any { eng.ResetStats(); log("INFO", "Stats reset."); return eng.Stats() })}, + "save": {Fn: a.save}, + "reset": {Fn: func(*jsonx.Obj) (any, error) { return a.reset() }}, + "player-setup": {Fn: a.setUpPlayers}, + "selfcheck": {Fn: a.selfCheck}, "update-check": {Fn: func(*jsonx.Obj) (any, error) { r, err := a.checkUpdates(true) @@ -174,9 +174,9 @@ func (a *app) reset() (any, error) { // setUpPlayers is "Set up the player connection". A player that was already set up its own way (an mpv or IINA // connection name, VLC's password and port) is adopted into the settings. func (a *app) setUpPlayers(body *jsonx.Obj) (any, error) { - closeMpc, _ := body.M["closeMpc"].(bool) + mayClose, _ := body.M["closePlayers"].(bool) cfg := a.eng.Config() - r := winsys.EnableMpcWebInterface(cfg.Port, closeMpc, cfg.MpvPipe, cfg.VlcPort, cfg.VlcPassword, cfg.IinaPipe) + r := winsys.SetUpPlayers(cfg.Port, mayClose, cfg.MpvPipe, cfg.VlcPort, cfg.VlcPassword, cfg.IinaPipe) take := map[string]any{} var adopted []string if r.MpvPipe != "" && r.MpvPipe != cfg.MpvPipe { diff --git a/docs/development.md b/docs/development.md index 4f6d767..dc05e3a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -118,7 +118,7 @@ Example: `MPRP_LIVE_PLAYER=mpv MPRP_LIVE_TITLE="Sample Movie" go test -count=1 - |---|---| | `main.go` | flags, single instance, `var version` | | `app.go` | the `app` type: start-up and quit order | -| `api.go` | the local API handlers (`state`, `status`, `save`, `reset`, `start`, `stop`, `mpc-web`, `diagnostics`, `update-*`, `quit`, ...) | +| `api.go` | the local API handlers (`state`, `status`, `save`, `reset`, `start`, `stop`, `player-setup`, `diagnostics`, `update-*`, `quit`, ...) | | `update.go` | update checks, install, automatic installs, the hand-over (`handOverTo`) | | `selfcheck.go` | **Help > Run a check** (its lines never hold a title) | | `window.go` | the window's X quits; minimizing sends it to the tray (`minimizeToTray`) | @@ -167,7 +167,7 @@ on every system. | `taskbar_windows.go` | the browser window's taskbar button gets the program's name, icon and start command (set from outside once it appears) | | `autostart*.go` | start at login: the registry's Run key, a LaunchAgent, XDG autostart (`autostart_unix.go`) | | `single_*.go` | single instance (mutex, file lock) | -| `mpcsetup.go` (`EnableMpcWebInterface`), `setup_unix.go`, `mpvconf.go`, `vlcconf.go` | **Set up the player connection** | +| `playersetup.go` (`SetUpPlayers`), `setup_unix.go`, `mpvconf.go`, `vlcconf.go` | **Set up the player connection** | ### Tools and docs | Path | Job | @@ -285,7 +285,7 @@ reads what plays. `mpcbe_logo`, checked 2026-11-21); the player logos, the MPC family's too, are fetched from `docs/players` (below). ### Set up the player connection -`winsys.EnableMpcWebInterface`: +`winsys.SetUpPlayers`: - **MPC-HC, MPC-BE:** web interface on (registry and ini; they are closed and reopened after the user confirms), and this-PC-only when the button switches it on. - **mpv:** `input-ipc-server` in the `mpv.conf` it reads (a name the user set is kept and adopted). @@ -294,7 +294,7 @@ reads what plays. exit. - **MPC-QT** needs nothing. -On macOS and Linux (`winsys.enableUnix`): +On macOS and Linux (`winsys.setUpUnix`): - **mpv:** the full socket path in `~/.config/mpv/mpv.conf`. - **IINA:** `enableAdvancedSettings` and an `input-ipc-server` row in `userOptions` through `defaults write com.colliderli.iina` (an existing row is kept and adopted; IINA is not closed, the user reopens it). diff --git a/docs/roadmap.md b/docs/roadmap.md index 340e446..25c0a5b 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -31,30 +31,27 @@ done. (Work in progress is a branch and pull request: [CONTRIBUTING](../CONTRIBU 3. **Tests for how the window's X quits** (`cmd/mprp/window.go`): the order of the dropped `/api/alive` connection and the window-handle polling. Also check whether `inTray` stays true when closing the window fails; if it does, a later X would not quit. -4. **Historic names in the code.** The API's `mpc-web`, `winsys.EnableMpcWebInterface` and `Status.MPC` cover every - player. Rename them; the page and the server ship together, so they change together. Done when no name says MPC for - a thing that serves all players. -5. **Split `core.Config`.** User settings, sign-in secrets and test hooks are one flat struct, compared with +4. **Split `core.Config`.** User settings, sign-in secrets and test hooks are one flat struct, compared with `reflect.DeepEqual` to decide a restart (`engine.go`). Separate them so a secret or a hook cannot cause a restart. -6. **The settings window in Chrome, Brave or Vivaldi** instead of Edge: does the taskbar identity (name, pin, icon) +5. **The settings window in Chrome, Brave or Vivaldi** instead of Edge: does the taskbar identity (name, pin, icon) apply there? -7. **MPC-QT's multi-window mode** with a portable build and the live engine test. -8. **The stream title on Linux:** research how to tell that Discord shares the screen (PipeWire, the screen-cast +6. **MPC-QT's multi-window mode** with a portable build and the live engine test. +7. **The stream title on Linux:** research how to tell that Discord shares the screen (PipeWire, the screen-cast portal). Today Linux chooses always or never ([decision](decisions.md#behaviour)). -9. **CI: the Chocolatey Kodi download** (TLS errors from its mirror) fails `players-windows` now and then, and the +8. **CI: the Chocolatey Kodi download** (TLS errors from its mirror) fails `players-windows` now and then, and the canary uses it. Add a retry or another source ([known flaky checks](development.md#known-flaky-checks)). -10. **Fix a match, first version** (settled 2026-11-25; part of version 0.9.60). Build what +9. **Fix a match, first version** (settled 2026-11-25; part of version 0.9.60). Build what [design/fix-a-match.md](design/fix-a-match.md) describes: the dialog and the list with the scope choice, covers from the other catalogs, offsets and "Tell the project". *Where:* `internal/artwork`, the `cmd/mprp` API, `internal/assets` (the window), `core.Config` and the store schema (`matchFixes`), the docs. Done when the dialog and the list replace the two text boxes, old `artworkAliases` and `artworkOverrides` lines still act as before (they become fixes once), and the tests the design names pass. -11. **Presence templates, first version** (settled 2026-11-25; part of version 0.9.60). Build +10. **Presence templates, first version** (settled 2026-11-25; part of version 0.9.60). Build [design/presence-templates.md](design/presence-templates.md): the Text lines row with Standard, Short, Detailed and Custom, including a film's cover text. *Where:* `internal/core` (`lines.go`, `BuildActivity`), the store schema (`textLines`, `customLines`), `internal/assets` (Look tab), the docs. Done when Standard reproduces the recorded golden data byte for byte, Custom lines show on the card, and the tests the design names pass. -12. **The update notices on Linux and macOS** (settled 2026-11-25; part of version 0.9.60). Windows already shows three +11. **The update notices on Linux and macOS** (settled 2026-11-25; part of version 0.9.60). Windows already shows three native notifications through the tray (`Tray.Balloon`): "updated to " once after an automatic update (`cmd/mprp/app.go`, `autoFrom`), "could not update to ..." after a rollback, and " is available" when automatic installs are off (`update.go`). Linux and macOS show none (`Balloon` returns false in @@ -62,7 +59,7 @@ done. (Work in progress is a branch and pull request: [CONTRIBUTING](../CONTRIBU notification service over D-Bus (`org.freedesktop.Notifications`, with `internal/dbus`), macOS through the menu bar app (cgo; tested on CI only). A click opens the settings window as on Windows. Done when each system shows the three notices, tests cover the D-Bus message against a fake bus, and the docs and changelog say so. -13. **Sign-ins encrypted on Windows** (settled 2026-11-25; part of version 0.9.60). Encrypt the secrets in `config.json` +12. **Sign-ins encrypted on Windows** (settled 2026-11-25; part of version 0.9.60). Encrypt the secrets in `config.json` with the per-user Windows DPAPI (`CryptProtectData` / `CryptUnprotectData` through `syscall`, standard library only): `plexToken`, `plexKey`, `stremioKey` and `jellyfinToken` (the sign-ins), and, to decide while building, the secrets typed in the window (`vlcPassword`, `kodiPassword`, `tmdbApiKey`). *Where:* `internal/store` (load and save), @@ -116,7 +113,7 @@ The updater checks a checksum from the same release, so anyone able to publish a - MPC-HC's web interface answers any web page once switched on (no password, open to all origins). The Privacy tab and SECURITY.md say so. - Keep sign-ins out of plain text in `config.json`. - - *Status:* settled 2026-11-25 as Windows' per-user DPAPI encryption (Next up 13); macOS and Linux stay as they are, + - *Status:* settled 2026-11-25 as Windows' per-user DPAPI encryption (Next up 12); macOS and Linux stay as they are, and the full system key store (the macOS Keychain, the Secret Service) is not planned. ### 5. Readable by a human, decisions in the open diff --git a/internal/assets/ui.html b/internal/assets/ui.html index c44d120..b803b83 100644 --- a/internal/assets/ui.html +++ b/internal/assets/ui.html @@ -49,8 +49,8 @@
-