Initial project snapshot

This commit is contained in:
2026-04-28 22:29:50 +03:00
commit 8ba0561f4f
365 changed files with 91832 additions and 0 deletions
@@ -0,0 +1,87 @@
using System.Text.Json.Serialization;
namespace RemoteAccessPlatform.Windows.Models;
public sealed class LoginRequest
{
[JsonPropertyName("email")]
public string Email { get; set; } = string.Empty;
[JsonPropertyName("password")]
public string Password { get; set; } = string.Empty;
[JsonPropertyName("device_fingerprint")]
public string DeviceFingerprint { get; set; } = string.Empty;
[JsonPropertyName("device_label")]
public string DeviceLabel { get; set; } = string.Empty;
[JsonPropertyName("trust_device")]
public bool TrustDevice { get; set; }
}
public sealed class RefreshRequest
{
[JsonPropertyName("refresh_token")]
public string RefreshToken { get; set; } = string.Empty;
}
public sealed class UserDto
{
public string ID { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
public sealed class DeviceDto
{
public string ID { get; set; } = string.Empty;
public string UserID { get; set; } = string.Empty;
public string Fingerprint { get; set; } = string.Empty;
public string Label { get; set; } = string.Empty;
public string TrustStatus { get; set; } = string.Empty;
}
public sealed class AuthSessionDto
{
public string ID { get; set; } = string.Empty;
public string UserID { get; set; } = string.Empty;
public string DeviceID { get; set; } = string.Empty;
}
public sealed class TokenPairDto
{
[JsonPropertyName("access_token")]
public string AccessToken { get; set; } = string.Empty;
[JsonPropertyName("access_token_expires_at")]
public DateTimeOffset AccessTokenExpiresAt { get; set; }
[JsonPropertyName("refresh_token")]
public string RefreshToken { get; set; } = string.Empty;
[JsonPropertyName("refresh_token_expires_at")]
public DateTimeOffset RefreshTokenExpiresAt { get; set; }
}
public sealed class AuthResultDto
{
[JsonPropertyName("user")]
public UserDto User { get; set; } = new();
[JsonPropertyName("device")]
public DeviceDto Device { get; set; } = new();
[JsonPropertyName("auth_session")]
public AuthSessionDto AuthSession { get; set; } = new();
[JsonPropertyName("tokens")]
public TokenPairDto Tokens { get; set; } = new();
}
public sealed class StoredAuthState
{
public UserDto User { get; set; } = new();
public DeviceDto Device { get; set; } = new();
public AuthSessionDto AuthSession { get; set; } = new();
public TokenPairDto Tokens { get; set; } = new();
}
@@ -0,0 +1,28 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace RemoteAccessPlatform.Windows.Models;
public sealed class LocalizedMessageDto
{
[JsonPropertyName("code")]
public string Code { get; set; } = string.Empty;
[JsonPropertyName("message_key")]
public string MessageKey { get; set; } = string.Empty;
[JsonPropertyName("fallback_message")]
public string FallbackMessage { get; set; } = string.Empty;
[JsonPropertyName("details")]
public Dictionary<string, JsonElement>? Details { get; set; }
[JsonPropertyName("trace_id")]
public string? TraceId { get; set; }
}
public sealed class BackendErrorEnvelopeDto
{
[JsonPropertyName("error")]
public LocalizedMessageDto Error { get; set; } = new();
}
@@ -0,0 +1,24 @@
using System.Text.Json.Serialization;
namespace RemoteAccessPlatform.Windows.Models;
public sealed class OrganizationDto
{
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("slug")]
public string Slug { get; set; } = string.Empty;
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("status")]
public string Status { get; set; } = string.Empty;
}
public sealed class OrganizationsResponse
{
[JsonPropertyName("organizations")]
public List<OrganizationDto> Organizations { get; set; } = [];
}
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
namespace RemoteAccessPlatform.Windows.Models;
public sealed class ResourceDto
{
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("organization_id")]
public string OrganizationId { get; set; } = string.Empty;
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("address")]
public string Address { get; set; } = string.Empty;
[JsonPropertyName("protocol")]
public string Protocol { get; set; } = string.Empty;
[JsonPropertyName("certificate_verification_mode")]
public string CertificateVerificationMode { get; set; } = "strict";
[JsonPropertyName("clipboard_mode")]
public string ClipboardMode { get; set; } = "disabled";
[JsonPropertyName("file_transfer_mode")]
public string FileTransferMode { get; set; } = "disabled";
[JsonPropertyName("metadata")]
public Dictionary<string, object?> Metadata { get; set; } = new();
}
public sealed class ResourcesResponse
{
[JsonPropertyName("resources")]
public List<ResourceDto> Resources { get; set; } = [];
}
@@ -0,0 +1,443 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace RemoteAccessPlatform.Windows.Models;
public sealed class StartSessionRequest
{
[JsonPropertyName("resource_id")]
public string ResourceId { get; set; } = string.Empty;
[JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
[JsonPropertyName("device_id")]
public string DeviceId { get; set; } = string.Empty;
}
public sealed class AttachSessionRequest
{
[JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
[JsonPropertyName("device_id")]
public string DeviceId { get; set; } = string.Empty;
}
public sealed class DetachSessionRequest
{
[JsonPropertyName("attachment_id")]
public string AttachmentId { get; set; } = string.Empty;
[JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
[JsonPropertyName("reason")]
public string Reason { get; set; } = string.Empty;
}
public sealed class TakeoverSessionRequest
{
[JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
[JsonPropertyName("device_id")]
public string DeviceId { get; set; } = string.Empty;
[JsonPropertyName("reason")]
public string Reason { get; set; } = string.Empty;
}
public sealed class TerminateSessionRequest
{
[JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
[JsonPropertyName("reason")]
public string Reason { get; set; } = string.Empty;
}
public sealed class RemoteSessionDto
{
public string ID { get; set; } = string.Empty;
public string OrganizationID { get; set; } = string.Empty;
public string ResourceID { get; set; } = string.Empty;
public string Protocol { get; set; } = string.Empty;
public string State { get; set; } = string.Empty;
public string WorkerID { get; set; } = string.Empty;
public string ControllerUserID { get; set; } = string.Empty;
public DateTimeOffset? DetachDeadlineAt { get; set; }
public DateTimeOffset? LastHeartbeatAt { get; set; }
public int TakeoverVersion { get; set; }
}
public sealed class SessionAttachmentDto
{
public string ID { get; set; } = string.Empty;
public string RemoteSessionID { get; set; } = string.Empty;
public string UserID { get; set; } = string.Empty;
public string DeviceID { get; set; } = string.Empty;
public string Role { get; set; } = string.Empty;
public string State { get; set; } = string.Empty;
public string? SupersededBy { get; set; }
public string? TakeoverOf { get; set; }
}
public sealed class AttachTokenDto
{
[JsonPropertyName("token")]
public string Token { get; set; } = string.Empty;
[JsonPropertyName("session_id")]
public string SessionId { get; set; } = string.Empty;
[JsonPropertyName("attachment_id")]
public string AttachmentId { get; set; } = string.Empty;
[JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
[JsonPropertyName("device_id")]
public string DeviceId { get; set; } = string.Empty;
[JsonPropertyName("worker_id")]
public string WorkerId { get; set; } = string.Empty;
[JsonPropertyName("takeover_version")]
public int TakeoverVersion { get; set; }
[JsonPropertyName("expires_at")]
public DateTimeOffset ExpiresAt { get; set; }
[JsonPropertyName("reconnectable")]
public bool Reconnectable { get; set; }
}
public sealed class SessionControlResultDto
{
[JsonPropertyName("session")]
public RemoteSessionDto Session { get; set; } = new();
[JsonPropertyName("attachment")]
public SessionAttachmentDto? Attachment { get; set; }
[JsonPropertyName("attach_token")]
public AttachTokenDto? AttachToken { get; set; }
[JsonPropertyName("gateway_url")]
public string? GatewayUrl { get; set; }
[JsonPropertyName("data_plane")]
public DataPlaneOfferDto? DataPlane { get; set; }
}
public sealed class DataPlaneOfferDto
{
[JsonPropertyName("preferred")]
public string Preferred { get; set; } = string.Empty;
[JsonPropertyName("token")]
public string Token { get; set; } = string.Empty;
[JsonPropertyName("expires_at")]
public DateTimeOffset ExpiresAt { get; set; }
[JsonPropertyName("candidates")]
public List<DataPlaneCandidateDto> Candidates { get; set; } = [];
}
public sealed class DataPlaneCandidateDto
{
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("url")]
public string Url { get; set; } = string.Empty;
[JsonPropertyName("worker_id")]
public string? WorkerId { get; set; }
[JsonPropertyName("priority")]
public int? Priority { get; set; }
[JsonPropertyName("metadata")]
public Dictionary<string, JsonElement>? Metadata { get; set; }
}
public sealed class SessionsResponse
{
[JsonPropertyName("sessions")]
public List<RemoteSessionDto> Sessions { get; set; } = [];
}
public sealed class LiveTransportEnvelopeDto
{
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("session_id")]
public string? SessionId { get; set; }
[JsonPropertyName("payload")]
public Dictionary<string, JsonElement>? Payload { get; set; }
[JsonPropertyName("event")]
public LocalizedMessageDto? Event { get; set; }
[JsonPropertyName("render_transport")]
public string? RenderTransport { get; set; }
[JsonPropertyName("color_mode")]
public string? ColorMode { get; set; }
[JsonIgnore]
public SessionFrameDto? BinaryFrame { get; set; }
}
public sealed class SessionRenderStateDto
{
[JsonPropertyName("quality_profile")]
public string QualityProfile { get; set; } = string.Empty;
[JsonPropertyName("state")]
public string State { get; set; } = string.Empty;
[JsonPropertyName("width")]
public int? Width { get; set; }
[JsonPropertyName("height")]
public int? Height { get; set; }
[JsonPropertyName("cursor_x")]
public int? CursorX { get; set; }
[JsonPropertyName("cursor_y")]
public int? CursorY { get; set; }
[JsonPropertyName("cursor_visible")]
public bool? CursorVisible { get; set; }
[JsonPropertyName("dirty_rectangles")]
public int? DirtyRectangles { get; set; }
[JsonPropertyName("last_render_at")]
public DateTimeOffset? LastRenderAt { get; set; }
}
public sealed class SessionFrameDto
{
[JsonPropertyName("message_type")]
public string? MessageType { get; set; }
[JsonPropertyName("frame_sequence")]
public long FrameSequence { get; set; }
[JsonPropertyName("frame_width")]
public int Width { get; set; }
[JsonPropertyName("frame_height")]
public int Height { get; set; }
[JsonPropertyName("frame_stride")]
public int Stride { get; set; }
[JsonPropertyName("frame_format")]
public string PixelFormat { get; set; } = string.Empty;
[JsonPropertyName("frame_update_kind")]
public string UpdateKind { get; set; } = "full";
[JsonPropertyName("desktop_width")]
public int DesktopWidth { get; set; }
[JsonPropertyName("desktop_height")]
public int DesktopHeight { get; set; }
[JsonPropertyName("region_x")]
public int RegionX { get; set; }
[JsonPropertyName("region_y")]
public int RegionY { get; set; }
[JsonPropertyName("region_width")]
public int RegionWidth { get; set; }
[JsonPropertyName("region_height")]
public int RegionHeight { get; set; }
[JsonPropertyName("region_stride")]
public int RegionStride { get; set; }
[JsonPropertyName("region_format")]
public string? RegionFormat { get; set; }
[JsonPropertyName("color_mode")]
public string ColorMode { get; set; } = "full_color";
[JsonPropertyName("quality_profile")]
public string? QualityProfile { get; set; }
[JsonPropertyName("original_frame_format")]
public string? OriginalFrameFormat { get; set; }
[JsonPropertyName("output_frame_format")]
public string? OutputFrameFormat { get; set; }
[JsonPropertyName("raw_frame_bytes")]
public long? RawFrameBytes { get; set; }
[JsonPropertyName("binary_direct_bytes")]
public long? BinaryDirectBytes { get; set; }
[JsonPropertyName("full_frame_bytes")]
public long? FullFrameBytes { get; set; }
[JsonPropertyName("region_bytes")]
public long? RegionBytes { get; set; }
[JsonPropertyName("region_savings_percent")]
public double? RegionSavingsPercent { get; set; }
[JsonPropertyName("diff_time_ms")]
public long? DiffTimeMs { get; set; }
[JsonPropertyName("render_update_reason")]
public string? RenderUpdateReason { get; set; }
[JsonPropertyName("fallback_to_full_frame_reason")]
public string? FallbackToFullFrameReason { get; set; }
[JsonPropertyName("frame_data")]
public byte[] Pixels { get; set; } = [];
[JsonPropertyName("input_correlation_id")]
public string? InputCorrelationId { get; set; }
[JsonPropertyName("worker_frame_captured_at")]
public string? WorkerFrameCapturedAt { get; set; }
}
public sealed class SessionInputEventDto
{
[JsonPropertyName("correlation_id")]
public string? CorrelationId { get; set; }
[JsonPropertyName("client_captured_at")]
public string? ClientCapturedAt { get; set; }
[JsonPropertyName("kind")]
public string Kind { get; set; } = string.Empty;
[JsonPropertyName("action")]
public string Action { get; set; } = string.Empty;
[JsonPropertyName("scan_code")]
public uint? ScanCode { get; set; }
[JsonPropertyName("is_extended")]
public bool? IsExtended { get; set; }
[JsonPropertyName("button")]
public string? Button { get; set; }
[JsonPropertyName("normalized_x")]
public double? NormalizedX { get; set; }
[JsonPropertyName("normalized_y")]
public double? NormalizedY { get; set; }
[JsonPropertyName("wheel_delta")]
public int? WheelDelta { get; set; }
[JsonPropertyName("is_horizontal_wheel")]
public bool? IsHorizontalWheel { get; set; }
[JsonPropertyName("focused")]
public bool? Focused { get; set; }
[JsonPropertyName("surface_width")]
public double? SurfaceWidth { get; set; }
[JsonPropertyName("surface_height")]
public double? SurfaceHeight { get; set; }
}
public sealed class FileUploadStartDto
{
[JsonPropertyName("direction")]
public string Direction { get; set; } = "client_to_server";
[JsonPropertyName("transfer_id")]
public string TransferId { get; set; } = string.Empty;
[JsonPropertyName("file_name")]
public string FileName { get; set; } = string.Empty;
[JsonPropertyName("file_size")]
public long FileSize { get; set; }
[JsonPropertyName("total_chunks")]
public long TotalChunks { get; set; }
[JsonPropertyName("content_hash")]
public string ContentHash { get; set; } = string.Empty;
}
public sealed class FileUploadChunkDto
{
[JsonPropertyName("direction")]
public string Direction { get; set; } = "client_to_server";
[JsonPropertyName("transfer_id")]
public string TransferId { get; set; } = string.Empty;
[JsonPropertyName("chunk_index")]
public long ChunkIndex { get; set; }
[JsonPropertyName("offset")]
public long Offset { get; set; }
[JsonPropertyName("chunk_size")]
public int ChunkSize { get; set; }
[JsonPropertyName("chunk_bytes")]
public string ChunkBytes { get; set; } = string.Empty;
}
public sealed class FileDownloadStartDto
{
[JsonPropertyName("direction")]
public string Direction { get; set; } = "server_to_client";
[JsonPropertyName("transfer_id")]
public string TransferId { get; set; } = string.Empty;
[JsonPropertyName("file_id")]
public string FileId { get; set; } = string.Empty;
}
public sealed class FileDownloadAckDto
{
[JsonPropertyName("direction")]
public string Direction { get; set; } = "server_to_client";
[JsonPropertyName("transfer_id")]
public string TransferId { get; set; } = string.Empty;
[JsonPropertyName("file_id")]
public string FileId { get; set; } = string.Empty;
[JsonPropertyName("sequence")]
public long Sequence { get; set; }
[JsonPropertyName("offset")]
public long Offset { get; set; }
}
public sealed class FileDownloadCandidateDto
{
public string FileId { get; set; } = string.Empty;
public string FileName { get; set; } = string.Empty;
public long FileSize { get; set; }
public string ContentHash { get; set; } = string.Empty;
}
@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
namespace RemoteAccessPlatform.Windows.Models;
public sealed class BackendEndpointOptions
{
[JsonPropertyName("api_base_url")]
public string ApiBaseUrl { get; set; } = "http://192.168.200.61:8080/api/v1";
[JsonPropertyName("gateway_websocket_url")]
public string GatewayWebSocketUrl { get; set; } = "ws://192.168.200.61:8080/api/v1/gateway/ws";
[JsonPropertyName("prefer_direct_data_plane")]
public bool PreferDirectDataPlane { get; set; } = true;
[JsonPropertyName("direct_data_plane_connect_timeout_ms")]
public int DirectDataPlaneConnectTimeoutMs { get; set; } = 750;
[JsonPropertyName("allow_insecure_direct_data_plane_tls_for_smoke")]
public bool AllowInsecureDirectDataPlaneTlsForSmoke { get; set; }
[JsonPropertyName("direct_data_plane_color_mode")]
public string DirectDataPlaneColorMode { get; set; } = "full_color";
[JsonPropertyName("direct_data_plane_platform_ca_bundle")]
public string? DirectDataPlanePlatformCaBundle { get; set; }
[JsonPropertyName("environment")]
public string Environment { get; set; } = "development";
}
public sealed class LocalClientSettings
{
[JsonPropertyName("device_fingerprint")]
public string? DeviceFingerprint { get; set; }
[JsonPropertyName("last_organization_by_user_id")]
public Dictionary<string, string> LastOrganizationByUserId { get; set; } = new();
}