Log in with Matrix

This commit is contained in:
Cadence Ember
2025-02-02 01:23:36 +13:00
parent 63cc089bdb
commit 443618b974
13 changed files with 222 additions and 23 deletions
+6 -3
View File
@@ -1,13 +1,16 @@
extends includes/template.pug
block body
if !session.data.managedGuilds
if !managed
.s-empty-state.wmx4.p48
!= icons.Spots.SpotEmptyXL
p You need to log in to manage your servers.
a.s-btn.s-btn__icon.s-btn__filled(href=rel("/oauth"))
a.s-btn.s-btn__icon.s-btn__featured.s-btn__filled(href=rel("/oauth"))
!= icons.Icons.IconDiscord
= ` Log in with Discord`
a.s-btn.s-btn__icon.s-btn__matrix.s-btn__filled(href=rel("/log-in-with-matrix"))
!= icons.Icons.IconChatBubble
= ` Log in with Matrix`
else if !guild_id
.s-empty-state.wmx4.p48
@@ -15,7 +18,7 @@ block body
p Select a server from the top right corner to continue.
p If the server you're looking for isn't there, try #[a(href=rel("/oauth?action=add")) logging in again.]
else if !discord.guilds.has(guild_id) || !session.data.managedGuilds.includes(guild_id)
else if !discord.guilds.has(guild_id) || !managed.includes(guild_id)
.s-empty-state.wmx4.p48
!= icons.Spots.SpotAlertXL
p Either the selected server doesn't exist, or you don't have the Manage Server permission on Discord.
+36 -7
View File
@@ -30,6 +30,31 @@ html(lang="en")
--_ts-multiple-bg: var(--green-400);
--_ts-multiple-fc: var(--white);
}
.s-btn.s-btn__matrix {
--_bu-bg-active: var(--black-300);
--_bu-bg-hover: var(--black-200);
--_bu-bg-selected: var(--black-300);
--_bu-fc: var(--black-500);
--_bu-fc-active: var(--_bu-fc);
--_bu-fc-hover: var(--black-500);
--_bu-fc-selected: var(--black-600);
--_bu-filled-bc: transparent;
--_bu-filled-bc-selected: var(--_bu-filled-bc);
--_bu-filled-bg: var(--black-400);
--_bu-filled-bg-active: var(--black-500);
--_bu-filled-bg-hover: var(--black-500);
--_bu-filled-bg-selected: var(--black-600);
--_bu-filled-fc: var(--white);
--_bu-filled-fc-active: var(--_bu-filled-fc);
--_bu-filled-fc-hover: var(--_bu-filled-fc);
--_bu-filled-fc-selected: var(--_bu-filled-fc);
--_bu-outlined-bc: var(--black-400);
--_bu-outlined-bc-selected: var(--black-500);
--_bu-outlined-bg-selected: var(--_bu-bg-selected);
--_bu-outlined-fc-selected: var(--_bu-fc-selected);
--_bu-number-fc: var(--white);
--_bu-number-fc-filled: var(--black);
}
body.themed.theme-system
header.s-topbar
.s-topbar--skip-link(href="#content") Skip to main content
@@ -38,22 +63,26 @@ html(lang="en")
img.s-avatar.s-avatar__32(src=rel("/icon.png"))
nav.s-topbar--navigation
ul.s-topbar--content
li.ps-relative
if !session.data.managedGuilds || session.data.managedGuilds.length === 0
a.s-btn.s-btn__icon.as-center(href=rel("/oauth"))
li.ps-relative.g8
if !session.data.mxid
a.s-btn.s-btn__icon.s-btn__matrix.s-btn__outlined.as-center(href=rel("/log-in-with-matrix"))
!= icons.Icons.IconSpeechBubble
= ` Log in with Matrix`
if !session.data.userID
a.s-btn.s-btn__icon.s-btn__featured.s-btn__outlined.as-center(href=rel("/oauth"))
!= icons.Icons.IconDiscord
= ` Log in`
else if guild_id && session.data.managedGuilds.includes(guild_id) && discord.guilds.has(guild_id)
= ` Log in with Discord`
if guild_id && managed.includes(guild_id) && discord.guilds.has(guild_id)
button.s-topbar--item.s-btn.s-btn__muted.s-user-card(popovertarget="guilds")
+guild(discord.guilds.get(guild_id))
else if session.data.managedGuilds
else if managed.length
button.s-topbar--item.s-btn.s-btn__muted.s-btn__dropdown.pr24.s-user-card.s-label(popovertarget="guilds")
| Your servers
#guilds(popover data-popper-placement="bottom" style="display: revert; width: revert;").s-popover.overflow-visible
.s-popover--arrow.s-popover--arrow__tc
.s-popover--content.overflow-y-auto.overflow-x-hidden
ul.s-menu(role="menu")
each guild in (session.data.managedGuilds || []).map(id => discord.guilds.get(id)).filter(g => g)
each guild in managed.map(id => discord.guilds.get(id)).filter(g => g)
li(role="menuitem")
a.s-topbar--item.s-user-card.d-flex.p4(href=rel(`/guild?guild_id=${guild.id}`))
+guild(guild)
+14
View File
@@ -0,0 +1,14 @@
extends includes/template.pug
block body
.s-page-title.mb24
h1.s-page-title--header Log in with Matrix
.d-flex.g16#form-container
.fl-grow1
form.d-flex.gy16.fd-column(method="post" action="/api/log-in-with-matrix" hx-post="/api/log-in-with-matrix" hx-indicator="#log-in-button" hx-select="#ok" hx-target="#form-container")
.d-flex.gy4.fd-column
label.s-label(for="mxid") Your Matrix ID
input.fl-grow1.s-input.wmx3#mxid(name="mxid" required placeholder="@user:example.org")
div
button.s-btn.s-btn__github#log-in-button Continue with Matrix
+1 -1
View File
@@ -2,5 +2,5 @@ extends includes/template.pug
block body
.ta-center.wmx5.p48.mx-auto#ok
!= icons.Spots.SpotApproveXL
!= spot ? icons.Spots[spot] : icons.Spots.SpotApproveXL
p.mt24.fs-body2= msg