mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 09:22:21 +00:00
fix(makhno): handle season filtering when requested season is unavailable
When a requested season is not available in the selected voice, redirect to season list instead of showing foreign seasons. This prevents displaying seasons from other voices that the user may not have access to.
This commit is contained in:
parent
e2bc12b009
commit
e9a4d19d8c
@ -266,11 +266,17 @@ namespace Makhno
|
||||
if (seasonsForVoice.Count == 0)
|
||||
continue;
|
||||
|
||||
int seasonNumber = seasonsForVoice.Any(s => s.Number == requestedSeason)
|
||||
? requestedSeason
|
||||
: seasonsForVoice.Min(s => s.Number);
|
||||
|
||||
string voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={seasonNumber}&t={i}";
|
||||
bool hasRequestedSeason = seasonsForVoice.Any(s => s.Number == requestedSeason);
|
||||
string voiceLink;
|
||||
if (hasRequestedSeason)
|
||||
{
|
||||
voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={requestedSeason}&t={i}";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Force season list for this voice to avoid showing чужі сезони
|
||||
voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season=-1&t={i}";
|
||||
}
|
||||
bool isActive = selectedVoice == i.ToString();
|
||||
voice_tpl.Append(voiceName, isActive, voiceLink);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user