feat: Light mode default, auth, Posts rename, display scaling, TinyMCE improvements
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NoticeBoard.Data;
|
||||
using Ical.Net;
|
||||
@@ -6,6 +7,7 @@ using Ical.Net.DataTypes;
|
||||
|
||||
namespace NoticeBoard.Controllers;
|
||||
|
||||
[Authorize]
|
||||
public class ApiController : Controller
|
||||
{
|
||||
private readonly IWebHostEnvironment _env;
|
||||
@@ -78,18 +80,18 @@ public class ApiController : Controller
|
||||
if (!Directory.Exists(uploadsPath))
|
||||
return Json(new { files = Array.Empty<object>() });
|
||||
|
||||
var imageExts = new[] { ".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".ico" };
|
||||
var files = Directory.GetFiles(uploadsPath)
|
||||
.Select(f => new FileInfo(f))
|
||||
.Where(f => imageExts.Contains(f.Extension.ToLower()))
|
||||
.OrderByDescending(f => f.CreationTimeUtc)
|
||||
.Select(f => new
|
||||
{
|
||||
name = f.Name,
|
||||
url = $"/uploads/{f.Name}",
|
||||
size = f.Length,
|
||||
created = f.CreationTimeUtc
|
||||
title = f.Name,
|
||||
value = $"/uploads/{f.Name}"
|
||||
});
|
||||
|
||||
return Json(new { files });
|
||||
return Json(files);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -107,6 +109,7 @@ public class ApiController : Controller
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ParseIcs(string url)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user