From 131c0c565cfd2f5c11939e05621cd4a671ec7ecb Mon Sep 17 00:00:00 2001 From: Rob Emery Date: Sun, 9 Nov 2025 17:57:55 +0000 Subject: [PATCH] feat(insights): detecting packaging method (#3841) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adding environmental variable so that navidrome can detect if its running as an MSI install for insights * Renaming to be ND_PACKAGE_TYPE so we can reuse this for the .deb/.rpm stats as well * Packaged implies a bool, this is a description so it should be packaging or just package imo * wixl currently doesn't support so I'm swapping out to a file next-door to the configuration file, we should be able to reuse this for deb/rpm as well * Using a file we should be able to add support for linux like this also * MSI should copy the package into place for us, it's not a KeyPath as older versions won't have it, so it's presence doesn't indicate the installed status of the package * OK this doesn't exist, need to find another way to do it * package to .package and moving to the datadir * fix(scanner): better log message when AutoImportPlaylists is disabled Fix #3861 Signed-off-by: Deluan * fix(scanner): support ID3v2 embedded images in WAV files Fix #3867 Signed-off-by: Deluan * feat(ui): show bitDepth in song info dialog Signed-off-by: Deluan * fix(server): don't break if the ND_CONFIGFILE does not exist Signed-off-by: Deluan * feat(docker): automatically loads a navidrome.toml file from /data, if available Signed-off-by: Deluan * feat(server): custom ArtistJoiner config (#3873) * feat(server): custom ArtistJoiner config Signed-off-by: Deluan * refactor(ui): organize ArtistLinkField, add tests Signed-off-by: Deluan * feat(ui): use display artist * feat(ui): use display artist Signed-off-by: Deluan --------- Signed-off-by: Deluan * chore: remove some BFR-related TODOs that are not valid anymore Signed-off-by: Deluan * chore: remove more outdated TODOs Signed-off-by: Deluan * fix(scanner): elapsed time for folder processing is wrong in the logs Signed-off-by: Deluan * Should be able to reuse this mechanism with deb and rpm, I think it would be nice to know which specific one it is without guessing based on /etc/debian_version or something; but it doesn't look like that is exposed by goreleaser into an env or anything :/ * Need to reference the installed file and I think Id's don't require [] * Need to add into the root directory for this to work * That was not deliberately removed * feat: add RPM and DEB package configuration files for Navidrome Signed-off-by: Deluan * Don't need this as goreleaser will sort it out --------- Signed-off-by: Deluan Co-authored-by: Deluan Quintão --- core/metrics/insights.go | 8 ++++++++ core/metrics/insights/data.go | 1 + release/goreleaser.yml | 9 +++++++++ release/linux/.package.deb | 1 + release/linux/.package.rpm | 1 + release/wix/build_msi.sh | 3 +++ release/wix/navidrome.wxs | 7 +++++++ 7 files changed, 30 insertions(+) create mode 100644 release/linux/.package.deb create mode 100644 release/linux/.package.rpm diff --git a/core/metrics/insights.go b/core/metrics/insights.go index f4f8738e7..010c24c28 100644 --- a/core/metrics/insights.go +++ b/core/metrics/insights.go @@ -6,6 +6,7 @@ import ( "encoding/json" "math" "net/http" + "os" "path/filepath" "runtime" "runtime/debug" @@ -160,6 +161,13 @@ var staticData = sync.OnceValue(func() insights.Data { data.Build.Settings, data.Build.GoVersion = buildInfo() data.OS.Containerized = consts.InContainer + // Install info + packageFilename := filepath.Join(conf.Server.DataFolder, ".package") + packageFileData, err := os.ReadFile(packageFilename) + if err == nil { + data.OS.Package = string(packageFileData) + } + // OS info data.OS.Type = runtime.GOOS data.OS.Arch = runtime.GOARCH diff --git a/core/metrics/insights/data.go b/core/metrics/insights/data.go index 105a6218e..c46eb8743 100644 --- a/core/metrics/insights/data.go +++ b/core/metrics/insights/data.go @@ -16,6 +16,7 @@ type Data struct { Containerized bool `json:"containerized"` Arch string `json:"arch"` NumCPU int `json:"numCPU"` + Package string `json:"package,omitempty"` } `json:"os"` Mem struct { Alloc uint64 `json:"alloc"` diff --git a/release/goreleaser.yml b/release/goreleaser.yml index f71c38f31..30c0d6f3b 100644 --- a/release/goreleaser.yml +++ b/release/goreleaser.yml @@ -83,6 +83,15 @@ nfpms: owner: navidrome group: navidrome + - src: release/linux/.package.rpm # contents: "rpm" + dst: /var/lib/navidrome/.package + type: "config|noreplace" + packager: rpm + - src: release/linux/.package.deb # contents: "deb" + dst: /var/lib/navidrome/.package + type: "config|noreplace" + packager: deb + scripts: preinstall: "release/linux/preinstall.sh" postinstall: "release/linux/postinstall.sh" diff --git a/release/linux/.package.deb b/release/linux/.package.deb new file mode 100644 index 000000000..811c85f42 --- /dev/null +++ b/release/linux/.package.deb @@ -0,0 +1 @@ +deb \ No newline at end of file diff --git a/release/linux/.package.rpm b/release/linux/.package.rpm new file mode 100644 index 000000000..7c88ef3c0 --- /dev/null +++ b/release/linux/.package.rpm @@ -0,0 +1 @@ +rpm \ No newline at end of file diff --git a/release/wix/build_msi.sh b/release/wix/build_msi.sh index 9fc008446..7e595311e 100755 --- a/release/wix/build_msi.sh +++ b/release/wix/build_msi.sh @@ -49,6 +49,9 @@ cp "${DOWNLOAD_FOLDER}"/extracted_ffmpeg/${FFMPEG_FILE}/bin/ffmpeg.exe "$MSI_OUT cp "$WORKSPACE"/LICENSE "$WORKSPACE"/README.md "$MSI_OUTPUT_DIR" cp "$BINARY" "$MSI_OUTPUT_DIR" +# package type indicator file +echo "msi" > "$MSI_OUTPUT_DIR/.package" + # workaround for wixl WixVariable not working to override bmp locations cp "$WORKSPACE"/release/wix/bmp/banner.bmp /usr/share/wixl-*/ext/ui/bitmaps/bannrbmp.bmp cp "$WORKSPACE"/release/wix/bmp/dialogue.bmp /usr/share/wixl-*/ext/ui/bitmaps/dlgbmp.bmp diff --git a/release/wix/navidrome.wxs b/release/wix/navidrome.wxs index ec8b164e8..8ebba4632 100644 --- a/release/wix/navidrome.wxs +++ b/release/wix/navidrome.wxs @@ -69,6 +69,12 @@ + + + + + + @@ -81,6 +87,7 @@ +