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:
+9
-2
@@ -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();
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user