Settings for the server are now combined with the settings from the SDK. This introduces a large breaking change and a migration should be created. This refactor utilizes .NET Configuration and the Options pattern. This will allow for the overriding of any setting using envionment variables. It also means that Settings.yml can be used to override any .NET configuration. A SettingsProvider implementation was created, and any updating of settings was changed from SettingsService.SaveSettings() to SettingsProvider.Update(s => { ... })
88 lines
3.1 KiB
Text
88 lines
3.1 KiB
Text
@page "/FirstTimeSetup/Metadata"
|
|
@using LANCommander.Server.Settings
|
|
@using Microsoft.Extensions.Options
|
|
@layout FirstTimeSetupLayout
|
|
@inject SetupService SetupService
|
|
@inject SettingsProvider<Settings> SettingsProvider
|
|
@inject IOptions<Settings> Settings
|
|
@inject NavigationManager NavigationManager
|
|
@inject ILogger<Index> Logger
|
|
|
|
<PageTitle>Metadata Connections - First Time Setup</PageTitle>
|
|
|
|
<Form Model="@Settings.Value" Loading="Loading" OnFinish="ValidateMetadataConnections" Layout="FormLayout.Vertical">
|
|
<FormItem>
|
|
LANCommander has the ability to pull metadata and media from external sources. Required credentials can be added here, or can be set later in Settings.
|
|
</FormItem>
|
|
|
|
<Divider Text="IGDB Credentials" />
|
|
|
|
<p>
|
|
<Text Type="TextElementType.Secondary">In order to use IGDB metadata, you need a Twitch developer account. <a href="https://api-docs.igdb.com/#account-creation" target="_blank">Click here</a> for more details.</Text>
|
|
</p>
|
|
|
|
<FormItem Label="Client ID">
|
|
<Input @bind-Value="context.Server.IGDB.ClientId" />
|
|
</FormItem>
|
|
<FormItem Label="Client Secret">
|
|
<InputPassword @bind-Value="context.Server.IGDB.ClientSecret" AutoComplete="false" />
|
|
</FormItem>
|
|
|
|
<Divider Text="SteamGridDB Credentials" />
|
|
|
|
<p>
|
|
<Text Type="TextElementType.Secondary">In order to automatically search SteamGridDB for media, you need an API key. <a href="https://www.steamgriddb.com/profile/preferences/api" target="_blank">Click here</a> to get your key.</Text>
|
|
</p>
|
|
|
|
<FormItem Label="API Key">
|
|
<InputPassword @bind-Value="context.Server.Media.SteamGridDbApiKey" AutoComplete="false" />
|
|
</FormItem>
|
|
|
|
<FormItem>
|
|
<GridRow Justify="RowJustify.End" Style="margin-top: 16px;">
|
|
<GridCol>
|
|
<Button Type="ButtonType.Primary" HtmlType="submit">
|
|
Save
|
|
</Button>
|
|
</GridCol>
|
|
</GridRow>
|
|
</FormItem>
|
|
</Form>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
FirstTimeSetupLayout Layout { get; set; }
|
|
|
|
bool Loading = false;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var isSetupInitialized = await SetupService.IsSetupInitialized();
|
|
if (isSetupInitialized)
|
|
{
|
|
NavigationManager.NavigateTo("/");
|
|
return;
|
|
}
|
|
|
|
await Layout.ChangeCurrentStep(FirstTimeSetupStep.Metadata);
|
|
|
|
SettingsProvider.Update(s =>
|
|
{
|
|
s.Server.IGDB.ClientId = Settings.Value.Server.IGDB.ClientId;
|
|
s.Server.IGDB.ClientSecret = Settings.Value.Server.IGDB.ClientSecret;
|
|
s.Server.Media.SteamGridDbApiKey = Settings.Value.Server.Media.SteamGridDbApiKey;
|
|
});
|
|
}
|
|
|
|
async Task ValidateMetadataConnections()
|
|
{
|
|
SettingsProvider.Update(s =>
|
|
{
|
|
s.Server.IGDB.ClientId = Settings.Value.Server.IGDB.ClientId;
|
|
s.Server.IGDB.ClientSecret = Settings.Value.Server.IGDB.ClientSecret;
|
|
s.Server.Media.SteamGridDbApiKey = Settings.Value.Server.Media.SteamGridDbApiKey;
|
|
});
|
|
|
|
NavigationManager.NavigateTo("/FirstTimeSetup/Administrator");
|
|
}
|
|
}
|