From b7cd641da6ea5011d5264541160cff4625ac0de9 Mon Sep 17 00:00:00 2001 From: baliasnyifeliks Date: Wed, 14 Jan 2026 09:47:29 +0200 Subject: [PATCH] feat(starlight): add episode image support to episode items - Extend episode item tuple to include image field - Update BuildEpisodeHtml to render episode images when available - Maintain backward compatibility for episodes without images --- StarLight/Controller.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/StarLight/Controller.cs b/StarLight/Controller.cs index efa9acf..4c2d352 100644 --- a/StarLight/Controller.cs +++ b/StarLight/Controller.cs @@ -84,7 +84,7 @@ namespace StarLight.Controllers if (episodes == null || episodes.Count == 0) return OnError("starlight", proxyManager); - var episodeItems = new List<(string name, object json)>(); + var episodeItems = new List<(string name, object json, string image)>(); int index = 1; foreach (var ep in episodes) { @@ -107,7 +107,7 @@ namespace StarLight.Controllers img = image }; - episodeItems.Add((episodeName, jsonItem)); + episodeItems.Add((episodeName, jsonItem, image)); index++; } @@ -172,7 +172,7 @@ namespace StarLight.Controllers return JsonSerializer.Serialize(payload, EpisodeJsonOptions); } - private static string BuildEpisodeHtml(List<(string name, object json)> items) + private static string BuildEpisodeHtml(List<(string name, object json, string image)> items) { var html = new StringBuilder(); bool firstjson = true; @@ -192,7 +192,18 @@ namespace StarLight.Controllers html.Append(JsonSerializer.Serialize(item.json, EpisodeJsonOptions)); html.Append("'>"); - html.Append("
"); + if (!string.IsNullOrEmpty(item.image)) + { + html.Append("
"); + } + else + { + html.Append("
"); + } + + html.Append("
"); HtmlEncode(item.name, html); html.Append("
");