Skip to content

Desktop Apps

Create desktop applications that appear on the in-game desktop. App UI is defined with HTML, rendered inside a sandboxed iframe within the game's window manager.

Basic App

typescript
import { App, RegisterApp } from "@hotbunny/hackhub-content-sdk";

@RegisterApp
class PasswordGenerator extends App {

    AppName = "passgen";
    Title = "Password Generator";
    Icon = "./assets/passgen.png";
    HTML = "app.html";
    DefaultSize = { width: 400, height: 300 };

}

Properties

PropertyTypeDescription
AppNamestringUnique app identifier
TitlestringWindow title
IconstringApp icon path
HTMLstringPath to the HTML file
DefaultSizeAppSizeDefault window dimensions { width, height }
MinSizeAppSizeMinimum window size
MaxSizeAppSizeMaximum window size
MaxOpennumberMax simultaneous instances
DisableMaximizebooleanDisable maximize button
DisableMinimizebooleanDisable minimize button
StoreAppStoreDefinitionApp Store listing
UnlockedbooleanAvailable by default (no quest required)
ExportsRecord<string, any>Functions/values exposed to HTML

App Store Listing

If you provide a Store definition, the app appears in the in-game App Store:

typescript
@RegisterApp
class MyApp extends App {

    AppName = "mytool";
    Title = "My Tool";
    Icon = "./assets/icon.png";
    HTML = "app.html";
    DefaultSize = { width: 600, height: 400 };
    Unlocked = true;

    Store = {
        title: "My Tool",
        description: "A useful tool for hackers",
        ratings: 4.5,
    };

}

Set Unlocked = true to make the app available in the App Store by default. Otherwise, it must be unlocked through a quest or other means.

Exports

Expose TypeScript functions to your app's HTML:

typescript
@RegisterApp
class Calculator extends App {

    AppName = "calculator";
    Title = "Calculator";
    Icon = "./assets/calc.png";
    HTML = "calculator.html";
    DefaultSize = { width: 300, height: 400 };

    Exports = {
        calculate: (expr: string) => eval(expr),
        version: "1.0.0",
    };

}

In your HTML:

html
<script>
    const result = calculate("2 + 2");
    document.getElementById("result").textContent = result;
</script>

SDK Access in HTML

SDK APIs are available via the HackhubSDK global:

html
<script>
    HackhubSDK.Events.emit("Calculator.Result", { value: 42 });
    HackhubSDK.Storage.set("lastResult", 42);
</script>

HotBunny Interactive Entertainment Inc.