PlanTempusAdmin/Pages/Setup/Scripts.cshtml.cs

29 lines
715 B
C#
Raw Permalink Normal View History

2026-02-03 00:17:08 +01:00
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace PlanTempusAdmin.Pages.Setup;
public class ScriptsModel : PageModel
{
private readonly IWebHostEnvironment _environment;
public string BashScript { get; set; } = string.Empty;
public ScriptsModel(IWebHostEnvironment environment)
{
_environment = environment;
}
public void OnGet()
{
var scriptPath = Path.Combine(_environment.ContentRootPath, "Scripts", "forgejo-backup.sh");
if (System.IO.File.Exists(scriptPath))
{
BashScript = System.IO.File.ReadAllText(scriptPath);
}
else
{
BashScript = "# Script not found at: " + scriptPath;
}
}
}