mirror of https://github.com/jellyfin/jellyfin.git
Make all properties nullable
This commit is contained in:
parent
35ff2be9d7
commit
0d6a63bf84
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable CS1591
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Model.QuickConnect;
|
||||
|
||||
namespace Emby.Server.Implementations.QuickConnect
|
||||
|
|
|
@ -234,7 +234,8 @@ namespace Emby.Server.Implementations.QuickConnect
|
|||
result.Authentication = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
|
||||
|
||||
// Advance the time on the request so it expires sooner as the client will pick up the changes in a few seconds
|
||||
result.DateAdded = result.DateAdded.Subtract(new TimeSpan(0, RequestExpiry - 1, 0));
|
||||
var added = result.DateAdded ?? DateTime.Now.Subtract(new TimeSpan(0, RequestExpiry, 0));
|
||||
result.DateAdded = added.Subtract(new TimeSpan(0, RequestExpiry - 1, 0));
|
||||
|
||||
_authenticationRepository.Create(new AuthenticationInfo
|
||||
{
|
||||
|
@ -284,7 +285,7 @@ namespace Emby.Server.Implementations.QuickConnect
|
|||
{
|
||||
bool expireAll = false;
|
||||
|
||||
// check if quick connect should be deactivated
|
||||
// Check if quick connect should be deactivated
|
||||
if (TemporaryActivation && DateTime.Now > DateActivated.AddMinutes(10) && State == QuickConnectState.Active)
|
||||
{
|
||||
_logger.LogDebug("Quick connect time expired, deactivating");
|
||||
|
@ -293,13 +294,14 @@ namespace Emby.Server.Implementations.QuickConnect
|
|||
TemporaryActivation = false;
|
||||
}
|
||||
|
||||
// expire stale connection requests
|
||||
// Expire stale connection requests
|
||||
var delete = new List<string>();
|
||||
var values = _currentRequests.Values.ToList();
|
||||
|
||||
for (int i = 0; i < _currentRequests.Count; i++)
|
||||
{
|
||||
if (DateTime.Now > values[i].DateAdded.AddMinutes(RequestExpiry) || expireAll)
|
||||
var added = values[i].DateAdded ?? DateTime.UnixEpoch;
|
||||
if (DateTime.Now > added.AddMinutes(RequestExpiry) || expireAll)
|
||||
{
|
||||
delete.Add(values[i].Lookup);
|
||||
}
|
||||
|
|
|
@ -15,36 +15,36 @@ namespace MediaBrowser.Model.QuickConnect
|
|||
/// <summary>
|
||||
/// Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information.
|
||||
/// </summary>
|
||||
public string Secret { get; set; }
|
||||
public string? Secret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
||||
/// </summary>
|
||||
public string Lookup { get; set; }
|
||||
public string? Lookup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user facing code used so the user can quickly differentiate this request from others.
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device friendly name.
|
||||
/// </summary>
|
||||
public string FriendlyName { get; set; }
|
||||
public string? FriendlyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the private access token.
|
||||
/// </summary>
|
||||
public string Authentication { get; set; }
|
||||
public string? Authentication { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an error message.
|
||||
/// </summary>
|
||||
public string Error { get; set; }
|
||||
public string? Error { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DateTime that this request was created.
|
||||
/// </summary>
|
||||
public DateTime DateAdded { get; set; }
|
||||
public DateTime? DateAdded { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,22 +15,22 @@ namespace MediaBrowser.Model.QuickConnect
|
|||
/// <summary>
|
||||
/// Gets the user facing code used so the user can quickly differentiate this request from others.
|
||||
/// </summary>
|
||||
public string Code { get; private set; }
|
||||
public string? Code { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
||||
/// </summary>
|
||||
public string Lookup { get; private set; }
|
||||
public string? Lookup { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device friendly name.
|
||||
/// </summary>
|
||||
public string FriendlyName { get; private set; }
|
||||
public string? FriendlyName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DateTime that this request was created.
|
||||
/// </summary>
|
||||
public DateTime DateAdded { get; private set; }
|
||||
public DateTime? DateAdded { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cast an internal quick connect result to a DTO by removing all sensitive properties.
|
||||
|
|
Loading…
Reference in New Issue