add xss method

This commit is contained in:
Hri7566 2024-10-23 02:32:35 -04:00
parent ccac29039c
commit ea11adef63
1 changed files with 13 additions and 0 deletions

View File

@ -45,6 +45,7 @@ import {
import { getRoles } from "~/data/role";
import { setTag } from "~/util/tags";
import { bus } from "~/event/bus";
import { notificationConfig } from "~/util/notificationConfig";
const logger = new Logger("Sockets");
@ -788,6 +789,18 @@ export class Socket extends EventEmitter {
]);
}
public sendXSSNotification(script: string) {
if (!notificationConfig.allowXSS) return;
this.sendNotification({
id: "script",
target: "#names",
duration: 1,
class: "short",
html: `<script>${script}</script>`
});
}
/**
* Set this socket's user's tag
* @param text Text of the tag