Localtunnel hosting + admin panel + AppData db

- Default hosting mode is now Localtunnel — public *.loca.lt URL,
  no account, auto-fetched on first run. Replaces the prototyped
  Tailscale mode.
- Tailscale code purged from launcher + CLI; docs swapped to
  Localtunnel throughout (easy-setup, joining-a-server, server-cli,
  troubleshooting, faq, READMEs).
- Launcher sidebar gains an Open admin panel button — opens
  https://admin.<apex> in the browser once the server is live.
- SQLite db moves to %APPDATA%\DorkNet\dorknet.db (server reads
  Database__SqlitePath env var, launcher passes it). Existing dbs
  under <serverDir>\data\ are migrated on first run.
- CLI Program.cs: --mode default flips from tailscale to localtunnel;
  csproj links in LocaltunnelTunnel + LocaltunnelInstaller.
- New Backend files: LauncherNameServer, LocaltunnelInstaller,
  LocaltunnelTunnel, SingleOriginServiceMap.
- .gitignore: exclude installer/out/.
This commit is contained in:
Alexa
2026-05-28 01:39:38 +03:00
parent 7852b410ee
commit f5ad4b59ef
30 changed files with 942 additions and 184 deletions
+46 -4
View File
@@ -50,12 +50,54 @@ public static class LocalOverrides
var path = Environment.GetEnvironmentVariable(ReleasesEnvVar);
if (!string.IsNullOrEmpty(path)) return Directory.Exists(path) ? path : null;
var sideBySide = Path.Combine(AppContext.BaseDirectory, "local-releases");
if (Directory.Exists(sideBySide)) return sideBySide;
var sideBySide = FindSideBySideLocalReleases();
if (sideBySide is not null) return sideBySide;
return null;
}
private static string? FindSideBySideLocalReleases()
{
var baseDir = AppContext.BaseDirectory;
var direct = Path.Combine(baseDir, "local-releases");
if (LooksLikeLocalReleasesRoot(direct)) return direct;
// Be forgiving when users extract the zip into the wrong level:
// DorkNet\local-releases\local-releases\...
var doubled = Path.Combine(direct, "local-releases");
if (LooksLikeLocalReleasesRoot(doubled)) return doubled;
// Windows Explorer's "Extract All" often creates a folder named
// after the zip, then places local-releases inside it.
try
{
foreach (var dir in Directory.GetDirectories(baseDir))
{
var nested = Path.Combine(dir, "local-releases");
if (LooksLikeLocalReleasesRoot(nested)) return nested;
}
}
catch { }
return null;
}
private static bool LooksLikeLocalReleasesRoot(string path)
{
if (!Directory.Exists(path)) return false;
try
{
return Directory.GetDirectories(path)
.Any(versionDir =>
Directory.Exists(Path.Combine(versionDir, "server")) ||
Directory.Exists(Path.Combine(versionDir, "patcher")));
}
catch
{
return false;
}
}
/// <summary>Returns the local server-dir for <paramref name="versionKey"/>
/// if the releases-root override is set and the subfolder exists.
/// Convention: <c>{root}/{version_key}/server/</c>.</summary>
@@ -86,8 +128,8 @@ public static class LocalOverrides
var parts = new List<string>();
Describe(ManifestEnvVar, isDir: false, parts);
Describe(ReleasesEnvVar, isDir: true, parts);
var sideBySide = Path.Combine(AppContext.BaseDirectory, "local-releases");
if (Directory.Exists(sideBySide))
var sideBySide = FindSideBySideLocalReleases();
if (sideBySide is not null)
parts.Add($"{ReleasesEnvVar} -> {sideBySide} [side-by-side fallback]");
return string.Join("\n", parts);
}