add official suyu listings
This commit is contained in:
parent
fcd165e990
commit
8aaa779c44
2 changed files with 7 additions and 1 deletions
|
@ -4,7 +4,7 @@ import type { SuyuUser } from "../schema";
|
|||
import { v4 } from "uuid";
|
||||
|
||||
export class RoomManager {
|
||||
private static rooms: Room[] = [];
|
||||
static rooms: Room[] = [];
|
||||
static roomTimeout: Record<string, number> = {}; // room id, last heard from
|
||||
static createRoom(room: IRoomConfig) {
|
||||
const existingRoom = this.rooms.find((r) => r.host.username === room.host.username);
|
||||
|
|
|
@ -66,5 +66,11 @@ export async function POST({ request, getClientAddress }) {
|
|||
hasPassword: body.hasPassword || false,
|
||||
});
|
||||
console.log("Room added:", JSON.stringify(room, null, 2));
|
||||
// push every room to the top which starts with `[SUYU OFFICIAL]` and was created with username "suyu"
|
||||
const suyuRoom = RoomManager.rooms.find((r) => r.roomInfo.name.startsWith("[SUYU OFFICIAL]"));
|
||||
if (suyuRoom && user.username === "suyu") {
|
||||
RoomManager.rooms.splice(RoomManager.rooms.indexOf(suyuRoom), 1);
|
||||
RoomManager.rooms.unshift(suyuRoom);
|
||||
}
|
||||
return json(room.toJSON());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue