mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
feat(server): capability framework, AudioMuse sonic routing & PsyLab Connections (#1033)
* feat(server): probe AudioMuse via OpenSubsonic and add PsyLab Connections tab Navidrome ≥0.62: detect sonicSimilarity extension for reliable plugin signal; older servers keep the legacy getSimilarSongs probe. PsyLab gets a Connections tab with session, endpoint, and active-server capability details. * feat(psylab): polish Connections tab, admin role probe, and tab bar layout Status badges and Navidrome admin/user validation in Connections; prevent PsyLab tab row from vertically collapsing under the Logs flex layout. * docs: add CHANGELOG and credits for PR #1032 * feat(settings): auto-enable AudioMuse on Navidrome 0.62+ with status indicator Replace the per-server manual toggle with a probe-driven badge when sonicSimilarity is available; pre-0.62 Navidrome keeps the legacy toggle. * feat(server): capability framework with AudioMuse sonic routing Add a declarative server-capability catalog (src/serverCapabilities/) that picks a feature strategy per server generation, runs only the needed probes, and routes API calls. AudioMuse Instant Mix now prefers the OpenSubsonic sonicSimilarity endpoint (getSonicSimilarTracks) on Navidrome 0.62+ and falls back to legacy getSimilarSongs. - catalog/context/resolve: eligibility, detection, activation, call routing - storeView: read facade over the existing per-server probe maps - getSonicSimilarTracks API client + fetchSimilarTracksRouted router - route Instant Mix and Lucky Mix through the resolver - ServersTab + PsyLab Connections read the resolver (auto status vs toggle) - tests: resolve, storeView, router * docs: update CHANGELOG and credits for PR #1033 Renamed branch supersedes PR #1032: point changelog/credits at #1033 and document the server-capability framework, auto-managed AudioMuse indicator, and sonic Instant Mix routing. * refactor(server): address PR #1033 review — idempotent probe, drop dead code - Make scheduleInstantMixProbeForServer idempotent: skip when a definitive result is cached; re-probe only on force (add/edit/test server), a prior error, or a server version/type change (invalidated in setSubsonicServerIdentity). Removes the steady-state 120 s re-probe, the present→probing→present flicker, and the momentary legacy-fallback routing window. - Remove now-dead identity helpers (showAudiomuseNavidromeServerSetting, isAudiomusePluginAutoManaged, isNavidromeSonicSimilarityEligible, resolveAudiomusePluginProbeUiStatus + type) and the superseded probeAudiomusePluginWithCredentials; the catalog is the single source of truth. - Drop the never-emitted 'unsupported' AudiomusePluginProbeResult variant. - Fill audiomuseStatus* keys in all 8 non-en locales. - Tests: probe idempotency + version-change invalidation; retarget OpenSubsonic test to fetchOpenSubsonicExtensionsWithCredentials.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import type { CapabilityDefinition } from './types';
|
||||
|
||||
/**
|
||||
* Declarative map of server-side features, the strategies that can provide them
|
||||
* per server generation, how to detect each, and which endpoint to route to.
|
||||
*
|
||||
* To add a feature with a new server path:
|
||||
* 1. (optional) register a probe in `probes.ts` and map it in the orchestrator
|
||||
* (`api/subsonic.ts`) + read facade (`storeView.ts`).
|
||||
* 2. add a `CapabilityDefinition` here with one strategy per server generation.
|
||||
* 3. consumers read it via `storeView` (UI) and the call router (runtime).
|
||||
* No version `if` checks belong in UI or call sites — they live here.
|
||||
*/
|
||||
|
||||
export const SONIC_SIMILARITY_EXTENSION = 'sonicSimilarity';
|
||||
|
||||
export const FEATURE_AUDIOMUSE_SIMILAR_TRACKS = 'audiomuse.similarTracks';
|
||||
|
||||
export const PROBE_OPENSUBSONIC_EXTENSIONS = 'opensubsonic.extensions';
|
||||
export const PROBE_LEGACY_INSTANT_MIX = 'navidrome.instantMix.legacy';
|
||||
|
||||
/** Operation names used by the call router. */
|
||||
export const OP_SIMILAR_TRACKS = 'similarTracks';
|
||||
|
||||
export const SERVER_CAPABILITY_CATALOG: CapabilityDefinition[] = [
|
||||
{
|
||||
feature: FEATURE_AUDIOMUSE_SIMILAR_TRACKS,
|
||||
labelKey: 'settings.audiomuseTitle',
|
||||
strategies: [
|
||||
{
|
||||
// Navidrome ≥ 0.62: AudioMuse plugin advertised via OpenSubsonic.
|
||||
id: 'opensubsonic.sonicSimilarity',
|
||||
priority: 100,
|
||||
when: (ctx) => ctx.isNavidrome && ctx.semverGte([0, 62, 0]),
|
||||
detection: {
|
||||
kind: 'extension',
|
||||
probeId: PROBE_OPENSUBSONIC_EXTENSIONS,
|
||||
extension: SONIC_SIMILARITY_EXTENSION,
|
||||
},
|
||||
trust: 'high',
|
||||
activation: 'auto',
|
||||
calls: {
|
||||
[OP_SIMILAR_TRACKS]: { endpoint: 'getSonicSimilarTracks.view', transport: 'opensubsonic' },
|
||||
},
|
||||
labelKey: 'settings.audiomuseStrategySonic',
|
||||
},
|
||||
{
|
||||
// Navidrome ≥ 0.60: legacy Instant Mix via getSimilarSongs (agents/plugin).
|
||||
id: 'subsonic.getSimilarSongs',
|
||||
priority: 50,
|
||||
when: (ctx) => ctx.isNavidrome && ctx.semverGte([0, 60, 0]),
|
||||
detection: {
|
||||
kind: 'functional',
|
||||
probeId: PROBE_LEGACY_INSTANT_MIX,
|
||||
presentWhen: (outcome) => outcome.status === 'present',
|
||||
},
|
||||
trust: 'low',
|
||||
activation: 'manual',
|
||||
alwaysCallable: true,
|
||||
calls: {
|
||||
[OP_SIMILAR_TRACKS]: { endpoint: 'getSimilarSongs.view', transport: 'subsonic' },
|
||||
},
|
||||
labelKey: 'settings.audiomuseStrategyLegacy',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function getCapabilityDefinition(feature: string): CapabilityDefinition | undefined {
|
||||
return SERVER_CAPABILITY_CATALOG.find((d) => d.feature === feature);
|
||||
}
|
||||
Reference in New Issue
Block a user