refacto site settings
Some checks failed
Dotnet build and test / build (pull_request) Failing after 8m29s

This commit is contained in:
Paul Schneider 2026-09-17 22:22:18 +01:00
commit 3bc4142383
Signed by: notazof
GPG key ID: 1DD5D838E5343B06
33 changed files with 399 additions and 315 deletions

View file

@ -10,6 +10,7 @@ using Microsoft.AspNetCore.SignalR;
using Yavsc.Server.Helpers;
using static Yavsc.Constants;
using Yavsc.Server.Hubs;
using Microsoft.Extensions.Options;
namespace Yavsc.Blogs.Controllers
{
@ -21,13 +22,20 @@ namespace Yavsc.Blogs.Controllers
private readonly IHubContext<ChatHub> hubContext;
readonly ApplicationDbContext dbContext;
public FileSystemStreamController(ApplicationDbContext context, ILiveProcessor liveProcessor, ILoggerFactory loggerFactory,
IHubContext<ChatHub> hubContext)
private readonly SiteSettings siteSettings;
public FileSystemStreamController(
ApplicationDbContext context,
ILiveProcessor liveProcessor,
ILoggerFactory loggerFactory,
IHubContext<ChatHub> hubContext,
IOptions<SiteSettings> siteSettings)
{
this.dbContext = context;
this.logger = loggerFactory.CreateLogger<FileSystemStreamController>();
this.liveProcessor = liveProcessor;
this.hubContext = hubContext;
this.siteSettings = siteSettings.Value;
}
[Authorize, Route("put/{filename}")]
@ -55,7 +63,7 @@ namespace Yavsc.Blogs.Controllers
);
string destDir = HttpContext.User.EnsureDestinationDirectory(filePath);
string destDir = HttpContext.User.EnsureDestinationDirectory(filePath, siteSettings);
logger.LogInformation($"Saving flow to {destDir}");
var userId = User.GetUserId();
var user = await dbContext.Users.FirstAsync(u => u.Id == userId);