From d6dfc1edaa26f0c8fbeed5e32ebf3751d27f10cf Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Tue, 30 Jan 2024 19:41:39 -0600 Subject: [PATCH] persist data protection keys in etv config folder (#1585) --- CHANGELOG.md | 5 +++++ ErsatzTV.Core/FileSystemLayout.cs | 2 ++ ErsatzTV/Startup.cs | 3 +++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d47d80f..1aca02a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Added - Add `show_studio` to search index for seasons and episodes +### Fixed +- Fix antiforgery error caused by reusing existing browser tabs across docker container restarts + - Data protection keys will now be persisted under ErsatzTV's config folder instead of being recreated at startup + ## [0.8.5-beta] - 2024-01-30 ### Added - Respect browser's `Accept-Language` header for date time display diff --git a/ErsatzTV.Core/FileSystemLayout.cs b/ErsatzTV.Core/FileSystemLayout.cs index da258335..126e3b55 100644 --- a/ErsatzTV.Core/FileSystemLayout.cs +++ b/ErsatzTV.Core/FileSystemLayout.cs @@ -15,6 +15,8 @@ public static class FileSystemLayout Environment.SpecialFolderOption.Create), "etv-transcode"); + public static readonly string DataProtectionFolder = Path.Combine(AppDataFolder, "data-protection"); + public static readonly string LogsFolder = Path.Combine(AppDataFolder, "logs"); public static readonly string DatabasePath = Path.Combine(AppDataFolder, "ersatztv.sqlite3"); diff --git a/ErsatzTV/Startup.cs b/ErsatzTV/Startup.cs index a9e60b1e..f6cca745 100644 --- a/ErsatzTV/Startup.cs +++ b/ErsatzTV/Startup.cs @@ -71,6 +71,7 @@ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.StaticFiles; using Microsoft.EntityFrameworkCore; @@ -132,6 +133,8 @@ public class Startup configuration.ReleaseStage = bugsnagConfig.Enable ? "public" : "private"; #endif }); + + services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(FileSystemLayout.DataProtectionFolder)); OidcHelper.Init(Configuration); JwtHelper.Init(Configuration);