Unlock commands now support a given time, e.g 10 minutes.
This commit is contained in:
+30
-10
@@ -2417,7 +2417,7 @@ function gotUserMessage(id, dest, username, time, privileged, kind, error, messa
|
||||
}
|
||||
let text = '' + message;
|
||||
localMessage(text);
|
||||
displayMessage(text);
|
||||
displayMessage(text, false);
|
||||
break;
|
||||
}
|
||||
case 'recording': {
|
||||
@@ -3204,9 +3204,25 @@ commands.lock = {
|
||||
|
||||
commands.unlock = {
|
||||
predicate: operatorPredicate,
|
||||
description: 'unlock this hall, revert the effect of /lock',
|
||||
description: 'unlock this hall now or later today',
|
||||
parameters: '[minutes[m|M] | HH:MM | h:mm AM/PM]',
|
||||
f: (c, r) => {
|
||||
serverConnection.hallAction('unlock');
|
||||
let spec = r.trim();
|
||||
if(!spec) {
|
||||
serverConnection.hallAction('unlock');
|
||||
return;
|
||||
}
|
||||
let timeZone = '';
|
||||
try {
|
||||
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || '';
|
||||
} catch(e) {
|
||||
console.warn('Could not determine browser timezone', e);
|
||||
}
|
||||
serverConnection.hallAction('unlock', {
|
||||
spec: spec,
|
||||
timeZone: timeZone,
|
||||
timezoneOffset: new Date().getTimezoneOffset(),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3906,8 +3922,9 @@ document.getElementById('resizer').addEventListener('keydown', function(e) {
|
||||
/**
|
||||
* @param {unknown} message
|
||||
* @param {string} [level]
|
||||
* @param {boolean} [announce]
|
||||
*/
|
||||
function displayError(message, level) {
|
||||
function displayError(message, level, announce = true) {
|
||||
if(!level)
|
||||
level = "error";
|
||||
let text = String(message);
|
||||
@@ -3926,10 +3943,12 @@ function displayError(message, level) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(level === "info")
|
||||
announceChat(text);
|
||||
else
|
||||
announceUrgent(text);
|
||||
if(announce) {
|
||||
if(level === "info")
|
||||
announceChat(text);
|
||||
else
|
||||
announceUrgent(text);
|
||||
}
|
||||
|
||||
/** @ts-ignore */
|
||||
Toastify({
|
||||
@@ -3951,9 +3970,10 @@ function displayWarning(message) {
|
||||
|
||||
/**
|
||||
* @param {unknown} message
|
||||
* @param {boolean} [announce]
|
||||
*/
|
||||
function displayMessage(message) {
|
||||
return displayError(message, "info");
|
||||
function displayMessage(message, announce = true) {
|
||||
return displayError(message, "info", announce);
|
||||
}
|
||||
|
||||
document.getElementById('loginform').onsubmit = async function(e) {
|
||||
|
||||
Reference in New Issue
Block a user