Skip to content

GameProfile Sharing via genhub:// Protocol & Rich Import Inspection UI #390

Description

@undead2146

[Feature] GameProfile Sharing via genhub:// Protocol & Rich Import Inspection UI

1. Problem Statement & Context

GenHub provides modular workspace isolation and Content-Addressable Storage (CAS) deduplication for Command & Conquer Generals and Zero Hour game configurations. With full system disaster recovery tracked in #387 (.ghbak archives containing full offline CAS blobs), there is an equally critical, complementary requirement: lightweight, one-click GameProfile sharing between players.

Currently:

  • Players who create customized mod, patch, map, or tool configurations (e.g. ShockWave 1.2 + SuperHackers 60Hz Patch + GenPatcher Addons) have no streamlined way to share that exact setup with friends, tournament organizers, or community members.
  • Past issue Feature: GameProfile Import & Automatic Content Acquisition #93 outlined generic JSON clipboard/file import concepts, but did not define the genhub:// protocol specification, OS deep-link registration, or a detailed inspection/preview workflow.
  • The Blind Import Risk: Importing a profile without inspecting it creates major usability and security risks. Recipients must have full visibility into the exact game client version, included mods/patches, missing CAS objects requiring download, required disk space, and any altered game settings (resolution, camera, arguments) before confirming.

Architectural Clarification: Disaster Recovery Backup vs. GameProfile Sharing

Dimension Full System Backup (#387 .ghbak) GameProfile Sharing (genhub:// / .ghprofile)
Primary Goal Complete offline disaster recovery / machine migration. Frictionless modpack & setup distribution between players.
Binary Assets Includes physical CAS blobs inside the archive. Excludes binary blobs; includes manifest IDs, hashes, and acquisition URLs.
Payload Size Multi-Gigabyte container (ZIP/ZSTD). Lightweight string/file (Kilobytes to low Megabytes).
Resolution 100% Offline / Air-gapped restore. On-demand dynamic download via ContentDeliveryService.
Transport File explorer / USB / Cloud backup. genhub:// deep links (Discord/browser/chat), text snippet, or .ghprofile.

2. User Stories & Use Cases

  • UC-1 (One-Click Profile Export & Link Generation): As a player or streamer, I want to click "Share Profile" on any GameProfile card to generate a compact genhub://profile/import?... link, copy a formatted Discord/forum invite snippet, or save a .ghprofile file.
  • UC-2 (Deep-Link Protocol Activation): As a recipient clicking a genhub://profile/import?... link in Discord, Reddit, or a web browser, I want GenHub to automatically focus/open and launch the "Import Shared Profile" inspection modal.
  • UC-3 (Detailed Pre-Import Inspection & Diff): As a recipient, before any content is acquired or applied to my system, I want to see a rich breakdown showing:
    • Base Game Client & Engine Version (e.g. C&C Generals: Zero Hour v1.04).
    • Target Game Installation compatibility (e.g. Steam / EA App / Retail).
    • Itemized Content Manifests (Mods, Patches, Add-ons, Maps) with publisher, version, and status tags (✅ Already Cached vs ⬇️ Download Required).
    • Total download size and disk footprint.
    • Game configuration & launch argument overrides.
    • Duplicate profile name detection with inline rename capability.
  • UC-4 (Automated Content Acquisition & Activation): As a recipient clicking "Accept & Acquire", I want GenHub to fetch missing manifests and CAS objects via the ContentDeliveryService, construct the workspace, create the profile, and highlight it on the launcher dashboard.
  • UC-5 (Safety & Guardrails): As a user receiving a link from an unknown community member, I want GenHub to validate manifest hashes, sanitize launch arguments, and reject arbitrary executable paths.

3. Protocol Specification & Architecture

A. URI Scheme Format (genhub://)

# Format 1: Inline compressed payload (for lightweight profiles with public manifests)
genhub://profile/import?data=<Base64Url(BrotliCompressed(JSON))>

# Format 2: Remote reference payload (for extensive bundles or hosted manifests)
genhub://profile/import?url=<https://manifests.community-outpost.com/profiles/shockwave-cup-2026.json>

# Format 3: Hub Catalog reference (pre-indexed catalog profile)
genhub://profile/view?id=<catalog-profile-id>&publisher=<publisher-slug>

B. Data Model: SharedGameProfilePackage

{
  "$schemaVersion": 1,
  "generatorVersion": "0.0.1282",
  "exportedAt": "2026-08-19T14:30:00Z",
  "profile": {
    "name": "ShockWave Chaos Tourney Edition",
    "description": "Standardized competitive ShockWave build with 60Hz and camera patches.",
    "themeColor": "#00CCFF",
    "gameType": "ZeroHour",
    "gameVersion": "1.04",
    "useSteamLaunch": false,
    "commandLineArguments": "-win -quickstart",
    "gameSettingsOverrides": {
      "videoResolutionWidth": 1920,
      "videoResolutionHeight": 1080,
      "videoWindowed": true,
      "tshRenderFpsFontSize": 12,
      "goShowFps": true
    }
  },
  "requiredManifests": [
    {
      "manifestId": "zero-hour-1.04-patch",
      "name": "Zero Hour Community Patch 1.04",
      "contentType": "Patch",
      "version": "1.04.1",
      "publisher": "TheSuperHackers",
      "manifestUrl": "https://cdn.community-outpost.com/manifests/zh-104-patch.json",
      "totalBytes": 18454912
    },
    {
      "manifestId": "shockwave-mod-v1.2",
      "name": "ShockWave Mod",
      "contentType": "Mod",
      "version": "1.20",
      "publisher": "SWR Productions",
      "manifestUrl": "https://cdn.community-outpost.com/manifests/shockwave-120.json",
      "totalBytes": 782194810
    }
  ]
}

C. Cross-Platform Protocol Registration & IPC Forwarding

  1. Windows: Registry key HKCU\Software\Classes\genhub\shell\open\command -> GenHub.Windows.exe "%1".
  2. macOS: CFBundleURLTypes -> URL Scheme genhub in Info.plist.
  3. Linux: .desktop file containing MimeType=x-scheme-handler/genhub;.
  4. IPC Forwarding: Program.cs parses incoming genhub://profile/... arguments via CommandLineParser.ExtractProfileShareUri(args) and forwards import-profile:<uri> through SingleInstanceManager named pipe to the active instance.

4. Proposed Interfaces & Data Models

namespace GenHub.Core.Interfaces.GameProfiles;

public interface IProfileSharingService
{
    /// <summary>Generates a compact genhub:// sharing URI for a given profile.</summary>
    Task<OperationResult<string>> ExportProfileToUriAsync(string profileId, CancellationToken cancellationToken = default);

    /// <summary>Exports a self-contained .ghprofile JSON container file.</summary>
    Task<OperationResult<string>> ExportProfileToFileAsync(string profileId, string destinationPath, CancellationToken cancellationToken = default);

    /// <summary>Parses and inspects a share URI or package, performing local CAS/manifest diffing without modifying state.</summary>
    Task<OperationResult<SharedProfileInspectionResult>> InspectSharedProfileAsync(string shareUriOrJson, CancellationToken cancellationToken = default);

    /// <summary>Acquires missing dependencies and installs the shared profile.</summary>
    Task<OperationResult<GameProfile>> ImportSharedProfileAsync(
        SharedProfileImportRequest request,
        IProgress<ContentAcquisitionProgress>? progress = null,
        CancellationToken cancellationToken = default);
}

public sealed class SharedProfileInspectionResult
{
    public required GameProfile ProfileMetadata { get; init; }
    public required IReadOnlyList<SharedManifestDependency> Manifests { get; init; }
    public required bool HasValidGameInstallation { get; init; }
    public required string? MatchedGameInstallationId { get; init; }
    public required long TotalDownloadBytesRequired { get; init; }
    public required int CachedManifestCount { get; init; }
    public required int MissingManifestCount { get; init; }
    public required bool HasNameConflict { get; init; }
    public required string SuggestedProfileName { get; init; }
    public required IReadOnlyList<string> SecurityWarnings { get; init; }
}

public sealed class SharedManifestDependency
{
    public required string ManifestId { get; init; }
    public required string DisplayName { get; init; }
    public required string Version { get; init; }
    public required ContentType ContentType { get; init; }
    public required string? Publisher { get; init; }
    public required bool IsCachedLocally { get; init; }
    public required long DownloadSize { get; init; }
}

5. UI/UX Specification & Wireframes (Conforming to GenHub Dark Theme)

A. Profile Card & Context Menu Share Action

  • Add a Share button (Classes="tool-button", share icon) to GameProfileCardView.axaml alongside Steam toggle, Edit, Copy, Shortcut, and Delete.
  • Add "Share Profile..." to Border.ContextMenu in GameProfileCardView.axaml.

B. Share Profile Dialog (ShareProfileDialogWindow.axaml)

+-------------------------------------------------------------------------+
|  SHARE GAME PROFILE: ShockWave Chaos                             [ X ]  |
+-------------------------------------------------------------------------+
| Share Link (Protocol URI):                                              |
| +---------------------------------------------------------+  [ COPY ]   |
| | genhub://profile/import?data=eJy1V11v2zYQ...             |            |
| +---------------------------------------------------------+             |
|                                                                         |
| [  Copy Discord Markdown Message  ]      [  Export .ghprofile File  ]   |
+-------------------------------------------------------------------------+

C. Rich Import & Inspection Modal (ImportProfileInspectionWindow.axaml)

Designed to strictly follow GenHub's Avalonia design language (#1F1F1F background, frosted glass cards, colored accent borders, and badge tags):

+------------------------------------------------------------------------------------+
|  IMPORT SHARED PROFILE                                                       [ X ]  |
+------------------------------------------------------------------------------------+
|  +-------------------+  ShockWave Chaos Tourney Edition                             |
|  |   [COVER IMAGE]   |  Target Client: Command & Conquer: Zero Hour (v1.04)        |
|  |     300x180       |  Publisher / Author: SWR Productions                        |
|  +-------------------+  Profile Name: [ ShockWave Chaos Tourney Edition        ]   |
+------------------------------------------------------------------------------------+
|  CONTENT & MOD MANIFESTS BREAKDOWN (2 items)                                       |
|  +------------------------------------------------------------------------------+  |
|  | [Patch] Zero Hour Patch 1.04    v1.04.1    TheSuperHackers    [ ✅ CACHED ]   |  |
|  | [Mod]   ShockWave Mod           v1.20      SWR Productions    [ ⬇️ 745 MB ]   |  |
|  +------------------------------------------------------------------------------+  |
+------------------------------------------------------------------------------------+
|  GAME SETTINGS & LAUNCH OPTIONS OVERRIDES                                           |
|  • Display: 1920x1080 (Windowed)    • Fast-Start: Enabled (-quickstart)             |
|  • GeneralsOnline / TSH Settings: 60 FPS Lock, Latency Overlay, In-Game Rank Badges|
+------------------------------------------------------------------------------------+
|  Target Installation: [ Steam (C:\Games\Steam\steamapps\common\Command & Conquer) ▼]|
|  Acquisition Requirements: 1 download required (745 MB total download)            |
+------------------------------------------------------------------------------------+
|                                      [ Cancel ]   [  ⬇️ Import & Download (745 MB)  ] |
+------------------------------------------------------------------------------------+

D. Content Acquisition & Download Overlay

  • Displays real-time progress (Acquiring ShockWave Mod... 45% (335 MB / 745 MB)) reusing DownloadItemProgressView and IContentDeliveryService pipeline.
  • Automatically selects and highlights the profile upon completion with a toast notification.

6. Security & Validation Guardrails

  1. Executable Path Isolation: Shared profiles cannot define arbitrary executable paths (ExecutablePath / CustomExecutablePath / WorkingDirectory). GenHub will bind executables strictly through local IGameInstallation resolution or verified tool manifests.
  2. Launch Argument Sanitization: Disallow command injection characters (|, &, ;, > , <) in CommandLineArguments.
  3. Payload Size Guard: Inline genhub:// data payloads capped at 64 KB to prevent buffer overflows or browser URI truncation. Payloads exceeding limit prompt export to .ghprofile file or remote URL.
  4. Manifest Integrity: Every referenced manifest is validated against its cryptographic SHA-256 hash in the CAS pool before workspace creation.

7. Implementation Plan & Acceptance Criteria

  • Protocol & IPC:
    • Add genhub://profile/import and genhub://profile/view routing to CommandLineConstants and CommandLineParser.
    • Add IpcCommands.ImportProfilePrefix handling to Windows, macOS, and Linux startup / SingleInstance listeners.
  • Core Services & Serialization:
    • Implement IProfileSharingService with Brotli/Base64Url compression and .ghprofile file packaging.
    • Implement InspectSharedProfileAsync calculating CAS diffs, missing manifest lists, download sizes, and installation validation.
    • Implement ImportSharedProfileAsync orchestrating manifest acquisition, CAS asset download, and profile creation.
  • UI & UX:
    • Add Share button and context menu item to GameProfileCardView.axaml.
    • Implement ShareProfileDialogWindow.axaml (URI copy, Discord markdown copy, file export).
    • Implement ImportProfileInspectionWindow.axaml conforming to GenHub UI styling (dark theme, glass cards, badges, diff table, settings summary).
    • Integrate download progress display during multi-manifest acquisition.
  • Security & Validation:
    • Sanitize command line arguments and forbid arbitrary absolute binary paths in imported profiles.
    • Handle missing remote resolvers, 404s, and corrupted payloads with clear user-facing error dialogs.
  • Testing:
    • Add unit tests for payload serialization, Brotli compression/decompression, and URL decoding in GenHub.Tests.Core.
    • Add integration tests for IProfileSharingService verifying CAS cache hits vs missing download estimations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ArchitectureHigher level designContent-PipelineComponents of the content-pipeline systemEnhancementNew feature or requestGUIFor graphical user interfaceWIP

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions