mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
commit
25400d89a9
9 changed files with 180 additions and 42 deletions
|
@ -33,7 +33,6 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
EnableKeepAlive = false,
|
||||
CancellationToken = cancellationToken,
|
||||
UserAgent = "Emby/3.0"
|
||||
|
||||
};
|
||||
|
||||
if (_cacheLength.Ticks > 0)
|
||||
|
|
|
@ -74,6 +74,8 @@ namespace MediaBrowser.Model.Configuration
|
|||
/// <value>The metadata path.</value>
|
||||
public string MetadataPath { get; set; }
|
||||
|
||||
public string LastVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display name of the season zero.
|
||||
/// </summary>
|
||||
|
|
|
@ -428,8 +428,24 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
|
||||
if (string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(localPath, "/mediabrowser", StringComparison.OrdinalIgnoreCase) ||
|
||||
localPath.IndexOf("mediabrowser/web", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||
localPath.IndexOf("dashboard/", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
localPath.IndexOf("mediabrowser/web", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
httpRes.StatusCode = 200;
|
||||
httpRes.ContentType = "text/html";
|
||||
var newUrl = urlString.Replace("mediabrowser", "emby", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("/dashboard/", "/web/", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (!string.Equals(newUrl, urlString, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
httpRes.Write("<!doctype html><html><head><title>Emby</title></head><body>Please update your Emby bookmark to <a href=\"" + newUrl + "\">" + newUrl + "</a></body></html>");
|
||||
|
||||
httpRes.Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (localPath.IndexOf("dashboard/", StringComparison.OrdinalIgnoreCase) != -1 &&
|
||||
localPath.IndexOf("web/dashboard", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
httpRes.StatusCode = 200;
|
||||
httpRes.ContentType = "text/html";
|
||||
|
|
|
@ -385,6 +385,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
new OmdbEpisodeProviderMigration(ServerConfigurationManager),
|
||||
new MovieDbEpisodeProviderMigration(ServerConfigurationManager),
|
||||
new DbMigration(ServerConfigurationManager, TaskManager),
|
||||
new UpdateLevelMigration(ServerConfigurationManager, this, HttpClient, JsonSerializer, _releaseAssetFilename),
|
||||
new FolderViewSettingMigration(ServerConfigurationManager, UserManager),
|
||||
new CollectionGroupingMigration(ServerConfigurationManager, UserManager),
|
||||
new CollectionsViewMigration(ServerConfigurationManager, UserManager)
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
<Compile Include="Migrations\DbMigration.cs" />
|
||||
<Compile Include="Migrations\MovieDbEpisodeProviderMigration.cs" />
|
||||
<Compile Include="Migrations\OmdbEpisodeProviderMigration.cs" />
|
||||
<Compile Include="Migrations\UpdateLevelMigration.cs" />
|
||||
<Compile Include="NativeEnvironment.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StartupOptions.cs" />
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Implementations.Updates;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Updates;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
public class UpdateLevelMigration : IVersionMigration
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly string _releaseAssetFilename;
|
||||
|
||||
public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename)
|
||||
{
|
||||
_config = config;
|
||||
_appHost = appHost;
|
||||
_httpClient = httpClient;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_releaseAssetFilename = releaseAssetFilename;
|
||||
}
|
||||
|
||||
public async void Run()
|
||||
{
|
||||
var lastVersion = _config.Configuration.LastVersion;
|
||||
var currentVersion = _appHost.ApplicationVersion;
|
||||
|
||||
if (string.Equals(lastVersion, currentVersion.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var updateLevel = _config.Configuration.SystemUpdateLevel;
|
||||
|
||||
// Go down a level
|
||||
if (updateLevel == PackageVersionClass.Release)
|
||||
{
|
||||
updateLevel = PackageVersionClass.Beta;
|
||||
}
|
||||
else if (updateLevel == PackageVersionClass.Beta)
|
||||
{
|
||||
updateLevel = PackageVersionClass.Dev;
|
||||
}
|
||||
else if (updateLevel == PackageVersionClass.Dev)
|
||||
{
|
||||
// It's already dev, there's nothing to check
|
||||
return;
|
||||
}
|
||||
|
||||
await CheckVersion(currentVersion, updateLevel, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CheckVersion(Version currentVersion, PackageVersionClass updateLevel, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await new GithubUpdater(_httpClient, _jsonSerializer, TimeSpan.FromMinutes(5))
|
||||
.CheckForUpdateResult("MediaBrowser", "Emby", currentVersion, PackageVersionClass.Beta, _releaseAssetFilename, "MBServer", "Mbserver.zip",
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result != null && result.IsUpdateAvailable)
|
||||
{
|
||||
_config.Configuration.SystemUpdateLevel = updateLevel;
|
||||
_config.SaveConfiguration();
|
||||
return;
|
||||
}
|
||||
|
||||
// Go down a level
|
||||
if (updateLevel == PackageVersionClass.Release)
|
||||
{
|
||||
updateLevel = PackageVersionClass.Beta;
|
||||
}
|
||||
else if (updateLevel == PackageVersionClass.Beta)
|
||||
{
|
||||
updateLevel = PackageVersionClass.Dev;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await CheckVersion(currentVersion, updateLevel, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -157,11 +157,21 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
var creator = GetPackageCreator();
|
||||
var directory = creator.DashboardUIPath;
|
||||
|
||||
var skipExtensions = GetUndeployedExtensions();
|
||||
var skipExtensions = GetDeployIgnoreExtensions();
|
||||
var skipNames = GetDeployIgnoreFilenames();
|
||||
|
||||
return
|
||||
Directory.GetFiles(directory, "*", SearchOption.AllDirectories)
|
||||
.Where(i => !skipExtensions.Contains(Path.GetExtension(i) ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
.Where(i => !skipNames.Any(s =>
|
||||
{
|
||||
if (s.Item2)
|
||||
{
|
||||
return string.Equals(s.Item1, Path.GetFileName(i), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
return (Path.GetFileName(i) ?? string.Empty).IndexOf(s.Item1, StringComparison.OrdinalIgnoreCase) != -1;
|
||||
}))
|
||||
.Select(i => i.Replace(directory, string.Empty, StringComparison.OrdinalIgnoreCase).Replace("\\", "/").TrimStart('/') + "?v=" + _appHost.ApplicationVersion.ToString())
|
||||
.ToList();
|
||||
}
|
||||
|
@ -300,7 +310,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
return new PackageCreator(_fileSystem, _localization, Logger, _serverConfigurationManager, _jsonSerializer);
|
||||
}
|
||||
|
||||
private List<string> GetUndeployedExtensions()
|
||||
private List<string> GetDeployIgnoreExtensions()
|
||||
{
|
||||
var list = new List<string>();
|
||||
|
||||
|
@ -315,6 +325,28 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
return list;
|
||||
}
|
||||
|
||||
private List<Tuple<string,bool>> GetDeployIgnoreFilenames()
|
||||
{
|
||||
var list = new List<Tuple<string, bool>>();
|
||||
|
||||
list.Add(new Tuple<string, bool>("copying", true));
|
||||
list.Add(new Tuple<string, bool>("license", true));
|
||||
list.Add(new Tuple<string, bool>("license-mit", true));
|
||||
list.Add(new Tuple<string, bool>("gitignore", false));
|
||||
list.Add(new Tuple<string, bool>("npmignore", false));
|
||||
list.Add(new Tuple<string, bool>("jshintrc", false));
|
||||
list.Add(new Tuple<string, bool>("gruntfile", false));
|
||||
list.Add(new Tuple<string, bool>("bowerrc", false));
|
||||
list.Add(new Tuple<string, bool>("jscsrc", false));
|
||||
list.Add(new Tuple<string, bool>("hero.svg", false));
|
||||
list.Add(new Tuple<string, bool>("travis.yml", false));
|
||||
list.Add(new Tuple<string, bool>("build.js", false));
|
||||
list.Add(new Tuple<string, bool>("editorconfig", false));
|
||||
list.Add(new Tuple<string, bool>("gitattributes", false));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetDashboardPackage request)
|
||||
{
|
||||
var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
|
||||
|
@ -344,30 +376,12 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
// Try to trim the output size a bit
|
||||
var bowerPath = Path.Combine(path, "bower_components");
|
||||
|
||||
if (!string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//var versionedBowerPath = Path.Combine(Path.GetDirectoryName(bowerPath), "bower_components" + _appHost.ApplicationVersion);
|
||||
//Directory.Move(bowerPath, versionedBowerPath);
|
||||
//bowerPath = versionedBowerPath;
|
||||
}
|
||||
|
||||
GetUndeployedExtensions().ForEach(i => DeleteFilesByExtension(bowerPath, i));
|
||||
GetDeployIgnoreExtensions().ForEach(i => DeleteFilesByExtension(bowerPath, i));
|
||||
|
||||
DeleteFilesByExtension(bowerPath, ".json", "strings\\");
|
||||
DeleteFilesByName(bowerPath, "copying", true);
|
||||
DeleteFilesByName(bowerPath, "license", true);
|
||||
DeleteFilesByName(bowerPath, "license-mit", true);
|
||||
DeleteFilesByName(bowerPath, "gitignore");
|
||||
DeleteFilesByName(bowerPath, "npmignore");
|
||||
DeleteFilesByName(bowerPath, "jshintrc");
|
||||
DeleteFilesByName(bowerPath, "gruntfile");
|
||||
DeleteFilesByName(bowerPath, "bowerrc");
|
||||
DeleteFilesByName(bowerPath, "jscsrc");
|
||||
DeleteFilesByName(bowerPath, "hero.svg");
|
||||
DeleteFilesByName(bowerPath, "travis.yml");
|
||||
DeleteFilesByName(bowerPath, "build.js");
|
||||
DeleteFilesByName(bowerPath, "editorconfig");
|
||||
DeleteFilesByName(bowerPath, "gitattributes");
|
||||
|
||||
GetDeployIgnoreFilenames().ForEach(i => DeleteFilesByName(bowerPath, i.Item1, i.Item2));
|
||||
|
||||
DeleteFoldersByName(bowerPath, "demo");
|
||||
DeleteFoldersByName(bowerPath, "test");
|
||||
DeleteFoldersByName(bowerPath, "guides");
|
||||
|
|
|
@ -101,6 +101,9 @@
|
|||
<Content Include="dashboard-ui\autoorganizesmart.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\camerauploadsettings.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\components\appfooter\appfooter.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -185,6 +188,9 @@
|
|||
<Content Include="dashboard-ui\css\images\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\camerauploadsettings.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\userpasswordpage.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -326,7 +332,7 @@
|
|||
<Content Include="dashboard-ui\scripts\homeupcoming.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\librarydisplay.js">
|
||||
<Content Include="dashboard-ui\dashboard\librarydisplay.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\livetvguideprovider.js">
|
||||
|
@ -338,7 +344,7 @@
|
|||
<Content Include="dashboard-ui\scripts\livetvtunerprovider-m3u.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\livetvtunerprovider-satip.js">
|
||||
<Content Include="dashboard-ui\dashboard\livetvtunerprovider-satip.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\localsync.js">
|
||||
|
@ -356,7 +362,7 @@
|
|||
<Content Include="dashboard-ui\scripts\mysyncsettings.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\autoorganizesmart.js">
|
||||
<Content Include="dashboard-ui\dashboard\autoorganizesmart.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\searchpage.js">
|
||||
|
@ -377,7 +383,7 @@
|
|||
<Content Include="dashboard-ui\scripts\tvlatest.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\wizardcomponents.js">
|
||||
<Content Include="dashboard-ui\dashboard\wizardcomponents.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\wizardcontroller.js">
|
||||
|
@ -503,7 +509,7 @@
|
|||
<Content Include="dashboard-ui\photos.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\dashboardhosting.js">
|
||||
<Content Include="dashboard-ui\dashboard\dashboardhosting.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\forgotpassword.js">
|
||||
|
@ -863,13 +869,13 @@
|
|||
<Content Include="dashboard-ui\scripts\chromecast.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\cinemamodeconfiguration.js">
|
||||
<Content Include="dashboard-ui\dashboard\cinemamodeconfiguration.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\connectlogin.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\dashboardgeneral.js">
|
||||
<Content Include="dashboard-ui\dashboard\dashboardgeneral.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\syncactivity.js">
|
||||
|
@ -881,7 +887,7 @@
|
|||
<Content Include="dashboard-ui\scripts\devices.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\devicesupload.js">
|
||||
<Content Include="dashboard-ui\dashboard\devicesupload.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\dlnaprofile.js">
|
||||
|
@ -896,10 +902,10 @@
|
|||
<Content Include="dashboard-ui\scripts\encodingsettings.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\autoorganizetv.js">
|
||||
<Content Include="dashboard-ui\dashboard\autoorganizetv.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\autoorganizelog.js">
|
||||
<Content Include="dashboard-ui\dashboard\autoorganizelog.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\externalplayer.js">
|
||||
|
@ -1089,7 +1095,7 @@
|
|||
<Content Include="dashboard-ui\scripts\edititemmetadata.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\librarysettings.js">
|
||||
<Content Include="dashboard-ui\dashboard\librarysettings.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\musicrecommended.js">
|
||||
|
@ -1356,7 +1362,7 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="dashboard-ui\scripts\logpage.js">
|
||||
<Content Include="dashboard-ui\dashboard\logpage.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
@ -1429,7 +1435,7 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="dashboard-ui\scripts\aboutpage.js">
|
||||
<Content Include="dashboard-ui\dashboard\aboutpage.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\supporter\supporterflag.png">
|
||||
|
@ -1441,7 +1447,7 @@
|
|||
<Content Include="dashboard-ui\itemlist.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\wizardfinishpage.js">
|
||||
<Content Include="dashboard-ui\dashboard\wizardfinishpage.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\items\detail\video.png">
|
||||
|
|
|
@ -118,7 +118,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
"airsbefore_season",
|
||||
"DVD_episodenumber",
|
||||
"DVD_season",
|
||||
"absolute_number"
|
||||
"absolute_number",
|
||||
"displayseason",
|
||||
"displayepisode"
|
||||
};
|
||||
|
||||
return list;
|
||||
|
|
Loading…
Reference in a new issue