2023-09-08 22:26:28 -05:00
|
|
|
@page "/Settings/IPXRelay"
|
|
|
|
|
@inject IPXRelayService IPXRelayService
|
|
|
|
|
@inject IMessageService MessageService
|
2024-07-07 16:33:46 -05:00
|
|
|
@inject ILogger<IPXRelay> Logger
|
2024-10-16 02:06:02 -05:00
|
|
|
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
|
2023-09-08 22:26:28 -05:00
|
|
|
|
|
|
|
|
<PageHeader Title="IPX Relay" />
|
|
|
|
|
|
2025-02-04 19:32:33 -06:00
|
|
|
<PageContent>
|
2023-09-08 22:26:28 -05:00
|
|
|
<Form Model="Settings" Layout="@FormLayout.Vertical">
|
|
|
|
|
<FormItem Label="Enable">
|
|
|
|
|
<Switch @bind-Checked="context.IPXRelay.Enabled" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
2024-01-02 21:33:39 -06:00
|
|
|
<FormItem Label="Host">
|
|
|
|
|
<Text Type="@TextElementType.Secondary">Use this to customize the host that is broadcasted to clients.</Text>
|
2025-02-04 19:32:33 -06:00
|
|
|
<Input @bind-Value="context.IPXRelay.Host" />
|
2024-01-02 21:33:39 -06:00
|
|
|
</FormItem>
|
|
|
|
|
|
2023-09-08 22:26:28 -05:00
|
|
|
<FormItem Label="Port">
|
2024-07-08 17:13:34 -05:00
|
|
|
<AntDesign.InputNumber @bind-Value="context.IPXRelay.Port" Max="65535" />
|
2023-09-08 22:26:28 -05:00
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem Label="Logging">
|
|
|
|
|
<Switch @bind-Checked="context.IPXRelay.Logging" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem>
|
|
|
|
|
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
2025-02-04 19:32:33 -06:00
|
|
|
</PageContent>
|
2023-09-08 22:26:28 -05:00
|
|
|
|
|
|
|
|
@code {
|
2024-11-22 02:04:04 -06:00
|
|
|
Settings Settings = SettingService.GetSettings();
|
2023-09-08 22:26:28 -05:00
|
|
|
|
2025-03-09 01:51:17 -06:00
|
|
|
async Task Save()
|
2023-09-08 22:26:28 -05:00
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SettingService.SaveSettings(Settings);
|
|
|
|
|
MessageService.Success("Settings saved!");
|
|
|
|
|
|
2025-03-09 01:51:17 -06:00
|
|
|
await IPXRelayService.StopAsync();
|
|
|
|
|
|
|
|
|
|
IPXRelayService.Init(Logger);
|
2023-09-08 22:26:28 -05:00
|
|
|
}
|
2024-07-07 16:33:46 -05:00
|
|
|
catch (Exception ex)
|
2023-09-08 22:26:28 -05:00
|
|
|
{
|
|
|
|
|
MessageService.Error("An unknown error occurred.");
|
2024-07-07 16:33:46 -05:00
|
|
|
Logger.LogError(ex, "An unknown error occurred.");
|
2023-09-08 22:26:28 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|