Skip to content

Websites

Create in-game websites accessible through the FirebearBrowser. Websites use HTML pages rendered inside sandboxed iframes.

Basic Website

typescript
import { Website, RegisterWebsite } from "@hotbunny/hackhub-content-sdk";

@RegisterWebsite
class HackerForum extends Website {

    SiteName = "Hacker Forum";
    Host = "hackerforum.net";
    Icon = "./assets/forum-icon.png";
    Pages = [
        { path: "/", title: "Home", html: "pages/home.html" },
        { path: "/about", title: "About", html: "pages/about.html" },
        { path: "/posts", title: "Posts", html: "pages/posts.html" },
    ];

}

Properties

PropertyTypeDescription
SiteNamestringDisplay name of the website
HoststringDomain name (e.g. hackerforum.net)
IconstringPath to the website favicon
PagesWebsitePageDefinition[]Array of page definitions
PopularbooleanShow in the browser's popular sites
ExportsRecord<string, any>Functions/values exposed to HTML

Pages

Each page in the Pages array has:

PropertyTypeDescription
pathstringURL path (e.g. /, /about)
titlestringPage title shown in the browser tab
htmlstringPath to the HTML file

HTML Pages

Your HTML files are rendered inside sandboxed iframes. You have full control over the page content:

html
<!DOCTYPE html>
<html>
<head>
    <style>
        body { background: #1a1a2e; color: #eee; font-family: monospace; }
        h1 { color: #0f0; }
    </style>
</head>
<body>
    <h1>Welcome to Hacker Forum</h1>
    <p>The underground community for elite hackers.</p>
</body>
</html>

Exports

Expose TypeScript functions and values to your HTML pages:

typescript
@RegisterWebsite
class MyWebsite extends Website {

    SiteName = "My Site";
    Host = "mysite.com";
    Icon = "./assets/icon.png";
    Pages = [
        { path: "/", title: "Home", html: "pages/home.html" },
    ];

    Exports = {
        formatPost: (text: string) => text.toUpperCase(),
        siteVersion: "1.0.0",
    };

}

In your HTML, exported values are available as globals:

html
<script>
    const formatted = formatPost("hello world");
    document.getElementById("version").textContent = siteVersion;
</script>

SDK Access in HTML

SDK APIs are available via the HackhubSDK global:

html
<script>
    HackhubSDK.Mail.send({
        to: "[email protected]",
        subject: "Welcome",
        content: "Thanks for registering!",
    });

    HackhubSDK.Events.emit("MyMod.UserRegistered", { username: "hacker" });
</script>

HotBunny Interactive Entertainment Inc.