Merge branch 'main' into development

# Conflicts:
#	LANCommander.Launcher.Services/AuthenticationService.cs
#	LANCommander.Launcher/UI/App.Chat.razor
#	LANCommander.Launcher/UI/App.Main.razor
#	LANCommander.Launcher/UI/Pages/Settings/Index.razor
This commit is contained in:
Pat Hartl 2025-11-09 14:33:07 -06:00
commit 5fa665f5ed
35 changed files with 76 additions and 48 deletions

View file

@ -1,6 +1,9 @@
name: LANCommander Development
on:
push:
branches:
- development
workflow_dispatch:
env:

View file

@ -7,8 +7,6 @@ using LANCommander.SDK.Providers;
using LANCommander.SDK.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Settings = LANCommander.Launcher.Models.Settings;
namespace LANCommander.Launcher.Services;
@ -37,6 +35,7 @@ public class AuthenticationService(
}
catch
{
logger.LogDebug("Server could not be reached");
}
return false;

View file

@ -4,6 +4,7 @@ using LANCommander.SDK;
using LANCommander.SDK.Extensions;
using Microsoft.Extensions.Logging;
using System.Collections.ObjectModel;
using LANCommander.SDK.Services;
namespace LANCommander.Launcher.Services
{
@ -18,13 +19,13 @@ namespace LANCommander.Launcher.Services
public delegate Task OnItemsFilteredHandler(IEnumerable<ListItem> items);
public event OnItemsFilteredHandler OnItemsFiltered;
private SDK.Client _client;
private DepotClient _depotClient;
public DepotService(
Client client,
DepotClient depotClient,
ILogger<DepotService> logger) : base(logger)
{
_client = client;
_depotClient = depotClient;
Filter.OnChanged += Filter_OnChanged;
}
@ -62,7 +63,7 @@ namespace LANCommander.Launcher.Services
using (var op = Logger.BeginDebugOperation("Loading depot items from host"))
{
var results = await _client.Depot.GetAsync();
var results = await _depotClient.GetAsync();
Filter.Populate(results);

View file

@ -21,4 +21,4 @@
if (currentUri.LocalPath == "/")
NavigationManager.NavigateTo("/Chat", true);
}
}
}

View file

@ -1,7 +0,0 @@
@page "/Authenticate"
<AuthenticationForm />
@code {
}

View file

@ -1,4 +1,3 @@
@using LANCommander.Launcher.UI.Authenticate.Components
@using LANCommander.SDK.Services
@namespace LANCommander.Launcher.UI
@inject IMessageService MessageService

View file

@ -7,6 +7,6 @@
var currentUri = new Uri(NavigationManager.Uri);
if (String.IsNullOrEmpty(Client.Settings.CurrentValue.Authentication.AccessToken) && currentUri.LocalPath != "/Authenticate")
NavigationManager.NavigateTo("/Authenticate");
NavigationManager.NavigateTo("/Authenticate", true);
}
}

View file

@ -0,0 +1,12 @@
@using LANCommander.Launcher.UI.Windows
@inherits LayoutComponentBase
@layout MainWindow
<AuthenticatedView NoAutoValidate="false">
<Authenticated>
@Body
</Authenticated>
<NotAuthenticated>
<RedirectToLogin/>
</NotAuthenticated>
</AuthenticatedView>

View file

@ -1,4 +1,4 @@
namespace LANCommander.Launcher.UI.Authenticate.Components;
namespace LANCommander.Launcher.UI.Components;
public class AuthenticationFormState
{

View file

@ -1,4 +1,4 @@
namespace LANCommander.Launcher.UI.Authenticate.Components;
namespace LANCommander.Launcher.UI.Components;
public enum AuthenticationStage
{

View file

@ -1,6 +1,7 @@
@using LANCommander.SDK.Exceptions
@using LANCommander.SDK.Models
@using LANCommander.SDK.Services
@namespace LANCommander.Launcher.UI.Components
@inject AuthenticationService AuthenticationService
@inject SDK.Client Client
@inject IConnectionClient ConnectionClient

View file

@ -1,5 +1,6 @@
@using LANCommander.SDK.Exceptions
@using LANCommander.SDK.Models
@namespace LANCommander.Launcher.UI.Components
@inject AuthenticationService AuthenticationService
@inject SDK.Client Client
@inject NavigationManager NavigationManager

View file

@ -1,6 +1,7 @@
@using LANCommander.Launcher.Models
@using LANCommander.SDK.Models
@using ListItem = AntDesign.ListItem
@namespace LANCommander.Launcher.UI.Components
@inject NavigationManager NavigationManager
@inject SDK.Client Client
@inject AuthenticationService AuthenticationService

View file

@ -0,0 +1,11 @@
@page "/Authenticate"
<AuthenticationForm />
@code {
protected override void OnInitialized()
{
}
}

View file

@ -1,5 +1,6 @@
@using LANCommander.Launcher.Models.Enums
@using LANCommander.SDK.Models
@namespace LANCommander.Launcher.UI.Components
@inject DepotService DepotService
@inject LocalizationService LocalizationService

View file

@ -1,7 +1,7 @@
@using LANCommander.Launcher.Data.Models
@using LANCommander.Launcher.Models
@using LANCommander.SDK.Extensions
@inject DepotService DepotService
@namespace LANCommander.Launcher.UI.Components
@inject LibraryService LibraryService
@inject GameService GameService
@inject InstallService InstallService

View file

@ -1,6 +1,5 @@
@using LANCommander.SDK.Models
@inject SDK.Client Client
@inject DepotService DepotService
@namespace LANCommander.Launcher.UI.Components
@inject LibraryService LibraryService
@inject ImportService ImportService
@inject IMessageService MessageService

View file

@ -1,4 +1,4 @@
@inject SDK.Client Client
@namespace LANCommander.Launcher.UI.Components
@inject DepotService DepotService
@inject LocalizationService LocalizationService

View file

@ -1,9 +1,9 @@
@page "/Depot"
@page "/Depot/{id:guid}"
@using LANCommander.Launcher.Models
@using LANCommander.Launcher.UI.Depot.Components
@using LANCommander.SDK.Exceptions
@implements IDisposable
@layout AuthenticatedLayout
@inject NavigationManager NavigationManager
@inject DepotService DepotService
@inject LibraryService LibraryService

View file

@ -4,6 +4,7 @@
@using Button = AntDesign.Button
@using ButtonType = AntDesign.ButtonType
@using Tooltip = AntDesign.Tooltip
@namespace LANCommander.Launcher.UI.Components
@inject LocalizationService LocalizationService
@inject InstallService InstallService
@inject GameClient GameClient

View file

@ -1,5 +1,6 @@
@using LANCommander.Launcher.Data.Models
@using LANCommander.SDK.Services
@namespace LANCommander.Launcher.UI.Components
@inject GameClient GameClient
<CascadingValue Value="CurrentGame">

View file

@ -1,3 +1,4 @@
@namespace LANCommander.Launcher.UI.Components
@inject LocalizationService LocalizationService
<div class="game-metadata">

View file

@ -1,3 +1,4 @@
@namespace LANCommander.Launcher.UI.Components
@using ListItem = LANCommander.Launcher.Models.ListItem
@if (CurrentItem?.DataItem is Data.Models.Game)

View file

@ -1,4 +1,5 @@
@using LANCommander.SDK.Extensions
@namespace LANCommander.Launcher.UI.Components
@inject LibraryService LibraryService
@inject NavigationManager NavigationManager
@inject LocalizationService LocalizationService

View file

@ -1,4 +1,5 @@
@using LANCommander.Launcher.Models
@namespace LANCommander.Launcher.UI.Components
<Dropdown Trigger="new Trigger[] { Trigger.ContextMenu }" Style="display: block; width: 100%;">
<Overlay>

View file

@ -2,7 +2,7 @@
@page "/Library/{id:guid}"
@using LANCommander.Launcher.Data.Models
@using LANCommander.Launcher.Models
@using LANCommander.Launcher.UI.Library.Components
@layout AuthenticatedLayout
@inject NavigationManager NavigationManager
@inject LibraryService LibraryService
@inject InstallService InstallService

View file

@ -1,6 +1,7 @@
@page "/Settings"
@using System.Globalization
@using LANCommander.Launcher.Models
@using LANCommander.SDK.Providers
@layout AuthenticatedLayout
@inject NavigationManager NavigationManager
@inject UpdateService UpdateService

View file

@ -68,22 +68,9 @@
<WindowContent>
<ErrorHandler Title="@LocalizationService.GetString("LauncherCrashed")">
<Body>
<AuthenticatedView NoAutoValidate="false">
<Authenticated>
@Body
@Body
@if (Client.Settings.CurrentValue.Debug.EnableScriptDebugging)
{
<PowerShellConsole/>
}
</Authenticated>
<NotAuthenticated>
<RedirectToLogin />
</NotAuthenticated>
</AuthenticatedView>
<ImportHandler @ref="ImportHandler" Progress="OnImportProcess" />
<ImportHandler @ref="ImportHandler" Progress="OnImportProcess"/>
<UpdateChecker/>
<AntContainer/>
<KeepAliveContainer/>

View file

@ -7,5 +7,6 @@
@using Microsoft.JSInterop
@using LANCommander.Launcher
@using LANCommander.Launcher.UI.Components
@using LANCommander.Launcher.UI.Layouts
@using LANCommander.Launcher.Services
@using AntDesign

View file

@ -19,6 +19,7 @@ public class AuthenticationClient(
ILogger<AuthenticationClient> logger,
ITokenProvider tokenProvider,
IServerConfigurationRefresher configRefresher,
ISettingsProvider settingsProvider,
ApiRequestFactory apiRequestFactory,
IConnectionClient connectionClient)
{
@ -88,7 +89,7 @@ public class AuthenticationClient(
{
try
{
apiRequestFactory
await apiRequestFactory
.Create()
.UseRoute("/api/Auth/Logout")
.UseAuthenticationToken()
@ -102,6 +103,12 @@ public class AuthenticationClient(
}
tokenProvider.SetToken(null);
settingsProvider.Update(s =>
{
s.Authentication.AccessToken = null;
s.Authentication.RefreshToken = null;
s.Authentication.OfflineModeEnabled = false;
});
}
public async Task RegisterAsync(string username, string password, string passwordConfirmation)

View file

@ -77,9 +77,21 @@ namespace LANCommander.Server.Controllers.Api
var results = await Cache.GetOrSetAsync("Depot/Results", async _ =>
{
var games = await GameService
.AsNoTracking()
.Include(g => g.Media)
.Include(g => g.Collections)
.Include(g => g.Platforms)
.Include(g => g.Tags)
.Include(g => g.Developers)
.Include(g => g.Genres)
.Include(g => g.Publishers)
.Include(g => g.Engine)
.GetAsync();
var results = new SDK.Models.DepotResults()
{
Games = Mapper.Map<ICollection<DepotGame>>(await GameService.AsNoTracking().GetAsync()),
Games = Mapper.Map<ICollection<DepotGame>>(games),
Collections = Mapper.Map<ICollection<SDK.Models.Collection>>(await CollectionService.AsNoTracking().GetAsync()),
Companies = Mapper.Map<ICollection<SDK.Models.Company>>(await CompanyService.AsNoTracking().GetAsync()),
Engines = Mapper.Map<ICollection<SDK.Models.Engine>>(await EngineService.AsNoTracking().GetAsync()),

View file

@ -12,13 +12,6 @@ services:
# - WINE=1
volumes:
- /path/to/appdata/config:/app/config
- /path/to/appdata/Backups:/app/Backups
- /path/to/appdata/Launcher:/app/Launcher
- /path/to/appdata/Media:/app/Media
- /path/to/appdata/Saves:/app/Saves
- /path/to/appdata/Servers:/app/Servers
- /path/to/appdata/Uploads:/app/Uploads
- /path/to/appdata/Updates:/app/Updates
ports:
- 1337:1337/tcp # Webinterface
- 35891:35891/udp # Beacon Broadcast