diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-19 21:08:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-19 21:08:35 -0500 |
| commit | 469590c9c51f028da454e7e31bea0e37b8f91f15 (patch) | |
| tree | bc6d287699dfeda2bbc85231591896587394be44 | |
| parent | 97639e5c85dcacf43f430aabb1d1eb0c79f70d23 (diff) | |
| parent | e066a02403b5e850233e18321835a216514ae856 (diff) | |
Merge pull request #508 from EraYaN/api-version-reporting
Update internal versioning and user agents.
22 files changed, 70 insertions, 55 deletions
diff --git a/.gitignore b/.gitignore index ec683f38f..aef666272 100644 --- a/.gitignore +++ b/.gitignore @@ -263,3 +263,4 @@ deployment/**/pkg-dist/ deployment/**/pkg-dist-tmp/ deployment/collect-dist/ +jellyfin_version.ini diff --git a/BDInfo/BDInfo.csproj b/BDInfo/BDInfo.csproj index 774e5709d..b2c752d0c 100644 --- a/BDInfo/BDInfo.csproj +++ b/BDInfo/BDInfo.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <ItemGroup> - <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\SharedVersion.cs" /> </ItemGroup> <ItemGroup> diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj index 774e5709d..b2c752d0c 100644 --- a/DvdLib/DvdLib.csproj +++ b/DvdLib/DvdLib.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <ItemGroup> - <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\SharedVersion.cs" /> </ItemGroup> <ItemGroup> diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj index f155bce6d..71ded2337 100644 --- a/Emby.Dlna/Emby.Dlna.csproj +++ b/Emby.Dlna/Emby.Dlna.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <ItemGroup> - <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\SharedVersion.cs" /> </ItemGroup> <ItemGroup> diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 2836ee95d..cdc8f7717 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -164,7 +164,7 @@ namespace Emby.Dlna.PlayTo string deviceName = null; - var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion.ToString(), uuid, deviceName, uri.OriginalString, null); + var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationSemanticVersion, uuid, deviceName, uri.OriginalString, null); var controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault(); diff --git a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj index 2a81f5aa0..dafa51cd5 100644 --- a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj +++ b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <ItemGroup> - <Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\..\SharedVersion.cs" /> </ItemGroup> <ItemGroup> diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj index 88e3af522..e344e7811 100644 --- a/Emby.Naming/Emby.Naming.csproj +++ b/Emby.Naming/Emby.Naming.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <ItemGroup> - <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\SharedVersion.cs" /> </ItemGroup> <ItemGroup> diff --git a/Emby.Notifications/Emby.Notifications.csproj b/Emby.Notifications/Emby.Notifications.csproj index 14caa4a55..5c68e48c8 100644 --- a/Emby.Notifications/Emby.Notifications.csproj +++ b/Emby.Notifications/Emby.Notifications.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <ItemGroup> - <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\SharedVersion.cs" /> </ItemGroup> <ItemGroup> diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 91eaf9bbf..f0e2eec20 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -429,12 +429,27 @@ namespace Emby.Server.Implementations _validAddressResults.Clear(); } - private Version _version; + private Version _applicationVersion; /// <summary> - /// Gets the current application version + /// Gets the current application server version /// </summary> - /// <value>The application version.</value> - public Version ApplicationVersion => _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version); + /// <value>The application server version.</value> + public Version ApplicationVersion => _applicationVersion ?? (_applicationVersion = typeof(ApplicationHost).Assembly.GetName().Version); + + public string ApplicationSemanticVersion => ApplicationVersion.ToString(3); + + /// <summary> + /// Gets the current application server version + /// </summary> + /// <value>The application server version.</value> + public string ApplicationUserAgent => Name.Replace(' ','-') + "/" + ApplicationSemanticVersion; + + private string _productName; + /// <summary> + /// Gets the current application name + /// </summary> + /// <value>The application name.</value> + public string ApplicationProductName => _productName ?? (_productName = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName); private DeviceId _deviceId; public string SystemId @@ -454,7 +469,7 @@ namespace Emby.Server.Implementations /// Gets the name. /// </summary> /// <value>The name.</value> - public string Name => "Emby Server"; + public string Name => "Jellyfin Server"; private static Tuple<Assembly, string> GetAssembly(Type type) { @@ -1004,26 +1019,7 @@ namespace Emby.Server.Implementations protected string GetDefaultUserAgent() { - var name = FormatAttribute(Name); - - return name + "/" + ApplicationVersion; - } - - private static string FormatAttribute(string str) - { - var arr = str.ToCharArray(); - - arr = Array.FindAll(arr, (c => (char.IsLetterOrDigit(c) - || char.IsWhiteSpace(c)))); - - var result = new string(arr); - - if (string.IsNullOrWhiteSpace(result)) - { - result = "Emby"; - } - - return result; + return ApplicationUserAgent; } protected virtual bool SupportsDualModeSockets => true; @@ -1825,7 +1821,8 @@ namespace Emby.Server.Implementations { HasPendingRestart = HasPendingRestart, IsShuttingDown = IsShuttingDown, - Version = ApplicationVersion.ToString(), + Version = ApplicationSemanticVersion, + ProductName = ApplicationProductName, WebSocketPortNumber = HttpPort, CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(), Id = SystemId, @@ -1871,7 +1868,7 @@ namespace Emby.Server.Implementations var wanAddress = await GetWanApiUrl(cancellationToken).ConfigureAwait(false); return new PublicSystemInfo { - Version = ApplicationVersion.ToString(), + Version = ApplicationSemanticVersion, Id = SystemId, OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(), WanAddress = wanAddress, diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index d3066e916..0bbffb824 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -38,7 +38,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings _appHost = appHost; } - private string UserAgent => "Emby/" + _appHost.ApplicationVersion; + private string UserAgent => _appHost.ApplicationUserAgent; private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc) { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs index 00ec4bf65..f93e7f78e 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs @@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts Url = url, CancellationToken = cancellationToken, // Some data providers will require a user agent - UserAgent = _appHost.FriendlyName + "/" + _appHost.ApplicationVersion + UserAgent = _appHost.ApplicationSemanticVersion }); } return Task.FromResult(_fileSystem.OpenRead(url)); diff --git a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj index baa522ee3..0225be2c2 100644 --- a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj +++ b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj @@ -6,7 +6,7 @@ </PropertyGroup> <ItemGroup> - <Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" /> + <Compile Include="..\..\SharedVersion.cs" /> </ItemGroup> </Project> diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index 234ada6c0..cba278c1e 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -309,8 +309,7 @@ namespace MediaBrowser.Api.Session DateCreated = DateTime.UtcNow, DeviceId = _appHost.SystemId, DeviceName = _appHost.FriendlyName, - AppVersion = _appHost.ApplicationVersion.ToString() - + AppVersion = _appHost.ApplicationSemanticVersion }); } diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index bc6c3a984..94dd251cf 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -72,6 +72,18 @@ namespace MediaBrowser.Common Version ApplicationVersion { get; } /// <summary> + /// Gets the application semantic version. + /// </summary> + /// <value>The application semantic version.</value> + string ApplicationSemanticVersion { get; } + + /// <summary> + /// Gets the application user agent. + /// </summary> + /// <value>The application user agent.</value> + string ApplicationUserAgent { get; } + + /// <summary> /// Gets or sets a value indicating whether this instance can self update. /// </summary> /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value> diff --git a/MediaBrowser.Model/System/PublicSystemInfo.cs b/MediaBrowser.Model/System/PublicSystemInfo.cs index bc8983fd1..accdc9e60 100644 --- a/MediaBrowser.Model/System/PublicSystemInfo.cs +++ b/MediaBrowser.Model/System/PublicSystemInfo.cs @@ -21,10 +21,10 @@ namespace MediaBrowser.Model.System public string ServerName { get; set; } /// <summary> - /// Gets or sets the version. + /// Gets or sets the server version. /// </summary> /// <value>The version.</value> - public string Version { get; set; } + public string Version { get; set; } /// <summary> /// Gets or sets the operating sytem. diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index b0432ae74..26f735330 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -16,6 +16,15 @@ namespace MediaBrowser.Model.System /// <value>The display name of the operating system.</value> public string OperatingSystemDisplayName { get; set; } + /// <summary> + /// The product name. This is the AssemblyProduct name. + /// </summary> + public string ProductName { get; set; } + + /// <summary> + /// Get or sets the package name. + /// </summary> + /// <value>The value of the '-package' command line argument.</value> public string PackageName { get; set; } /// <summary> diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index aaed69459..f03a8c2c2 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -424,7 +424,7 @@ namespace MediaBrowser.Providers.Movies _lastRequestTicks = DateTime.UtcNow.Ticks; options.BufferContent = true; - options.UserAgent = "Emby/" + _appHost.ApplicationVersion; + options.UserAgent = _appHost.ApplicationUserAgent; return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false); } diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index 3ad968449..ecae0c39d 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -742,7 +742,7 @@ namespace MediaBrowser.Providers.Music { Url = url, CancellationToken = cancellationToken, - UserAgent = _appHost.Name + "/" + _appHost.ApplicationVersion, + UserAgent = _appHost.ApplicationUserAgent, BufferContent = throttleMs > 0 }; diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 53a414649..c31f3a97e 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -205,7 +205,7 @@ namespace MediaBrowser.WebDashboard.Api return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => Task.FromResult(stream)); } - return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersion.ToString(), null)); + return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationSemanticVersion, null)); } throw new ResourceNotFoundException(); @@ -342,7 +342,7 @@ namespace MediaBrowser.WebDashboard.Api cacheDuration = TimeSpan.FromDays(365); } - var cacheKey = (_appHost.ApplicationVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); + var cacheKey = (_appHost.ApplicationSemanticVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); // html gets modified on the fly if (contentType.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)) @@ -364,7 +364,7 @@ namespace MediaBrowser.WebDashboard.Api private Task<Stream> GetResourceStream(string basePath, string virtualPath, string localizationCulture) { return GetPackageCreator(basePath) - .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationVersion.ToString()); + .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationSemanticVersion); } private PackageCreator GetPackageCreator(string basePath) @@ -400,7 +400,7 @@ namespace MediaBrowser.WebDashboard.Api CopyDirectory(inputPath, targetPath); } - var appVersion = _appHost.ApplicationVersion.ToString(); + var appVersion = _appHost.ApplicationSemanticVersion; await DumpHtml(packageCreator, inputPath, targetPath, mode, appVersion); diff --git a/MediaBrowser.sln b/MediaBrowser.sln index c9676553e..f1976c3c7 100644 --- a/MediaBrowser.sln +++ b/MediaBrowser.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26730.3 @@ -58,6 +57,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{41093F42-C7CC-4D07-956B-6182CBEDE2EC}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + SharedVersion.cs = SharedVersion.cs EndProjectSection EndProject Global @@ -178,12 +178,9 @@ Global SolutionGuid = {3448830C-EBDC-426C-85CD-7BBB9651A7FE} EndGlobalSection GlobalSection(AutomaticVersions) = postSolution - PrimaryVersionType = AssemblyFileVersionAttribute UpdateAssemblyVersion = True UpdateAssemblyFileVersion = True UpdateAssemblyInfoVersion = True - ShouldCreateLogs = True - AdvancedSettingsExpanded = True AssemblyVersionSettings = None.None.None.None AssemblyFileVersionSettings = None.None.None.None AssemblyInfoVersionSettings = None.None.None.None diff --git a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs index ad4fbbb02..b5ae23021 100644 --- a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs +++ b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs @@ -20,5 +20,5 @@ using System.Runtime.InteropServices; // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("2019.1.20.3")] diff --git a/RSSDP/Properties/AssemblyInfo.cs b/RSSDP/Properties/AssemblyInfo.cs index 7098279b4..d2bb7c6f3 100644 --- a/RSSDP/Properties/AssemblyInfo.cs +++ b/RSSDP/Properties/AssemblyInfo.cs @@ -20,5 +20,5 @@ using System.Runtime.InteropServices; // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("2019.1.20.3")] |
