From d063f13ca539fce78c665469675a991fca9d5b26 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 23 Dec 2025 07:44:52 +0100 Subject: [PATCH] Hotfix - Auto-enable plugins after updating them --- .../Updating/WorkshopUpdateService.cs | 20 ++++++++++++++++++- .../PluginEntryInstallationHandler.cs | 4 +--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Artemis.UI/Services/Updating/WorkshopUpdateService.cs b/src/Artemis.UI/Services/Updating/WorkshopUpdateService.cs index 8850de70e..5603aa441 100644 --- a/src/Artemis.UI/Services/Updating/WorkshopUpdateService.cs +++ b/src/Artemis.UI/Services/Updating/WorkshopUpdateService.cs @@ -20,15 +20,21 @@ public class WorkshopUpdateService : IWorkshopUpdateService private readonly ILogger _logger; private readonly IWorkshopClient _client; private readonly IWorkshopService _workshopService; + private readonly IPluginManagementService _pluginManagementService; private readonly Lazy _updateNotificationProvider; private readonly PluginSetting _showNotifications; - public WorkshopUpdateService(ILogger logger, IWorkshopClient client, IWorkshopService workshopService, ISettingsService settingsService, + public WorkshopUpdateService(ILogger logger, + IWorkshopClient client, + IWorkshopService workshopService, + ISettingsService settingsService, + IPluginManagementService pluginManagementService, Lazy updateNotificationProvider) { _logger = logger; _client = client; _workshopService = workshopService; + _pluginManagementService = pluginManagementService; _updateNotificationProvider = updateNotificationProvider; _showNotifications = settingsService.GetSetting("Workshop.ShowNotifications", true); } @@ -88,6 +94,18 @@ public class WorkshopUpdateService : IWorkshopUpdateService else _logger.Warning("Auto-update failed for entry {Entry}: {Message}", entry, updateResult.Message); + if (!updateResult.IsSuccess || updateResult.Installed is not Plugin {IsEnabled: false} updatedPlugin) + return updateResult.IsSuccess; + + try + { + _pluginManagementService.EnablePlugin(updatedPlugin, true, true); + } + catch (Exception e) + { + _logger.Warning(e, "Failed to auto-enable updated plugin {Plugin}", updatedPlugin); + } + return updateResult.IsSuccess; } catch (Exception e) diff --git a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/PluginEntryInstallationHandler.cs b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/PluginEntryInstallationHandler.cs index 80a3cb012..7ad0655c1 100644 --- a/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/PluginEntryInstallationHandler.cs +++ b/src/Artemis.WebClient.Workshop/Handlers/InstallationHandlers/Implementations/PluginEntryInstallationHandler.cs @@ -101,9 +101,7 @@ public class PluginEntryInstallationHandler : IEntryInstallationHandler { // ignored, will get cleaned up as an orphaned file } - - if (installedEntry.Entity.Id != Guid.Empty) - _workshopService.RemoveInstalledEntry(installedEntry); + return EntryInstallResult.FromException(e); }