Skip backing up public source code

This commit is contained in:
TwistedUmbrellaX 2024-03-01 16:53:41 -05:00
parent c3a9a33526
commit de61329140

View File

@ -85,7 +85,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
var indexPath = Path.Join(applicationPaths.WebPath, "index.html");
try
{
InjectSkipButton(indexPath, Path.Join(introsDirectory, "index-pre-skip-button.html"));
InjectSkipButton(indexPath);
}
catch (Exception ex)
{
@ -328,8 +328,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
/// Inject the skip button script into the web interface.
/// </summary>
/// <param name="indexPath">Full path to index.html.</param>
/// <param name="backupPath">Full path to create a backup of index.html at.</param>
private void InjectSkipButton(string indexPath, string backupPath)
private void InjectSkipButton(string indexPath)
{
// Parts of this code are based off of JellyScrub's script injection code.
// https://github.com/nicknsy/jellyscrub/blob/4ce806f602988a662cfe3cdbaac35ee8046b7ec4/Nick.Plugin.Jellyscrub/JellyscrubPlugin.cs
@ -349,10 +348,6 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
return;
}
// Backup the original version of the web interface
_logger.LogInformation("Backing up index.html to {Backup}", backupPath);
File.WriteAllText(backupPath, contents);
// Inject a link to the script at the end of the <head> section.
// A regex is used here to ensure the replacement is only done once.
_logger.LogDebug("Injecting script tag");