Disable mare api impersonation
This commit is contained in:
@@ -56,11 +56,14 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
_activeGameObjectHandlers.Remove(msg.GameObjectHandler);
|
||||
});
|
||||
|
||||
/*
|
||||
_marePluginEnabled = PluginWatcherService.GetInitialPluginState(pi, "MareSynchronos")?.IsLoaded ?? false;
|
||||
Mediator.SubscribeKeyed<PluginChangeMessage>(this, "MareSynchronos", p => {
|
||||
_marePluginEnabled = p.IsLoaded;
|
||||
HandleMareImpersonation(automatic: true);
|
||||
});
|
||||
*/
|
||||
_marePluginEnabled = true;
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
@@ -101,11 +104,11 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
if (_mareConfig.Current.MareAPI)
|
||||
{
|
||||
var cancelToken = _registerDelayCts.Token;
|
||||
Task.Run(async () =>
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
// Wait before registering to reduce the chance of a race condition
|
||||
if (automatic)
|
||||
await Task.Delay(5000);
|
||||
await Task.Delay(5000).ConfigureAwait(false);
|
||||
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
return;
|
||||
@@ -118,7 +121,7 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
|
||||
_loadFileProviderMare?.RegisterFunc(LoadMcdf);
|
||||
_loadFileAsyncProviderMare?.RegisterFunc(LoadMcdfAsync);
|
||||
_handledGameAddressesMare?.RegisterFunc(GetHandledAddresses);
|
||||
_handledGameAddressesMare?.RegisterFunc(MareGetHandledAddresses);
|
||||
_impersonating = true;
|
||||
_logger.LogDebug("Registered MareSynchronos API");
|
||||
}, cancelToken);
|
||||
@@ -180,6 +183,11 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
}
|
||||
|
||||
private List<nint> GetHandledAddresses()
|
||||
{
|
||||
return _activeGameObjectHandlers.Where(g => g.Address != nint.Zero).Select(g => g.Address).Distinct().ToList();
|
||||
}
|
||||
|
||||
private List<nint> MareGetHandledAddresses()
|
||||
{
|
||||
if (!_impersonating)
|
||||
{
|
||||
@@ -191,6 +199,6 @@ public class IpcProvider : IHostedService, IMediatorSubscriber
|
||||
return [];
|
||||
}
|
||||
|
||||
return _activeGameObjectHandlers.Where(g => g.Address != nint.Zero).Select(g => g.Address).Distinct().ToList();
|
||||
return GetHandledAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,20 +581,26 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_uiShared.BigText("Advanced");
|
||||
|
||||
bool mareApi = _configService.Current.MareAPI;
|
||||
if (ImGui.Checkbox("Enable Mare Synchronos API", ref mareApi))
|
||||
using (var disabled = ImRaii.Disabled(true))
|
||||
{
|
||||
_configService.Current.MareAPI = mareApi;
|
||||
_configService.Save();
|
||||
_ipcProvider.HandleMareImpersonation();
|
||||
bool dummyFalse = false;
|
||||
if (ImGui.Checkbox("Enable Mare Synchronos API", ref dummyFalse))
|
||||
{
|
||||
_configService.Current.MareAPI = mareApi;
|
||||
_configService.Save();
|
||||
_ipcProvider.HandleMareImpersonation();
|
||||
}
|
||||
_uiShared.DrawHelpText("Enables handling of the Mare Synchronos API. This currently includes:\n\n" +
|
||||
" - MCDF loading support for other plugins\n" +
|
||||
" - Blocking Moodles applications to paired users\n\n" +
|
||||
"If the Mare Synchronos plugin is loaded while this option is enabled, control of its API will be relinquished.");
|
||||
}
|
||||
_uiShared.DrawHelpText("Enables handling of the Mare Synchronos API. This currently includes:\n\n" +
|
||||
" - MCDF loading support for other plugins\n" +
|
||||
" - Blocking Moodles applications to paired users\n\n" +
|
||||
"If the Mare Synchronos plugin is loaded while this option is enabled, control of its API will be relinquished.");
|
||||
|
||||
using (_ = ImRaii.PushIndent())
|
||||
{
|
||||
ImGui.SameLine(300.0f * ImGuiHelpers.GlobalScale);
|
||||
UiSharedService.ColorTextWrapped("Mare API impersonation is currently unavailable", ImGuiColors.DalamudGrey2);
|
||||
/*
|
||||
if (_ipcProvider.ImpersonationActive)
|
||||
{
|
||||
UiSharedService.ColorTextWrapped("Mare API active!", ImGuiColors.HealerGreen);
|
||||
@@ -608,6 +614,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
else
|
||||
UiSharedService.ColorTextWrapped("Mare API inactive: Unknown reason", ImGuiColors.DalamudRed);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool logEvents = _configService.Current.LogEvents;
|
||||
|
||||
Reference in New Issue
Block a user