yavsc/src/Yavsc.Org/Controllers/FileSystemController.cs

26 lines
768 B
C#
Raw Normal View History

2023-03-19 17:57:55 +00:00
using Microsoft.AspNetCore.Mvc;
2026-09-17 22:22:18 +01:00
using Microsoft.Extensions.Options;
2025-02-17 23:56:28 +00:00
using Yavsc.Server.Helpers;
2019-08-25 01:47:46 +01:00
2026-09-17 22:22:18 +01:00
namespace Yavsc.Org.Controllers
2019-08-25 01:47:46 +01:00
{
public class FileSystemController : Controller
{
2026-09-17 22:22:18 +01:00
private SiteSettings _siteSettings;
public FileSystemController(IOptions<SiteSettings> siteSettings)
2019-08-25 01:47:46 +01:00
{
2026-09-17 22:22:18 +01:00
_siteSettings = siteSettings.Value;
2019-08-25 01:47:46 +01:00
}
2026-09-17 22:22:18 +01:00
// Removed redundant empty constructor block
2019-08-25 01:47:46 +01:00
public IActionResult Index(string subdir="")
2026-09-17 22:22:18 +01:00
{
2019-08-25 01:47:46 +01:00
if (subdir !=null)
if (!subdir.IsValidYavscPath())
return new BadRequestResult();
2026-09-17 22:22:18 +01:00
var files = FileSystemHelpers.GetUserFiles(_siteSettings, User.GetUserId(), subdir);
2019-08-25 01:47:46 +01:00
return View(files);
}
}
2020-10-09 19:35:39 +01:00
}