Address compiler warnings
This commit is contained in:
parent
44a9fb1fcd
commit
17af1e8dfe
@ -37,7 +37,7 @@ public class Padding
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] AddPSSPadding(byte[] hash)
|
public static byte[]? AddPSSPadding(byte[] hash)
|
||||||
{
|
{
|
||||||
int modBits = 2048;
|
int modBits = 2048;
|
||||||
int hLen = 20;
|
int hLen = 20;
|
||||||
|
|||||||
@ -5,5 +5,5 @@ public interface IFileNameHelper
|
|||||||
Task<string> BuildFilename(string fileFormat, Dictionary<string, string> values);
|
Task<string> BuildFilename(string fileFormat, Dictionary<string, string> values);
|
||||||
|
|
||||||
Task<Dictionary<string, string>> GetFilename(object obj1, object obj2, object obj3, List<string> selectedProperties,
|
Task<Dictionary<string, string>> GetFilename(object obj1, object obj2, object obj3, List<string> selectedProperties,
|
||||||
string username, Dictionary<string, long> users = null);
|
string username, Dictionary<string, long>? users);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UserEntities.User? user = new();
|
UserEntities.User user = new();
|
||||||
int post_limit = 50;
|
int post_limit = 50;
|
||||||
Dictionary<string, string> getParams = new()
|
Dictionary<string, string> getParams = new()
|
||||||
{
|
{
|
||||||
@ -166,7 +166,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<JObject> GetUserInfoById(string endpoint)
|
public async Task<JObject?> GetUserInfoById(string endpoint)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -231,7 +231,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<Dictionary<string, long>> GetLists(string endpoint)
|
public async Task<Dictionary<string, long>?> GetLists(string endpoint)
|
||||||
{
|
{
|
||||||
Log.Debug("Calling GetLists");
|
Log.Debug("Calling GetLists");
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<Dictionary<long, string>> GetMedia(MediaType mediatype,
|
public async Task<Dictionary<long, string>?> GetMedia(MediaType mediatype,
|
||||||
string endpoint,
|
string endpoint,
|
||||||
string? username,
|
string? username,
|
||||||
string folder,
|
string folder,
|
||||||
|
|||||||
@ -575,9 +575,12 @@ public class DownloadService(
|
|||||||
|
|
||||||
using HttpResponseMessage response = await client.GetAsync(mpdURL, HttpCompletionOption.ResponseHeadersRead);
|
using HttpResponseMessage response = await client.GetAsync(mpdURL, HttpCompletionOption.ResponseHeadersRead);
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
if (response.Content.Headers.LastModified != null)
|
||||||
{
|
{
|
||||||
return response.Content.Headers.LastModified.Value.DateTime;
|
return response.Content.Headers.LastModified.Value.DateTime;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DateTime.Now;
|
return DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,10 +16,10 @@ public interface IAPIService
|
|||||||
Task<string> GetDecryptionKeyCDM(Dictionary<string, string> drmHeaders, string licenceURL, string pssh);
|
Task<string> GetDecryptionKeyCDM(Dictionary<string, string> drmHeaders, string licenceURL, string pssh);
|
||||||
Task<DateTime> GetDRMMPDLastModified(string mpdUrl, string policy, string signature, string kvp);
|
Task<DateTime> GetDRMMPDLastModified(string mpdUrl, string policy, string signature, string kvp);
|
||||||
Task<string> GetDRMMPDPSSH(string mpdUrl, string policy, string signature, string kvp);
|
Task<string> GetDRMMPDPSSH(string mpdUrl, string policy, string signature, string kvp);
|
||||||
Task<Dictionary<string, long>> GetLists(string endpoint);
|
Task<Dictionary<string, long>?> GetLists(string endpoint);
|
||||||
Task<List<string>> GetListUsers(string endpoint);
|
Task<List<string>?> GetListUsers(string endpoint);
|
||||||
|
|
||||||
Task<Dictionary<long, string>> GetMedia(MediaType mediatype, string endpoint, string? username, string folder,
|
Task<Dictionary<long, string>?> GetMedia(MediaType mediatype, string endpoint, string? username, string folder,
|
||||||
List<long> paid_post_ids);
|
List<long> paid_post_ids);
|
||||||
|
|
||||||
Task<PurchasedEntities.PaidPostCollection> GetPaidPosts(string endpoint, string folder, string username,
|
Task<PurchasedEntities.PaidPostCollection> GetPaidPosts(string endpoint, string folder, string username,
|
||||||
@ -46,10 +46,10 @@ public interface IAPIService
|
|||||||
Task<List<PurchasedEntities.PurchasedTabCollection>> GetPurchasedTab(string endpoint, string folder,
|
Task<List<PurchasedEntities.PurchasedTabCollection>> GetPurchasedTab(string endpoint, string folder,
|
||||||
Dictionary<string, long> users);
|
Dictionary<string, long> users);
|
||||||
|
|
||||||
Task<UserEntities.User> GetUserInfo(string endpoint);
|
Task<UserEntities.User?> GetUserInfo(string endpoint);
|
||||||
Task<JObject> GetUserInfoById(string endpoint);
|
Task<JObject?> GetUserInfoById(string endpoint);
|
||||||
Dictionary<string, string> GetDynamicHeaders(string path, string queryParam);
|
Dictionary<string, string> GetDynamicHeaders(string path, string queryParam);
|
||||||
Task<Dictionary<string, long>> GetActiveSubscriptions(string endpoint, bool includeRestrictedSubscriptions);
|
Task<Dictionary<string, long>?> GetActiveSubscriptions(string endpoint, bool includeRestrictedSubscriptions);
|
||||||
Task<Dictionary<string, long>> GetExpiredSubscriptions(string endpoint, bool includeRestrictedSubscriptions);
|
Task<Dictionary<string, long>?> GetExpiredSubscriptions(string endpoint, bool includeRestrictedSubscriptions);
|
||||||
Task<string> GetDecryptionKeyOFDL(Dictionary<string, string> drmHeaders, string licenceURL, string pssh);
|
Task<string> GetDecryptionKeyOFDL(Dictionary<string, string> drmHeaders, string licenceURL, string pssh);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ internal class HttpUtil
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<string> GetWebSource(string URL, Dictionary<string, string> headers = null)
|
public static async Task<string> GetWebSource(string URL, Dictionary<string, string>? headers = null)
|
||||||
{
|
{
|
||||||
HttpResponseMessage response = await PerformOperation(async () => { return await Get(URL, headers); });
|
HttpResponseMessage response = await PerformOperation(async () => { return await Get(URL, headers); });
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ internal class HttpUtil
|
|||||||
return Encoding.UTF8.GetString(bytes);
|
return Encoding.UTF8.GetString(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<byte[]> GetBinary(string URL, Dictionary<string, string> headers = null)
|
public static async Task<byte[]> GetBinary(string URL, Dictionary<string, string>? headers = null)
|
||||||
{
|
{
|
||||||
HttpResponseMessage response = await PerformOperation(async () => { return await Get(URL, headers); });
|
HttpResponseMessage response = await PerformOperation(async () => { return await Get(URL, headers); });
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ internal class HttpUtil
|
|||||||
|
|
||||||
public static string GetString(byte[] bytes) => Encoding.UTF8.GetString(bytes);
|
public static string GetString(byte[] bytes) => Encoding.UTF8.GetString(bytes);
|
||||||
|
|
||||||
private static async Task<HttpResponseMessage> Get(string URL, Dictionary<string, string> headers = null)
|
private static async Task<HttpResponseMessage> Get(string URL, Dictionary<string, string>? headers = null)
|
||||||
{
|
{
|
||||||
HttpRequestMessage request = new() { RequestUri = new Uri(URL), Method = HttpMethod.Get };
|
HttpRequestMessage request = new() { RequestUri = new Uri(URL), Method = HttpMethod.Get };
|
||||||
|
|
||||||
@ -87,8 +87,8 @@ internal class HttpUtil
|
|||||||
return await Send(request);
|
return await Send(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<HttpResponseMessage> Post(string URL, Dictionary<string, string> headers,
|
private static async Task<HttpResponseMessage> Post(string URL, Dictionary<string, string>? headers = null,
|
||||||
HttpContent content)
|
HttpContent? content = null)
|
||||||
{
|
{
|
||||||
HttpRequestMessage request = new() { RequestUri = new Uri(URL), Method = HttpMethod.Post, Content = content };
|
HttpRequestMessage request = new() { RequestUri = new Uri(URL), Method = HttpMethod.Post, Content = content };
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class CDM
|
|||||||
return pssh;
|
return pssh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string OpenSession(string initDataB64, string deviceName, bool offline = false, bool raw = false)
|
public static string? OpenSession(string initDataB64, string deviceName, bool offline = false, bool raw = false)
|
||||||
{
|
{
|
||||||
byte[] initData = CheckPSSH(initDataB64);
|
byte[] initData = CheckPSSH(initDataB64);
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public class CDM
|
|||||||
return BytesToHex(sessionId);
|
return BytesToHex(sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WidevineCencHeader ParseInitData(byte[] initData)
|
private static WidevineCencHeader? ParseInitData(byte[] initData)
|
||||||
{
|
{
|
||||||
WidevineCencHeader cencHeader;
|
WidevineCencHeader cencHeader;
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ public class CDM
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] GetLicenseRequest(string sessionId)
|
public static byte[]? GetLicenseRequest(string sessionId)
|
||||||
{
|
{
|
||||||
//Logger.Debug($"GetLicenseRequest(sessionId={BytesToHex(sessionId)})");
|
//Logger.Debug($"GetLicenseRequest(sessionId={BytesToHex(sessionId)})");
|
||||||
//Logger.Verbose($"Getting license request");
|
//Logger.Verbose($"Getting license request");
|
||||||
|
|||||||
@ -11,8 +11,8 @@ namespace OF_DL.Widevine;
|
|||||||
|
|
||||||
public class CDMDevice
|
public class CDMDevice
|
||||||
{
|
{
|
||||||
public CDMDevice(string deviceName, byte[] clientIdBlobBytes = null, byte[] privateKeyBytes = null,
|
public CDMDevice(string deviceName, byte[]? clientIdBlobBytes = null, byte[]? privateKeyBytes = null,
|
||||||
byte[] vmpBytes = null)
|
byte[]? vmpBytes = null)
|
||||||
{
|
{
|
||||||
DeviceName = deviceName;
|
DeviceName = deviceName;
|
||||||
|
|
||||||
|
|||||||
@ -6,11 +6,11 @@ namespace OF_DL.Widevine;
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class ContentKey
|
public class ContentKey
|
||||||
{
|
{
|
||||||
[JsonPropertyName("key_id")] public byte[] KeyID { get; set; }
|
[JsonPropertyName("key_id")] public byte[] KeyID { get; set; } = [];
|
||||||
|
|
||||||
[JsonPropertyName("type")] public string Type { get; set; }
|
[JsonPropertyName("type")] public string Type { get; set; } = "";
|
||||||
|
|
||||||
[JsonPropertyName("bytes")] public byte[] Bytes { get; set; }
|
[JsonPropertyName("bytes")] public byte[] Bytes { get; set; } = [];
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
[JsonPropertyName("permissions")]
|
[JsonPropertyName("permissions")]
|
||||||
@ -20,7 +20,7 @@ public class ContentKey
|
|||||||
set => PermissionsString = string.Join(",", value);
|
set => PermissionsString = string.Join(",", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore] public string PermissionsString { get; set; }
|
[JsonIgnore] public string PermissionsString { get; set; } = "";
|
||||||
|
|
||||||
public override string ToString() =>
|
public override string ToString() =>
|
||||||
$"{BitConverter.ToString(KeyID).Replace("-", "").ToLower()}:{BitConverter.ToString(Bytes).Replace("-", "").ToLower()}";
|
$"{BitConverter.ToString(KeyID).Replace("-", "").ToLower()}:{BitConverter.ToString(Bytes).Replace("-", "").ToLower()}";
|
||||||
|
|||||||
@ -2,7 +2,7 @@ namespace OF_DL.Widevine;
|
|||||||
|
|
||||||
public class DerivedKeys
|
public class DerivedKeys
|
||||||
{
|
{
|
||||||
public byte[] Auth1 { get; set; }
|
public byte[] Auth1 { get; set; } = [];
|
||||||
public byte[] Auth2 { get; set; }
|
public byte[] Auth2 { get; set; } = [];
|
||||||
public byte[] Enc { get; set; }
|
public byte[] Enc { get; set; } = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ internal class PSSHBox
|
|||||||
|
|
||||||
if (dataLength == 0)
|
if (dataLength == 0)
|
||||||
{
|
{
|
||||||
return new PSSHBox(kids, null);
|
return new PSSHBox(kids, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] data = new byte[dataLength];
|
byte[] data = new byte[dataLength];
|
||||||
|
|||||||
@ -1,24 +1,16 @@
|
|||||||
namespace OF_DL.Widevine;
|
namespace OF_DL.Widevine;
|
||||||
|
|
||||||
internal class Session
|
internal class Session(byte[] sessionId, dynamic initData, CDMDevice device, bool offline)
|
||||||
{
|
{
|
||||||
public Session(byte[] sessionId, dynamic initData, CDMDevice device, bool offline)
|
public byte[] SessionId { get; set; } = sessionId;
|
||||||
{
|
public dynamic InitData { get; set; } = initData;
|
||||||
SessionId = sessionId;
|
public bool Offline { get; set; } = offline;
|
||||||
InitData = initData;
|
public CDMDevice Device { get; set; } = device;
|
||||||
Offline = offline;
|
public byte[] SessionKey { get; set; } = [];
|
||||||
Device = device;
|
public DerivedKeys DerivedKeys { get; set; } = new();
|
||||||
}
|
public byte[] LicenseRequest { get; set; } = [];
|
||||||
|
public SignedLicense License { get; set; } = new();
|
||||||
public byte[] SessionId { get; set; }
|
public SignedDeviceCertificate ServiceCertificate { get; set; } = new();
|
||||||
public dynamic InitData { get; set; }
|
|
||||||
public bool Offline { get; set; }
|
|
||||||
public CDMDevice Device { get; set; }
|
|
||||||
public byte[] SessionKey { get; set; }
|
|
||||||
public DerivedKeys DerivedKeys { get; set; }
|
|
||||||
public byte[] LicenseRequest { get; set; }
|
|
||||||
public SignedLicense License { get; set; }
|
|
||||||
public SignedDeviceCertificate ServiceCertificate { get; set; }
|
|
||||||
public bool PrivacyMode { get; set; }
|
public bool PrivacyMode { get; set; }
|
||||||
public List<ContentKey> ContentKeys { get; set; } = new();
|
public List<ContentKey> ContentKeys { get; set; } = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user