Files
rhema-together/web/app/layouts/default.vue
T
vhaudiquet 3b82719d56 feat: add account avatars and a deployable image
Accounts get a profile page with an uploaded picture, shown in the
sidebar, the room bar, and every human message. Pictures live in the
SQLite database and are served through an authenticated route.

Hardening from the security audit: preview hosts expire after 24 hours
and carry no-referrer; removing a member or archiving a room ends their
event feed, presence socket, and terminal within seconds; previews and
the terminal pin the SSH host key; invites are claimed atomically;
missing accounts spend the same argon2 time as wrong passwords;
registration is closed by default; WebSockets check the origin; and the
master key is created with mode 0600.

The Dockerfile builds one image with the static client and the server.
The Helm chart runs a single replica with a SQLite volume, a wildcard
preview ingress, and the proxy settings the event feed and uploads
need. It refuses more than one replica because state is in process.
2026-11-28 02:07:26 +01:00

108 lines
2.9 KiB
Vue

<script setup lang="ts">
import { computed, onMounted, watch } from 'vue'
import { LogOut, Plus, Settings } from 'lucide-vue-next'
const { user, signOut, session } = useSession()
const avatarSrc = computed(() => {
if (!user.value?.avatar_updated_at) return null
return `/api/avatars/${user.value.id}?v=${user.value.avatar_updated_at}`
})
const {
rooms: roomList,
loading: roomsLoading,
error: roomsError,
creating,
openCreate,
closeCreate,
refresh: refreshRooms,
} = useRooms()
onMounted(() => {
if (session.value.loaded && user.value) void refreshRooms()
})
watch(user, (current) => {
if (current) void refreshRooms()
})
async function onSignOut() {
await signOut()
}
</script>
<template>
<div class="app-shell">
<aside class="sidebar">
<div class="sidebar-top">
<NuxtLink to="/rooms" class="sidebar-brand">
<img src="/rhema-logo.png" class="sidebar-brand-mark" alt="">
<span>Rhema Together</span>
</NuxtLink>
</div>
<div class="sidebar-label">
<span>Rooms</span>
<button
type="button"
class="icon-btn"
aria-label="New room"
title="New room"
@click="openCreate()"
>
<Plus :size="16" aria-hidden="true" />
</button>
</div>
<nav class="sidebar-rooms" aria-label="Rooms">
<p v-if="roomsLoading && roomList.length === 0" class="sidebar-room muted">Loading rooms.</p>
<p v-else-if="roomsError" class="sidebar-room muted">{{ roomsError }}</p>
<p v-else-if="roomList.length === 0" class="sidebar-room muted">No rooms yet.</p>
<NuxtLink
v-for="room in roomList"
:key="room.id"
:to="`/room/${room.id}`"
class="sidebar-room"
:title="room.name"
>
{{ room.name }}
</NuxtLink>
</nav>
<div class="sidebar-bottom">
<NuxtLink to="/settings" class="sidebar-link">
<Settings :size="16" aria-hidden="true" />
<span>Settings</span>
</NuxtLink>
<div class="sidebar-account">
<NuxtLink to="/profile" class="sidebar-account-link" title="Open profile">
<AppAvatar
v-if="user"
:name="user.display_name"
color="var(--member-1)"
:src="avatarSrc"
size="sm"
/>
<span class="sidebar-account-name" :title="user?.handle">{{ user?.display_name }}</span>
</NuxtLink>
<button
type="button"
class="icon-btn"
aria-label="Sign out"
title="Sign out"
@click="onSignOut"
>
<LogOut :size="16" aria-hidden="true" />
</button>
</div>
</div>
</aside>
<div class="main">
<slot />
</div>
<NewRoomDialog v-if="creating" @close="closeCreate()" />
</div>
</template>