fix path
This commit is contained in:
@@ -13,7 +13,7 @@ public class ScriptInjector
|
|||||||
{
|
{
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
private readonly ILogger<ScriptInjector> _logger;
|
private readonly ILogger<ScriptInjector> _logger;
|
||||||
private const string ScriptTag = "<script src=\"Seasonals/Resources/seasonals.js\"></script>";
|
private const string ScriptTag = "<script src=\"/Seasonals/Resources/seasonals.js\"></script>";
|
||||||
private const string Marker = "</body>";
|
private const string Marker = "</body>";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -66,6 +66,10 @@ public class ScriptInjector
|
|||||||
File.WriteAllText(indexPath, newContent);
|
File.WriteAllText(indexPath, newContent);
|
||||||
_logger.LogInformation("Successfully injected Seasonals script into index.html.");
|
_logger.LogInformation("Successfully injected Seasonals script into index.html.");
|
||||||
}
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Permission denied when attempting to inject script into index.html. Automatic injection failed. Please ensure the Jellyfin web directory is writable by the process, or manually add the script tag: {ScriptTag}", ScriptTag);
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error injecting Seasonals script.");
|
_logger.LogError(ex, "Error injecting Seasonals script.");
|
||||||
@@ -104,6 +108,10 @@ public class ScriptInjector
|
|||||||
File.WriteAllText(indexPath, newContent);
|
File.WriteAllText(indexPath, newContent);
|
||||||
_logger.LogInformation("Successfully removed Seasonals script from index.html.");
|
_logger.LogInformation("Successfully removed Seasonals script from index.html.");
|
||||||
}
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Permission denied when attempting to remove script from index.html.");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Error removing Seasonals script.");
|
_logger.LogError(ex, "Error removing Seasonals script.");
|
||||||
|
|||||||
Reference in New Issue
Block a user