Skip to content

Commit

Permalink
ui: allow instances to provide their own names. Fixes #205.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkaufman committed Jan 24, 2021
1 parent eab20c8 commit b3d5e51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions html/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ function updateCurrentUsers() {
}

updateCurrentUsersText(x_audio_metadata.n_connected_users);

if (x_audio_metadata.instance_name) {
window.instanceName.innerText = x_audio_metadata.instance_name;
}
}
};
xhr.send();
Expand Down
2 changes: 1 addition & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
<div id=toplinks>
<div id=logoAndName>
<img src="https://www.jefftk.com/bucket-brigade-logo.png" width=64 height=64>
<h1>Bucket Brigade</h1>
<h1 id=instanceName>Bucket Brigade</h1>
</div>

<a target="_blank" href="recordings/">Recent Recordings</a>
Expand Down
7 changes: 5 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,10 +921,13 @@ def handle_post(in_json, in_data) -> Tuple[Any, str]:

action = query_params.get("action", None)
if action == "status":
return np.zeros(0, np.uint8), json.dumps({
rsp = {
"n_connected_users": len(active_users()),
"max_users": MAX_USERS,
})
}
if "instance_name" in secrets:
rsp["instance_name"] = secrets["instance_name"]
return np.zeros(0, np.uint8), json.dumps(rsp)

userid = query_params.get("userid", None)
if userid is not None:
Expand Down

0 comments on commit b3d5e51

Please sign in to comment.