E frontend reconciliation (1/2): types.ts sources from bindings; backend field fixes

- types.ts now re-exports wire types from generated bindings (single source of
  truth); keeps frontend-only unions (ItemType/LibraryType/PersonType/
  SessionCommand) and aliases Session = SessionInfo.
- Backend: MediaItem.runtime_ticks serializes as runTimeTicks (matches frontend,
  fixes a latent undefined-read bug); ArtistItem serializes camelCase id/name
  (PascalCase aliases retained for Jellyfin deserialize).
- player.ts: normalize remote NowPlayingItem -> MediaItem in mergedMedia so
  display components treat local/remote items uniformly.
- Reduces svelte-check errors 141 -> 70 (remaining: nullable guards + played->isPlayed).
This commit is contained in:
2026-06-20 20:30:08 +02:00
parent 6146d70bc5
commit 76c78e2edc
4 changed files with 81 additions and 244 deletions
+4 -1
View File
@@ -60,9 +60,11 @@ pub struct UserData {
/// Artist item with ID and name (for clickable artist links)
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "PascalCase")]
#[serde(rename_all = "camelCase")]
pub struct ArtistItem {
#[serde(alias = "Id")]
pub id: String,
#[serde(alias = "Name")]
pub name: String,
}
@@ -118,6 +120,7 @@ pub struct MediaItem {
#[serde(skip_serializing_if = "Option::is_none")]
pub official_rating: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "runTimeTicks")]
pub runtime_ticks: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub primary_image_tag: Option<String>,