Skip to content

Instantly share code, notes, and snippets.

// Get the URL of a Hubs room that is not empty nor at room capacity
// Warning: the proper API is being defined at https://github.com/mozilla/reticulum/pull/382
let getBestRoom = async () => {
// by https://twitter.com/jamesckane for @paracreative worked on the #ApartPosters show.
// let endpoint = "https://show.apartposters.com/api/v1/media/search?source=rooms&filter=public";
let endpoint = "/api/v1/media/search?source=rooms&filter=public";
let response = await fetch(endpoint);
let json = await response.json();
let rooms = json.entries;
let bestRoom = {};
@camelgod
camelgod / gist:a712ce7d43f21260ae5b4971b9a58dfb
Last active February 14, 2023 18:10
[DUMMY CODE, NOT TESTED] Utopiah BestRoom script with scenes
// Warning this is pretty hacky as you need to change the URL for the room to end with the scene ID. Maybe there is a better way to query the scene ID based on the url, but the spoke only allows to set URL so this is what I imagined late in the evening.
// open-media-button.js
} else if (await isHubsRoomUrl(this.src)) {
// Get the 6 last letters of the name of the url (that you set up as the Scene ID)
let lastSix = this.src.substr(this.src.length - 6); // Should be something like "avC5IO"
// use modified Utopiah script
let bestRoom = getBestRoom(lastSix);
await exitImmersive();