Merge pull request #2878 from MediaBrowser/dev

Dev
pull/1154/head
Luke 7 years ago committed by GitHub
commit 4f3eef77b6

@ -113,7 +113,7 @@ namespace Emby.Dlna.PlayTo
private int GetInactiveTimerIntervalMs() private int GetInactiveTimerIntervalMs()
{ {
return Timeout.Infinite; return 60000;
} }
public void Start() public void Start()

@ -48,23 +48,7 @@ namespace Emby.Dlna.PlayTo
{ {
get get
{ {
var lastDateKnownActivity = _creationTime > _device.DateLastActivity ? _creationTime : _device.DateLastActivity; return !_disposed && _device != null;
if (DateTime.UtcNow >= lastDateKnownActivity.AddSeconds(120))
{
try
{
// Session is inactive, mark it for Disposal and don't start the elapsed timer.
_sessionManager.ReportSessionEnded(_session.Id);
}
catch (Exception ex)
{
_logger.ErrorException("Error in ReportSessionEnded", ex);
}
return false;
}
return _device != null;
} }
} }

@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.Services
var attrs = appHost.GetRouteAttributes(requestType); var attrs = appHost.GetRouteAttributes(requestType);
foreach (RouteAttribute attr in attrs) foreach (RouteAttribute attr in attrs)
{ {
var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.Summary); var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description);
RegisterRestPath(restPath); RegisterRestPath(restPath);
} }

@ -51,6 +51,8 @@ namespace Emby.Server.Implementations.Services
public string Path { get { return this.restPath; } } public string Path { get { return this.restPath; } }
public string Summary { get; private set; } public string Summary { get; private set; }
public string Description { get; private set; }
public bool IsHidden { get; private set; }
public int Priority { get; set; } //passed back to RouteAttribute public int Priority { get; set; } //passed back to RouteAttribute
@ -91,10 +93,12 @@ namespace Emby.Server.Implementations.Services
return list; return list;
} }
public RestPath(Func<Type, object> createInstanceFn, Func<Type, Func<string, object>> getParseFn, Type requestType, string path, string verbs, string summary = null) public RestPath(Func<Type, object> createInstanceFn, Func<Type, Func<string, object>> getParseFn, Type requestType, string path, string verbs, bool isHidden = false, string summary = null, string description = null)
{ {
this.RequestType = requestType; this.RequestType = requestType;
this.Summary = summary; this.Summary = summary;
this.IsHidden = isHidden;
this.Description = description;
this.restPath = path; this.restPath = path;
this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);

@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Services
public string host { get; set; } public string host { get; set; }
public string basePath { get; set; } public string basePath { get; set; }
public SwaggerTag[] tags { get; set; } public SwaggerTag[] tags { get; set; }
public Dictionary<string, Dictionary<string, SwaggerMethod>> paths { get; set; } public IDictionary<string, Dictionary<string, SwaggerMethod>> paths { get; set; }
public Dictionary<string, SwaggerDefinition> definitions { get; set; } public Dictionary<string, SwaggerDefinition> definitions { get; set; }
} }
@ -147,16 +147,21 @@ namespace Emby.Server.Implementations.Services
return new Dictionary<string, SwaggerDefinition>(); return new Dictionary<string, SwaggerDefinition>();
} }
private Dictionary<string, Dictionary<string, SwaggerMethod>> GetPaths() private IDictionary<string, Dictionary<string, SwaggerMethod>> GetPaths()
{ {
var paths = new Dictionary<string, Dictionary<string, SwaggerMethod>>(); var paths = new SortedDictionary<string, Dictionary<string, SwaggerMethod>>();
var all = ServiceController.Instance.RestPathMap.ToList(); var all = ServiceController.Instance.RestPathMap.OrderBy(i => i.Key, StringComparer.OrdinalIgnoreCase).ToList();
foreach (var current in all) foreach (var current in all)
{ {
foreach (var info in current.Value) foreach (var info in current.Value)
{ {
if (info.IsHidden)
{
continue;
}
if (info.Path.StartsWith("/mediabrowser", StringComparison.OrdinalIgnoreCase)) if (info.Path.StartsWith("/mediabrowser", StringComparison.OrdinalIgnoreCase))
{ {
continue; continue;
@ -191,6 +196,7 @@ namespace Emby.Server.Implementations.Services
result[verb.ToLower()] = new SwaggerMethod result[verb.ToLower()] = new SwaggerMethod
{ {
summary = info.Summary, summary = info.Summary,
description = info.Description,
produces = new[] produces = new[]
{ {
"application/json" "application/json"

@ -82,7 +82,7 @@ namespace MediaBrowser.Api
/// <summary> /// <summary>
/// Class GetPluginSecurityInfo /// Class GetPluginSecurityInfo
/// </summary> /// </summary>
[Route("/Plugins/SecurityInfo", "GET", Summary = "Gets plugin registration information")] [Route("/Plugins/SecurityInfo", "GET", Summary = "Gets plugin registration information", IsHidden = true)]
[Authenticated] [Authenticated]
public class GetPluginSecurityInfo : IReturn<PluginSecurityInfo> public class GetPluginSecurityInfo : IReturn<PluginSecurityInfo>
{ {
@ -91,13 +91,13 @@ namespace MediaBrowser.Api
/// <summary> /// <summary>
/// Class UpdatePluginSecurityInfo /// Class UpdatePluginSecurityInfo
/// </summary> /// </summary>
[Route("/Plugins/SecurityInfo", "POST", Summary = "Updates plugin registration information")] [Route("/Plugins/SecurityInfo", "POST", Summary = "Updates plugin registration information", IsHidden = true)]
[Authenticated(Roles = "Admin")] [Authenticated(Roles = "Admin")]
public class UpdatePluginSecurityInfo : PluginSecurityInfo, IReturnVoid public class UpdatePluginSecurityInfo : PluginSecurityInfo, IReturnVoid
{ {
} }
[Route("/Plugins/RegistrationRecords/{Name}", "GET", Summary = "Gets registration status for a feature")] [Route("/Plugins/RegistrationRecords/{Name}", "GET", Summary = "Gets registration status for a feature", IsHidden = true)]
[Authenticated] [Authenticated]
public class GetRegistrationStatus public class GetRegistrationStatus
{ {
@ -108,7 +108,7 @@ namespace MediaBrowser.Api
public string Mb2Equivalent { get; set; } public string Mb2Equivalent { get; set; }
} }
[Route("/Registrations/{Name}", "GET", Summary = "Gets registration status for a feature")] [Route("/Registrations/{Name}", "GET", Summary = "Gets registration status for a feature", IsHidden = true)]
[Authenticated] [Authenticated]
public class GetRegistration : IReturn<RegistrationInfo> public class GetRegistration : IReturn<RegistrationInfo>
{ {
@ -116,7 +116,7 @@ namespace MediaBrowser.Api
public string Name { get; set; } public string Name { get; set; }
} }
[Route("/Appstore/Register", "POST", Summary = "Registers an appstore sale")] [Route("/Appstore/Register", "POST", Summary = "Registers an appstore sale", IsHidden = true)]
[Authenticated] [Authenticated]
public class RegisterAppstoreSale public class RegisterAppstoreSale
{ {

@ -88,6 +88,10 @@ namespace MediaBrowser.Model.Services
/// </summary> /// </summary>
public string Summary { get; set; } public string Summary { get; set; }
public string Description { get; set; }
public bool IsHidden { get; set; }
/// <summary> /// <summary>
/// Gets or sets longer text to explain the behaviour of the route. /// Gets or sets longer text to explain the behaviour of the route.
/// </summary> /// </summary>

@ -127,10 +127,10 @@ namespace MediaBrowser.Server.Mono
var task = appHost.Init(initProgress); var task = appHost.Init(initProgress);
appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo);
Task.WaitAll(task); Task.WaitAll(task);
appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo);
Console.WriteLine("Running startup tasks"); Console.WriteLine("Running startup tasks");
task = appHost.RunStartupTasks(); task = appHost.RunStartupTasks();

@ -47,13 +47,13 @@ namespace MediaBrowser.WebDashboard.Api
public string Name { get; set; } public string Name { get; set; }
} }
[Route("/web/Package", "GET")] [Route("/web/Package", "GET", IsHidden = true)]
public class GetDashboardPackage public class GetDashboardPackage
{ {
public string Mode { get; set; } public string Mode { get; set; }
} }
[Route("/robots.txt", "GET")] [Route("/robots.txt", "GET", IsHidden = true)]
public class GetRobotsTxt public class GetRobotsTxt
{ {
} }
@ -61,7 +61,7 @@ namespace MediaBrowser.WebDashboard.Api
/// <summary> /// <summary>
/// Class GetDashboardResource /// Class GetDashboardResource
/// </summary> /// </summary>
[Route("/web/{ResourceName*}", "GET")] [Route("/web/{ResourceName*}", "GET", IsHidden = true)]
public class GetDashboardResource public class GetDashboardResource
{ {
/// <summary> /// <summary>
@ -76,7 +76,7 @@ namespace MediaBrowser.WebDashboard.Api
public string V { get; set; } public string V { get; set; }
} }
[Route("/favicon.ico", "GET")] [Route("/favicon.ico", "GET", IsHidden = true)]
public class GetFavIcon public class GetFavIcon
{ {
} }

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.30.16")] [assembly: AssemblyVersion("3.2.30.17")]

Loading…
Cancel
Save