浏览代码

update components

Luke Pulverenti 9 年之前
父节点
当前提交
7627c6707d

+ 2 - 2
MediaBrowser.Api/StartupWizardService.cs

@@ -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
             {
             {

+ 1 - 1
MediaBrowser.Api/System/SystemInfoWebSocketListener.cs

@@ -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();
         }
         }
     }
     }
 }
 }

+ 4 - 4
MediaBrowser.Api/System/SystemService.cs

@@ -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
             {
             {

+ 1 - 1
MediaBrowser.Controller/IServerApplicationHost.cs

@@ -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].

+ 4 - 0
MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs

@@ -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();
         }
         }
 
 

+ 16 - 0
MediaBrowser.Server.Implementations/HttpServer/SocketSharp/RequestMono.cs

@@ -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;

+ 1 - 1
MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpRequest.cs

@@ -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);
         }
         }

+ 15 - 2
MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs

@@ -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()
+        {
+        }
     }
     }
 }
 }

+ 116 - 48
MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj

@@ -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>

+ 3 - 3
MediaBrowser.Server.Implementations/Session/SessionManager.cs

@@ -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>

+ 4 - 6
MediaBrowser.Server.Implementations/Social/SharingManager.cs

@@ -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;
 
 

+ 4 - 2
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -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
             };
             };
         }
         }