version check no longer works in 10.10

This commit is contained in:
Kilian von Pflugk 2024-11-08 11:01:15 +01:00
parent ec4863dd5d
commit f70207d002

View File

@ -477,45 +477,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
/// <param name="webPath">Full path to index.html.</param> /// <param name="webPath">Full path to index.html.</param>
private void InjectSkipButton(string webPath) private void InjectSkipButton(string webPath)
{ {
string searchPattern = "dashboard-dashboard.*.chunk.js"; string pattern;
string[] filePaths = Directory.GetFiles(webPath, searchPattern, SearchOption.TopDirectoryOnly);
string pattern = @"buildVersion""\)\.innerText=""(?<buildVersion>\d+\.\d+\.\d+)"",.*?webVersion""\)\.innerText=""(?<webVersion>\d+\.\d+\.\d+)";
string webVersionString = "unknown";
// Create a Regex object
Regex regex = new Regex(pattern);
// should be only one file but this safer
foreach (var file in filePaths)
{
string dashBoardText = File.ReadAllText(file);
// Perform the match
Match match = regex.Match(dashBoardText);
// search for buildVersion and webVersion
if (match.Success)
{
webVersionString = match.Groups["webVersion"].Value;
_logger.LogInformation("Found jellyfin-web <{WebVersion}>", webVersionString);
break;
}
}
if (webVersionString != "unknown")
{
// append Revision
webVersionString += ".0";
if (Version.TryParse(webVersionString, out var webversion))
{
if (_applicationHost.ApplicationVersion != webversion)
{
_logger.LogWarning("The jellyfin-web <{WebVersion}> NOT compatible with Jellyfin <{JellyfinVersion}>", webVersionString, _applicationHost.ApplicationVersion);
}
else
{
_logger.LogInformation("The jellyfin-web <{WebVersion}> compatible with Jellyfin <{JellyfinVersion}>", webVersionString, _applicationHost.ApplicationVersion);
}
}
}
// Inject the skip intro button code into the web interface. // Inject the skip intro button code into the web interface.
string indexPath = Path.Join(webPath, "index.html"); string indexPath = Path.Join(webPath, "index.html");