diff --git a/public/api/rooms/index.ts b/public/api/rooms/index.ts index 8b3dd9b..020592a 100644 --- a/public/api/rooms/index.ts +++ b/public/api/rooms/index.ts @@ -25,7 +25,7 @@ export async function GET(_req: Request, meta: Record): Promise item.load()); + })).map((room_entry) => room_entry.load()); return Response.json(rooms, { status: 200 diff --git a/public/icons/android-chrome-192x192.png b/public/icons/android-chrome-192x192.png new file mode 100644 index 0000000..26aa0e7 Binary files /dev/null and b/public/icons/android-chrome-192x192.png differ diff --git a/public/icons/android-chrome-512x512.png b/public/icons/android-chrome-512x512.png new file mode 100644 index 0000000..b7739c7 Binary files /dev/null and b/public/icons/android-chrome-512x512.png differ diff --git a/public/icons/apple-touch-icon.png b/public/icons/apple-touch-icon.png new file mode 100644 index 0000000..b11ab60 Binary files /dev/null and b/public/icons/apple-touch-icon.png differ diff --git a/public/icons/favicon-16x16.png b/public/icons/favicon-16x16.png new file mode 100644 index 0000000..b3194d3 Binary files /dev/null and b/public/icons/favicon-16x16.png differ diff --git a/public/icons/favicon-32x32.png b/public/icons/favicon-32x32.png new file mode 100644 index 0000000..f7058e0 Binary files /dev/null and b/public/icons/favicon-32x32.png differ diff --git a/public/icons/favicon.ico b/public/icons/favicon.ico new file mode 100644 index 0000000..48bc866 Binary files /dev/null and b/public/icons/favicon.ico differ diff --git a/public/index.html b/public/index.html index 2cc7d28..13c9791 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,13 @@ autonomous.contact + + + + + + diff --git a/public/tabs/tabs.html b/public/tabs/tabs.html index 936214b..c41ad36 100644 --- a/public/tabs/tabs.html +++ b/public/tabs/tabs.html @@ -2,7 +2,7 @@ window.addEventListener("locationchange", () => { const hash = window.location.hash?.slice(1); if (hash) { - const target_tab_url = hash.slice(0, hash.slice(1).indexOf("/")); + const target_tab_url = hash.slice(0, hash.slice(1).indexOf("/") + 1); const target_tab = document.querySelector(`[data-hash="${target_tab_url}"]`); console.dir({ hash, diff --git a/public/tabs/talk.html b/public/tabs/talk.html index 4082df8..bfd51a7 100644 --- a/public/tabs/talk.html +++ b/public/tabs/talk.html @@ -229,12 +229,23 @@ const room_id = room_chat_content.dataset.room_id; const last_message_id = room_chat_content.dataset.last_message_id; + if (!room_id) { + return; + } + const message_polling_url = `/rooms/${room_id}/events?type=chat&limit=100&sort=newest&wait=true${last_message_id ? `&after_id=${last_message_id}` : ""}`; + room_polling_request_abort_controller = + room_polling_request_abort_controller || new AbortController(); + api.fetch(message_polling_url, { signal: room_polling_request_abort_controller.signal, }) .then((new_events) => { + console.dir({ + room_id, + new_events, + }); append_room_events(new_events); poll_for_new_events(room_id); }) @@ -245,6 +256,8 @@ } async function load_room(room_id) { + const room_chat_content = document.getElementById("room-chat-content"); + if (room_polling_request_abort_controller) { room_polling_request_abort_controller.abort(); room_polling_request_abort_controller = null; @@ -259,7 +272,6 @@ } const room = await room_response.json(); - const room_chat_content = document.getElementById("room-chat-content"); room_chat_content.dataset.room_id = room.id; room_chat_content.innerHTML = ""; @@ -328,14 +340,15 @@ const room_id = hash.substring(12) || first_room_id; if (!room_id) { - alert("failed to load chat room!"); return; } const room_chat_container = document.getElementById("room-chat-container"); - room_chat_container.dataset.room_id = room_id; - load_room(room_id); + if (room_chat_container.dataset.room_id !== room_id) { + room_chat_container.dataset.room_id = room_id; + load_room(room_id); + } } window.addEventListener("locationchange", check_for_room_in_url);