Startoption -dev: lokale Test-Website (localhost:5080)

Eigene Anmeldung (settings.dev.json), bleibt bei Selbst-Installation und Update erhalten, DEV-Schild in der Oberflaeche.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 17:48:47 +01:00
co-authored by Claude Opus 5.5
parent b69b9638ff
commit 077e39fa8a
10 changed files with 46 additions and 9 deletions
+9 -2
View File
@@ -8,8 +8,15 @@ namespace BSO.Launcher;
public static class Api
{
public const string BaseUrl = "https://bso.mbm.wtf";
/// <summary>Zum Testen umstellbar: BSO_LAUNCHER_API=http://localhost:5080</summary>
public static string Base => (Environment.GetEnvironmentVariable("BSO_LAUNCHER_API") ?? BaseUrl).TrimEnd('/');
/// <summary>Lokale Test-Website (BSO-Website mit "dotnet run --urls http://localhost:5080").</summary>
public const string DevUrl = "http://localhost:5080";
public const string DevArg = "-dev";
/// <summary>Mit -dev (oder --dev) gestartet: gegen die lokale Test-Website statt bso.mbm.wtf.</summary>
public static readonly bool Dev = Environment.GetCommandLineArgs().Skip(1).Any(a => a is "-dev" or "--dev");
/// <summary>Adresse der Website. BSO_LAUNCHER_API geht vor (beliebiger Test-Server), dann -dev, sonst bso.mbm.wtf.</summary>
public static string Base => (Environment.GetEnvironmentVariable("BSO_LAUNCHER_API") ?? (Dev ? DevUrl : BaseUrl)).TrimEnd('/');
public static readonly HttpClient Http = CreateHttp();
+4 -1
View File
@@ -111,9 +111,12 @@ public static class Installer
catch { /* ohne Verknuepfung geht es auch */ }
}
/// <summary>Installierte Kopie starten - mit -dev, wenn diese hier mit -dev lief.</summary>
public static void StartInstalled()
{
Process.Start(new ProcessStartInfo(InstalledExe) { UseShellExecute = true, WorkingDirectory = InstallDir });
var start = new ProcessStartInfo(InstalledExe) { UseShellExecute = true, WorkingDirectory = InstallDir };
if (Api.Dev) start.ArgumentList.Add(Api.DevArg);
Process.Start(start);
}
/// <summary>Ordner/Dateien loeschen, sobald dieser Prozess beendet ist (seine .exe ist bis dahin gesperrt).</summary>
+1
View File
@@ -45,6 +45,7 @@ public static class SelfUpdate
var start = new ProcessStartInfo(exe) { UseShellExecute = true };
start.ArgumentList.Add(AfterUpdateArg);
if (!Installer.RunningInstalled) start.ArgumentList.Add("--portable");
if (Api.Dev) start.ArgumentList.Add(Api.DevArg);
Process.Start(start);
return release.version;
}
+2 -1
View File
@@ -11,7 +11,8 @@ namespace BSO.Launcher;
public sealed class Settings
{
public static string Folder => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "BSO Launcher");
static string FilePath => Path.Combine(Folder, "settings.json");
/// <summary>Mit -dev eigene Datei: die Anmeldung gilt nur fuer die Website, bei der sie gemacht wurde.</summary>
static string FilePath => Path.Combine(Folder, Api.Dev ? "settings.dev.json" : "settings.json");
static readonly JsonSerializerOptions Options = new() { WriteIndented = true };
public string? Username { get; set; }