mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-20 11:09:15 +02:00
Update server/socket-handlers/general-socket-handler.js
This commit is contained in:
parent
c568a141e6
commit
b5f77dc330
1 changed files with 8 additions and 3 deletions
|
@ -93,10 +93,15 @@ module.exports.generalSocketHandler = (socket, server) => {
|
|||
});
|
||||
|
||||
socket.on("getPushExample", (language, callback) => {
|
||||
if (!LANGUAGE_REGEX.test(language)) {
|
||||
callback({
|
||||
try {
|
||||
checkLogin(socket);
|
||||
if (!/^[a-z-]+$/.test(language)) {
|
||||
throw new Error("Invalid language");
|
||||
}
|
||||
} catch (e) {
|
||||
callback({
|
||||
ok: false,
|
||||
msg: "requested language is not recognised as valid by the server",
|
||||
msg: e.message,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue