LANCommander/LANCommander.Server/UI/Pages/Settings/Beacon.razor
2025-02-04 19:32:33 -06:00

47 lines
1.6 KiB
Text

@page "/Settings/Beacon"
@inject IMessageService MessageService
@inject ILogger<Beacon> Logger
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
<PageHeader Title="Beacon" />
<PageContent>
<Form Model="Settings" Layout="@FormLayout.Vertical">
<FormItem Label="Enable">
<Text Type="@TextElementType.Secondary">Enabling the beacon will allow clients on the same network to auto-discover the LANCommander address.</Text>
<Switch @bind-Checked="context.Beacon.Enabled" />
</FormItem>
<FormItem Label="Name">
<Text Type="@TextElementType.Secondary">Use this to customize the name that is broadcasted to clients.</Text>
<Input @bind-Value="Settings.Beacon.Name" />
</FormItem>
<FormItem Label="Address">
<Text Type="@TextElementType.Secondary">Use this to customize the address that is broadcasted to clients. Default: http://&lt;Server IP&gt;:@context.Port</Text>
<Input @bind-Value="Settings.Beacon.Address" />
</FormItem>
<FormItem>
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
</FormItem>
</Form>
</PageContent>
@code {
Settings Settings = SettingService.GetSettings();
void Save()
{
try
{
SettingService.SaveSettings(Settings);
MessageService.Success("Settings saved!");
}
catch (Exception ex)
{
MessageService.Error("An unknown error occurred.");
Logger.LogError(ex, "An unknown error occurred.");
}
}
}