### Example Application Response Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md This is an example of a successful response when retrieving all applications, detailing their configurations. ```json { "success": true, "apps": [ { "id": "steam", "title": "Steam", "icon_png_path": "/path/to/icon.png", "start_virtual_compositor": true, "render_node": "/dev/dri/renderD128", "runner": { "type": "docker", "image": "ghcr.io/games-on-whales/steam:latest", "name": "steam", "env": ["DISPLAY=:0"], "mounts": ["/home/user:/home/user"], "devices": ["/dev/dri"], "ports": [], "run_cmd": "steam" } } ] } ``` -------------------------------- ### Example Add Application Response Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md A successful response after attempting to add a new application. ```json { "success": true, "error": null } ``` -------------------------------- ### Start Containerized Runner Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Use this endpoint to start a new containerized application runner. Specify the runner type, image, environment variables, and other configuration details. ```json { "session_id": "session-001", "stop_stream_when_over": false, "runner": { "type": "docker", "name": "steam-instance", "image": "ghcr.io/games-on-whales/steam:latest", "env": ["DISPLAY=:0"], "mounts": ["/home/user:/home/user"], "devices": ["/dev/dri"], "ports": [], "run_cmd": "steam", "base_create_json": "{...}" } } ``` -------------------------------- ### Start Containerized Application Runner Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Starts a containerized application runner. The 'joinable' parameter is intended to allow other clients to join but is not currently implemented. ```csharp public static async Task StartRunner(Runner runner, bool joinable = false) ``` ```csharp var runner = new Runner { Type = "docker", Image = "ghcr.io/games-on-whales/wolf-ui:main", Name = "wolf-ui", Env = new List { "LOGLEVEL=INFO" } }; await WolfApi.StartRunner(runner); ``` -------------------------------- ### StartRunner Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Starts a containerized application runner with specified configuration. Optionally allows other clients to join. ```APIDOC ## StartRunner(Runner runner, bool joinable = false) ### Description Starts a containerized application runner with specified configuration. Optionally allows other clients to join. ### Method POST ### Endpoint /api/runner/start ### Parameters #### Request Body - **runner** (Runner) - Required - Runner configuration - **Type** (string) - Required - Type of the runner (e.g., "docker") - **Image** (string) - Required - Docker image to use - **Name** (string) - Required - Name for the runner - **Env** (List) - Optional - Environment variables for the runner - **joinable** (bool) - Optional - If true, allows other clients to join (not currently used). Defaults to false. ### Request Example ```json { "runner": { "Type": "docker", "Image": "ghcr.io/games-on-whales/wolf-ui:main", "Name": "wolf-ui", "Env": ["LOGLEVEL=INFO"] }, "joinable": false } ``` ### Response #### Success Response (200) - void ``` -------------------------------- ### Starter Request Model Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/types.md Represents the request object for starting a runner with session context. Use this to configure runner startup parameters. ```csharp public class Starter { public bool StopStreamWhenOver { get; set; } public string? SessionId { get; set; } public Runner? Runner { get; set; } } ``` -------------------------------- ### Get All Apps Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves all available applications. Handles potential network errors by returning null. ```csharp public static async Task GetApps() ``` ```csharp var appsResponse = await WolfApi.GetApps(); if (appsResponse?.Success == true) { foreach (var app in appsResponse.Apps) { GD.Print($"App: {app.Title}"); } } ``` -------------------------------- ### GET /apps Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Retrieve all available applications. This endpoint returns a list of applications with their details, including configuration for running them. ```APIDOC ## GET /apps ### Description Retrieve all available applications. This endpoint returns a list of applications with their details, including configuration for running them. ### Method GET ### Endpoint /api/v1/apps ### Response #### Success Response (200 OK) - **success** (boolean) - Whether request succeeded - **apps** (App[]) - List of available applications #### Response Example ```json { "success": true, "apps": [ { "id": "steam", "title": "Steam", "icon_png_path": "/path/to/icon.png", "start_virtual_compositor": true, "render_node": "/dev/dri/renderD128", "runner": { "type": "docker", "image": "ghcr.io/games-on-whales/steam:latest", "name": "steam", "env": ["DISPLAY=:0"], "mounts": ["/home/user:/home/user"], "devices": ["/dev/dri"], "ports": [], "run_cmd": "steam" } } ] } ``` ``` -------------------------------- ### Initialize API and List Apps Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Initializes the Wolf API client and retrieves a list of applications. This is a common starting point for interacting with the API. ```csharp WolfApi.Init(); var appsResponse = await WolfApi.GetApps(); ``` -------------------------------- ### Logging Method Examples Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Demonstrates how to use the various logging methods (Information, Error, Warning, Debug) with formatted strings and arguments. These methods allow for detailed and structured logging. ```csharp logger.LogInformation("Loading {0} apps for profile {1}", appCount, profileName); logger.LogError("Failed to connect to {0}: {1}", hostname, errorMessage); logger.LogWarning("Deprecated method {0} called", methodName); logger.LogDebug("Cache hit for key {0}", cacheKey); ``` -------------------------------- ### Logging Example Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Retrieves a logger instance for a specific class and demonstrates logging messages at different severity levels (Information, Warning, Error). ```csharp ILogger logger = Main.GetLogger(); logger.LogInformation("Message with {0}", arg); logger.LogWarning("Warning"); logger.LogError("Error"); ``` -------------------------------- ### Runners Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/GENERATION-SUMMARY.txt Endpoint for starting application runners. ```APIDOC ## POST /runners/start ### Description Starts an application runner. ### Method POST ### Endpoint /runners/start ### Request Body - **runnerConfig** (object) - Required - Configuration for the runner. ### Request Example { "example": "{\n \"appName\": \"Example App\",\n \"args\": [\"--fullscreen\", \"--resolution=1080p\"]\n}" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. ### Response Example { "example": "{\n \"message\": \"Runner started successfully\"\n}" } ``` -------------------------------- ### Retrieve All Applications Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Use this endpoint to get a list of all applications configured in the system. The response includes details about each application's runner configuration. ```bash GET /api/v1/apps ``` -------------------------------- ### Server-Sent Events Example Stream Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md This example demonstrates the structure of a Server-Sent Events stream, including keepalive messages and various event types like lobby creation, stopping, joining, and leaving. ```text :keepalive event: wolf::core::events::CreateLobbyEvent data: {"lobby_id":"lobby-123",...} event: wolf::core::events::StopLobbyEvent data: {"lobby_id":"lobby-123"} event: wolf::core::events::JoinLobbyEvent data: {"lobby_id":"lobby-123","moonlight_session_id":"session-001",...} event: wolf::core::events::LeaveLobbyEvent data: {"lobby_id":"lobby-123","moonlight_session_id":"session-001",...} ``` -------------------------------- ### Example config.toml Structure Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/configuration.md This TOML structure defines the configuration for a Wolf-UI Docker container, including environment variables, mounts, and image details. ```toml [[profiles.apps]] start_virtual_compositor = true title = 'Wolf UI' [profiles.apps.runner] base_create_json = '''{ "HostConfig": {...} }''' devices = [] env = [ 'GOW_REQUIRED_DEVICES=/dev/input/event* /dev/dri/* /dev/nvidia*', 'WOLF_SOCKET_PATH=/var/run/wolf/wolf.sock', 'WOLF_UI_AUTOUPDATE=False', 'LOGLEVEL=INFO' ] image = 'ghcr.io/games-on-whales/wolf-ui:main' mounts = [ '/var/run/wolf/wolf.sock:/var/run/wolf/wolf.sock' ] name = 'Wolf-UI' ports = [] type = 'docker' ``` -------------------------------- ### OptInJsonTypeInfoResolver Example Usage Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Demonstrates how to use `OptInJsonTypeInfoResolver` by marking properties with `[JsonInclude]` to control serialization. Only properties with this attribute will be serialized. ```csharp public class MyModel { [JsonInclude, JsonPropertyName("public_field")] public string PublicField { get; set; } // Serialized public string InternalField { get; set; } // NOT serialized } ``` -------------------------------- ### POST /runners/start Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Starts a containerized application runner. It allows specifying details about the runner configuration, such as the image, environment variables, and commands to execute. ```APIDOC ## POST /runners/start ### Description Start a containerized application runner. ### Method POST ### Endpoint /api/v1/runners/start ### Parameters #### Request Body - **session_id** (string) - Yes - Associated session ID - **runner** (Runner) - Yes - Container configuration - **stop_stream_when_over** (boolean) - No - Stop stream when app exits ### Request Example ```json { "session_id": "session-001", "stop_stream_when_over": false, "runner": { "type": "docker", "name": "steam-instance", "image": "ghcr.io/games-on-whales/steam:latest", "env": ["DISPLAY=:0"], "mounts": ["/home/user:/home/user"], "devices": ["/dev/dri"], "ports": [], "run_cmd": "steam", "base_create_json": "{...}" } } ``` ### Response #### Success Response (200 OK) - **success** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Setup LoggerFactory with LOGLEVEL Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/configuration.md Initializes the LoggerFactory and sets the log level based on the LOGLEVEL environment variable. The logger is created for the main application class. ```csharp static Main() { var logLevelEnv = Environment.GetEnvironmentVariable("LOGLEVEL") ?? "INFO"; Factory = LoggerFactory.Create(); Factory.SetLogLevel(logLevel); Logger = Factory.CreateLogger
(); } ``` -------------------------------- ### Sample Profile Response Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md This is an example of a successful JSON response (200 OK) when retrieving user profiles, showing the structure of profile data. ```json { "success": true, "profiles": [ { "id": "profile-001", "name": "John Doe", "icon_png_path": "/path/to/profile-pic.png", "pin": [1, 2, 3, 4], "apps": [ { "id": "steam", "title": "Steam", "icon_png_path": "/path/to/icon.png", "start_virtual_compositor": true, "runner": { ... } } ] } ] } ``` -------------------------------- ### Retrieve All User Profiles Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Use this GET request to fetch a list of all user profiles. No authentication is required. ```http GET /api/v1/profiles ``` -------------------------------- ### Get Session and Stream Settings Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Retrieves the current session information and prints details about the streaming video and audio settings. ```csharp var session = await WolfApi.GetSession(); if (session != null) { GD.Print($"Stream: {session.VideoWidth}x{session.VideoHeight}@{session.VideoRefreshRate}Hz"); GD.Print($"Audio: {session.AudioChannelCount} channels"); } ``` -------------------------------- ### Get All User Profiles Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves a list of all available user profiles. Returns an empty list if the operation fails. ```csharp public static async Task> GetProfiles() ``` ```csharp var profiles = await WolfApi.GetProfiles(); var firstProfile = profiles.FirstOrDefault(); ``` -------------------------------- ### Get Connected Clients Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves a list of all currently connected clients. Returns an empty list if an error occurs. ```csharp public static async Task> GetClients() ``` -------------------------------- ### Get Logger and Log Messages Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Obtains a logger instance for a specific class and demonstrates logging messages at different severity levels (Information, Warning, Error). ```csharp private static readonly ILogger Logger = Main.GetLogger(); public void MyMethod() { Logger.LogInformation("Processing {0} items", count); Logger.LogWarning("Slow operation detected"); Logger.LogError("Failed: {0}", error); } ``` -------------------------------- ### Main._Ready() Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Godot lifecycle method called when the node enters the scene tree. Initializes various systems including sound effects, API, and auto-update checks. ```APIDOC ## Main._Ready() ### Description Called when the node enters the scene tree. Initializes sound effects audio processor, timer for periodic sound effect updates, WolfAPI singleton and event listener, self-update check, and logs the current session ID. ### Method `override` ### Signature `public override void _Ready()` ### Timeline - Early initialization: Skipped if running in editor - Initialization order: Sound effects → API init → Auto-update ``` -------------------------------- ### Main _Ready() Method Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Called when the node enters the scene tree. Initializes sound effects, timers, API, and performs self-update checks. ```csharp public override void _Ready() ``` -------------------------------- ### Create and Join Lobby Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Demonstrates how to create a new lobby and then join an existing lobby using its ID. Requires lobby and session information. ```csharp var lobbyId = await WolfApi.CreateLobby(lobby); var result = await WolfApi.JoinLobby(lobbyId, sessionId); ``` -------------------------------- ### Runners API Endpoints Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/WOLF-UI-REFERENCE.md Endpoint for starting an application runner. ```APIDOC ## POST /runners/start ### Description Start an application runner. ### Method POST ### Endpoint /api/v1/runners/start ### Request Body - **appName** (string) - Required - The name of the application to run. ### Response #### Success Response (200) - **message** (string) - Confirmation message. ``` -------------------------------- ### Initialize API and List Apps Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Initializes the Wolf API singleton and retrieves a list of available apps. Iterates through the apps and prints their titles. ```csharp WolfApi.Init(); // Set up singleton var appsResponse = await WolfApi.GetApps(); foreach (var app in appsResponse.Apps ?? new List()) { GD.Print($"App: {app.Title}"); } ``` -------------------------------- ### WolfAPI.Init() Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Initializes the WolfAPI singleton. This method should be called during application startup to set up the API client and begin listening for server-sent events. ```APIDOC ## Init() ### Description Initializes the WolfAPI singleton. Called during Main._Ready() to set up the API client and start listening to server-sent events. ### Method Static Method ### Return void ``` -------------------------------- ### Retrieve All Active Lobbies Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Use this endpoint to get a list of all currently active lobbies. No authentication is required. ```http GET /api/v1/lobbies ``` -------------------------------- ### WolfAPI Client Class Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Documentation for the complete WolfAPI singleton class, including all static methods organized by category such as Apps, Profiles, Lobbies, Sessions, Clients, Runners, Docker, and Utils. It also covers properties, events, signals, and configuration for rate limiting and caching. ```APIDOC ## WolfAPI Client Class ### Description Complete documentation for the WolfAPI singleton class. This class provides access to various functionalities including managing Apps, Profiles, Lobbies, Sessions, Clients, Runners, Docker operations, and utility functions. It details all static methods, properties, events, and signals, along with configuration options for rate limiting and caching. ### Methods - **Apps**: Methods for managing applications. - **Profiles**: Methods for managing user profiles. - **Lobbies**: Methods for managing game lobbies. - **Sessions**: Methods for managing user sessions. - **Clients**: Methods for managing client connections. - **Runners**: Methods for managing game runners. - **Docker**: Methods for Docker-related operations. - **Utils**: Miscellaneous utility methods. ### Properties - **Properties**: Details of available properties within the WolfAPI class. - **Events**: Information on events emitted by the WolfAPI class. - **Signals**: Details on signals provided by the WolfAPI class. ### Configuration - **Rate Limiting**: Configuration options for API rate limiting. - **Caching**: Configuration for caching mechanisms (in-memory and disk-based). ``` -------------------------------- ### Get Session Information Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves the current session details. Returns null if no session is owned by the client. ```csharp public static async Task GetSession() ``` ```csharp var session = await WolfApi.GetSession(); if (session != null) { GD.Print($"Video: {session.VideoWidth}x{session.VideoHeight}@{session.VideoRefreshRate}Hz"); } ``` -------------------------------- ### Get Logger Instance Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Creates a logger instance for a given type. Used for logging within the application. ```csharp public static ILogger GetLogger() ``` ```csharp private static readonly ILogger Logger = Main.GetLogger(); ``` -------------------------------- ### Get All Active Lobbies Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves a list of all currently active lobbies. Returns an empty list if the operation fails. ```csharp public static async Task> GetLobbies() ``` ```csharp var lobbies = await WolfApi.GetLobbies(); foreach (var lobby in lobbies) { GD.Print($"Lobby: {lobby.Name}"); } ``` -------------------------------- ### POST /apps/add Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Add a new application to the system. This endpoint allows users to register a new application with its configuration details. ```APIDOC ## POST /apps/add ### Description Add a new application to the system. This endpoint allows users to register a new application with its configuration details. ### Method POST ### Endpoint /api/v1/apps/add ### Parameters #### Request Body - **id** (string) - Required - Unique app identifier - **title** (string) - Required - Display name - **icon_png_path** (string) - Optional - Path to icon image - **start_virtual_compositor** (boolean) - Optional - Start virtual compositor - **render_node** (string) - Optional - GPU render node - **runner** (Runner) - Optional - Container configuration ### Request Example ```json { "id": "custom-app", "title": "My Game", "icon_png_path": "/path/to/icon.png", "start_virtual_compositor": false, "render_node": null, "runner": { "type": "docker", "image": "ghcr.io/my-org/my-game:latest" } } ``` ### Response #### Success Response (200 OK) - **success** (boolean) - Whether operation succeeded - **error** (string?) - Error message if failed #### Response Example ```json { "success": true, "error": null } ``` ``` -------------------------------- ### Retrieve Registered Moonlight Clients Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md This GET request retrieves a list of all clients registered with the Moonlight system. It does not require any authentication. ```http GET /api/v1/clients ``` -------------------------------- ### Retrieve Active Streaming Sessions Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Use this endpoint to get a list of all currently active streaming sessions. No authentication is required. ```http GET /api/v1/sessions ``` -------------------------------- ### Create and Join Lobby Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Creates a new game lobby with a specified name and joinability, then joins the created lobby using the current session ID. ```csharp var lobby = new Lobby { Name = "My Game", MultiUser = true }; var lobbyId = await WolfApi.CreateLobby(lobby); var result = await WolfApi.JoinLobby(lobbyId, WolfApi.SessionId); ``` -------------------------------- ### GET /events Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Subscribe to real-time server events. This endpoint provides a stream of events from the server using the Server-Sent Events format. ```APIDOC ## GET /events ### Description Subscribe to real-time server events. ### Method GET ### Endpoint /api/v1/events ### Parameters None ### Request Example ``` GET /api/v1/events ``` ### Response #### Success Response (200 OK - Streaming) (Server-Sent Events stream) **Event Types:** | Event | Data | Description | |-------|------|-------------| | CreateLobbyEvent | Lobby | Lobby created | | StopLobbyEvent | `{lobby_id: string}` | Lobby stopped | | JoinLobbyEvent | LobbyJoin | Client joined lobby | | LeaveLobbyEvent | LobbyJoin | Client left lobby | | DockerPullImageStartEvent | `{image_name: string}` | Image pull started | | DockerPullImageEndEvent | `{image_name: string}` | Image pull completed | | StreamSession | Session | Stream established | | StopStreamEvent | Session | Stream ended | | PauseStreamEvent | Session | Stream paused | | ResumeStreamEvent | Session | Stream resumed | **Keepalive:** Server sends `:keepalive` every 30s to prevent connection timeout ``` -------------------------------- ### Custom Logging with ILogger Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/WOLF-UI-REFERENCE.md Demonstrates how to obtain and use an ILogger instance for logging messages at different levels. Output includes timestamp, level, class name, and formatted message. ```csharp ILogger logger = Main.GetLogger(); logger.LogInformation("Info message"); logger.LogWarning("Warning with {0}", param); logger.LogError("Error: {0}", error); logger.LogDebug("Debug details"); ``` -------------------------------- ### GET /docker/images/inspect Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Checks if a Docker image exists locally on the system. This is useful for verifying image availability before attempting to pull or use it. ```APIDOC ## GET /docker/images/inspect ### Description Check if a Docker image exists locally. ### Method GET ### Endpoint /api/v1/docker/images/inspect?image_name={imageName} ### Parameters #### Query Parameters - **image_name** (string) - Yes - Docker image name/URI ### Request Example ``` GET /api/v1/docker/images/inspect?image_name=ghcr.io/games-on-whales/steam:latest ``` ### Response #### Success Response (200 OK) - **Id** (string) - The ID of the Docker image. - **RepoTags** (array) - Tags associated with the image. - **Architecture** (string) - The architecture of the image. - **Os** (string) - The operating system of the image. - **Size** (integer) - The size of the image in bytes. - **Created** (string) - The creation timestamp of the image. #### Response Example ```json { "Id": "sha256:abc123...", "RepoTags": ["ghcr.io/games-on-whales/steam:latest"], "Architecture": "amd64", "Os": "linux", "Size": 1234567890, "Created": "2025-07-11T10:15:30Z" } ``` #### Error Response (404 Not Found) (empty response) ``` -------------------------------- ### Get Apps for a Specific Profile Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves applications associated with a given profile. Returns an empty list if no apps are found for the profile. ```csharp public static async Task> GetApps(Profile usedProfile) ``` ```csharp var profile = new Profile { Id = "profile123" }; var apps = await WolfApi.GetApps(profile); ``` -------------------------------- ### Get Controller Button Icon Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Retrieves the appropriate texture for a specific controller button based on the currently detected controller type. ```csharp public Texture2D GetIcon(ControllerButton button) ``` ```csharp var selectButtonTexture = controllerMap.GetIcon(ControllerMap.ControllerButton.Accept); buttonIcon.Texture = selectButtonTexture; ``` -------------------------------- ### Initialize WolfAPI Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Initializes the WolfAPI singleton. This method is typically called during the application's startup sequence to set up the API client and begin listening for server-sent events. ```csharp public static void Init() ``` -------------------------------- ### Create DynamicTheme Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Instantiates a DynamicTheme, which merges with the default or a provided base theme for customization. ```csharp public DynamicTheme() ``` ```csharp public DynamicTheme(Theme @base) ``` -------------------------------- ### Create and Save a Dynamic Theme Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Use the DynamicTheme class to create and customize themes at runtime. Saved themes are merged with the default theme. ```csharp var customTheme = new DynamicTheme(); // Merges with default customTheme.Save("/home/user/.wolf-ui/my-theme.tres"); ``` -------------------------------- ### Wolf-UI Documentation Structure Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md This snippet shows the directory structure of the Wolf-UI documentation. It helps understand where to find specific reference materials. ```tree /output/ ├── README.md # This file ├── INDEX.md # Navigation index for all documents ├── WOLF-UI-REFERENCE.md # Project overview and architecture ├── configuration.md # Environment variables and config ├── endpoints.md # Complete API endpoint reference ├── types.md # Data types and model definitions └── api-reference/ ├── wolfapi.md # WolfAPI client class reference ├── main-and-scenes.md # Main entry point and UI components └── misc-utilities.md # Utility classes and helpers ``` -------------------------------- ### Add a New Application Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Adds a new application to the system. Returns an ErrorResponse indicating success or failure. ```csharp public static async Task AddApp(App app) ``` -------------------------------- ### GET /utils/get-icon Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Download an application or lobby icon image. This endpoint allows users to retrieve icon images by providing a path to the icon. ```APIDOC ## GET /utils/get-icon ### Description Download an application or lobby icon image. ### Method GET ### Endpoint /api/v1/utils/get-icon?icon_path={iconPath} ### Parameters #### Query Parameters - **icon_path** (string) - Yes - Path to icon (local or URL) ### Request Example ``` GET /api/v1/utils/get-icon?icon_path=/path/to/app/icon.png ``` ### Response #### Success Response (200 OK) (PNG image binary data) #### Response Headers Content-Type: image/png Content-Length: 12345 #### Response Example (PNG image binary data) #### Error Response (404 Not Found) (empty) ``` -------------------------------- ### Utility Classes Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Documentation for various utility classes, including QuestionDialogue for modal dialogs, InputActions for input tracking, Logger and LoggerFactory for logging, ClientSideRateLimitedHandler for HTTP rate limiting, JsonUtil for serialization, DynamicTheme for customization, and ControllerMap for controller detection. ```APIDOC ## Utility Classes ### Description This section documents various utility classes designed to assist with common tasks. These include classes for handling modal dialogs, tracking input, managing logging, implementing client-side rate limiting for HTTP requests, JSON serialization, dynamic theme customization, and detecting controller types. ### Classes - **QuestionDialogue**: Provides modal dialogs with asynchronous support. - **InputActions**: Handles input tracking and display. - **Logger and LoggerFactory**: Offers configurable logging capabilities. - **ClientSideRateLimitedHandler**: Implements client-side rate limiting for HTTP requests. - **JsonUtil**: Infrastructure for JSON serialization and deserialization. - **DynamicTheme**: Enables theme customization. - **ControllerMap**: Detects and maps controller types. - **Other utility classes**: Additional helper classes. ``` -------------------------------- ### GET /clients Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Retrieves a list of all registered Moonlight clients. This endpoint provides details about each client, including their ID and application state folder. ```APIDOC ## GET /clients ### Description Retrieve all registered Moonlight clients. ### Method GET ### Endpoint /api/v1/clients ### Response #### Success Response (200 OK) - **success** (boolean) - Whether request succeeded - **clients** (Client[]) - List of clients ### Response Example ```json { "success": true, "clients": [ { "client_id": "client-001", "app_state_folder": "/home/user/.wolf/client-001", "client_cert": "-----BEGIN CERTIFICATE-----\n...", "settings": { "mouse_acceleration": 1.0 } } ] } ``` ``` -------------------------------- ### DynamicTheme Constructors Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Provides methods to create and initialize DynamicTheme resources, allowing for customization by merging with default or custom base themes. ```APIDOC ## DynamicTheme() ### Description Creates a new theme resource that merges with the built-in default theme, enabling customization. ### Constructor `public DynamicTheme()` ``` ```APIDOC ## DynamicTheme(Theme @base) ### Description Creates a new theme resource that merges with a provided base theme. ### Constructor `public DynamicTheme(Theme @base)` ### Parameters #### Path Parameters - **@base** (Theme) - Required - Base theme to merge with ``` -------------------------------- ### VideoSettings Model Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/types.md Defines the configuration for video streaming, including resolution, refresh rate, and render node settings. ```csharp public class VideoSettings { public int Width { get; set; } public int Height { get; set; } public int RefreshRate { get; set; } public string? WaylandRenderNode { get; set; } public string? RunnerRenderNode { get; set; } public string? VideoProducerBufferCaps { get; set; } } ``` -------------------------------- ### GET /profiles Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Retrieves a list of all user profiles. This endpoint provides information about each user's profile, including their name, icon, and associated applications. ```APIDOC ## GET /profiles ### Description Retrieve all user profiles. This endpoint provides information about each user's profile, including their name, icon, and associated applications. ### Method GET ### Endpoint /api/v1/profiles ### Parameters ### Request Body ### Request Example ``` GET /api/v1/profiles ``` ### Response #### Success Response (200 OK) - **success** (boolean) - Whether request succeeded - **profiles** (Profile[]) - List of user profiles #### Response Example ```json { "success": true, "profiles": [ { "id": "profile-001", "name": "John Doe", "icon_png_path": "/path/to/profile-pic.png", "pin": [ 1, 2, 3, 4 ], "apps": [ { "id": "steam", "title": "Steam", "icon_png_path": "/path/to/icon.png", "start_virtual_compositor": true, "runner": { ... } } ] } ] } ``` ``` -------------------------------- ### Main._Input(InputEvent) Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Godot lifecycle method that processes all input events, delegating controller detection to ControllerMap. ```APIDOC ## Main._Input(InputEvent) ### Description Processes all input events. Delegates to ControllerMap for controller detection. ### Method `override` ### Signature `public override void _Input(InputEvent @event)` ### Parameters #### Parameters - **@event** (`InputEvent`) - Input event from Godot input system ``` -------------------------------- ### Add New Application Configuration Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Submit a POST request with application details to add a new entry. This includes basic information and optional runner configuration for containerized applications. ```json { "id": "custom-app", "title": "My Game", "icon_png_path": "/path/to/icon.png", "start_virtual_compositor": false, "render_node": null, "runner": { "type": "docker", "image": "ghcr.io/my-org/my-game:latest" } } ``` -------------------------------- ### Override Rendering Backend Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/configuration.md Use the WOLF_UI_ARGS environment variable to force a specific rendering backend and driver. Supported options depend on the Godot engine configuration. ```bash WOLF_UI_ARGS="--rendering-method gl_compatibility --rendering-driver opengl3" ``` -------------------------------- ### Define JSON Serializable Property Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/configuration.md Example of marking a property for JSON serialization and mapping its name. Use [JsonInclude] to include the property and [JsonPropertyName] to specify the JSON key. ```csharp [JsonInclude, JsonPropertyName("app_id")] public string? AppId { get; set; } ``` -------------------------------- ### Wolf-UI Data Flow Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/WOLF-UI-REFERENCE.md Illustrates the data flow within the Wolf-UI application, from user input to UI updates. ```text User Input ↓ Godot Scene (_Input event) ↓ Scene Handler / InputActions ↓ WolfAPI Method Call (async) ↓ HTTP Request via Unix Socket ↓ Wolf Backend ↓ HTTP Response + Server-Sent Events ↓ Signal Emission (Godot) ↓ UI Update (Scenes, Controls) ``` -------------------------------- ### GET /sessions Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Retrieves a list of all currently active streaming sessions. This endpoint provides details about each session, including application ID, client information, and video/audio settings. ```APIDOC ## GET /sessions ### Description Retrieve all active streaming sessions. ### Method GET ### Endpoint /api/v1/sessions ### Response #### Success Response (200 OK) - **success** (boolean) - Whether request succeeded - **sessions** (Session[]) - List of active sessions ### Response Example ```json { "success": true, "sessions": [ { "app_id": "steam", "client_id": "client-001", "client_ip": "192.168.1.100", "video_width": 1920, "video_height": 1080, "video_refresh_rate": 60, "audio_channel_count": 2, "client_settings": { "mouse_acceleration": 1.0, "h_scroll_acceleration": 1.0, "v_scroll_acceleration": 1.0 } } ] } ``` ``` -------------------------------- ### Applications Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/GENERATION-SUMMARY.txt Endpoints for managing applications within the Wolf-UI system. ```APIDOC ## GET /apps ### Description Retrieves a list of all registered applications. ### Method GET ### Endpoint /apps ### Response #### Success Response (200) - **apps** (array) - A list of application objects. ### Response Example { "example": "[\n {\n \"id\": \"app1\",\n \"name\": \"Example App\"\n }\n]" } ``` ```APIDOC ## POST /apps/add ### Description Adds a new application to the Wolf-UI system. ### Method POST ### Endpoint /apps/add ### Request Body - **app** (object) - Required - The application definition to add. ### Request Example { "example": "{\n \"id\": \"new-app-id\",\n \"name\": \"New Application\"\n}" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. ### Response Example { "example": "{\n \"message\": \"Application added successfully\"\n}" } ``` ```APIDOC ## POST /apps/delete ### Description Deletes an application from the Wolf-UI system. ### Method POST ### Endpoint /apps/delete ### Request Body - **appId** (string) - Required - The ID of the application to delete. ### Request Example { "example": "{\n \"appId\": \"app1\"\n}" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. ### Response Example { "example": "{\n \"message\": \"Application deleted successfully\"\n}" } ``` -------------------------------- ### Get and Use ILogger Instance Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/configuration.md Retrieves a logger instance for a specific class and logs messages at different severity levels. Ensure the LoggerFactory is set up before calling GetLogger. ```csharp ILogger logger = Main.GetLogger(); logger.LogInformation("Info message"); logger.LogWarning("Warning message"); logger.LogError("Error message"); logger.LogDebug("Debug message"); ``` -------------------------------- ### Override Rendering Method via Environment Variable Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Force OpenGL 3 backend for systems without Vulkan support or for NVIDIA compatibility. Set the WOLF_UI_ARGS environment variable. ```bash export WOLF_UI_ARGS="--rendering-method gl_compatibility --rendering-driver opengl3" ``` -------------------------------- ### ClientSettings Model Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/types.md Defines the configuration for client input handling, including controller overrides and mouse/scroll acceleration. ```csharp public class ClientSettings { public List? ControllersOverride { get; set; } public float HScrollAcceleration { get; set; } public float MouseAcceleration { get; set; } public int RunGid { get; set; } public int RunUid { get; set; } public float VScrollAcceleration { get; set; } } ``` -------------------------------- ### HTTP API Endpoints Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Documentation for all HTTP API endpoints, including request and response schemas, query parameters, request bodies, status codes, error responses, Server-Sent Events format, rate limiting behavior, and example requests/responses. ```APIDOC ## HTTP API Endpoints ### Description This section details all available HTTP API endpoints. It provides comprehensive information on request and response schemas, query parameters, request bodies, status codes, and error responses. It also covers the Server-Sent Events format, rate limiting behavior, and includes example requests and responses for each endpoint. ### Endpoints - **All endpoints**: Fully documented with request/response schemas. - **Query Parameters**: Specification of available query parameters. - **Request Bodies**: Schema definitions for request bodies. - **Status Codes**: Details on success and error status codes. - **Error Responses**: Structure of error responses. - **Server-Sent Events**: Format and usage of SSE. ### Behavior - **Rate Limiting**: Description of API rate limiting policies. ### Examples - **Request Examples**: Illustrative examples of API requests. - **Response Examples**: Illustrative examples of API responses. ``` -------------------------------- ### GetApps() - Application Management Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Retrieves all available applications. Handles potential network errors by returning null. ```APIDOC ## GetApps() ### Description Retrieves all available applications. ### Method `public static async Task GetApps()` ### Return `AppsRequest?` - Response containing success status and list of apps, or null on network error. ### Throws Logs `HttpRequestException` on connection failure. ### Example ```csharp var appsResponse = await WolfApi.GetApps(); if (appsResponse?.Success == true) { foreach (var app in appsResponse.Apps) { GD.Print($"App: {app.Title}"); } } ``` ``` -------------------------------- ### Open Simple Yes/No Dialogue Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Displays a modal dialog for a simple yes/no confirmation. Blocks until the user selects an option. The return value is a boolean indicating the user's choice. ```csharp var result = await QuestionDialogue.OpenDialogue( "Confirm", "Do you want to continue?", new Dictionary { { "Yes", true }, { "No", false } } ); if (result) { GD.Print("User confirmed"); } ``` -------------------------------- ### Wolf UI Performance Tuning Parameters Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Adjust these C# parameters in WolfAPI.cs to tune performance, including token limits and cache durations. ```csharp TokenLimit = 8 TokensPerPeriod = 2 ReplenishmentPeriod = TimeSpan.FromMilliseconds(1) ``` -------------------------------- ### Pull Docker Image with Streaming Progress Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/endpoints.md Initiate a Docker image pull from a registry. The response is streamed using Server-Sent Events, providing real-time progress for each layer and a final success status. ```text data: {"layer_id":"sha256:abc123","current_progress":0,"total":1000000} data: {"layer_id":"sha256:abc123","current_progress":100000,"total":1000000} data: {"layer_id":"def456","current_progress":50000,"total":500000} data: {"success":true} ``` -------------------------------- ### Create a New Lobby Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/wolfapi.md Creates a new lobby with specified configurations. Returns the ID of the created lobby or null if creation fails. ```csharp public static async Task CreateLobby(Lobby lobby) ``` ```csharp var newLobby = new Lobby { Name = "My Game Session", MultiUser = true, StopWhenEveryoneLeaves = true }; var lobbyId = await WolfApi.CreateLobby(newLobby); ``` -------------------------------- ### Wolf UI Environment Variables Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Set these environment variables to configure Wolf UI. WOLF_SESSION_ID is optional and auto-generated if not provided. ```bash WOLF_SESSION_ID=unique-session-id # Optional, auto-generated if not set WOLF_SOCKET_PATH=/var/run/wolf/wolf.sock # Path to Wolf API socket LOGLEVEL=INFO # Logging level WOLF_UI_AUTOUPDATE=True # Enable auto-update ``` -------------------------------- ### Utils Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/GENERATION-SUMMARY.txt Utility endpoint for retrieving icons. ```APIDOC ## GET /utils/get-icon ### Description Retrieves an icon resource. ### Method GET ### Endpoint /utils/get-icon ### Query Parameters - **iconName** (string) - Required - The name of the icon to retrieve. ### Response #### Success Response (200) - **iconData** (string) - The icon data (e.g., base64 encoded). ### Response Example { "example": "{\n \"iconData\": \"data:image/png;base64,iVBORw0KGgo...\"\n}" } ``` -------------------------------- ### Pull Docker Image with Progress Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/README.md Subscribes to image pull progress events and initiates a Docker image pull. Logs the progress percentage to the console. ```csharp WolfApi.Singleton.ImagePullProgress += (img, progress) => { GD.Print($"{img}: {progress:F1}%"); }; WolfApi.PullImage("ghcr.io/games-on-whales/steam:latest"); ``` -------------------------------- ### Wolf UI Docker Mounts Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md These mounts are required when running Wolf UI in a Docker container to access necessary system resources. ```bash /var/run/wolf/wolf.sock:/var/run/wolf/wolf.sock # Wolf API socket /dev/input/:/dev/input/ # Input devices /dev/dri/:/dev/dri/ # GPU devices ``` -------------------------------- ### Enable Wolf-UI Auto-Update Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/configuration.md Set the WOLF_UI_AUTOUPDATE environment variable to 'True' to enable automatic updates for Wolf-UI. This feature checks for new versions at startup, pulls them if available, and prompts the user to restart. ```bash WOLF_UI_AUTOUPDATE=True ``` -------------------------------- ### Main _Input() Method Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/main-and-scenes.md Processes all input events received from the Godot input system. Delegates controller detection to ControllerMap. ```csharp public override void _Input(InputEvent @event) ``` -------------------------------- ### Open Dialogue with Custom Keybinds Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/api-reference/misc-utilities.md Displays a modal dialog with custom button labels and associated keybinds for selection. Blocks until the user selects an option or triggers a keybind. The return value is the string associated with the selected choice. ```csharp var choice = await QuestionDialogue.OpenDialogue( "Choose Action", "Select an action:", new Dictionary { { "Play", "play" }, { "Settings", "settings" }, { "Exit", "exit" } }, new Dictionary> { { "Play", () => Input.IsActionJustPressed("ui_select") }, { "Settings", () => Input.IsActionJustPressed("ui_focus_next") } } ); ``` -------------------------------- ### Docker Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/GENERATION-SUMMARY.txt Endpoints for interacting with Docker images. ```APIDOC ## GET /docker/images/inspect ### Description Inspects a Docker image to retrieve its metadata. ### Method GET ### Endpoint /docker/images/inspect ### Query Parameters - **imageName** (string) - Required - The name of the Docker image to inspect. ### Response #### Success Response (200) - **imageInfo** (object) - Metadata about the Docker image. ### Response Example { "example": "{\n \"id\": \"sha256:abcdef...\",\n \"tags\": [\"latest\", \"v1.0.0\"]\n}" } ``` ```APIDOC ## POST /docker/images/pull ### Description Pulls a Docker image from a registry. ### Method POST ### Endpoint /docker/images/pull ### Request Body - **imageName** (string) - Required - The name of the Docker image to pull. ### Request Example { "example": "{\n \"imageName\": \"ubuntu:latest\"\n}" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. ### Response Example { "example": "{\n \"message\": \"Docker image pulled successfully\"\n}" } ``` -------------------------------- ### Pull Docker Image with Progress Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/INDEX.md Subscribes to image pull progress events to display download percentages and then initiates the pull for a specified Docker image. ```csharp WolfApi.Singleton.ImagePullProgress += (imageName, progress) => { GD.Print($"Pulling {imageName}: {progress:F1}%"); }; WolfApi.PullImage("ghcr.io/games-on-whales/some-app:latest"); ``` -------------------------------- ### App Data Model Source: https://github.com/games-on-whales/wolf-ui/blob/main/_autodocs/types.md Represents a containerized application. Use this model to define application properties like icon path, title, and runner configuration. ```csharp public partial class App { public string? IconPngPath { get; set; } public bool StartVirtualCompositor { get; set; } public string? Title { get; set; } public string? Id { get; set; } public Resources.WolfAPI.Runner? Runner { get; set; } public string? RenderNode { get; set; } } ```