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:
parent
7c7d91eda9
commit
d063f13ca5
@ -20,15 +20,21 @@ public class WorkshopUpdateService : IWorkshopUpdateService
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IWorkshopClient _client;
|
private readonly IWorkshopClient _client;
|
||||||
private readonly IWorkshopService _workshopService;
|
private readonly IWorkshopService _workshopService;
|
||||||
|
private readonly IPluginManagementService _pluginManagementService;
|
||||||
private readonly Lazy<IUpdateNotificationProvider> _updateNotificationProvider;
|
private readonly Lazy<IUpdateNotificationProvider> _updateNotificationProvider;
|
||||||
private readonly PluginSetting<bool> _showNotifications;
|
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)
|
Lazy<IUpdateNotificationProvider> updateNotificationProvider)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_client = client;
|
_client = client;
|
||||||
_workshopService = workshopService;
|
_workshopService = workshopService;
|
||||||
|
_pluginManagementService = pluginManagementService;
|
||||||
_updateNotificationProvider = updateNotificationProvider;
|
_updateNotificationProvider = updateNotificationProvider;
|
||||||
_showNotifications = settingsService.GetSetting("Workshop.ShowNotifications", true);
|
_showNotifications = settingsService.GetSetting("Workshop.ShowNotifications", true);
|
||||||
}
|
}
|
||||||
@ -88,6 +94,18 @@ public class WorkshopUpdateService : IWorkshopUpdateService
|
|||||||
else
|
else
|
||||||
_logger.Warning("Auto-update failed for entry {Entry}: {Message}", entry, updateResult.Message);
|
_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;
|
return updateResult.IsSuccess;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@ -101,9 +101,7 @@ public class PluginEntryInstallationHandler : IEntryInstallationHandler
|
|||||||
{
|
{
|
||||||
// ignored, will get cleaned up as an orphaned file
|
// ignored, will get cleaned up as an orphaned file
|
||||||
}
|
}
|
||||||
|
|
||||||
if (installedEntry.Entity.Id != Guid.Empty)
|
|
||||||
_workshopService.RemoveInstalledEntry(installedEntry);
|
|
||||||
return EntryInstallResult.FromException(e);
|
return EntryInstallResult.FromException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user