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
| Property | Type | Description |
|---|---|---|
AppName | string | Unique app identifier |
Title | string | Window title |
Icon | string | App icon path |
HTML | string | Path to the HTML file |
DefaultSize | AppSize | Default window dimensions { width, height } |
MinSize | AppSize | Minimum window size |
MaxSize | AppSize | Maximum window size |
MaxOpen | number | Max simultaneous instances |
DisableMaximize | boolean | Disable maximize button |
DisableMinimize | boolean | Disable minimize button |
Store | AppStoreDefinition | App Store listing |
Unlocked | boolean | Available by default (no quest required) |
Exports | Record<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>