mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-20 19:19:16 +02:00
refactor the check
This commit is contained in:
parent
1c2fd42ba5
commit
21620bc7af
1 changed files with 3 additions and 9 deletions
|
@ -93,16 +93,10 @@ module.exports.generalSocketHandler = (socket, server) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("getPushExample", (language, callback) => {
|
socket.on("getPushExample", (language, callback) => {
|
||||||
try {
|
if (!LANGUAGE_REGEX.test(language)) {
|
||||||
checkLogin(socket);
|
callback({
|
||||||
|
|
||||||
if (!LANGUAGE_REGEX.test(language)) {
|
|
||||||
throw new Error("Invalid language");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
callback({
|
|
||||||
ok: false,
|
ok: false,
|
||||||
msg: e.message,
|
msg: "requested language is not recognised as valid by the server",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue