removed codegen script, cleaned profile class

This commit is contained in:
2025-03-24 21:55:17 -04:00
parent 616f5dd619
commit ad73736517
2 changed files with 7 additions and 33 deletions

View File

@@ -1,21 +0,0 @@
import * as fs from "node:fs";
const rooms = JSON.parse(fs.readFileSync('./rooms.json'));
const lines = [
"enum IntegratedRoomScene {"
];
for (const room of rooms) {
if (room.Scenes[0].Name == "Home") {
lines.push(` ${room.Name} = "${room.Scenes[0].RoomSceneLocationId}",`);
} else {
for (const scene of room.Scenes) {
lines.push(` ${room.Name}_${scene.Name} = "${scene.RoomSceneLocationId}",`);
}
}
}
lines.push("}");
fs.writeFileSync('./enum.ts', lines.join('\n'));

View File

@@ -4,12 +4,9 @@ import { Config } from "../config.ts";
import { AuthType } from "./users.ts";
import * as JsonWebToken from "@gz/jwt";
import { TokenBaseFormat } from "../apiutils.ts";
import Logging from "@proxnet/undead-logging";
const config = Config.getConfig();
const log = new Logging("Profiles");
interface ProfileInitOptions {
username: string;
}
@@ -63,15 +60,10 @@ class Profile {
}
static async getUniqueUsername() {
let username = `${
Dictionary
.Adjectives[
Math.floor(Math.random() * Dictionary.Adjectives.length)
]
}${
Dictionary
.Nouns[Math.floor(Math.random() * Dictionary.Nouns.length)]
}${Math.round(Math.random() * 10000)}`;
const adjective = Dictionary.Adjectives[Math.floor(Math.random() * Dictionary.Adjectives.length)];
const noun = Dictionary.Nouns[Math.floor(Math.random() * Dictionary.Nouns.length)];
const identifier = Math.round(Math.random() * 10000);
let username = `${adjective}${noun}${identifier}`;
while ((await Profile.byName(username)) !== null) {
username = await this.getUniqueUsername();
}
@@ -204,6 +196,9 @@ class Profile {
return await Profile.getExportAccount(this.#id);
}
// get, set instance
// this.#instance: RoomInstance
async getToken() {
const payload: ProfileTokenFormat = {
iss: config.web.publichost,