mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 01:02:57 -07:00
Lots of fixes. Becoming more stable now. #865
This commit is contained in:
parent
1c6ddc74cb
commit
dcf97a1008
31 changed files with 1021 additions and 381 deletions
|
@ -4,21 +4,24 @@ using Ombi.Core.Settings;
|
|||
using Ombi.Helpers;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
|
||||
namespace Ombi.Settings.Settings
|
||||
{
|
||||
public class SettingsServiceV2<T> : ISettingsService<T>
|
||||
public class SettingsService<T> : ISettingsService<T>
|
||||
where T : Ombi.Settings.Settings.Models.Settings, new()
|
||||
{
|
||||
|
||||
public SettingsServiceV2(ISettingsRepository repo)
|
||||
public SettingsService(ISettingsRepository repo, IDataProtectionProvider provider)
|
||||
{
|
||||
Repo = repo;
|
||||
EntityName = typeof(T).Name;
|
||||
_protector = provider.CreateProtector(GetType().FullName);
|
||||
}
|
||||
|
||||
private ISettingsRepository Repo { get; }
|
||||
private string EntityName { get; }
|
||||
private readonly IDataProtector _protector;
|
||||
|
||||
public T GetSettings()
|
||||
{
|
||||
|
@ -119,12 +122,12 @@ namespace Ombi.Settings.Settings
|
|||
|
||||
private string EncryptSettings(GlobalSettings settings)
|
||||
{
|
||||
return StringCipher.EncryptString(settings.Content, $"Ombiv3SettingsEncryptionPassword");
|
||||
return _protector.Protect(settings.Content);
|
||||
}
|
||||
|
||||
private string DecryptSettings(GlobalSettings settings)
|
||||
{
|
||||
return StringCipher.DecryptString(settings.Content, $"Ombiv3SettingsEncryptionPassword");
|
||||
return _protector.Unprotect(settings.Content);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue