feat: Phase 0 shells, design system, server skeleton, Docker and CI

- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set,
  styles for all standard controls, custom chrome window with snap
  layouts, rail, job bar, Auto/manual slider, chips, toasts.
- Titano desktop shell with sections, Settings (language, theme),
  About and a --capture screenshot mode.
- Titano Server skeleton: env/server.json configuration, self-signed
  TLS with fingerprint, /health, /server/info, i18n endpoint and the
  embedded admin panel; in-process server tests.
- Docker image (multi-arch, PUID/PGID, health check), compose file,
  Unraid template; CI, release and nightly workflows; changelog tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 09:35:03 +00:00
1 parent 800843d2ae
commit c40b6a7cd3
122 files changed
+6838 -22

No files matched your search

@@ -0,0 +1,35 @@
using System.IO;
namespace Titano.App.Infrastructure;
/// <summary>
/// Where the client keeps its data (BRIEF §6.2): <c>%LOCALAPPDATA%\Titano</c>, or <c>.\data</c> next to the
/// executable when <c>portable.txt</c> exists. Never inside Documents/OneDrive (SQLite corrupts in synced folders).
/// </summary>
public sealed class AppEnvironment
{
private AppEnvironment(string dataDirectory, bool portable)
{
DataDirectory = dataDirectory;
IsPortable = portable;
Directory.CreateDirectory(DataDirectory);
Directory.CreateDirectory(LogDirectory);
Directory.CreateDirectory(CacheDirectory);
}
public string DataDirectory { get; }
public bool IsPortable { get; }
public string LogDirectory => Path.Combine(DataDirectory, "logs");
public string CacheDirectory => Path.Combine(DataDirectory, "cache");
public string DatabasePath => Path.Combine(DataDirectory, "titano.db");
public string SettingsPath => Path.Combine(DataDirectory, "settings.json");
public static AppEnvironment Detect()
{
var exeDir = AppContext.BaseDirectory;
if (File.Exists(Path.Combine(exeDir, "portable.txt")))
return new AppEnvironment(Path.Combine(exeDir, "data"), portable: true);
var local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
return new AppEnvironment(Path.Combine(local, "Titano"), portable: false);
}
}
@@ -0,0 +1,51 @@
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using Titano.Core.IO;
using Titano.Ui.Theming;
namespace Titano.App.Infrastructure;
/// <summary>Per-user preferences needed before the database opens (language, theme, window layout).</summary>
public sealed class AppSettings
{
public string? Language { get; set; }
public AppTheme Theme { get; set; } = AppTheme.Dark;
public bool RailCollapsed { get; set; }
public bool CheckForUpdates { get; set; } = true;
public bool AnonymousUsageCounts { get; set; }
public string? LastArchivePath { get; set; }
public WindowPlacement? Window { get; set; }
public sealed class WindowPlacement
{
public double Left { get; set; }
public double Top { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public bool Maximized { get; set; }
}
public static AppSettings Load(string path)
{
try
{
if (File.Exists(path))
return JsonSerializer.Deserialize(File.ReadAllText(path), AppSettingsJson.Default.AppSettings) ?? new AppSettings();
}
catch (JsonException)
{
// A corrupt settings file must never block startup; defaults apply.
}
catch (IOException)
{
}
return new AppSettings();
}
public void Save(string path) => AtomicFile.WriteAllText(path, JsonSerializer.Serialize(this, AppSettingsJson.Default.AppSettings));
}
[JsonSourceGenerationOptions(WriteIndented = true, UseStringEnumConverter = true)]
[JsonSerializable(typeof(AppSettings))]
internal sealed partial class AppSettingsJson : JsonSerializerContext;
@@ -0,0 +1,34 @@
using Titano.Core.Localization;
namespace Titano.App.Infrastructure;
/// <summary>Culture-aware number, size and duration formatting for the UI.</summary>
public static class Formatting
{
private static readonly string[] ByteUnits = ["B", "KB", "MB", "GB", "TB", "PB"];
/// <summary>1,536 → "1.5 KB" (decimal units, as Explorer shows for drives).</summary>
public static string Bytes(long bytes)
{
double value = bytes;
var unit = 0;
while (value >= 1000 && unit < ByteUnits.Length - 1)
{
value /= 1000;
unit++;
}
var format = unit == 0 || value >= 100 ? "0" : "0.#";
return value.ToString(format, Loc.Culture) + " " + ByteUnits[unit];
}
public static string Count(long n) => n.ToString("N0", Loc.Culture);
/// <summary>Compact duration: "2 h 00 m", "5 min", "40 s".</summary>
public static string Duration(TimeSpan t)
{
if (t.TotalHours >= 24) return Loc.L("Common.Duration.Days", (int)t.TotalDays, t.Hours);
if (t.TotalHours >= 1) return Loc.L("Common.Duration.Hours", (int)t.TotalHours, t.Minutes.ToString("00", Loc.Culture));
if (t.TotalMinutes >= 1) return Loc.L("Common.Duration.Minutes", (int)Math.Round(t.TotalMinutes));
return Loc.L("Common.Duration.Seconds", (int)Math.Round(t.TotalSeconds));
}
}
@@ -0,0 +1,14 @@
namespace Titano.App.Infrastructure;
/// <summary>Public links (BRIEF §19.4). Overridable at build time via the TitanoReleasesRepo property.</summary>
public static class ProductLinks
{
public static string ReleasesRepository { get; } =
typeof(ProductLinks).Assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyMetadataAttribute), false)
.OfType<System.Reflection.AssemblyMetadataAttribute>()
.FirstOrDefault(a => a.Key == "TitanoReleasesRepo")?.Value ?? "alby96/titano-releases";
public static string Releases => $"https://github.com/{ReleasesRepository}/releases";
public static string LatestReleaseApi => $"https://api.github.com/repos/{ReleasesRepository}/releases/latest";
}
@@ -0,0 +1,20 @@
using System.Diagnostics;
using System.IO;
namespace Titano.App.Infrastructure;
/// <summary>The only shell launches the product performs (BRIEF §8.6): open a URL, reveal a folder.</summary>
public static class ShellActions
{
public static void OpenUrl(string url)
{
if (!Uri.TryCreate(url, UriKind.Absolute, out var uri) || uri.Scheme is not ("https" or "http" or "ms-windows-store")) return;
Process.Start(new ProcessStartInfo(uri.AbsoluteUri) { UseShellExecute = true });
}
public static void OpenFolder(string path)
{
if (!Directory.Exists(path)) return;
Process.Start(new ProcessStartInfo(path) { UseShellExecute = true, Verb = "explore" });
}
}