mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
commit
8d8b20227f
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user