1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-02-04 02:43:32 +00:00

Hotfix - Auto-enable plugins after updating them

This commit is contained in:
Robert 2025-12-23 07:44:52 +01:00
parent 7c7d91eda9
commit d063f13ca5
2 changed files with 20 additions and 4 deletions

View File

@ -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<IUpdateNotificationProvider> _updateNotificationProvider;
private readonly PluginSetting<bool> _showNotifications;
public WorkshopUpdateService(ILogger logger, IWorkshopClient client, IWorkshopService workshopService, ISettingsService settingsService,
public WorkshopUpdateService(ILogger logger,
IWorkshopClient client,
IWorkshopService workshopService,
ISettingsService settingsService,
IPluginManagementService pluginManagementService,
Lazy<IUpdateNotificationProvider> 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)

View File

@ -102,8 +102,6 @@ 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);
}