feat: comprehensive project improvements
Some checks failed
CI / Rust Format (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Test Server (push) Has been cancelled
CI / Frontend Check (push) Has been cancelled
CI / Tauri Client Check (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Build Tauri (Linux) (push) Has been cancelled
Some checks failed
CI / Rust Format (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Test Server (push) Has been cancelled
CI / Frontend Check (push) Has been cancelled
CI / Tauri Client Check (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Build Tauri (Linux) (push) Has been cancelled
- Fix 14 Clippy warnings across server and bot-sdk - Add 67 unit tests (32 bot-sdk, 34 server, 1 doctest) - Add Prometheus metrics endpoint (/api/metrics) - Add structured JSON logging (EIFELDC_LOG_FORMAT=json) - Add release workflow (Docker push + GitHub Release + Tauri builds) - Add rate limiting middleware (EIFELDC_RATE_LIMIT) - Add CORS restriction (EIFELDC_CORS_ORIGINS) - Add session token expiry (EIFELDC_SESSION_TTL) - Add input validation (username/password/homeserver length limits) - Add upload size limit (EIFELDC_MAX_UPLOAD_MB) - Upgrade Tauri client from v1 to v2 - Add session store with SQLite persistence - Add proper error types and cleanup across all crates - Format all code with cargo fmt - Update CI pipeline with fmt, clippy, test, frontend, and Tauri checks - Add README with full API reference and setup guide
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { currentServer, channels, currentChannel, textChannels, voiceChannels, currentUser, voiceState, refreshChannels } from '../lib/store';
|
||||
import { currentServer, channels, currentChannel, textChannels, voiceChannels, currentUser, voiceState, refreshChannels, userProfile, refreshProfile, updateDisplayName, unreadCounts } from '../lib/store';
|
||||
import { connectToVoice, disconnectFromVoice, toggleMute, toggleDeafen, voiceRoom } from '../lib/voice';
|
||||
import { onMount } from 'svelte';
|
||||
import { getJoinedRooms, joinVoiceChannel, createRoom, joinRoom, leaveRoom, logout, setPresence, type VoiceStateInfo, type RoomInfo } from '../lib/api';
|
||||
import { getJoinedRooms, createRoom, joinRoom, leaveRoom, logout, setPresence, type RoomInfo } from '../lib/api';
|
||||
|
||||
let showCreateRoom = false;
|
||||
let showJoinRoom = false;
|
||||
@@ -12,6 +13,8 @@
|
||||
let joinError = '';
|
||||
let showSettings = false;
|
||||
let presenceStatus: 'online' | 'idle' | 'dnd' | 'offline' = 'online';
|
||||
let editingName = false;
|
||||
let editNameValue = '';
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
@@ -26,6 +29,7 @@
|
||||
} catch (e) {
|
||||
console.error('Failed to load rooms', e);
|
||||
}
|
||||
refreshProfile();
|
||||
});
|
||||
|
||||
async function handleCreateRoom() {
|
||||
@@ -55,13 +59,11 @@
|
||||
|
||||
async function handleJoinVoice(channel: any) {
|
||||
try {
|
||||
const result: VoiceStateInfo = await joinVoiceChannel(channel.id);
|
||||
voiceState.set({
|
||||
channelId: result.room_id,
|
||||
muted: result.muted,
|
||||
deafened: result.deafened,
|
||||
streaming: result.streaming,
|
||||
});
|
||||
await connectToVoice(channel.id);
|
||||
voiceState.update(s => ({
|
||||
...s,
|
||||
channelId: channel.id,
|
||||
}));
|
||||
} catch (e) {
|
||||
console.error('Failed to join voice', e);
|
||||
}
|
||||
@@ -88,6 +90,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSaveName() {
|
||||
if (!editNameValue.trim()) return;
|
||||
try {
|
||||
await updateDisplayName(editNameValue.trim());
|
||||
editingName = false;
|
||||
} catch (e) {
|
||||
console.error('Failed to update name', e);
|
||||
}
|
||||
}
|
||||
|
||||
function startEditName() {
|
||||
editNameValue = $userProfile?.display_name || $currentUser?.username || '';
|
||||
editingName = true;
|
||||
}
|
||||
|
||||
async function handlePresenceChange(status: string) {
|
||||
try {
|
||||
await setPresence(status);
|
||||
@@ -140,13 +157,16 @@
|
||||
<button
|
||||
class="channel-item"
|
||||
class:active={$currentChannel?.id === channel.id}
|
||||
on:click={() => currentChannel.set(channel)}
|
||||
on:click={() => { currentChannel.set(channel); unreadCounts.update(c => { delete c[channel.id]; return c; }); }}
|
||||
on:contextmenu|preventDefault={() => handleLeaveRoom(channel.id)}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" class="channel-icon">
|
||||
<path d="M5.88657 21C5.57547 21 5.3399 20.7189 5.39427 20.4126L6.00001 17H2.59511C2.28449 17 2.04905 16.7198 2.10259 16.4138L2.27759 15.4138C2.31946 15.1746 2.52722 15 2.77011 15H6.35001L7.41001 9H4.00511C3.69449 9 3.45905 8.71977 3.51259 8.41381L3.68759 7.41381C3.72946 7.17456 3.93722 7 4.18011 7H7.76001L8.39677 3.41262C8.43914 3.17391 8.64664 3 8.88907 3H9.89044C10.2015 3 10.4371 3.28107 10.3827 3.58738L9.76001 7H15.76L16.3968 3.41262C16.4391 3.17391 16.6466 3 16.8891 3H17.8904C18.2015 3 18.4371 3.28107 18.3827 3.58738L17.76 7H21.1649C21.4755 7 21.711 7.28023 21.6574 7.58619L21.4824 8.58619C21.4406 8.82544 21.2328 9 20.9899 9H17.41L16.35 15H19.755C20.0656 15 20.301 15.2802 20.2474 15.5862L20.0724 16.5862C20.0306 16.8254 19.8228 17 19.5799 17H16L15.3632 20.5874C15.3209 20.8261 15.1134 21 14.8709 21H13.8696C13.5585 21 13.3229 20.7189 13.3773 20.4126L14 17H8.00001L7.36325 20.5874C7.32088 20.8261 7.11337 21 6.87094 21H5.88657ZM9.41045 9L8.35045 15H14.3504L15.4104 9H9.41045Z"/>
|
||||
</svg>
|
||||
<span>{channel.name}</span>
|
||||
{#if $unreadCounts[channel.id]}
|
||||
<span class="unread-badge">{$unreadCounts[channel.id]}</span>
|
||||
{/if}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -159,8 +179,14 @@
|
||||
{#each $voiceChannels as channel}
|
||||
<button
|
||||
class="channel-item voice"
|
||||
class:active={$currentChannel?.id === channel.id}
|
||||
on:click={() => handleJoinVoice(channel)}
|
||||
class:active={$voiceRoom.roomId === channel.id}
|
||||
on:click={() => {
|
||||
if ($voiceRoom.roomId === channel.id) {
|
||||
disconnectFromVoice();
|
||||
} else {
|
||||
handleJoinVoice(channel);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" class="channel-icon">
|
||||
<path d="M12 3c-4.97 0-9 4.03-9 9v7c0 1.66 1.34 3 3 3h3v-8H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-4v8h3c1.66 0 3-1.34 3-3v-7c0-4.97-4.03-9-9-9z"/>
|
||||
@@ -220,17 +246,31 @@
|
||||
|
||||
<div class="user-panel">
|
||||
<div class="user-info">
|
||||
<div class="avatar-small">{$currentUser?.username?.charAt(0).toUpperCase() || '?'}</div>
|
||||
<div class="avatar-small">{$userProfile?.display_name?.charAt(0).toUpperCase() || $currentUser?.username?.charAt(0).toUpperCase() || '?'}</div>
|
||||
<div class="user-details">
|
||||
<span class="username">{$currentUser?.username || 'Benutzer'}</span>
|
||||
<span class="status-text">{presenceStatus === 'online' ? 'Online' : presenceStatus === 'idle' ? 'Abwesend' : presenceStatus === 'dnd' ? 'Nicht stören' : 'Offline'}</span>
|
||||
{#if editingName}
|
||||
<input
|
||||
type="text"
|
||||
bind:value={editNameValue}
|
||||
placeholder="Anzeigename"
|
||||
class="edit-name-input"
|
||||
on:keydown={(e) => { if (e.key === 'Enter') handleSaveName(); if (e.key === 'Escape') editingName = false; }}
|
||||
/>
|
||||
<div class="edit-name-actions">
|
||||
<button class="btn-icon-small" on:click={handleSaveName}>✓</button>
|
||||
<button class="btn-icon-small" on:click={() => editingName = false}>✕</button>
|
||||
</div>
|
||||
{:else}
|
||||
<span class="username" on:click={startEditName} title="Klicken zum Bearbeiten">{$userProfile?.display_name || $currentUser?.username || 'Benutzer'}</span>
|
||||
<span class="status-text">{presenceStatus === 'online' ? 'Online' : presenceStatus === 'idle' ? 'Abwesend' : presenceStatus === 'dnd' ? 'Nicht stören' : 'Offline'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-actions">
|
||||
<button class="btn-icon" title="Mikrofon" on:click={() => { if ($voiceState.channelId) voiceState.update(s => ({ ...s, muted: !s.muted })); }}>
|
||||
<button class="btn-icon" title="Mikrofon" on:click={() => { if ($voiceRoom.connected) toggleMute(); }}>
|
||||
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1-9c0-.55.45-1 1-1s1 .45 1 1v6c0 .55-.45 1-1 1s-1-.45-1-1V5z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
|
||||
</button>
|
||||
<button class="btn-icon" title="Kopfhörer" on:click={() => { if ($voiceState.channelId) voiceState.update(s => ({ ...s, deafened: !s.deafened })); }}>
|
||||
<button class="btn-icon" title="Kopfhörer" on:click={() => { if ($voiceRoom.connected) toggleDeafen(); }}>
|
||||
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 3c-4.97 0-9 4.03-9 9v7c0 1.66 1.34 3 3 3h3v-8H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-4v8h3c1.66 0 3-1.34 3-3v-7c0-4.97-4.03-9-9-9z"/></svg>
|
||||
</button>
|
||||
<button class="btn-icon" title="Einstellungen" on:click={() => showSettings = !showSettings}>⚙</button>
|
||||
@@ -322,9 +362,20 @@
|
||||
}
|
||||
|
||||
.channel-item.active {
|
||||
background: var(--bg-active);
|
||||
background-color: var(--bg-active);
|
||||
color: var(--text-primary);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.unread-badge {
|
||||
background: var(--danger);
|
||||
color: white;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
border-radius: 8px;
|
||||
padding: 1px 6px;
|
||||
margin-left: auto;
|
||||
min-width: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.channel-icon {
|
||||
@@ -383,11 +434,45 @@
|
||||
}
|
||||
|
||||
.username {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 0.95rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.username:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.edit-name-input {
|
||||
width: 100%;
|
||||
padding: 2px 6px;
|
||||
background: var(--bg-input);
|
||||
border: 1px solid var(--accent);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9rem;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.edit-name-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.btn-icon-small {
|
||||
background: none;
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
padding: 1px 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.btn-icon-small:hover {
|
||||
color: var(--text-primary);
|
||||
border-color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.status-text {
|
||||
|
||||
Reference in New Issue
Block a user