Merge pull request #1861 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-06-19 13:42:43 -04:00 committed by GitHub
commit 44c3424e16
16 changed files with 192 additions and 71 deletions

View File

@ -200,6 +200,8 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by timers belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "SeriesTimerId", Description = "Optional filter by timers belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
public bool? IsActive { get; set; }
} }
[Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")] [Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
@ -927,7 +929,8 @@ namespace MediaBrowser.Api.LiveTv
var result = await _liveTvManager.GetTimers(new TimerQuery var result = await _liveTvManager.GetTimers(new TimerQuery
{ {
ChannelId = request.ChannelId, ChannelId = request.ChannelId,
SeriesTimerId = request.SeriesTimerId SeriesTimerId = request.SeriesTimerId,
IsActive = request.IsActive
}, CancellationToken.None).ConfigureAwait(false); }, CancellationToken.None).ConfigureAwait(false);

View File

@ -69,9 +69,9 @@ namespace MediaBrowser.Api
_config.SaveConfiguration(); _config.SaveConfiguration();
} }
public object Get(GetStartupInfo request) public async Task<object> Get(GetStartupInfo request)
{ {
var info = _appHost.GetSystemInfo(); var info = await _appHost.GetSystemInfo().ConfigureAwait(false);
return new StartupInfo return new StartupInfo
{ {

View File

@ -43,7 +43,7 @@ namespace MediaBrowser.Api.System
/// <returns>Task{SystemInfo}.</returns> /// <returns>Task{SystemInfo}.</returns>
protected override Task<SystemInfo> GetDataToSend(WebSocketListenerState state) protected override Task<SystemInfo> GetDataToSend(WebSocketListenerState state)
{ {
return Task.FromResult(_appHost.GetSystemInfo()); return _appHost.GetSystemInfo();
} }
} }
} }

View File

@ -157,16 +157,16 @@ namespace MediaBrowser.Api.System
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public object Get(GetSystemInfo request) public async Task<object> Get(GetSystemInfo request)
{ {
var result = _appHost.GetSystemInfo(); var result = await _appHost.GetSystemInfo().ConfigureAwait(false);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
public object Get(GetPublicSystemInfo request) public async Task<object> Get(GetPublicSystemInfo request)
{ {
var result = _appHost.GetSystemInfo(); var result = await _appHost.GetSystemInfo().ConfigureAwait(false);
var publicInfo = new PublicSystemInfo var publicInfo = new PublicSystemInfo
{ {

View File

@ -18,7 +18,7 @@ namespace MediaBrowser.Controller
/// Gets the system info. /// Gets the system info.
/// </summary> /// </summary>
/// <returns>SystemInfo.</returns> /// <returns>SystemInfo.</returns>
SystemInfo GetSystemInfo(); Task<SystemInfo> GetSystemInfo();
/// <summary> /// <summary>
/// Gets a value indicating whether [supports automatic run at startup]. /// Gets a value indicating whether [supports automatic run at startup].

View File

@ -13,5 +13,7 @@
/// </summary> /// </summary>
/// <value>The series timer identifier.</value> /// <value>The series timer identifier.</value>
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
public bool? IsActive { get; set; }
} }
} }

View File

@ -39,6 +39,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// </summary> /// </summary>
private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
public Func<IDisposable> ResultScope { get; set; }
public List<Cookie> Cookies { get; private set; }
/// <summary> /// <summary>
/// Additional HTTP Headers /// Additional HTTP Headers
/// </summary> /// </summary>
@ -81,6 +84,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
Options["Accept-Ranges"] = "bytes"; Options["Accept-Ranges"] = "bytes";
StatusCode = HttpStatusCode.PartialContent; StatusCode = HttpStatusCode.PartialContent;
Cookies = new List<Cookie>();
SetRangeValues(); SetRangeValues();
} }

View File

@ -4,6 +4,7 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Web; using System.Web;
using ServiceStack;
using ServiceStack.Web; using ServiceStack.Web;
namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
@ -116,6 +117,21 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
} }
} }
public string Accept
{
get
{
return string.IsNullOrEmpty(request.Headers[HttpHeaders.Accept]) ? null : request.Headers[HttpHeaders.Accept];
}
}
public string Authorization
{
get
{
return string.IsNullOrEmpty(request.Headers[HttpHeaders.Authorization]) ? null : request.Headers[HttpHeaders.Authorization];
}
}
protected bool validate_cookies, validate_query_string, validate_form; protected bool validate_cookies, validate_query_string, validate_form;
protected bool checked_cookies, checked_query_string, checked_form; protected bool checked_cookies, checked_query_string, checked_form;

View File

@ -22,7 +22,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
this.OperationName = operationName; this.OperationName = operationName;
this.RequestAttributes = requestAttributes; this.RequestAttributes = requestAttributes;
this.request = httpContext.Request; this.request = httpContext.Request;
this.response = new WebSocketSharpResponse(logger, httpContext.Response); this.response = new WebSocketSharpResponse(logger, httpContext.Response, this);
this.RequestPreferences = new RequestPreferences(this); this.RequestPreferences = new RequestPreferences(this);
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net; using System.Net;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
@ -14,14 +15,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly HttpListenerResponse response; private readonly HttpListenerResponse response;
public WebSocketSharpResponse(ILogger logger, HttpListenerResponse response) public WebSocketSharpResponse(ILogger logger, HttpListenerResponse response, IRequest request)
{ {
_logger = logger; _logger = logger;
this.response = response; this.response = response;
Items = new Dictionary<string, object>();
Request = request;
} }
public IRequest Request { get; private set; }
public bool UseBufferedStream { get; set; } public bool UseBufferedStream { get; set; }
public Dictionary<string, object> Items { get; private set; }
public object OriginalResponse public object OriginalResponse
{ {
get { return response; } get { return response; }
@ -58,6 +62,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
response.AddHeader(name, value); response.AddHeader(name, value);
} }
public string GetHeader(string name)
{
return response.Headers[name];
}
public void Redirect(string url) public void Redirect(string url)
{ {
response.Redirect(url); response.Redirect(url);
@ -142,5 +151,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
} }
public bool KeepAlive { get; set; } public bool KeepAlive { get; set; }
public void ClearCookies()
{
}
} }
} }

View File

@ -1010,6 +1010,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
Action onStarted = () => Action onStarted = () =>
{ {
timer.Status = RecordingStatus.InProgress;
_timerProvider.AddOrUpdate(timer);
result.Item3.Release(); result.Item3.Release();
isResourceOpen = false; isResourceOpen = false;
}; };

View File

@ -1665,6 +1665,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var results = await Task.WhenAll(tasks).ConfigureAwait(false); var results = await Task.WhenAll(tasks).ConfigureAwait(false);
var timers = results.SelectMany(i => i.ToList()); var timers = results.SelectMany(i => i.ToList());
if (query.IsActive.HasValue)
{
if (query.IsActive.Value)
{
timers = timers.Where(i => i.Item1.Status == RecordingStatus.InProgress);
}
else
{
timers = timers.Where(i => i.Item1.Status != RecordingStatus.InProgress);
}
}
if (!string.IsNullOrEmpty(query.ChannelId)) if (!string.IsNullOrEmpty(query.ChannelId))
{ {
var guid = new Guid(query.ChannelId); var guid = new Guid(query.ChannelId);

View File

@ -392,7 +392,103 @@
<EmbeddedResource Include="Localization\Ratings\ru.txt" /> <EmbeddedResource Include="Localization\Ratings\ru.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\backbone-min.js">
<Link>swagger-ui\lib\backbone-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\handlebars-2.0.0.js">
<Link>swagger-ui\lib\handlebars-2.0.0.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\highlight.7.3.pack.js">
<Link>swagger-ui\lib\highlight.7.3.pack.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery-1.8.0.min.js">
<Link>swagger-ui\lib\jquery-1.8.0.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.ba-bbq.min.js">
<Link>swagger-ui\lib\jquery.ba-bbq.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.slideto.min.js">
<Link>swagger-ui\lib\jquery.slideto.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.wiggle.min.js">
<Link>swagger-ui\lib\jquery.wiggle.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\marked.js">
<Link>swagger-ui\lib\marked.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred.bundle.js">
<Link>swagger-ui\lib\shred.bundle.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger-client.js">
<Link>swagger-ui\lib\swagger-client.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger-oauth.js">
<Link>swagger-ui\lib\swagger-oauth.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\underscore-min.js">
<Link>swagger-ui\lib\underscore-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\o2c.html">
<Link>swagger-ui\o2c.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\patch.js">
<Link>swagger-ui\patch.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.js">
<Link>swagger-ui\swagger-ui.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.min.js">
<Link>swagger-ui\swagger-ui.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Localization\countries.json" /> <EmbeddedResource Include="Localization\countries.json" />
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.eot">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.eot</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.ttf">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.ttf</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.woff2">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.woff2</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="app.config" /> <None Include="app.config" />
<EmbeddedResource Include="Localization\Core\core.json" /> <EmbeddedResource Include="Localization\Core\core.json" />
<EmbeddedResource Include="Localization\Core\ar.json" /> <EmbeddedResource Include="Localization\Core\ar.json" />
@ -609,10 +705,30 @@
<EmbeddedResource Include="Localization\Ratings\ca.txt" /> <EmbeddedResource Include="Localization\Ratings\ca.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\reset.css">
<Link>swagger-ui\css\reset.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\screen.css"> <Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\screen.css">
<Link>swagger-ui\css\screen.css</Link> <Link>swagger-ui\css\screen.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\typography.css">
<Link>swagger-ui\css\typography.css</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-700.svg">
<Link>swagger-ui\fonts\droid-sans-v6-latin-700.svg</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\fonts\droid-sans-v6-latin-regular.svg">
<Link>swagger-ui\fonts\droid-sans-v6-latin-regular.svg</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\explorer_icons.png">
<Link>swagger-ui\images\explorer_icons.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\logo_small.png"> <Content Include="..\ThirdParty\ServiceStack\swagger-ui\images\logo_small.png">
<Link>swagger-ui\images\logo_small.png</Link> <Link>swagger-ui\images\logo_small.png</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -633,58 +749,10 @@
<Link>swagger-ui\index.html</Link> <Link>swagger-ui\index.html</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\backbone-min.js">
<Link>swagger-ui\lib\backbone-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\handlebars-1.0.0.js">
<Link>swagger-ui\lib\handlebars-1.0.0.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\highlight.7.3.pack.js">
<Link>swagger-ui\lib\highlight.7.3.pack.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery-1.8.0.min.js">
<Link>swagger-ui\lib\jquery-1.8.0.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.ba-bbq.min.js">
<Link>swagger-ui\lib\jquery.ba-bbq.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.slideto.min.js">
<Link>swagger-ui\lib\jquery.slideto.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\jquery.wiggle.min.js">
<Link>swagger-ui\lib\jquery.wiggle.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred.bundle.js">
<Link>swagger-ui\lib\shred.bundle.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred\content.js"> <Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\shred\content.js">
<Link>swagger-ui\lib\shred\content.js</Link> <Link>swagger-ui\lib\shred\content.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\swagger.js">
<Link>swagger-ui\lib\swagger.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\lib\underscore-min.js">
<Link>swagger-ui\lib\underscore-min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.js">
<Link>swagger-ui\swagger-ui.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\swagger-ui.min.js">
<Link>swagger-ui\swagger-ui.min.js</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Localization\iso6392.txt" /> <EmbeddedResource Include="Localization\iso6392.txt" />
<EmbeddedResource Include="Localization\Ratings\be.txt" /> <EmbeddedResource Include="Localization\Ratings\be.txt" />
</ItemGroup> </ItemGroup>

View File

@ -1134,11 +1134,11 @@ namespace MediaBrowser.Server.Implementations.Session
/// </summary> /// </summary>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public Task SendRestartRequiredNotification(CancellationToken cancellationToken) public async Task SendRestartRequiredNotification(CancellationToken cancellationToken)
{ {
var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList(); var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList();
var info = _appHost.GetSystemInfo(); var info = await _appHost.GetSystemInfo().ConfigureAwait(false);
var tasks = sessions.Select(session => Task.Run(async () => var tasks = sessions.Select(session => Task.Run(async () =>
{ {
@ -1153,7 +1153,7 @@ namespace MediaBrowser.Server.Implementations.Session
}, cancellationToken)); }, cancellationToken));
return Task.WhenAll(tasks); await Task.WhenAll(tasks).ConfigureAwait(false);
} }
/// <summary> /// <summary>

View File

@ -43,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.Social
throw new ResourceNotFoundException(); throw new ResourceNotFoundException();
} }
var externalUrl = _appHost.GetSystemInfo().WanAddress; var externalUrl = (await _appHost.GetSystemInfo().ConfigureAwait(false)).WanAddress;
if (string.IsNullOrWhiteSpace(externalUrl)) if (string.IsNullOrWhiteSpace(externalUrl))
{ {
@ -58,7 +58,7 @@ namespace MediaBrowser.Server.Implementations.Social
UserId = userId UserId = userId
}; };
AddShareInfo(info); AddShareInfo(info, externalUrl);
await _repository.CreateShare(info).ConfigureAwait(false); await _repository.CreateShare(info).ConfigureAwait(false);
@ -74,15 +74,13 @@ namespace MediaBrowser.Server.Implementations.Social
{ {
var info = _repository.GetShareInfo(id); var info = _repository.GetShareInfo(id);
AddShareInfo(info); AddShareInfo(info, _appHost.GetSystemInfo().Result.WanAddress);
return info; return info;
} }
private void AddShareInfo(SocialShareInfo info) private void AddShareInfo(SocialShareInfo info, string externalUrl)
{ {
var externalUrl = _appHost.GetSystemInfo().WanAddress;
info.ImageUrl = externalUrl + "/Social/Shares/Public/" + info.Id + "/Image"; info.ImageUrl = externalUrl + "/Social/Shares/Public/" + info.Id + "/Image";
info.Url = externalUrl + "/emby/web/shared.html?id=" + info.Id; info.Url = externalUrl + "/emby/web/shared.html?id=" + info.Id;

View File

@ -1098,8 +1098,10 @@ namespace MediaBrowser.Server.Startup.Common
/// Gets the system status. /// Gets the system status.
/// </summary> /// </summary>
/// <returns>SystemInfo.</returns> /// <returns>SystemInfo.</returns>
public SystemInfo GetSystemInfo() public async Task<SystemInfo> GetSystemInfo()
{ {
var localAddress = await GetLocalApiUrl().ConfigureAwait(false);
return new SystemInfo return new SystemInfo
{ {
HasPendingRestart = HasPendingRestart, HasPendingRestart = HasPendingRestart,
@ -1130,7 +1132,7 @@ namespace MediaBrowser.Server.Startup.Common
IsRunningAsService = IsRunningAsService, IsRunningAsService = IsRunningAsService,
SupportsRunningAsService = SupportsRunningAsService, SupportsRunningAsService = SupportsRunningAsService,
ServerName = FriendlyName, ServerName = FriendlyName,
LocalAddress = GetLocalApiUrl().Result, LocalAddress = localAddress,
SupportsLibraryMonitor = SupportsLibraryMonitor SupportsLibraryMonitor = SupportsLibraryMonitor
}; };
} }