Add blahs in actions
All checks were successful
Android Build / publish (push) Successful in 44s
Linux Build / publish (push) Successful in 53s

This commit is contained in:
olcxja 2026-05-21 08:28:06 +02:00
commit 81145968a1
9 changed files with 237 additions and 35 deletions

View file

@ -72,6 +72,14 @@
"title.sent": "Sent",
"title.all": "All",
"title.unread": "Unread",
"desc.no.invites": "No invites found",
"desc.no.notifications": "No notifications found",
"action.fetching.invites.sent": "Fetching sent invites...",
"action.fetching.invites.recv": "Fetching received invites...",
"action.dm.fetch": "Fetching dms...",
"action.dm.adding": "Adding...",
"action.auth": "Authenticating...",
"title.sign.up": "Sign Up",
"title.sign.in": "Sign In",

View file

@ -96,7 +96,7 @@
}
sidebarPfp.src = await getAvatarUrl(username);
showAction("Authenticating...", "startauth");
showAction("action.auth", "startauth");
let res = await Auth(username, password);
clearAction("startauth");
if (res.startsWith("success:")) {
@ -120,9 +120,9 @@
try {
showAction("Refreshing dms...", "dmrefresh");
let res = await fetchEncrypted("user/dm/list", "");
console.log(res);
showAction("action.dm.fetch", "dmrefresh");
let res = await fetchEncrypted("user/dm/list");
clearAction("dmrefresh");
}
catch (e) {
@ -133,9 +133,9 @@
async function addDm() {
try {
showAction("Adding...", "dmadd");
showAction("action.dm.adding", "dmadd");
let res = await fetchEncrypted("user/dm/invite", document.getElementById("addchat-username").value);
console.log(res);
clearAction("dmadd");
showBlahNotification(res);
}

View file

@ -325,7 +325,7 @@ async function Auth(username, password) {
}
async function fetchEncrypted(request, body) {
async function fetchEncrypted(request, body = "") {
let nonce = await getNonce(username, passwordHash);
@ -420,7 +420,7 @@ function showAction(message, actionid) {
const notif = document.createElement('div');
notif.className = `notification action`;
notif.textContent = message;
notif.textContent = processBlah(message);
notif.id = `notification-${actionid}`;
container.appendChild(notif);
@ -964,16 +964,60 @@ function setActiveRoombarItem(itemId) {
}
}
function switchInvitesTab(tab) {
async function switchInvitesTab(tab) {
if (!document.getElementById(`tab-invites-${tab}`).classList.contains('tab-inactive')) return;
document.getElementById('tab-invites-received').classList.add('tab-inactive');
document.getElementById('tab-invites-sent').classList.add('tab-inactive');
document.getElementById(`tab-invites-${tab}`).classList.remove('tab-inactive');
let container = document.getElementById("invites-container");
let innerString = "";
if (tab == "received")
if (tab === "received")
{
try {
showAction("action.fetching.invites.recv", "fetching.invites.recv");
let res = await fetchEncrypted("user/invites/received");
if (res !== "")
{
if (res.includes(",")) {
console.log(res);
}
else
{
console.log(res);
container.innerHTML = invitesEntry;
}
}
}
catch (e) {
showBlahNotification("error:something.wrong");
console.error(e);
}
clearAction("fetching.invites.recv");
}
else if (tab === "sent")
{
try {
showAction("action.fetching.invites.sent", "fetching.invites.sent");
let res = await fetchEncrypted("user/invites/sent");
if (res !== "")
{
if (res.includes(",")) {
console.log(res);
}
else
{
console.log(res);
container.innerHTML = invitesEntry;
}
}
}
catch (e) {
showBlahNotification("error:something.wrong");
console.error(e);
}
clearAction("fetching.invites.sent");
}
}

View file

@ -170,4 +170,6 @@ var addSpaceMenu = `
//elements
var detailsBtn = `<button class="mobile-nav-btn right" onclick="mobileNavDetails()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z"/></svg></button>`;
var backBtnHtml = `<button class="mobile-nav-btn" onclick="mobileNavBack()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="m313-440 224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"/></svg></button>`;
var backBtnHtml = `<button class="mobile-nav-btn" onclick="mobileNavBack()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="m313-440 224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"/></svg></button>`;
var invitesEntry = `???`;