Size: 590 B Modified: 21/06/2026 5:41 AM
using KaiChat.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace KaiChat.Pages;

public class FilesModel : PageModel
{
    private readonly IFileService _file;

    public FilesModel(IFileService file)
    {
        _file = file;
    }

    public string CurrentPath { get; set; } = "";
    public List<KaiChat.Models.FileItem> Contents { get; set; } = new();

    public void OnGet(string? path)
    {
        CurrentPath = path?.TrimStart('/') ?? "";
        Contents = _file.GetDirectoryContents(CurrentPath);
    }
}
Offline