9dbe0c183e
* feat(plugins): add PluginList method Signed-off-by: Deluan <deluan@navidrome.org> * feat: enhance insights collection with plugin awareness and expanded metrics Enhanced the insights collection system to provide more comprehensive telemetry data about Navidrome installations. This update adds plugin awareness through dependency injection integration, expands configuration detection capabilities, and includes additional library metrics. Key improvements include: - Added PluginLoader interface integration to collect plugin information when enabled - Enhanced configuration detection with proper credential validation for LastFM, Spotify, and Deezer - Added new library metrics including Libraries count and smart playlist detection - Expanded configuration insights with reverse proxy, custom PID, and custom tags detection - Updated Wire dependency injection to support the new plugin loader requirement - Added corresponding data structures for plugin information collection This enhancement provides valuable insights into feature usage patterns and plugin adoption while maintaining privacy and following existing telemetry practices. * fix: correct type assertion in plugin manager test Fixed type mismatch in test where PluginManifestCapabilitiesElem was being compared with string literal. The test now properly casts the string to the correct enum type for comparison. * refactor: move static config checks to staticData function Moved HasCustomTags, ReverseProxyConfigured, and HasCustomPID configuration checks from the dynamic collect() function to the static staticData() function where they belong. This eliminates redundant computation on every insights collection cycle and implements the actual logic for HasCustomTags instead of the hardcoded false value. The HasCustomTags field now properly detects if custom tags are configured by checking the length of conf.Server.Tags. This change improves performance by computing static configuration values only once rather than on every insights collection. * feat: add granular control for insights collection Added DevEnablePluginsInsights configuration option to allow fine-grained control over whether plugin information is collected as part of the insights data. This change enhances privacy controls by allowing users to opt-out of plugin reporting while still participating in general insights collection. The implementation includes: - New configuration option DevEnablePluginsInsights with default value true - Gated plugin collection in insights.go based on both plugin enablement and permission flag - Enhanced plugin information to include version data alongside name - Improved code organization with clearer conditional logic for data collection * refactor: rename PluginNames parameter from serviceName to capability Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
90 lines
4.0 KiB
Go
90 lines
4.0 KiB
Go
package insights
|
|
|
|
type Data struct {
|
|
InsightsID string `json:"id"`
|
|
Version string `json:"version"`
|
|
Uptime int64 `json:"uptime"`
|
|
Build struct {
|
|
// build settings used by the Go compiler
|
|
Settings map[string]string `json:"settings"`
|
|
GoVersion string `json:"goVersion"`
|
|
} `json:"build"`
|
|
OS struct {
|
|
Type string `json:"type"`
|
|
Distro string `json:"distro,omitempty"`
|
|
Version string `json:"version,omitempty"`
|
|
Containerized bool `json:"containerized"`
|
|
Arch string `json:"arch"`
|
|
NumCPU int `json:"numCPU"`
|
|
} `json:"os"`
|
|
Mem struct {
|
|
Alloc uint64 `json:"alloc"`
|
|
TotalAlloc uint64 `json:"totalAlloc"`
|
|
Sys uint64 `json:"sys"`
|
|
NumGC uint32 `json:"numGC"`
|
|
} `json:"mem"`
|
|
FS struct {
|
|
Music *FSInfo `json:"music,omitempty"`
|
|
Data *FSInfo `json:"data,omitempty"`
|
|
Cache *FSInfo `json:"cache,omitempty"`
|
|
Backup *FSInfo `json:"backup,omitempty"`
|
|
} `json:"fs"`
|
|
Library struct {
|
|
Tracks int64 `json:"tracks"`
|
|
Albums int64 `json:"albums"`
|
|
Artists int64 `json:"artists"`
|
|
Playlists int64 `json:"playlists"`
|
|
Shares int64 `json:"shares"`
|
|
Radios int64 `json:"radios"`
|
|
Libraries int64 `json:"libraries"`
|
|
ActiveUsers int64 `json:"activeUsers"`
|
|
ActivePlayers map[string]int64 `json:"activePlayers,omitempty"`
|
|
} `json:"library"`
|
|
Config struct {
|
|
LogLevel string `json:"logLevel,omitempty"`
|
|
LogFileConfigured bool `json:"logFileConfigured,omitempty"`
|
|
TLSConfigured bool `json:"tlsConfigured,omitempty"`
|
|
ScannerEnabled bool `json:"scannerEnabled,omitempty"`
|
|
ScanSchedule string `json:"scanSchedule,omitempty"`
|
|
ScanWatcherWait uint64 `json:"scanWatcherWait,omitempty"`
|
|
ScanOnStartup bool `json:"scanOnStartup,omitempty"`
|
|
TranscodingCacheSize string `json:"transcodingCacheSize,omitempty"`
|
|
ImageCacheSize string `json:"imageCacheSize,omitempty"`
|
|
EnableArtworkPrecache bool `json:"enableArtworkPrecache,omitempty"`
|
|
EnableDownloads bool `json:"enableDownloads,omitempty"`
|
|
EnableSharing bool `json:"enableSharing,omitempty"`
|
|
EnableStarRating bool `json:"enableStarRating,omitempty"`
|
|
EnableLastFM bool `json:"enableLastFM,omitempty"`
|
|
EnableListenBrainz bool `json:"enableListenBrainz,omitempty"`
|
|
EnableDeezer bool `json:"enableDeezer,omitempty"`
|
|
EnableMediaFileCoverArt bool `json:"enableMediaFileCoverArt,omitempty"`
|
|
EnableSpotify bool `json:"enableSpotify,omitempty"`
|
|
EnableJukebox bool `json:"enableJukebox,omitempty"`
|
|
EnablePrometheus bool `json:"enablePrometheus,omitempty"`
|
|
EnableCoverAnimation bool `json:"enableCoverAnimation,omitempty"`
|
|
EnableNowPlaying bool `json:"enableNowPlaying,omitempty"`
|
|
SessionTimeout uint64 `json:"sessionTimeout,omitempty"`
|
|
SearchFullString bool `json:"searchFullString,omitempty"`
|
|
RecentlyAddedByModTime bool `json:"recentlyAddedByModTime,omitempty"`
|
|
PreferSortTags bool `json:"preferSortTags,omitempty"`
|
|
BackupSchedule string `json:"backupSchedule,omitempty"`
|
|
BackupCount int `json:"backupCount,omitempty"`
|
|
DevActivityPanel bool `json:"devActivityPanel,omitempty"`
|
|
DefaultBackgroundURLSet bool `json:"defaultBackgroundURL,omitempty"`
|
|
HasSmartPlaylists bool `json:"hasSmartPlaylists,omitempty"`
|
|
ReverseProxyConfigured bool `json:"reverseProxyConfigured,omitempty"`
|
|
HasCustomPID bool `json:"hasCustomPID,omitempty"`
|
|
HasCustomTags bool `json:"hasCustomTags,omitempty"`
|
|
} `json:"config"`
|
|
Plugins map[string]PluginInfo `json:"plugins,omitempty"`
|
|
}
|
|
|
|
type PluginInfo struct {
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
type FSInfo struct {
|
|
Type string `json:"type,omitempty"`
|
|
}
|