Merge pull request #2047 from MediaBrowser/dev

Dev
pull/702/head
Luke 8 years ago committed by GitHub
commit 8d8b20227f

@ -73,8 +73,13 @@ namespace MediaBrowser.Dlna
lock (_profiles) lock (_profiles)
{ {
var list = _profiles.Values.ToList(); 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() public DeviceProfile GetDefaultProfile()

@ -171,10 +171,13 @@ namespace MediaBrowser.Providers.MediaInfo
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{ {
var file = directoryService.GetFile(item.Path); if (!string.IsNullOrWhiteSpace(item.Path))
if (file != null && file.LastWriteTimeUtc != item.DateModified)
{ {
return true; var file = directoryService.GetFile(item.Path);
if (file != null && file.LastWriteTimeUtc != item.DateModified)
{
return true;
}
} }
if (item.SupportsLocalMetadata) if (item.SupportsLocalMetadata)

@ -61,6 +61,11 @@ namespace MediaBrowser.Server.Implementations.IO
public void RestartTimer() public void RestartTimer()
{ {
if (_disposed)
{
return;
}
lock (_timerLock) lock (_timerLock)
{ {
if (_timer == null) if (_timer == null)
@ -281,8 +286,10 @@ namespace MediaBrowser.Server.Implementations.IO
} }
} }
private bool _disposed;
public void Dispose() public void Dispose()
{ {
_disposed = true;
DisposeTimer(); DisposeTimer();
} }
} }

@ -58,6 +58,11 @@ namespace MediaBrowser.WebDashboard.Api
{ {
} }
[Route("/web/staticfiles", "GET")]
public class GetCacheFiles
{
}
/// <summary> /// <summary>
/// Class GetDashboardResource /// Class GetDashboardResource
/// </summary> /// </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)); 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> /// <summary>
/// Gets the specified request. /// Gets the specified request.
/// </summary> /// </summary>
@ -274,6 +300,21 @@ namespace MediaBrowser.WebDashboard.Api
return new PackageCreator(_fileSystem, _localization, Logger, _serverConfigurationManager, _jsonSerializer); 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) public async Task<object> Get(GetDashboardPackage request)
{ {
var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath, var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
@ -296,12 +337,9 @@ namespace MediaBrowser.WebDashboard.Api
var appVersion = _appHost.ApplicationVersion.ToString(); 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)) var mode = request.Mode;
{
_fileSystem.DeleteFile(Path.Combine(path, "scripts", "registrationservices.js"));
}
// Try to trim the output size a bit // Try to trim the output size a bit
var bowerPath = Path.Combine(path, "bower_components"); var bowerPath = Path.Combine(path, "bower_components");
@ -313,14 +351,9 @@ namespace MediaBrowser.WebDashboard.Api
//bowerPath = versionedBowerPath; //bowerPath = versionedBowerPath;
} }
DeleteFilesByExtension(bowerPath, ".log"); GetUndeployedExtensions().ForEach(i => DeleteFilesByExtension(bowerPath, i));
DeleteFilesByExtension(bowerPath, ".txt");
DeleteFilesByExtension(bowerPath, ".map");
DeleteFilesByExtension(bowerPath, ".md");
DeleteFilesByExtension(bowerPath, ".json", "strings\\"); DeleteFilesByExtension(bowerPath, ".json", "strings\\");
DeleteFilesByExtension(bowerPath, ".gz");
DeleteFilesByExtension(bowerPath, ".bat");
DeleteFilesByExtension(bowerPath, ".sh");
DeleteFilesByName(bowerPath, "copying", true); DeleteFilesByName(bowerPath, "copying", true);
DeleteFilesByName(bowerPath, "license", true); DeleteFilesByName(bowerPath, "license", true);
DeleteFilesByName(bowerPath, "license-mit", 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"), "meteor");
//DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st"); //DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
//DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src"); //DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src");
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase)) if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{ {
// Delete things that are unneeded in an attempt to keep the output as trim as possible // 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.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 else
{ {

@ -372,12 +372,12 @@ namespace MediaBrowser.WebDashboard.Api
sb.Append("<meta property=\"fb:app_id\" content=\"1618309211750238\">"); sb.Append("<meta property=\"fb:app_id\" content=\"1618309211750238\">");
// http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html // 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\" href=\"touchicon.png\">");
sb.Append("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"css/images/touchicon72.png\">"); sb.Append("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"touchicon72.png\">");
sb.Append("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"css/images/touchicon114.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=\"apple-touch-startup-image\" href=\"css/images/iossplash.png\">");
sb.Append("<link rel=\"shortcut icon\" href=\"css/images/favicon.ico\">"); 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=\"msapplication-TileColor\" content=\"#333333\">");
sb.Append("<meta name=\"theme-color\" content=\"#43A047\">"); sb.Append("<meta name=\"theme-color\" content=\"#43A047\">");
@ -431,7 +431,7 @@ namespace MediaBrowser.WebDashboard.Api
var files = new List<string>(); 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); files.Add("scripts/site.js" + versionString);

@ -233,10 +233,7 @@
<Content Include="dashboard-ui\css\images\empty.png"> <Content Include="dashboard-ui\css\images\empty.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\css\images\logo536.png"> <Content Include="dashboard-ui\touchicon144.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\touchicon144.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\css\images\tour\admin\help.png"> <Content Include="dashboard-ui\css\images\tour\admin\help.png">
@ -1196,13 +1193,13 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="dashboard-ui\css\images\touchicon.png"> <Content Include="dashboard-ui\touchicon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\css\images\touchicon114.png"> <Content Include="dashboard-ui\touchicon114.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\css\images\touchicon72.png"> <Content Include="dashboard-ui\touchicon72.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save