mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-07 17:12:44 +01:00
parent
bc50fd937d
commit
6783514525
3 changed files with 9 additions and 4 deletions
|
|
@ -156,6 +156,8 @@ public int UILanguage
|
|||
|
||||
public string HmacSalt => GetValue("HmacSalt", Guid.NewGuid().ToString(), true);
|
||||
|
||||
public string DownloadProtectionKey => GetValue("DownloadProtectionKey", Guid.NewGuid().ToString().Replace("-", ""), true);
|
||||
|
||||
public bool ProxyEnabled => GetValueBoolean("ProxyEnabled", false);
|
||||
|
||||
public ProxyType ProxyType => GetValueEnum<ProxyType>("ProxyType", ProxyType.Http);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ public interface IConfigService
|
|||
string RijndaelSalt { get; }
|
||||
string HmacSalt { get; }
|
||||
|
||||
//Link Protection
|
||||
string DownloadProtectionKey { get; }
|
||||
|
||||
//Proxy
|
||||
bool ProxyEnabled { get; }
|
||||
ProxyType ProxyType { get; }
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ public interface IProtectionService
|
|||
|
||||
public class ProtectionService : IProtectionService
|
||||
{
|
||||
private readonly IConfigFileProvider _configService;
|
||||
private readonly IConfigService _configService;
|
||||
|
||||
public ProtectionService(IConfigFileProvider configService)
|
||||
public ProtectionService(IConfigService configService)
|
||||
{
|
||||
_configService = configService;
|
||||
}
|
||||
|
||||
public string Protect(string text)
|
||||
{
|
||||
var key = Encoding.UTF8.GetBytes(_configService.ApiKey);
|
||||
var key = Encoding.UTF8.GetBytes(_configService.DownloadProtectionKey);
|
||||
|
||||
using (var aesAlg = Aes.Create())
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ public string UnProtect(string value)
|
|||
|
||||
Buffer.BlockCopy(fullCipher, 0, iv, 0, iv.Length);
|
||||
Buffer.BlockCopy(fullCipher, iv.Length, cipher, 0, fullCipher.Length - iv.Length);
|
||||
var key = Encoding.UTF8.GetBytes(_configService.ApiKey);
|
||||
var key = Encoding.UTF8.GetBytes(_configService.DownloadProtectionKey);
|
||||
|
||||
using (var aesAlg = Aes.Create())
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue