removed codegen script, cleaned profile class
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user