stan44 7562cf6fad Add gateway root adoption and mobile polish
- Add Tauri commands to inspect and adopt the gateway repo root
- Retry locked vault commands by prompting for unlock
- Improve mobile layout, editor mode toggles, and settings UI
2026-03-30 00:00:25 -05:00

56 lines
1.4 KiB
C#

using System.Text.Json;
using System.Text.Json.Serialization;
namespace Journal.WebGateway.Infrastructure;
public sealed class WebUiState(string distPath)
{
public string DistPath { get; } = distPath;
public bool Exists => Directory.Exists(DistPath) && File.Exists(Path.Combine(DistPath, "index.html"));
}
public sealed class SidecarRootState(string autoRoot)
{
private readonly object _sync = new();
private string _fallbackRoot = autoRoot;
private string _currentRoot = autoRoot;
private bool _isCustom;
public (string Root, bool IsCustom) Get()
{
lock (_sync) return (_currentRoot, _isCustom);
}
public void SetResolved(string path, bool isCustom)
{
lock (_sync)
{
_currentRoot = Path.GetFullPath(path.Trim());
_isCustom = isCustom;
if (!isCustom)
_fallbackRoot = _currentRoot;
}
}
public void ResetToFallback()
{
lock (_sync)
{
_currentRoot = _fallbackRoot;
_isCustom = false;
}
}
}
public sealed class SetSidecarRootRequest { public string? Path { get; set; } }
public sealed class CommandEnvelope
{
public string Action { get; set; } = "";
public string? CorrelationId { get; set; }
public string? Id { get; set; }
public string? Type { get; set; }
public string? Tag { get; set; }
public JsonElement? Payload { get; set; }
}