diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-06 13:46:09 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-09-06 13:46:09 -0400 |
| commit | 41cabc7bd37eadf2752b50a6b5090af5dcf10035 (patch) | |
| tree | 650451ac7d7871202e3264cc7964eb15b4e75cd6 /MediaBrowser.Common.Implementations | |
| parent | 392699404b8e7c530314d2a164b43101a672bf13 (diff) | |
add system id to remote calls
Diffstat (limited to 'MediaBrowser.Common.Implementations')
4 files changed, 30 insertions, 2 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 80f017f52..011dd76ee 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Implementations.Archiving; +using MediaBrowser.Common.Implementations.Devices; using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.Implementations.Security; @@ -178,6 +179,20 @@ namespace MediaBrowser.Common.Implementations /// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value> public abstract bool IsRunningAsService { get; } + private DeviceId _deviceId; + public string SystemId + { + get + { + if (_deviceId == null) + { + _deviceId = new DeviceId(ApplicationPaths, LogManager.GetLogger("SystemId")); + } + + return _deviceId.Value; + } + } + /// <summary> /// Initializes a new instance of the <see cref="BaseApplicationHost{TApplicationPathsType}"/> class. /// </summary> diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index f8d1f80b1..6e4b57076 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -203,6 +203,7 @@ namespace MediaBrowser.Common.Implementations.Security { "feature", feature }, { "key", SupporterKey }, { "mac", mac }, + { "systemid", _appHost.SystemId }, { "mb2equiv", mb2Equivalent }, { "ver", version }, { "platform", Environment.OSVersion.VersionString }, diff --git a/MediaBrowser.Common.Implementations/Security/UsageReporter.cs b/MediaBrowser.Common.Implementations/Security/UsageReporter.cs index 89ca0a0e4..a06351be2 100644 --- a/MediaBrowser.Common.Implementations/Security/UsageReporter.cs +++ b/MediaBrowser.Common.Implementations/Security/UsageReporter.cs @@ -30,6 +30,7 @@ namespace MediaBrowser.Common.Implementations.Security { { "feature", _applicationHost.Name }, { "mac", mac }, + { "systemid", _applicationHost.SystemId }, { "ver", _applicationHost.ApplicationVersion.ToString() }, { "platform", Environment.OSVersion.VersionString }, { "isservice", _applicationHost.IsRunningAsService.ToString().ToLower()} @@ -40,12 +41,18 @@ namespace MediaBrowser.Common.Implementations.Security public Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken) { + if (string.IsNullOrWhiteSpace(app.DeviceId)) + { + throw new ArgumentException("Client info must have a device Id"); + } + cancellationToken.ThrowIfCancellationRequested(); var data = new Dictionary<string, string> { { "feature", app.AppName ?? "Unknown App" }, - { "mac", app.DeviceId ?? _networkManager.GetMacAddress() }, + { "systemid", _applicationHost.SystemId }, + { "mac", app.DeviceId }, { "ver", app.AppVersion ?? "Unknown" }, { "platform", app.DeviceName }, }; diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index e4c88e656..fb0c9914f 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -154,7 +154,12 @@ namespace MediaBrowser.Common.Implementations.Updates PackageType? packageType = null, Version applicationVersion = null) { - var data = new Dictionary<string, string> { { "key", _securityManager.SupporterKey }, { "mac", _networkManager.GetMacAddress() } }; + var data = new Dictionary<string, string> + { + { "key", _securityManager.SupporterKey }, + { "mac", _networkManager.GetMacAddress() }, + { "systemid", _applicationHost.SystemId } + }; using (var json = await _httpClient.Post(Constants.Constants.MbAdminUrl + "service/package/retrieveall", data, cancellationToken).ConfigureAwait(false)) { |
