diff --git a/static/js/01-api.js b/static/js/01-api.js index 05c8a48..520edc1 100644 --- a/static/js/01-api.js +++ b/static/js/01-api.js @@ -37,6 +37,9 @@ Glow.handleUnauthorized = () => { Glow.state.pageTypeFilter = ""; Glow.state.activeProfile = null; Glow.state.settings = null; + Glow.state.settingsSaved = null; + Glow.state.settingsDraft = null; + Glow.state.settingsDirty = false; Glow.state.selectedAttachment = []; Glow.state.selectedThreadAttachment = []; Glow.state.typingUsers = []; @@ -76,6 +79,13 @@ Glow.handleUnauthorized = () => { Glow.state.calls.backendParticipants = []; Glow.state.calls.scope = null; Glow.state.calls.statusText = "Idle"; + Glow.state.calls.metrics = { + packetLoss: null, + uptime: null, + latency: null, + elapsedSeconds: 0, + userCount: 0 + }; Glow.state.calls.permissions = { can_manage: false, can_end: false, @@ -89,6 +99,7 @@ Glow.handleUnauthorized = () => { Glow.closeReactionPopup?.(); Glow.closeMediaModal?.(); Glow.endLocalCallUi?.(); + Glow.profileResetCropState?.(); Glow.setSelectedAttachment?.([]); Glow.setSelectedThreadAttachment?.([]); @@ -461,4 +472,58 @@ Glow.apiDismissGroupCallInvite = inviteId => headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) } - ); \ No newline at end of file + ); + +/* optional / not yet guaranteed on all backends */ +Glow.apiBookmarkMessage = messageId => + Glow.apiRequest(`/api/messages/${encodeURIComponent(messageId)}/bookmark`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({}) + }); + +Glow.apiUnbookmarkMessage = messageId => + Glow.apiRequest(`/api/messages/${encodeURIComponent(messageId)}/bookmark`, { + method: "DELETE" + }); + +Glow.apiPinMessage = messageId => + Glow.apiRequest(`/api/messages/${encodeURIComponent(messageId)}/pin`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({}) + }); + +Glow.apiUnpinMessage = messageId => + Glow.apiRequest(`/api/messages/${encodeURIComponent(messageId)}/pin`, { + method: "DELETE" + }); + +Glow.apiListPins = (scopeKind, scopeId) => + Glow.apiRequest( + `/api/pins?scope_kind=${encodeURIComponent(scopeKind)}&scope_id=${encodeURIComponent(scopeId)}` + ); + +Glow.apiListBookmarks = () => + Glow.apiRequest("/api/bookmarks"); + +Glow.apiCreateMessageShare = messageId => + Glow.apiRequest(`/api/messages/${encodeURIComponent(messageId)}/share`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({}) + }); + +Glow.apiCreateAttachmentShare = attachmentId => + Glow.apiRequest(`/api/attachments/${encodeURIComponent(attachmentId)}/share`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({}) + }); + +Glow.apiCreateScheduledMessage = payload => + Glow.apiRequest("/api/scheduled-messages", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(payload) + }); \ No newline at end of file