@page "/Settings/Media" @using LANCommander.SDK.Enums @inject StorageLocationService StorageLocationService @inject IMessageService MessageService @inject ILogger Logger @attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
In order to automatically search SteamGridDB for media, you need an API key. Click here to get your key.
@code { Settings Settings = SettingService.GetSettings(); string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory()); StorageLocation StorageLocation = new(); protected override async Task OnInitializedAsync() { StorageLocation = await StorageLocationService.FirstOrDefaultAsync(l => l.Default && l.Type == SDK.Enums.StorageLocationType.Media); if (StorageLocation == null) { StorageLocation = new StorageLocation { Default = true, Path = "Media", Type = StorageLocationType.Media }; StorageLocation = await StorageLocationService.AddAsync(StorageLocation); } } async Task Save() { try { SettingService.SaveSettings(Settings); await StorageLocationService.UpdateAsync(StorageLocation); MessageService.Success("Settings saved!"); } catch (Exception ex) { MessageService.Error("An unknown error occurred."); Logger.LogError(ex, "An unknown error occurred."); } } 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); StorageLocation.Path = path; } }