Import december-2020-12-18 from private repo (scrubbed 2026-05-27)

Targets Rec Room 2020.12.18 client.

Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
  the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces the dorknet-clientpatch-{key}.zip
  Release asset the launcher fetches.
- .github/workflows/release.yml — auto-publishes both Release assets
  on v1-december-* tag push.

Scrubbed via maintainer-side scrub-for-public.ps1: same drop rules as
the prior import, plus build-patcher-zip.ps1 added to the tools/
allow-list so it survives the scrub.
This commit is contained in:
Alexa
2026-05-27 01:04:12 +03:00
commit 4edf25b2d5
375 changed files with 201291 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// Lightweight fetch wrapper for the public-facing site. Talks to the
// apex-hosted PublicSiteController at /api/site/v1/*. Anonymous-only —
// the public site has no login flow, so there's no Authorization
// header or token plumbing.
const BASE = '/api/site/v1';
export class ApiError extends Error {
constructor(public status: number, message: string) {
super(message);
this.name = 'ApiError';
}
}
export async function get<T = unknown>(path: string): Promise<T> {
const res = await fetch(BASE + path);
if (!res.ok) {
let msg = `${res.status} ${res.statusText}`;
try {
const body = await res.json();
if (body?.error) msg = body.error;
else if (body?.message) msg = body.message;
} catch { /* keep status text */ }
throw new ApiError(res.status, msg);
}
if (res.status === 204) return undefined as T;
return res.json() as Promise<T>;
}
+25
View File
@@ -0,0 +1,25 @@
// Friendly date formatting — mirrors the admin SPA's helper but kept
// local to avoid sharing source across two TS projects.
export function relativeTime(iso: string | null | undefined): string {
if (!iso) return '';
const d = new Date(iso);
if (Number.isNaN(+d)) return '';
const s = (Date.now() - d.getTime()) / 1000;
if (s < 60) return 'just now';
if (s < 3600) return `${Math.floor(s / 60)}m ago`;
if (s < 86400) return `${Math.floor(s / 3600)}h ago`;
if (s < 604800) return `${Math.floor(s / 86400)}d ago`;
return d.toLocaleDateString();
}
export function absoluteTime(iso: string | null | undefined): string {
if (!iso) return '';
const d = new Date(iso);
return Number.isNaN(+d) ? '' : d.toLocaleString();
}
export function num(n: number | null | undefined): string {
if (n === null || n === undefined) return '0';
return n.toLocaleString();
}
+70
View File
@@ -0,0 +1,70 @@
// Wire shapes returned by PublicSiteController. All keys are
// camelCase (server uses default ASP.NET serializer for this
// controller; only the legacy game-facing endpoints stick with
// PascalCase to placate LitJson on the watch).
export interface SitePlayerCard {
id: number;
username: string;
displayName: string;
level: number;
isAdmin: boolean;
isDeveloper: boolean;
isVerified: boolean;
isJunior: boolean;
profileImageName: string | null;
}
export interface SitePlayerDetail extends SitePlayerCard {
bio: string;
xp: number;
createdAt: string;
photoCount: number;
}
export interface SitePhoto {
id: number;
uploaderPlayerId: number;
uploaderUsername: string;
uploaderDisplayName: string;
uploaderProfileImageName: string | null;
blobName: string;
imageUrl: string;
caption: string;
roomId: number;
roomName: string;
isPublic: boolean;
cheerCount: number;
viewCount: number;
createdAt: string;
}
export interface SiteRoom {
id: number;
name: string;
description: string;
creatorPlayerId: number;
isDormRoom: boolean;
isAGRoom: boolean;
visitCount: number;
visitorCount: number;
cheerCount: number;
imageName: string;
}
export interface SiteStats {
playerCount: number;
roomCount: number;
photoCount: number;
inventionCount: number;
}
// CDN URL helper for profile images. Mirrors the admin SPA's helper
// so the apex visit ends up calling img.localhost (signed via the
// hardcoded p1 key id baked into the patched client). On rec.net
// fallbacks to img.rec.net so the site works on either apex.
export function profileImageUrl(name: string | null | undefined, width = 96): string | null {
if (!name) return null;
const apex = typeof window !== 'undefined' && window.location.host.endsWith('localhost') ? 'localhost' : 'rec.net';
return `https://img.${apex}/${encodeURIComponent(name)}?width=${width}&cropSquare=1&sig=p1`;
}