removed codegen script, cleaned profile class
This commit is contained in:
@@ -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'));
|
|
||||||
@@ -4,12 +4,9 @@ import { Config } from "../config.ts";
|
|||||||
import { AuthType } from "./users.ts";
|
import { AuthType } from "./users.ts";
|
||||||
import * as JsonWebToken from "@gz/jwt";
|
import * as JsonWebToken from "@gz/jwt";
|
||||||
import { TokenBaseFormat } from "../apiutils.ts";
|
import { TokenBaseFormat } from "../apiutils.ts";
|
||||||
import Logging from "@proxnet/undead-logging";
|
|
||||||
|
|
||||||
const config = Config.getConfig();
|
const config = Config.getConfig();
|
||||||
|
|
||||||
const log = new Logging("Profiles");
|
|
||||||
|
|
||||||
interface ProfileInitOptions {
|
interface ProfileInitOptions {
|
||||||
username: string;
|
username: string;
|
||||||
}
|
}
|
||||||
@@ -63,15 +60,10 @@ class Profile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async getUniqueUsername() {
|
static async getUniqueUsername() {
|
||||||
let username = `${
|
const adjective = Dictionary.Adjectives[Math.floor(Math.random() * Dictionary.Adjectives.length)];
|
||||||
Dictionary
|
const noun = Dictionary.Nouns[Math.floor(Math.random() * Dictionary.Nouns.length)];
|
||||||
.Adjectives[
|
const identifier = Math.round(Math.random() * 10000);
|
||||||
Math.floor(Math.random() * Dictionary.Adjectives.length)
|
let username = `${adjective}${noun}${identifier}`;
|
||||||
]
|
|
||||||
}${
|
|
||||||
Dictionary
|
|
||||||
.Nouns[Math.floor(Math.random() * Dictionary.Nouns.length)]
|
|
||||||
}${Math.round(Math.random() * 10000)}`;
|
|
||||||
while ((await Profile.byName(username)) !== null) {
|
while ((await Profile.byName(username)) !== null) {
|
||||||
username = await this.getUniqueUsername();
|
username = await this.getUniqueUsername();
|
||||||
}
|
}
|
||||||
@@ -204,6 +196,9 @@ class Profile {
|
|||||||
return await Profile.getExportAccount(this.#id);
|
return await Profile.getExportAccount(this.#id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get, set instance
|
||||||
|
// this.#instance: RoomInstance
|
||||||
|
|
||||||
async getToken() {
|
async getToken() {
|
||||||
const payload: ProfileTokenFormat = {
|
const payload: ProfileTokenFormat = {
|
||||||
iss: config.web.publichost,
|
iss: config.web.publichost,
|
||||||
|
|||||||
Reference in New Issue
Block a user