diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index d125047f52..f4e1d84ac6 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -268,7 +268,14 @@ namespace MediaBrowser.Model.Configuration
/// true if [enable dashboard response caching]; otherwise, false.
[ProtoMember(61)]
public bool EnableDashboardResponseCaching { get; set; }
-
+
+ ///
+ /// Allows the dashboard to be served from a custom path.
+ ///
+ /// The dashboard source path.
+ [ProtoMember(62)]
+ public string DashboardSourcePath { get; set; }
+
// Next Proto number ====> 62
///
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 5a8e7a6ff0..7c3de72fe8 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -140,6 +140,35 @@ namespace MediaBrowser.WebDashboard.Api
_serverConfigurationManager = serverConfigurationManager;
}
+ ///
+ /// Gets the dashboard UI path.
+ ///
+ /// The dashboard UI path.
+ public string DashboardUIPath
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(_serverConfigurationManager.Configuration.DashboardSourcePath))
+ {
+ return _serverConfigurationManager.Configuration.DashboardSourcePath;
+ }
+
+ var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
+
+ return Path.Combine(runningDirectory, "dashboard-ui");
+ }
+ }
+
+ ///
+ /// Gets the dashboard resource path.
+ ///
+ /// The virtual path.
+ /// System.String.
+ private string GetDashboardResourcePath(string virtualPath)
+ {
+ return Path.Combine(DashboardUIPath, virtualPath.Replace('/', '\\'));
+ }
+
///
/// Gets the specified request.
///
@@ -290,11 +319,7 @@ namespace MediaBrowser.WebDashboard.Api
/// Task{Stream}.
private Stream GetRawResourceStream(string path)
{
- var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
-
- path = Path.Combine(runningDirectory, "dashboard-ui", path.Replace('/', '\\'));
-
- return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, StreamDefaults.DefaultFileStreamBufferSize, true);
+ return new FileStream(GetDashboardResourcePath(path), FileMode.Open, FileAccess.Read, FileShare.ReadWrite, StreamDefaults.DefaultFileStreamBufferSize, true);
// This code is used when the files are embedded resources
//return GetType().Assembly.GetManifestResourceStream("MediaBrowser.WebDashboard.Html." + ConvertUrlToResourcePath(path));
@@ -564,9 +589,7 @@ namespace MediaBrowser.WebDashboard.Api
/// Task.
private async Task AppendResource(Stream outputStream, string path, byte[] newLineBytes)
{
- var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
-
- path = Path.Combine(runningDirectory, "dashboard-ui", path.Replace('/', '\\'));
+ path = GetDashboardResourcePath(path);
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, StreamDefaults.DefaultFileStreamBufferSize, true))
{