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 System.Collections.Generic;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using MediaBrowser.Model.QuickConnect;
|
using MediaBrowser.Model.QuickConnect;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.QuickConnect
|
namespace Emby.Server.Implementations.QuickConnect
|
||||||
|
|
|
@ -234,7 +234,8 @@ namespace Emby.Server.Implementations.QuickConnect
|
||||||
result.Authentication = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
|
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
|
// 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
|
_authenticationRepository.Create(new AuthenticationInfo
|
||||||
{
|
{
|
||||||
|
@ -284,7 +285,7 @@ namespace Emby.Server.Implementations.QuickConnect
|
||||||
{
|
{
|
||||||
bool expireAll = false;
|
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)
|
if (TemporaryActivation && DateTime.Now > DateActivated.AddMinutes(10) && State == QuickConnectState.Active)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Quick connect time expired, deactivating");
|
_logger.LogDebug("Quick connect time expired, deactivating");
|
||||||
|
@ -293,13 +294,14 @@ namespace Emby.Server.Implementations.QuickConnect
|
||||||
TemporaryActivation = false;
|
TemporaryActivation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// expire stale connection requests
|
// Expire stale connection requests
|
||||||
var delete = new List<string>();
|
var delete = new List<string>();
|
||||||
var values = _currentRequests.Values.ToList();
|
var values = _currentRequests.Values.ToList();
|
||||||
|
|
||||||
for (int i = 0; i < _currentRequests.Count; i++)
|
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);
|
delete.Add(values[i].Lookup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,36 +15,36 @@ namespace MediaBrowser.Model.QuickConnect
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information.
|
/// Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Secret { get; set; }
|
public string? Secret { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
/// Gets or sets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Lookup { get; set; }
|
public string? Lookup { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user facing code used so the user can quickly differentiate this request from others.
|
/// Gets or sets the user facing code used so the user can quickly differentiate this request from others.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Code { get; set; }
|
public string? Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the device friendly name.
|
/// Gets or sets the device friendly name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FriendlyName { get; set; }
|
public string? FriendlyName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the private access token.
|
/// Gets or sets the private access token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Authentication { get; set; }
|
public string? Authentication { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an error message.
|
/// Gets or sets an error message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Error { get; set; }
|
public string? Error { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DateTime that this request was created.
|
/// Gets or sets the DateTime that this request was created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateAdded { get; set; }
|
public DateTime? DateAdded { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,22 +15,22 @@ namespace MediaBrowser.Model.QuickConnect
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user facing code used so the user can quickly differentiate this request from others.
|
/// Gets the user facing code used so the user can quickly differentiate this request from others.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Code { get; private set; }
|
public string? Code { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
/// Gets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Lookup { get; private set; }
|
public string? Lookup { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the device friendly name.
|
/// Gets the device friendly name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FriendlyName { get; private set; }
|
public string? FriendlyName { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the DateTime that this request was created.
|
/// Gets the DateTime that this request was created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateAdded { get; private set; }
|
public DateTime? DateAdded { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cast an internal quick connect result to a DTO by removing all sensitive properties.
|
/// Cast an internal quick connect result to a DTO by removing all sensitive properties.
|
||||||
|
|
Loading…
Reference in New Issue