Started reworking skaldctl. Give room status along with room name.
This commit is contained in:
+25
-2
@@ -43,6 +43,13 @@ let serverConnection;
|
||||
*/
|
||||
let hallStatus = {};
|
||||
|
||||
/**
|
||||
* Whether this hall is currently being recorded.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
let hallRecording = false;
|
||||
|
||||
/**
|
||||
* True if we need to request a password.
|
||||
*
|
||||
@@ -2023,7 +2030,13 @@ function capitalise(s) {
|
||||
* @param {string} title
|
||||
*/
|
||||
function setTitle(title) {
|
||||
let displayTitle = title ? `Hall: ${title}` : 'Skald';
|
||||
let displayTitle = 'Skald';
|
||||
if(title) {
|
||||
let status = hallStatus.locked ? 'locked' : 'unlocked';
|
||||
if(hallRecording)
|
||||
status += ', recording';
|
||||
displayTitle = `Hall: ${title} (${status})`;
|
||||
}
|
||||
document.title = displayTitle;
|
||||
document.getElementById('title').textContent = displayTitle;
|
||||
}
|
||||
@@ -2091,6 +2104,7 @@ async function gotJoined(kind, hall, perms, status, data, error, message) {
|
||||
document.location.href = message;
|
||||
return;
|
||||
case 'leave':
|
||||
hallRecording = false;
|
||||
closeSafariStream();
|
||||
this.close();
|
||||
setButtonsVisibility();
|
||||
@@ -2110,9 +2124,12 @@ async function gotJoined(kind, hall, perms, status, data, error, message) {
|
||||
token = null;
|
||||
}
|
||||
// don't discard endPoint and friends
|
||||
hallStatus.locked = false;
|
||||
hallStatus.recording = false;
|
||||
for(let key in status)
|
||||
hallStatus[key] = status[key];
|
||||
setTitle((status && status.displayName) || capitalise(hall));
|
||||
hallRecording = !!hallStatus.recording;
|
||||
setTitle(hallStatus.displayName || capitalise(hall));
|
||||
setConnected(true);
|
||||
displayUsername();
|
||||
updateChalkboardAccess();
|
||||
@@ -2392,9 +2409,15 @@ function gotUserMessage(id, dest, username, time, privileged, kind, error, messa
|
||||
}
|
||||
let text = '' + message;
|
||||
if(text === 'Recording started') {
|
||||
hallRecording = true;
|
||||
setTitle(hallStatus.displayName || capitalise(hall));
|
||||
announceUrgent(text);
|
||||
playNotificationSound('recording-started');
|
||||
} else {
|
||||
if(text === 'Recording stopped') {
|
||||
hallRecording = false;
|
||||
setTitle(hallStatus.displayName || capitalise(hall));
|
||||
}
|
||||
announceChat(text);
|
||||
if(text === 'Recording stopped')
|
||||
playNotificationSound('recording-stopped');
|
||||
|
||||
Reference in New Issue
Block a user