better defaults for media options

This commit is contained in:
2026-04-07 15:08:39 +02:00
parent 202ef8ecd1
commit 52619fd236
3 changed files with 10 additions and 8 deletions
+3 -3
View File
@@ -7,17 +7,17 @@ public class LogLevelOverrides : Dictionary<string, LogLevel>
{
public LogLevelOverrides()//IHostEnvironment env)
{
this["finch"] = LogLevel.Debug;
this["Finch"] = LogLevel.Debug;
this["Finch.Routing"] = LogLevel.Debug;
// if (env.IsDevelopment())
// {
// this["finch"] = LogLevel.Debug;
// this["Finch"] = LogLevel.Debug;
// this["Finch.Routing"] = LogLevel.Debug;
// }
// else
// {
// this["finch"] = LogLevel.Debug;
// this["Finch"] = LogLevel.Debug;
// }
this["SixLabors"] = LogLevel.Warning;
+6 -4
View File
@@ -9,6 +9,8 @@ using SixLabors.ImageSharp.Web.DependencyInjection;
using System.IO;
using Finch.Media.ImageSharp;
using Finch.Media.ImageSharp.Processors;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Finch.Media;
@@ -27,8 +29,8 @@ internal class FinchMediaModule : FinchModule
services.AddOptions<PhysicalFileSystemCacheOptions>().Configure(opts =>
{
opts.CacheRootPath = "~/";
opts.CacheFolder = "cache";
opts.CacheRootPath = Path.GetTempPath().EnsureEndsWith('/');
opts.CacheFolder = ".imagesharpcache";
}).Bind(configuration.GetSection("Finch:Media:ImageSharp:Cache"));
//configuration.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "Config/imaging.json"), true, true);
@@ -51,8 +53,8 @@ internal class FinchMediaModule : FinchModule
services.AddOptions<MediaOptions>().Configure(opts =>
{
opts.FolderPath = "media";
opts.AllowedOtherFileExtensions = new() { ".pdf", ".docx", ".doc", ".svg", ".xml" };
opts.AllowedImageFileExtensions = new() { ".jpg", ".jpeg", ".png", ".bmp", ".webp", ".gif", ".avif" };
opts.AllowedOtherFileExtensions = [".pdf", ".docx", ".doc", ".svg", ".mp4", ".webm", ".avif", ".av1", ".xlsx", ".xls", ".xml"];
opts.AllowedImageFileExtensions = [".jpg", ".jpeg", ".png", ".bmp", ".webp", ".gif", ".avif"];
// opts.Thumbnails = new()
// {
// { "thumb", new ResizeOptions() { Size = new(100, 100), Mode = ResizeMode.Max } },
+1 -1
View File
@@ -37,7 +37,7 @@ public class ImagingSharpRemoteCacheOptions
{
public bool Enabled { get; set; } = true;
public int ExpiresInHours { get; set; } = -1;
public int ExpiresInHours { get; set; } = 168;
public string MediaFolder { get; set; } = "/media/_remote/";