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
| Property | Type | Description |
|---|---|---|
SiteName | string | Display name of the website |
Host | string | Domain name (e.g. hackerforum.net) |
Icon | string | Path to the website favicon |
Pages | WebsitePageDefinition[] | Array of page definitions |
Popular | boolean | Show in the browser's popular sites |
Exports | Record<string, any> | Functions/values exposed to HTML |
Pages
Each page in the Pages array has:
| Property | Type | Description |
|---|---|---|
path | string | URL path (e.g. /, /about) |
title | string | Page title shown in the browser tab |
html | string | Path 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>