feature: favicon
fix: partial attempt to clean up room loading
This commit is contained in:
parent
5d244f65c7
commit
be84aef1e0
10 changed files with 25 additions and 6 deletions
|
@ -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
|
||||
return entry.path.indexOf('/events/') === -1;
|
||||
}
|
||||
})).map((item) => item.load());
|
||||
})).map((room_entry) => room_entry.load());
|
||||
|
||||
return Response.json(rooms, {
|
||||
status: 200
|
||||
|
|
BIN
public/icons/android-chrome-192x192.png
Normal file
BIN
public/icons/android-chrome-192x192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
BIN
public/icons/android-chrome-512x512.png
Normal file
BIN
public/icons/android-chrome-512x512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
BIN
public/icons/apple-touch-icon.png
Normal file
BIN
public/icons/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
BIN
public/icons/favicon-16x16.png
Normal file
BIN
public/icons/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 482 B |
BIN
public/icons/favicon-32x32.png
Normal file
BIN
public/icons/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 698 B |
BIN
public/icons/favicon.ico
Normal file
BIN
public/icons/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
|
@ -4,7 +4,13 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<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>
|
||||
|
||||
<script src="./js/datetimeutils.js" type="text/javascript"></script>
|
||||
<script src="./js/locationchange.js" type="text/javascript"></script>
|
||||
<script src="./js/totp.js" type="text/javascript"></script>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,15 +340,16 @@
|
|||
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;
|
||||
|
||||
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);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue