From ad73736517dd4bd59f3e188978a447ac23f01dd7 Mon Sep 17 00:00:00 2001 From: zombieb Date: Mon, 24 Mar 2025 21:55:17 -0400 Subject: [PATCH] removed codegen script, cleaned profile class --- res/script.js | 21 --------------------- src/data/profiles.ts | 19 +++++++------------ 2 files changed, 7 insertions(+), 33 deletions(-) delete mode 100644 res/script.js diff --git a/res/script.js b/res/script.js deleted file mode 100644 index 2f8fc1d..0000000 --- a/res/script.js +++ /dev/null @@ -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')); \ No newline at end of file diff --git a/src/data/profiles.ts b/src/data/profiles.ts index 02ad23a..b13c5cf 100644 --- a/src/data/profiles.ts +++ b/src/data/profiles.ts @@ -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,