Compare commits

..

4 Commits

6 changed files with 45 additions and 35 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -12,7 +12,6 @@
"bun-types": "^1.0.1", "bun-types": "^1.0.1",
"commander": "^11.1.0", "commander": "^11.1.0",
"date-holidays": "^3.21.5", "date-holidays": "^3.21.5",
"dotenv": "^8.6.0",
"events": "^3.3.0", "events": "^3.3.0",
"fancy-text-converter": "^1.0.9", "fancy-text-converter": "^1.0.9",
"keccak": "^2.1.0", "keccak": "^2.1.0",

View File

@ -53,14 +53,14 @@ export class Channel extends EventEmitter {
public logger: Logger; public logger: Logger;
public chatHistory = new Array<ClientEvents["a"]>(); public chatHistory = new Array<ClientEvents["a"]>();
// TODO Add the crown
public crown?: Crown; public crown?: Crown;
constructor( constructor(
private _id: string, private _id: string,
set?: Partial<IChannelSettings>, set?: Partial<IChannelSettings>,
creator?: Socket, creator?: Socket,
owner_id?: string owner_id?: string,
public stays: boolean = false
) { ) {
super(); super();
@ -120,7 +120,7 @@ export class Channel extends EventEmitter {
} }
} }
if (this.ppl.length == 0) { if (this.ppl.length == 0 && !this.stays) {
this.destroy(); this.destroy();
} }
}); });
@ -562,10 +562,10 @@ export default Channel;
let hasFullChannel = false; let hasFullChannel = false;
for (const id of config.forceLoad) { for (const id of config.forceLoad) {
new Channel(id); new Channel(id, undefined, undefined, undefined, true);
if (id == config.fullChannel) hasFullChannel = true; if (id == config.fullChannel) hasFullChannel = true;
} }
if (!hasFullChannel) { if (!hasFullChannel) {
new Channel(config.fullChannel); new Channel(config.fullChannel, undefined, undefined, undefined, true);
} }

View File

@ -4,9 +4,6 @@
* by Hri7566 * by Hri7566
*/ */
// Preload environment variables
import env from "./util/env";
// import { app } from "./ws/server"; // import { app } from "./ws/server";
import "./ws/server"; import "./ws/server";
import { Logger } from "./util/Logger"; import { Logger } from "./util/Logger";

View File

@ -395,7 +395,13 @@ export class Socket extends EventEmitter {
ch.playNotes(msg, this); ch.playNotes(msg, this);
} }
public subscribeToChannelList() {} public subscribeToChannelList() {
// TODO Channel list subbing
}
public unsubscribeFromChannelList() {
// TODO Channel list unsubbing
}
} }
export const socketsBySocketID = new Map<string, Socket>(); export const socketsBySocketID = new Map<string, Socket>();

View File

@ -0,0 +1,8 @@
import { ServerEventListener } from "../../../../util/types";
export const minus_ls: ServerEventListener<"-ls"> = {
id: "-ls",
callback: (msg, socket) => {
socket.unsubscribeFromChannelList();
}
};