Compare commits

..

4 Commits

6 changed files with 45 additions and 35 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -1,28 +1,27 @@
{
"name": "mpp-server",
"version": "2.0.0",
"description": "Hri7566's MPP Server",
"main": "src/index.ts",
"keywords": [],
"author": "Hri7566",
"license": "ISC",
"dependencies": {
"@prisma/client": "5.7.0",
"@t3-oss/env-core": "^0.6.1",
"bun-types": "^1.0.1",
"commander": "^11.1.0",
"date-holidays": "^3.21.5",
"dotenv": "^8.6.0",
"events": "^3.3.0",
"fancy-text-converter": "^1.0.9",
"keccak": "^2.1.0",
"unique-names-generator": "^4.7.1",
"yaml": "^2.3.2",
"zod": "^3.22.2"
},
"devDependencies": {
"@types/node": "^20.5.9",
"prisma": "5.7.0",
"typescript": "^5.2.2"
}
"name": "mpp-server",
"version": "2.0.0",
"description": "Hri7566's MPP Server",
"main": "src/index.ts",
"keywords": [],
"author": "Hri7566",
"license": "ISC",
"dependencies": {
"@prisma/client": "5.7.0",
"@t3-oss/env-core": "^0.6.1",
"bun-types": "^1.0.1",
"commander": "^11.1.0",
"date-holidays": "^3.21.5",
"events": "^3.3.0",
"fancy-text-converter": "^1.0.9",
"keccak": "^2.1.0",
"unique-names-generator": "^4.7.1",
"yaml": "^2.3.2",
"zod": "^3.22.2"
},
"devDependencies": {
"@types/node": "^20.5.9",
"prisma": "5.7.0",
"typescript": "^5.2.2"
}
}

View File

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

View File

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

View File

@ -395,7 +395,13 @@ export class Socket extends EventEmitter {
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>();

View File

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