add xss method
This commit is contained in:
parent
ccac29039c
commit
ea11adef63
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue