parent
1689cab3b3
commit
3f3d5b718b
|
@ -0,0 +1,67 @@
|
|||
@page "/Settings/Media"
|
||||
@using LANCommander.Components.FileManagerComponents;
|
||||
@using LANCommander.Models;
|
||||
@layout SettingsLayout
|
||||
@inject SettingService SettingService
|
||||
@inject IMessageService MessageService
|
||||
@attribute [Authorize(Roles = "Administrator")]
|
||||
|
||||
<PageHeader Title="Media" />
|
||||
|
||||
<div style="padding: 0 24px;">
|
||||
<Form Model="Settings" Layout="@FormLayout.Vertical">
|
||||
<FormItem Label="Storage Path">
|
||||
<FilePicker Root="@RootPath" EntrySelectable="x => x is FileManagerDirectory" @bind-Value="@context.Media.StoragePath" OkText="Select Path" Title="Choose Path" OnSelected="OnPathSelected" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="Max Size (MB)">
|
||||
<AntDesign.InputNumber @bind-Value="context.Media.MaxSize" Min="1" DefaultValue="25" />
|
||||
</FormItem>
|
||||
|
||||
<Divider Text="SteamGridDB Credentials" />
|
||||
|
||||
<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>
|
||||
|
||||
<FormItem Label="API Key">
|
||||
<InputPassword @bind-Value="context.Media.SteamGridDbApiKey" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem>
|
||||
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
LANCommanderSettings Settings;
|
||||
|
||||
string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory());
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Settings = SettingService.GetSettings();
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
SettingService.SaveSettings(Settings);
|
||||
MessageService.Success("Settings saved!");
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageService.Error("An unknown error occurred.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPathSelected(string path)
|
||||
{
|
||||
var appPath = Directory.GetCurrentDirectory();
|
||||
|
||||
if (path != null && path.StartsWith(appPath))
|
||||
path = path.Substring(appPath.Length).TrimStart(Path.DirectorySeparatorChar).TrimEnd(Path.DirectorySeparatorChar);
|
||||
|
||||
Settings.Archives.StoragePath = path;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
<MenuItem RouterLink="/Settings/Authentication">Authentication</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/UserSaves">User Saves</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Archives">Archives</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Media">Media</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/IPXRelay">IPX Relay</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Beacon">Beacon</MenuItem>
|
||||
<MenuItem RouterLink="/Settings/Tools" RouterMatch="@NavLinkMatch.Prefix">Tools</MenuItem>
|
||||
|
|
Loading…
Reference in New Issue