2026-06-12 23:48:11 -05:00
|
|
|
@page "/Settings"
|
2023-03-03 17:41:15 -06:00
|
|
|
@page "/Settings/General"
|
2025-11-16 12:31:25 -06:00
|
|
|
@using LANCommander.Server.Settings
|
|
|
|
|
@using LANCommander.Server.Settings.Enums
|
|
|
|
|
@using Microsoft.Extensions.Options
|
|
|
|
|
@inject IOptions<Settings> Settings
|
|
|
|
|
@inject SettingsProvider<Settings> SettingsProvider
|
2023-03-02 18:50:24 -06:00
|
|
|
@inject IMessageService MessageService
|
2024-07-07 16:33:46 -05:00
|
|
|
@inject ILogger<General> Logger
|
2024-10-16 02:06:02 -05:00
|
|
|
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
|
2023-03-02 18:50:24 -06:00
|
|
|
|
2023-03-03 17:34:27 -06:00
|
|
|
<PageHeader Title="General" />
|
|
|
|
|
|
2025-02-04 19:32:33 -06:00
|
|
|
<PageContent>
|
2025-11-16 12:31:25 -06:00
|
|
|
<Form Model="Settings.Value" Layout="@FormLayout.Vertical">
|
2025-01-25 02:40:36 -06:00
|
|
|
<FormItem Label="Port">
|
2025-11-16 12:31:25 -06:00
|
|
|
<AntDesign.InputNumber @bind-Value="context.Server.Http.Port" />
|
2023-09-05 19:41:11 -05:00
|
|
|
</FormItem>
|
2026-06-12 23:48:11 -05:00
|
|
|
|
2025-01-25 01:57:17 -06:00
|
|
|
<Divider Text="SSL" />
|
2025-02-04 19:32:33 -06:00
|
|
|
|
2025-01-25 01:57:17 -06:00
|
|
|
<FormItem Label="Use SSL">
|
2025-11-16 12:31:25 -06:00
|
|
|
<Switch @bind-Checked="context.Server.Http.UseSSL" />
|
2025-01-25 01:57:17 -06:00
|
|
|
</FormItem>
|
2025-02-04 19:32:33 -06:00
|
|
|
|
2025-01-25 02:40:36 -06:00
|
|
|
<FormItem Label="SSL Port">
|
2025-11-16 12:31:25 -06:00
|
|
|
<AntDesign.InputNumber @bind-Value="context.Server.Http.SSLPort" Disabled="!context.Server.Http.UseSSL" />
|
2025-01-25 02:40:36 -06:00
|
|
|
</FormItem>
|
2025-02-04 19:32:33 -06:00
|
|
|
|
2025-01-25 01:57:17 -06:00
|
|
|
<FormItem Label="Certificate Path">
|
2025-11-16 12:31:25 -06:00
|
|
|
<FilePicker Root="@RootPath" @bind-Value="context.Server.Http.CertificatePath" Disabled="!context.Server.Http.UseSSL" />
|
2025-01-25 01:57:17 -06:00
|
|
|
</FormItem>
|
2025-02-04 19:32:33 -06:00
|
|
|
|
2025-01-25 01:57:17 -06:00
|
|
|
<FormItem Label="Certificate Password">
|
2025-11-16 12:31:25 -06:00
|
|
|
<InputPassword @bind-Value="context.Server.Http.CertificatePassword" Disabled="!context.Server.Http.UseSSL" />
|
2025-01-25 01:57:17 -06:00
|
|
|
</FormItem>
|
2023-03-20 00:15:46 -05:00
|
|
|
|
2023-03-03 17:34:27 -06:00
|
|
|
<FormItem>
|
2023-03-20 00:15:46 -05:00
|
|
|
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
|
2023-03-03 17:34:27 -06:00
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
2025-02-04 19:32:33 -06:00
|
|
|
</PageContent>
|
2023-02-17 18:02:01 -06:00
|
|
|
|
|
|
|
|
@code {
|
2025-01-25 01:57:17 -06:00
|
|
|
string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory());
|
2023-02-17 18:02:01 -06:00
|
|
|
|
2024-11-22 02:04:04 -06:00
|
|
|
void Save()
|
2023-02-17 18:02:01 -06:00
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2025-11-16 12:31:25 -06:00
|
|
|
SettingsProvider.Update(s =>
|
|
|
|
|
{
|
|
|
|
|
s.Server.Http = Settings.Value.Server.Http;
|
|
|
|
|
});
|
2026-06-12 23:48:11 -05:00
|
|
|
|
2023-03-02 18:50:24 -06:00
|
|
|
MessageService.Success("Settings saved!");
|
2023-02-17 18:02:01 -06:00
|
|
|
}
|
2024-07-07 16:33:46 -05:00
|
|
|
catch (Exception ex)
|
2023-02-17 18:02:01 -06:00
|
|
|
{
|
2023-03-02 18:50:24 -06:00
|
|
|
MessageService.Error("An unknown error occurred.");
|
2024-07-07 16:33:46 -05:00
|
|
|
Logger.LogError(ex, "An unknown error occurred.");
|
2023-02-17 18:02:01 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|