aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Dlna/DlnaManager.cs7
-rw-r--r--MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs9
-rw-r--r--MediaBrowser.Server.Implementations/IO/FileRefresher.cs7
-rw-r--r--MediaBrowser.WebDashboard/Api/DashboardService.cs61
-rw-r--r--MediaBrowser.WebDashboard/Api/PackageCreator.cs10
-rw-r--r--MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj11
6 files changed, 74 insertions, 31 deletions
diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs
index 931cc208f..a01d73451 100644
--- a/MediaBrowser.Dlna/DlnaManager.cs
+++ b/MediaBrowser.Dlna/DlnaManager.cs
@@ -73,8 +73,13 @@ namespace MediaBrowser.Dlna
lock (_profiles)
{
var list = _profiles.Values.ToList();
- return list.Select(i => i.Item2).OrderBy(i => i.Name);
+ return list
+ .OrderBy(i => i.Item1.Info.Type == DeviceProfileType.User ? 0 : 1)
+ .ThenBy(i => i.Item1.Info.Name)
+ .Select(i => i.Item2)
+ .ToList();
}
+
}
public DeviceProfile GetDefaultProfile()
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs
index 11280cff2..e36be5419 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs
@@ -171,10 +171,13 @@ namespace MediaBrowser.Providers.MediaInfo
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
- var file = directoryService.GetFile(item.Path);
- if (file != null && file.LastWriteTimeUtc != item.DateModified)
+ if (!string.IsNullOrWhiteSpace(item.Path))
{
- return true;
+ var file = directoryService.GetFile(item.Path);
+ if (file != null && file.LastWriteTimeUtc != item.DateModified)
+ {
+ return true;
+ }
}
if (item.SupportsLocalMetadata)
diff --git a/MediaBrowser.Server.Implementations/IO/FileRefresher.cs b/MediaBrowser.Server.Implementations/IO/FileRefresher.cs
index f48beacb5..742585143 100644
--- a/MediaBrowser.Server.Implementations/IO/FileRefresher.cs
+++ b/MediaBrowser.Server.Implementations/IO/FileRefresher.cs
@@ -61,6 +61,11 @@ namespace MediaBrowser.Server.Implementations.IO
public void RestartTimer()
{
+ if (_disposed)
+ {
+ return;
+ }
+
lock (_timerLock)
{
if (_timer == null)
@@ -281,8 +286,10 @@ namespace MediaBrowser.Server.Implementations.IO
}
}
+ private bool _disposed;
public void Dispose()
{
+ _disposed = true;
DisposeTimer();
}
}
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 34ad32111..4e4a98060 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -58,6 +58,11 @@ namespace MediaBrowser.WebDashboard.Api
{
}
+ [Route("/web/staticfiles", "GET")]
+ public class GetCacheFiles
+ {
+ }
+
/// <summary>
/// Class GetDashboardResource
/// </summary>
@@ -140,6 +145,27 @@ namespace MediaBrowser.WebDashboard.Api
return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml("dummy.html", page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false));
}
+ public object Get(GetCacheFiles request)
+ {
+ var allFiles = GetCacheFileList();
+
+ return ResultFactory.GetOptimizedResult(Request, _jsonSerializer.SerializeToString(allFiles));
+ }
+
+ private List<string> GetCacheFileList()
+ {
+ var creator = GetPackageCreator();
+ var directory = creator.DashboardUIPath;
+
+ var skipExtensions = GetUndeployedExtensions();
+
+ return
+ Directory.GetFiles(directory, "*", SearchOption.AllDirectories)
+ .Where(i => !skipExtensions.Contains(Path.GetExtension(i) ?? string.Empty, StringComparer.OrdinalIgnoreCase))
+ .Select(i => i.Replace(directory, string.Empty, StringComparison.OrdinalIgnoreCase).Replace("\\", "/").TrimStart('/') + "?v=" + _appHost.ApplicationVersion.ToString())
+ .ToList();
+ }
+
/// <summary>
/// Gets the specified request.
/// </summary>
@@ -274,6 +300,21 @@ namespace MediaBrowser.WebDashboard.Api
return new PackageCreator(_fileSystem, _localization, Logger, _serverConfigurationManager, _jsonSerializer);
}
+ private List<string> GetUndeployedExtensions()
+ {
+ var list = new List<string>();
+
+ list.Add(".log");
+ list.Add(".txt");
+ list.Add(".map");
+ list.Add(".md");
+ list.Add(".gz");
+ list.Add(".bat");
+ list.Add(".sh");
+
+ return list;
+ }
+
public async Task<object> Get(GetDashboardPackage request)
{
var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
@@ -296,12 +337,9 @@ namespace MediaBrowser.WebDashboard.Api
var appVersion = _appHost.ApplicationVersion.ToString();
- var mode = request.Mode;
+ File.WriteAllText(Path.Combine(path, "staticfiles"), _jsonSerializer.SerializeToString(GetCacheFileList()));
- if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
- {
- _fileSystem.DeleteFile(Path.Combine(path, "scripts", "registrationservices.js"));
- }
+ var mode = request.Mode;
// Try to trim the output size a bit
var bowerPath = Path.Combine(path, "bower_components");
@@ -313,14 +351,9 @@ namespace MediaBrowser.WebDashboard.Api
//bowerPath = versionedBowerPath;
}
- DeleteFilesByExtension(bowerPath, ".log");
- DeleteFilesByExtension(bowerPath, ".txt");
- DeleteFilesByExtension(bowerPath, ".map");
- DeleteFilesByExtension(bowerPath, ".md");
+ GetUndeployedExtensions().ForEach(i => DeleteFilesByExtension(bowerPath, i));
+
DeleteFilesByExtension(bowerPath, ".json", "strings\\");
- DeleteFilesByExtension(bowerPath, ".gz");
- DeleteFilesByExtension(bowerPath, ".bat");
- DeleteFilesByExtension(bowerPath, ".sh");
DeleteFilesByName(bowerPath, "copying", true);
DeleteFilesByName(bowerPath, "license", true);
DeleteFilesByName(bowerPath, "license-mit", true);
@@ -359,13 +392,11 @@ namespace MediaBrowser.WebDashboard.Api
//DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
//DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
//DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src");
-
+
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
// Delete things that are unneeded in an attempt to keep the output as trim as possible
_fileSystem.DeleteDirectory(Path.Combine(path, "css", "images", "tour"), true);
-
- _fileSystem.DeleteFile(Path.Combine(path, "thirdparty", "jquerymobile-1.4.5", "jquery.mobile-1.4.5.min.map"));
}
else
{
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
index b7b1f1dfd..c5af1cee7 100644
--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs
+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
@@ -372,12 +372,12 @@ namespace MediaBrowser.WebDashboard.Api
sb.Append("<meta property=\"fb:app_id\" content=\"1618309211750238\">");
// http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
- sb.Append("<link rel=\"apple-touch-icon\" href=\"css/images/touchicon.png\">");
- sb.Append("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"css/images/touchicon72.png\">");
- sb.Append("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"css/images/touchicon114.png\">");
+ sb.Append("<link rel=\"apple-touch-icon\" href=\"touchicon.png\">");
+ sb.Append("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"touchicon72.png\">");
+ sb.Append("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"touchicon114.png\">");
sb.Append("<link rel=\"apple-touch-startup-image\" href=\"css/images/iossplash.png\">");
sb.Append("<link rel=\"shortcut icon\" href=\"css/images/favicon.ico\">");
- sb.Append("<meta name=\"msapplication-TileImage\" content=\"css/images/touchicon144.png\">");
+ sb.Append("<meta name=\"msapplication-TileImage\" content=\"touchicon144.png\">");
sb.Append("<meta name=\"msapplication-TileColor\" content=\"#333333\">");
sb.Append("<meta name=\"theme-color\" content=\"#43A047\">");
@@ -431,7 +431,7 @@ namespace MediaBrowser.WebDashboard.Api
var files = new List<string>();
- files.Add("bower_components/requirejs/require.js");
+ files.Add("bower_components/requirejs/require.js" + versionString);
files.Add("scripts/site.js" + versionString);
diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
index cc064dc81..2917ec2ce 100644
--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
@@ -233,10 +233,7 @@
<Content Include="dashboard-ui\css\images\empty.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\css\images\logo536.png">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="dashboard-ui\css\images\touchicon144.png">
+ <Content Include="dashboard-ui\touchicon144.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\tour\admin\help.png">
@@ -1196,13 +1193,13 @@
</Content>
</ItemGroup>
<ItemGroup>
- <Content Include="dashboard-ui\css\images\touchicon.png">
+ <Content Include="dashboard-ui\touchicon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\css\images\touchicon114.png">
+ <Content Include="dashboard-ui\touchicon114.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="dashboard-ui\css\images\touchicon72.png">
+ <Content Include="dashboard-ui\touchicon72.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>