forked from vhaudiquet/rhema-together
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.
53 lines
1.9 KiB
Vue
53 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import type { Message } from '~/types'
|
|
import { fullTime, relativeTime } from '~/utils/format'
|
|
import { memberColorVar } from '~/utils/member'
|
|
|
|
const props = defineProps<{ message: Message; color?: string | null; avatar?: string | null }>()
|
|
|
|
const segments = computed(() => {
|
|
const parts = props.message.text.split(/(@rhema\b)/gi)
|
|
return parts
|
|
.filter((part) => part.length > 0)
|
|
.map((part) => ({ text: part, mention: /^@rhema$/i.test(part) }))
|
|
})
|
|
|
|
const style = computed(() => ({ '--member': memberColorVar(props.color) }))
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="message.author_kind === 'system'" class="msg msg-system">
|
|
{{ message.text }}
|
|
</div>
|
|
|
|
<div v-else-if="message.author_kind === 'agent'" class="msg msg-agent">
|
|
<div class="msg-head">
|
|
<span class="msg-agent-label">rhema</span>
|
|
<span class="msg-time" :title="fullTime(message.created_at)">{{ relativeTime(message.created_at) }}</span>
|
|
</div>
|
|
<div class="msg-text">
|
|
<template v-for="(segment, index) in segments" :key="index">
|
|
<span v-if="segment.mention" class="mention">{{ segment.text }}</span>
|
|
<template v-else>{{ segment.text }}</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
|
|
<div v-else class="msg msg-human">
|
|
<AppAvatar :name="message.author_name" :color="color" :src="avatar" size="sm" />
|
|
<div class="msg-body">
|
|
<div class="msg-head">
|
|
<span class="msg-author member-name" :style="style">{{ message.author_name }}</span>
|
|
<span class="msg-time" :title="fullTime(message.created_at)">{{ relativeTime(message.created_at) }}</span>
|
|
</div>
|
|
<div class="msg-text">
|
|
<template v-for="(segment, index) in segments" :key="index">
|
|
<span v-if="segment.mention" class="mention">{{ segment.text }}</span>
|
|
<template v-else>{{ segment.text }}</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|