feat: Light mode default, auth, Posts rename, display scaling, TinyMCE improvements

This commit is contained in:
Jess Rogerson
2026-05-21 14:22:46 +10:00
parent 51d086dab9
commit 39fcd9ec6e
154 changed files with 12897 additions and 133 deletions
+8 -5
View File
@@ -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)
{
+5 -41
View File
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using NoticeBoard.Data;
@@ -5,6 +6,7 @@ using NoticeBoard.Models;
namespace NoticeBoard.Controllers;
[Authorize]
public class DevicesController : Controller
{
private readonly AppDbContext _db;
@@ -113,8 +115,6 @@ public class DevicesController : Controller
return RedirectToAction(nameof(Index));
}
// === Playlist Management ===
public async Task<IActionResult> Playlist(int id)
{
var device = await _db.Devices
@@ -166,29 +166,6 @@ public class DevicesController : Controller
return RedirectToAction(nameof(Playlist), new { id });
}
[HttpPost]
public async Task<IActionResult> UpdatePlaylist(int id, int[] slideIds, int[] durations, bool[] enabled)
{
var deviceSlides = await _db.DeviceSlides
.Where(ds => ds.DeviceId == id)
.ToListAsync();
for (int i = 0; i < slideIds.Length; i++)
{
var ds = deviceSlides.FirstOrDefault(x => x.Id == slideIds[i]);
if (ds != null)
{
ds.DisplayOrder = i + 1;
if (i < durations.Length) ds.DurationSeconds = durations[i];
ds.Enabled = i < enabled.Length && enabled[i];
}
}
await _db.SaveChangesAsync();
TempData["Success"] = "Playlist updated.";
return RedirectToAction(nameof(Playlist), new { id });
}
[HttpPost]
public async Task<IActionResult> ReorderPlaylist([FromBody] ReorderRequest request)
{
@@ -229,19 +206,6 @@ public class DevicesController : Controller
}
}
public class ReorderRequest
{
public int[]? ItemIds { get; set; }
}
public class UpdateDurationRequest
{
public int DeviceSlideId { get; set; }
public int DurationSeconds { get; set; }
}
public class ToggleEnabledRequest
{
public int DeviceSlideId { get; set; }
public bool Enabled { get; set; }
}
public class ReorderRequest { public int[]? ItemIds { get; set; } }
public class UpdateDurationRequest { public int DeviceSlideId { get; set; } public int DurationSeconds { get; set; } }
public class ToggleEnabledRequest { public int DeviceSlideId { get; set; } public bool Enabled { get; set; } }