mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-05-01 00:31:09 +00:00
Impl default config for testing frontend
This commit is contained in:
parent
5d15900436
commit
42a778bef2
2 changed files with 12 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,5 +3,6 @@
|
|||
*.key
|
||||
|
||||
config.toml
|
||||
/pages/default.json
|
||||
result
|
||||
result-*
|
||||
|
|
|
@ -9,6 +9,7 @@ let roomUrl = '';
|
|||
let roomUuid = null;
|
||||
let feed = null;
|
||||
let keypair = null;
|
||||
let defaultConfig = {};
|
||||
|
||||
function bufToHex(buf) {
|
||||
return [...new Uint8Array(buf)]
|
||||
|
@ -307,12 +308,22 @@ async function postChat(text) {
|
|||
}
|
||||
|
||||
window.onload = async (_) => {
|
||||
try {
|
||||
const resp = await fetch('./default.json');
|
||||
if (resp.ok) {
|
||||
defaultConfig = await resp.json();
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (!await loadKeypair()) {
|
||||
await generateKeypair();
|
||||
}
|
||||
if (keypair !== null) {
|
||||
userPubkeyDisplay.value = await getUserPubkey();
|
||||
}
|
||||
if (roomUrlInput.value === '' && defaultConfig.room_url) {
|
||||
roomUrlInput.value = defaultConfig.room_url;
|
||||
}
|
||||
await connectRoom(roomUrlInput.value);
|
||||
};
|
||||
roomUrlInput.onchange = async (e) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue