- Regenerate migrations - Fix identity database context lifetimes - Fix rendering of edit components - Move database settings to separate section
64 lines
1.9 KiB
Text
64 lines
1.9 KiB
Text
@page "/Settings"
|
|
@page "/Settings/General"
|
|
@using LANCommander.Server.Settings
|
|
@using LANCommander.Server.Settings.Enums
|
|
@using Microsoft.Extensions.Options
|
|
@inject IOptions<Settings> Settings
|
|
@inject SettingsProvider<Settings> SettingsProvider
|
|
@inject IMessageService MessageService
|
|
@inject ILogger<General> Logger
|
|
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
|
|
|
|
<PageHeader Title="General" />
|
|
|
|
<PageContent>
|
|
<Form Model="Settings.Value" Layout="@FormLayout.Vertical">
|
|
<FormItem Label="Port">
|
|
<AntDesign.InputNumber @bind-Value="context.Server.Http.Port" />
|
|
</FormItem>
|
|
|
|
<Divider Text="SSL" />
|
|
|
|
<FormItem Label="Use SSL">
|
|
<Switch @bind-Checked="context.Server.Http.UseSSL" />
|
|
</FormItem>
|
|
|
|
<FormItem Label="SSL Port">
|
|
<AntDesign.InputNumber @bind-Value="context.Server.Http.SSLPort" Disabled="!context.Server.Http.UseSSL" />
|
|
</FormItem>
|
|
|
|
<FormItem Label="Certificate Path">
|
|
<FilePicker Root="@RootPath" @bind-Value="context.Server.Http.CertificatePath" Disabled="!context.Server.Http.UseSSL" />
|
|
</FormItem>
|
|
|
|
<FormItem Label="Certificate Password">
|
|
<InputPassword @bind-Value="context.Server.Http.CertificatePassword" Disabled="!context.Server.Http.UseSSL" />
|
|
</FormItem>
|
|
|
|
<FormItem>
|
|
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
|
|
</FormItem>
|
|
</Form>
|
|
</PageContent>
|
|
|
|
@code {
|
|
string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory());
|
|
|
|
void Save()
|
|
{
|
|
try
|
|
{
|
|
SettingsProvider.Update(s =>
|
|
{
|
|
s.Server.Http = Settings.Value.Server.Http;
|
|
});
|
|
|
|
MessageService.Success("Settings saved!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageService.Error("An unknown error occurred.");
|
|
Logger.LogError(ex, "An unknown error occurred.");
|
|
}
|
|
}
|
|
}
|