feature: favicon

fix: partial attempt to clean up room loading
This commit is contained in:
Andy Burke 2025-07-04 13:27:57 -07:00
parent 5d244f65c7
commit be84aef1e0
10 changed files with 25 additions and 6 deletions

View file

@ -25,7 +25,7 @@ export async function GET(_req: Request, meta: Record<string, any>): Promise<Res
// doesn't yet filter that out in its all() logic // doesn't yet filter that out in its all() logic
return entry.path.indexOf('/events/') === -1; return entry.path.indexOf('/events/') === -1;
} }
})).map((item) => item.load()); })).map((room_entry) => room_entry.load());
return Response.json(rooms, { return Response.json(rooms, {
status: 200 status: 200

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

BIN
public/icons/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -4,7 +4,13 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>autonomous.contact</title> <title>autonomous.contact</title>
<link rel="apple-touch-icon" sizes="180x180" href="./icons/apple-touch-icon.png" ></link>
<link rel="icon" type="image/png" sizes="32x32" href="./icons/favicon-32x32.png" ></link>
<link rel="icon" type="image/png" sizes="16x16" href="./icons/favicon-16x16.png" ></link>
<link rel="stylesheet" href="./base.css"></link> <link rel="stylesheet" href="./base.css"></link>
<script src="./js/datetimeutils.js" type="text/javascript"></script> <script src="./js/datetimeutils.js" type="text/javascript"></script>
<script src="./js/locationchange.js" type="text/javascript"></script> <script src="./js/locationchange.js" type="text/javascript"></script>
<script src="./js/totp.js" type="text/javascript"></script> <script src="./js/totp.js" type="text/javascript"></script>

View file

@ -2,7 +2,7 @@
window.addEventListener("locationchange", () => { window.addEventListener("locationchange", () => {
const hash = window.location.hash?.slice(1); const hash = window.location.hash?.slice(1);
if (hash) { 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}"]`); const target_tab = document.querySelector(`[data-hash="${target_tab_url}"]`);
console.dir({ console.dir({
hash, hash,

View file

@ -229,12 +229,23 @@
const room_id = room_chat_content.dataset.room_id; const room_id = room_chat_content.dataset.room_id;
const last_message_id = room_chat_content.dataset.last_message_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}` : ""}`; 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, { api.fetch(message_polling_url, {
signal: room_polling_request_abort_controller.signal, signal: room_polling_request_abort_controller.signal,
}) })
.then((new_events) => { .then((new_events) => {
console.dir({
room_id,
new_events,
});
append_room_events(new_events); append_room_events(new_events);
poll_for_new_events(room_id); poll_for_new_events(room_id);
}) })
@ -245,6 +256,8 @@
} }
async function load_room(room_id) { async function load_room(room_id) {
const room_chat_content = document.getElementById("room-chat-content");
if (room_polling_request_abort_controller) { if (room_polling_request_abort_controller) {
room_polling_request_abort_controller.abort(); room_polling_request_abort_controller.abort();
room_polling_request_abort_controller = null; room_polling_request_abort_controller = null;
@ -259,7 +272,6 @@
} }
const room = await room_response.json(); 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.dataset.room_id = room.id;
room_chat_content.innerHTML = ""; room_chat_content.innerHTML = "";
@ -328,15 +340,16 @@
const room_id = hash.substring(12) || first_room_id; const room_id = hash.substring(12) || first_room_id;
if (!room_id) { if (!room_id) {
alert("failed to load chat room!");
return; return;
} }
const room_chat_container = document.getElementById("room-chat-container"); const room_chat_container = document.getElementById("room-chat-container");
room_chat_container.dataset.room_id = room_id;
if (room_chat_container.dataset.room_id !== room_id) {
room_chat_container.dataset.room_id = room_id;
load_room(room_id); load_room(room_id);
} }
}
window.addEventListener("locationchange", check_for_room_in_url); window.addEventListener("locationchange", check_for_room_in_url);
document.addEventListener("DOMContentLoaded", async () => { document.addEventListener("DOMContentLoaded", async () => {