mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Core - Avoid restart loop if failing to drop admin permissions
Profile editor - Close brush/effect dialog if said brush/effect is unloaded Webserver - Fixed ServerUrl value containing a wildcard instead of localhost
This commit is contained in:
1 parent
ebb4aaa46c
commit
a2df88bab9
6 files changed
+43
-26
No files matched your search
@@ -238,11 +238,7 @@ namespace Artemis.Core.Services
|
||||
|
||||
// Initialize the services
|
||||
_pluginManagementService.CopyBuiltInPlugins();
|
||||
_pluginManagementService.LoadPlugins(
|
||||
StartupArguments.Contains("--ignore-plugin-lock"),
|
||||
StartupArguments.Contains("--force-elevation"),
|
||||
IsElevated
|
||||
);
|
||||
_pluginManagementService.LoadPlugins(StartupArguments, IsElevated);
|
||||
|
||||
_rgbService.IsRenderPaused = false;
|
||||
OnInitialized();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Loads all installed plugins. If plugins already loaded this will reload them all
|
||||
/// </summary>
|
||||
void LoadPlugins(bool ignorePluginLock, bool stayElevated, bool isElevated);
|
||||
void LoadPlugins(List<string> startupArguments, bool isElevated);
|
||||
|
||||
/// <summary>
|
||||
/// Unloads all installed plugins.
|
||||
|
||||
@@ -179,8 +179,11 @@ namespace Artemis.Core.Services
|
||||
|
||||
#region Plugins
|
||||
|
||||
public void LoadPlugins(bool ignorePluginLock, bool stayElevated, bool isElevated)
|
||||
public void LoadPlugins(List<string> startupArguments, bool isElevated)
|
||||
{
|
||||
bool ignorePluginLock = startupArguments.Contains("--ignore-plugin-lock");
|
||||
bool stayElevated = startupArguments.Contains("--force-elevation");
|
||||
bool droppedAdmin = startupArguments.Contains("--dropped-admin");
|
||||
if (LoadingPlugins)
|
||||
throw new ArtemisCoreException("Cannot load plugins while a previous load hasn't been completed yet.");
|
||||
|
||||
@@ -218,10 +221,15 @@ namespace Artemis.Core.Services
|
||||
|
||||
if (isElevated && !adminRequired && !stayElevated)
|
||||
{
|
||||
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
|
||||
_logger.Information("Restarting because no plugin requires elevation and --force-elevation was not supplied");
|
||||
Utilities.Restart(false, TimeSpan.Zero);
|
||||
return;
|
||||
if (droppedAdmin)
|
||||
_logger.Information("No plugin requires elevation but dropping admin failed before, ignoring");
|
||||
else
|
||||
{
|
||||
// No need for a delay this early on, nothing that needs graceful shutdown is happening yet
|
||||
_logger.Information("Restarting because no plugin requires elevation and --force-elevation was not supplied");
|
||||
Utilities.Restart(false, TimeSpan.Zero, "--dropped-admin");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Plugin plugin in _plugins.Where(p => p.Entity.IsEnabled))
|
||||
|
||||
@@ -43,10 +43,9 @@ namespace Artemis.Core.Services
|
||||
Server?.Dispose();
|
||||
Server = null;
|
||||
|
||||
string url = $"http://*:{_webServerPortSetting.Value}/";
|
||||
WebApiModule apiModule = new("/api/", JsonNetSerializer);
|
||||
PluginsModule.ServerUrl = url;
|
||||
WebServer server = new WebServer(o => o.WithUrlPrefix(url).WithMode(HttpListenerMode.EmbedIO))
|
||||
PluginsModule.ServerUrl = $"http://localhost:{_webServerPortSetting.Value}/";
|
||||
WebServer server = new WebServer(o => o.WithUrlPrefix($"http://*:{_webServerPortSetting.Value}/").WithMode(HttpListenerMode.EmbedIO))
|
||||
.WithLocalSessionManager()
|
||||
.WithModule(apiModule)
|
||||
.WithModule(PluginsModule)
|
||||
@@ -61,7 +60,7 @@ namespace Artemis.Core.Services
|
||||
server.StateChanged += (s, e) => _logger.Verbose("WebServer new state - {state}", e.NewState);
|
||||
|
||||
// Store the URL in a webserver.txt file so that remote applications can find it
|
||||
File.WriteAllText(Path.Combine(Constants.DataFolder, "webserver.txt"), $"http://localhost:{_webServerPortSetting.Value}/");
|
||||
File.WriteAllText(Path.Combine(Constants.DataFolder, "webserver.txt"), PluginsModule.ServerUrl);
|
||||
|
||||
return server;
|
||||
}
|
||||
@@ -156,7 +155,6 @@ namespace Artemis.Core.Services
|
||||
|
||||
private void HandleDataModelRequest<T>(Module<T> module, T value) where T : DataModel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RemovePluginEndPoint(PluginEndPoint endPoint)
|
||||
|
||||
Reference in new issue
Block a user