mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
Merge branch 'master' into userdb-efcore
# Conflicts: # Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs # Emby.Server.Implementations/ApplicationHost.cs # Emby.Server.Implementations/Devices/DeviceManager.cs # Jellyfin.Server/Jellyfin.Server.csproj # Jellyfin.Server/Migrations/MigrationRunner.cs # MediaBrowser.Controller/Devices/IDeviceManager.cs
This commit is contained in:
@@ -8,7 +8,6 @@ using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Devices;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
@@ -30,7 +29,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
/// </summary>
|
||||
public sealed class ActivityLogEntryPoint : IServerEntryPoint
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<ActivityLogEntryPoint> _logger;
|
||||
private readonly IInstallationManager _installationManager;
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly ITaskManager _taskManager;
|
||||
@@ -38,14 +37,12 @@ namespace Emby.Server.Implementations.Activity
|
||||
private readonly ILocalizationManager _localization;
|
||||
private readonly ISubtitleManager _subManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDeviceManager _deviceManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ActivityLogEntryPoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
/// <param name="deviceManager">The device manager.</param>
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="activityManager">The activity manager.</param>
|
||||
/// <param name="localization">The localization manager.</param>
|
||||
@@ -55,7 +52,6 @@ namespace Emby.Server.Implementations.Activity
|
||||
public ActivityLogEntryPoint(
|
||||
ILogger<ActivityLogEntryPoint> logger,
|
||||
ISessionManager sessionManager,
|
||||
IDeviceManager deviceManager,
|
||||
ITaskManager taskManager,
|
||||
IActivityManager activityManager,
|
||||
ILocalizationManager localization,
|
||||
@@ -65,7 +61,6 @@ namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
_logger = logger;
|
||||
_sessionManager = sessionManager;
|
||||
_deviceManager = deviceManager;
|
||||
_taskManager = taskManager;
|
||||
_activityManager = activityManager;
|
||||
_localization = localization;
|
||||
@@ -98,36 +93,18 @@ namespace Emby.Server.Implementations.Activity
|
||||
_userManager.OnUserDeleted += OnUserDeleted;
|
||||
_userManager.OnUserLockedOut += OnUserLockedOut;
|
||||
|
||||
_deviceManager.CameraImageUploaded += OnCameraImageUploaded;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async void OnCameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("CameraImageUploadedFrom"),
|
||||
e.Argument.Device.Name),
|
||||
NotificationType.CameraImageUploaded.ToString(),
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserLockedOut(object sender, GenericEventArgs<User> e)
|
||||
{
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserLockedOutWithName"),
|
||||
e.Argument.Username),
|
||||
NotificationType.UserLockedOut.ToString(),
|
||||
e.Argument.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("UserLockedOutWithName"),
|
||||
e.Argument.Username),
|
||||
NotificationType.UserLockedOut.ToString(),
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -138,11 +115,9 @@ namespace Emby.Server.Implementations.Activity
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"),
|
||||
e.Provider,
|
||||
Emby.Notifications.NotificationEntryPoint.GetItemName(e.Item)),
|
||||
Notifications.NotificationEntryPoint.GetItemName(e.Item)),
|
||||
"SubtitleDownloadFailure",
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
Guid.Empty)
|
||||
{
|
||||
ItemId = e.Item.Id.ToString("N", CultureInfo.InvariantCulture),
|
||||
ShortOverview = e.Exception.Message
|
||||
@@ -180,9 +155,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
GetItemName(item),
|
||||
e.DeviceName),
|
||||
GetPlaybackStoppedNotificationType(item.MediaType),
|
||||
user.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
user.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -217,9 +190,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
GetItemName(item),
|
||||
e.DeviceName),
|
||||
GetPlaybackNotificationType(item.MediaType),
|
||||
user.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
user.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -286,9 +257,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
session.UserName,
|
||||
session.DeviceName),
|
||||
"SessionEnded",
|
||||
session.UserId,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
session.UserId)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -307,9 +276,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("AuthenticationSucceededWithUserName"),
|
||||
user.Name),
|
||||
"AuthenticationSucceeded",
|
||||
user.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
user.Id)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -326,10 +293,9 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("FailedLoginAttemptWithUserName"),
|
||||
e.Argument.Username),
|
||||
"AuthenticationFailed",
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Error)
|
||||
Guid.Empty)
|
||||
{
|
||||
LogSeverity = LogLevel.Error,
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localization.GetLocalizedString("LabelIpAddressValue"),
|
||||
@@ -345,9 +311,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("UserPolicyUpdatedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserPolicyUpdated",
|
||||
e.Argument.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -359,9 +323,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("UserDeletedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserDeleted",
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
Guid.Empty))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -373,9 +335,8 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("UserPasswordChangedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserPasswordChanged",
|
||||
e.Argument.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)).ConfigureAwait(false);
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnUserCreated(object sender, GenericEventArgs<User> e)
|
||||
@@ -386,9 +347,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("UserCreatedWithName"),
|
||||
e.Argument.Username),
|
||||
"UserCreated",
|
||||
e.Argument.Id,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
e.Argument.Id))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -408,9 +367,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
session.UserName,
|
||||
session.DeviceName),
|
||||
"SessionStarted",
|
||||
session.UserId,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
session.UserId)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -427,9 +384,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("PluginUpdatedWithName"),
|
||||
e.Argument.Item1.Name),
|
||||
NotificationType.PluginUpdateInstalled.ToString(),
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
Guid.Empty)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -447,9 +402,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("PluginUninstalledWithName"),
|
||||
e.Argument.Name),
|
||||
NotificationType.PluginUninstalled.ToString(),
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace))
|
||||
Guid.Empty))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -461,9 +414,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("PluginInstalledWithName"),
|
||||
e.Argument.name),
|
||||
NotificationType.PluginInstalled.ToString(),
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
Guid.Empty)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -482,9 +433,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
_localization.GetLocalizedString("NameInstallFailed"),
|
||||
installationInfo.Name),
|
||||
NotificationType.InstallationFailed.ToString(),
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Trace)
|
||||
Guid.Empty)
|
||||
{
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -528,10 +477,9 @@ namespace Emby.Server.Implementations.Activity
|
||||
await CreateLogEntry(new ActivityLog(
|
||||
string.Format(CultureInfo.InvariantCulture, _localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
|
||||
NotificationType.TaskFailed.ToString(),
|
||||
Guid.Empty,
|
||||
DateTime.UtcNow,
|
||||
LogLevel.Error)
|
||||
Guid.Empty)
|
||||
{
|
||||
LogSeverity = LogLevel.Error,
|
||||
Overview = string.Join(Environment.NewLine, vals),
|
||||
ShortOverview = runningTime
|
||||
}).ConfigureAwait(false);
|
||||
@@ -565,8 +513,6 @@ namespace Emby.Server.Implementations.Activity
|
||||
_userManager.OnUserPasswordChanged -= OnUserPasswordChanged;
|
||||
_userManager.OnUserDeleted -= OnUserDeleted;
|
||||
_userManager.OnUserLockedOut -= OnUserLockedOut;
|
||||
|
||||
_deviceManager.CameraImageUploaded -= OnCameraImageUploaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -586,7 +532,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
{
|
||||
int years = days / DaysInYear;
|
||||
values.Add(CreateValueString(years, "year"));
|
||||
days = days % DaysInYear;
|
||||
days %= DaysInYear;
|
||||
}
|
||||
|
||||
// Number of months
|
||||
|
||||
Reference in New Issue
Block a user