@@ -1,61 +1,104 @@
|
||||
# BridgeSwarm Advanced Chat
|
||||
|
||||
A feature-rich P2P chat application built on BridgeSwarm with real-time messaging, rooms, file sharing, and more.
|
||||
A production-polished P2P chat demo on BridgeSwarm: rooms (channels), presence, markdown, emoji, and peer file transfer — all over one Hyperswarm topic with no central server.
|
||||
|
||||
## Features
|
||||
|
||||
### Messaging
|
||||
- Real-time P2P messaging between tabs/browsers
|
||||
- Rich text formatting (bold, italic, code)
|
||||
- Emoji support with quick picker
|
||||
- Message timestamps
|
||||
- System messages for join/leave events
|
||||
- Real-time P2P messages between tabs/browsers (Unicode / emoji safe)
|
||||
- Markdown (sanitized with DOMPurify) + formatting toolbar
|
||||
- Emoji picker
|
||||
- Timestamps and system join/leave messages
|
||||
- Typing indicators (scoped to the current room)
|
||||
|
||||
### Rooms
|
||||
- Multiple chat rooms support
|
||||
- Create custom rooms with topics
|
||||
- Room member counts
|
||||
- Quick room switching
|
||||
- Multiple **channels** on a single Hyperswarm topic (not separate DHT topics)
|
||||
- Create rooms; peers learn about new rooms over the wire
|
||||
- Full **state sync** on connect (rooms, recent history, file metadata, nicknames)
|
||||
- Per-room message history (in-memory for the session)
|
||||
|
||||
### User Management
|
||||
- Custom nicknames
|
||||
- Online user list with status indicators
|
||||
- Unique avatar colors based on nickname
|
||||
- User presence tracking
|
||||
### Users
|
||||
- Nicknames + online peer list
|
||||
- Deterministic avatar colors from public key / nickname
|
||||
- Presence handshake on connect
|
||||
|
||||
### File Sharing
|
||||
- Share files directly in chat
|
||||
- File name and size display
|
||||
- Download shared files
|
||||
### File sharing
|
||||
- Announce file metadata to the room
|
||||
- Peers request bytes with `file-request` / `file-data` (targeted)
|
||||
- Soft size cap: **1.5 MB** per file
|
||||
- Does **not** require Hyperdrive replication
|
||||
|
||||
### Customization
|
||||
- Toggle notifications
|
||||
- Sound effects on/off
|
||||
- Auto-scroll control
|
||||
- Dark theme UI
|
||||
### App chrome
|
||||
- Leave / rejoin, host-disconnect recovery
|
||||
- **Session restore** on reload (same `swarmId` + seed identity, rooms/history, reattached peers)
|
||||
- Toast alerts + optional sounds
|
||||
- Mobile drawers for rooms/users and settings/files
|
||||
- Examples back link
|
||||
|
||||
### P2P Architecture
|
||||
- No central server required
|
||||
- Messages flow directly between peers
|
||||
- Uses Hyperswarm for peer discovery
|
||||
- Each tab gets unique public key for identity
|
||||
|
||||
## How to Run
|
||||
## How to run
|
||||
|
||||
1. Load the BridgeSwarm extension and native host.
|
||||
2. Enable **Examples server** in extension Settings (or from the repo: `npm run examples`)
|
||||
3. Open **http://127.0.0.1:4173/chat-advanced/** in two tabs.
|
||||
2. Enable **Examples server** in extension Settings (or from the repo: `npm run examples`).
|
||||
3. Open **http://127.0.0.1:4173/chat-advanced/** in **two tabs**.
|
||||
|
||||
Do **not** open via `file://` — browsers treat each local file as a unique security origin.
|
||||
Do **not** open via `file://`.
|
||||
|
||||
## Usage
|
||||
|
||||
### Joining
|
||||
- Enter a topic/address (or use default)
|
||||
- Enter your nickname
|
||||
- Click "Join"
|
||||
1. Enter a topic (default `bridge-swarm-advanced-v1`) and nickname.
|
||||
2. Click **Join**. Join stays open until the connection succeeds.
|
||||
3. Open the same topic in a second tab to chat.
|
||||
|
||||
### Sending Messages
|
||||
- Type in the message box
|
||||
- Press Enter or click Send
|
||||
- Use **bold**, *italic*, and `code` formatting
|
||||
### Messaging
|
||||
- Type in the compose box; Enter sends (Shift+Enter for newline).
|
||||
- Use the toolbar for markdown shortcuts, or the emoji picker.
|
||||
- Toggle **Markdown** in Settings to switch between sanitized rich HTML and simple formatting.
|
||||
|
||||
### Rooms
|
||||
- Click **+** to create a channel name (letters, numbers, `.` `_` `-`).
|
||||
- Peers receive a `room` announce plus a `state-sync` snapshot so late joiners get the full room list and recent history.
|
||||
- Room counts show local message counts for that channel.
|
||||
|
||||
### Files
|
||||
1. Click the paperclip and pick a file under 1.5 MB.
|
||||
2. Peers see a share bubble and automatically request the bytes.
|
||||
3. Click the file in the sidebar or **Download** on the bubble when ready.
|
||||
|
||||
### Leave
|
||||
- Use **Leave** in the left sidebar to destroy the swarm and return to the join modal.
|
||||
- If the native host drops, the UI resets so you can rejoin.
|
||||
|
||||
## Protocol (overview)
|
||||
|
||||
| Type | Purpose |
|
||||
|------|---------|
|
||||
| `handshake` / `presence` | Nickname + public key exchange |
|
||||
| `state-sync` | Snapshot: rooms, recent messages, file metadata, users |
|
||||
| `state-request` | Ask peer to send a fresh `state-sync` |
|
||||
| `chat` | Room-scoped text message |
|
||||
| `system` | Join/leave style notices |
|
||||
| `typing` | Room-scoped typing flag |
|
||||
| `room` | Announce a new channel |
|
||||
| `file` | Metadata announce (no payload) |
|
||||
| `file-request` | Ask peer for bytes (`requesterKey`) |
|
||||
| `file-data` | Targeted base64 response |
|
||||
|
||||
All writes use `TextEncoder` → `conn.write(Uint8Array)`.
|
||||
|
||||
## Security notes
|
||||
|
||||
- Markdown is passed through **DOMPurify** before `innerHTML`.
|
||||
- Anyone on the topic can read messages and request shared files — treat the topic like a shared room password.
|
||||
- File bytes stay in memory for the session; nothing is durable across reloads.
|
||||
|
||||
## Architecture
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
TabA[Tab A] -->|Hyperswarm topic| TabB[Tab B]
|
||||
TabA -->|chat room presence typing| TabB
|
||||
TabA -->|file announce| TabB
|
||||
TabB -->|file-request| TabA
|
||||
TabA -->|file-data| TabB
|
||||
```
|
||||
|
||||
+1422
-801
File diff suppressed because it is too large
Load Diff
@@ -10,16 +10,26 @@
|
||||
<script>if (BridgeSwarmExamples.guardFileProtocol('chat-advanced/')) { /* blocked */ }</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app-container">
|
||||
<aside class="sidebar">
|
||||
<a class="bs-back-link" href="../">← Examples</a>
|
||||
|
||||
<div class="mobile-bar">
|
||||
<button type="button" class="btn-icon" id="btnToggleLeft" aria-label="Open rooms and users" title="Rooms & users">☰</button>
|
||||
<span class="mobile-title" id="mobileTitle">#lobby</span>
|
||||
<button type="button" class="btn-icon" id="btnToggleRight" aria-label="Open settings and files" title="Settings & files">⚙</button>
|
||||
</div>
|
||||
<div class="drawer-backdrop hidden" id="drawerBackdrop" aria-hidden="true"></div>
|
||||
|
||||
<div class="app-container" id="appContainer">
|
||||
<aside class="sidebar" id="leftSidebar">
|
||||
<div class="sidebar-header">
|
||||
<h2>Advanced Chat</h2>
|
||||
<button type="button" class="btn-icon btn-leave" id="btnLeave" aria-label="Leave chat" title="Leave" disabled>Leave</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="user-profile">
|
||||
<div class="avatar" id="avatar">?</div>
|
||||
<div class="avatar" id="avatar" role="img" aria-label="Your avatar">?</div>
|
||||
<div class="user-info">
|
||||
<input type="text" id="nickname" placeholder="Nickname" maxlength="20">
|
||||
<input type="text" id="nickname" placeholder="Nickname" maxlength="20" aria-label="Nickname" disabled>
|
||||
<div class="public-key" id="publicKey" title="Click to copy">Your ID: (join to generate)</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,22 +37,16 @@
|
||||
<div class="rooms-section">
|
||||
<div class="section-header">
|
||||
<h3>Rooms</h3>
|
||||
<button class="btn-icon" id="btnCreateRoom" title="Create Room">+</button>
|
||||
<button type="button" class="btn-icon" id="btnCreateRoom" aria-label="Create room" title="Create Room" disabled>+</button>
|
||||
</div>
|
||||
<ul class="room-list" id="roomList">
|
||||
<li class="room active" data-room="lobby">
|
||||
<span class="room-icon">#</span>
|
||||
<span class="room-name">lobby</span>
|
||||
<span class="room-count" id="room-lobby-count">0</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="room-list" id="roomList" role="listbox" aria-label="Rooms"></ul>
|
||||
</div>
|
||||
|
||||
<div class="users-section">
|
||||
<div class="section-header">
|
||||
<h3>Online Users <span id="userCount">(0)</span></h3>
|
||||
</div>
|
||||
<ul class="user-list" id="userList"></ul>
|
||||
<ul class="user-list" id="userList" aria-live="polite"></ul>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -53,38 +57,40 @@
|
||||
<span class="room-topic" id="roomTopic">General discussion</span>
|
||||
</div>
|
||||
<div class="chat-actions">
|
||||
<button class="btn-icon" id="btnToggleEmoji" title="Emoji">😊</button>
|
||||
<button class="btn-icon" id="btnSendFile" title="Send File">📎</button>
|
||||
<button class="btn-icon" id="btnClearChat" title="Clear Chat">🗑️</button>
|
||||
<button type="button" class="btn-icon" id="btnToggleEmoji" aria-label="Emoji picker" title="Emoji" disabled>😊</button>
|
||||
<button type="button" class="btn-icon" id="btnSendFile" aria-label="Send file" title="Send File" disabled>📎</button>
|
||||
<button type="button" class="btn-icon" id="btnClearChat" aria-label="Clear chat" title="Clear Chat" disabled>🗑️</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="messages" id="messages"></div>
|
||||
<div class="messages" id="messages" role="log" aria-live="polite" aria-relevant="additions">
|
||||
<div class="empty-state" id="messagesEmpty">Join a topic to start chatting. Open this page in a second tab to talk P2P.</div>
|
||||
</div>
|
||||
|
||||
<div class="typing-indicator" id="typingIndicator">
|
||||
<span id="typingUsers"></span> is typing...
|
||||
<div class="typing-indicator" id="typingIndicator" aria-live="polite">
|
||||
<span id="typingUsers"></span> is typing…
|
||||
</div>
|
||||
|
||||
<div class="compose-area">
|
||||
<div class="compose-tools">
|
||||
<button class="btn-tool" id="btnBold" title="Bold (Ctrl+B)"><strong>B</strong></button>
|
||||
<button class="btn-tool" id="btnItalic" title="Italic (Ctrl+I)"><em>I</em></button>
|
||||
<button class="btn-tool" id="btnStrike" title="Strikethrough"><s>S</s></button>
|
||||
<button class="btn-tool" id="btnCode" title="Inline Code"></></button>
|
||||
<button class="btn-tool" id="btnCodeBlock" title="Code Block">{ }</button>
|
||||
<button class="btn-tool" id="btnLink" title="Link">🔗</button>
|
||||
<button class="btn-tool" id="btnList" title="List">•</button>
|
||||
<button class="btn-tool" id="btnQuote" title="Quote">"</button>
|
||||
<button class="btn-tool" id="btnEmoji2" title="Emoji">😀</button>
|
||||
<button type="button" class="btn-tool" id="btnBold" aria-label="Bold" title="Bold (Ctrl+B)" disabled><strong>B</strong></button>
|
||||
<button type="button" class="btn-tool" id="btnItalic" aria-label="Italic" title="Italic (Ctrl+I)" disabled><em>I</em></button>
|
||||
<button type="button" class="btn-tool" id="btnStrike" aria-label="Strikethrough" title="Strikethrough" disabled><s>S</s></button>
|
||||
<button type="button" class="btn-tool" id="btnCode" aria-label="Inline code" title="Inline Code" disabled></></button>
|
||||
<button type="button" class="btn-tool" id="btnCodeBlock" aria-label="Code block" title="Code Block" disabled>{ }</button>
|
||||
<button type="button" class="btn-tool" id="btnLink" aria-label="Insert link" title="Link" disabled>🔗</button>
|
||||
<button type="button" class="btn-tool" id="btnList" aria-label="List" title="List" disabled>•</button>
|
||||
<button type="button" class="btn-tool" id="btnQuote" aria-label="Quote" title="Quote" disabled>"</button>
|
||||
<button type="button" class="btn-tool" id="btnEmoji2" aria-label="Emoji" title="Emoji" disabled>😀</button>
|
||||
</div>
|
||||
<div class="compose-input">
|
||||
<textarea id="messageInput" placeholder="Type a message... (Markdown supported)" rows="1"></textarea>
|
||||
<button class="btn-send" id="btnSend">Send</button>
|
||||
<textarea id="messageInput" placeholder="Type a message… (Markdown supported)" rows="1" aria-label="Message" disabled></textarea>
|
||||
<button type="button" class="btn-send" id="btnSend" disabled>Send</button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<aside class="right-sidebar">
|
||||
<aside class="right-sidebar" id="rightSidebar">
|
||||
<div class="sidebar-section">
|
||||
<h3>Room Info</h3>
|
||||
<div class="info-item">
|
||||
@@ -95,11 +101,17 @@
|
||||
<span class="label">Messages:</span>
|
||||
<span id="messageCount">0</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">Peers:</span>
|
||||
<span id="peerCount">0</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-section">
|
||||
<h3>Shared Files</h3>
|
||||
<ul class="file-list" id="fileList"></ul>
|
||||
<ul class="file-list" id="fileList">
|
||||
<li class="empty-hint" id="filesEmpty">No shared files yet</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-section">
|
||||
@@ -107,7 +119,7 @@
|
||||
<div class="setting-item">
|
||||
<label>
|
||||
<input type="checkbox" id="chkNotifications">
|
||||
Notifications
|
||||
Toast alerts
|
||||
</label>
|
||||
</div>
|
||||
<div class="setting-item">
|
||||
@@ -132,50 +144,49 @@
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="createRoomModal">
|
||||
<div class="modal hidden" id="createRoomModal" role="dialog" aria-modal="true" aria-labelledby="createRoomTitle">
|
||||
<div class="modal-content">
|
||||
<h3>Create New Room</h3>
|
||||
<input type="text" id="newRoomName" placeholder="Room name" maxlength="30">
|
||||
<input type="text" id="newRoomTopic" placeholder="Room topic (optional)">
|
||||
<h3 id="createRoomTitle">Create New Room</h3>
|
||||
<p class="modal-hint">Rooms are channels on the same Hyperswarm topic. Peers see rooms you create.</p>
|
||||
<input type="text" id="newRoomName" placeholder="Room name" maxlength="30" aria-label="Room name">
|
||||
<input type="text" id="newRoomTopic" placeholder="Room topic (optional)" maxlength="80" aria-label="Room topic">
|
||||
<div class="modal-actions">
|
||||
<button class="btn secondary" id="btnCancelCreate">Cancel</button>
|
||||
<button class="btn primary" id="btnConfirmCreate">Create</button>
|
||||
<button type="button" class="btn secondary" id="btnCancelCreate">Cancel</button>
|
||||
<button type="button" class="btn primary" id="btnConfirmCreate">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="joinModal">
|
||||
<div class="modal" id="joinModal" role="dialog" aria-modal="true" aria-labelledby="joinTitle">
|
||||
<div class="modal-content">
|
||||
<h3>Join Chat</h3>
|
||||
<h3 id="joinTitle">Join Chat</h3>
|
||||
<p class="modal-hint join-error hidden" id="joinError" role="alert"></p>
|
||||
<div class="form-group">
|
||||
<label>Topic/Address</label>
|
||||
<label for="joinTopic">Topic / address</label>
|
||||
<input type="text" id="joinTopic" placeholder="e.g. bridge-swarm-advanced" value="bridge-swarm-advanced-v1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Your Nickname</label>
|
||||
<label for="joinNickname">Your nickname</label>
|
||||
<input type="text" id="joinNickname" placeholder="Enter your nickname" maxlength="20">
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button class="btn primary" id="btnJoinChat">Join</button>
|
||||
<button type="button" class="btn primary" id="btnJoinChat">Join</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast-container" id="toastContainer"></div>
|
||||
<div class="toast-container" id="toastContainer" aria-live="polite"></div>
|
||||
|
||||
<div class="status-bar">
|
||||
<span class="status" id="status">Disconnected</span>
|
||||
<span class="connection-status" id="connectionStatus">●</span>
|
||||
<span class="status" id="status">Waiting for BridgeSwarm…</span>
|
||||
<span class="connection-status offline" id="connectionStatus" aria-hidden="true">●</span>
|
||||
</div>
|
||||
|
||||
<input type="file" id="fileInput" hidden>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked@12.0.2/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/highlight.min.js"></script>
|
||||
<script type="module">
|
||||
import { markedHighlight } from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
|
||||
window.markedHighlight = markedHighlight;
|
||||
</script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
@import url('../shared/theme.css');
|
||||
|
||||
:root {
|
||||
--bg-primary: var(--bg);
|
||||
--bg-secondary: var(--panel);
|
||||
--bg-tertiary: var(--panel-2);
|
||||
--bg-hover: #283548;
|
||||
--border-color: var(--border);
|
||||
--text-primary: var(--text);
|
||||
--text-secondary: var(--muted);
|
||||
--text-muted: var(--faint);
|
||||
--accent-primary: var(--accent);
|
||||
--accent-primary-hover: var(--accent-hover);
|
||||
--accent-secondary: var(--accent-2);
|
||||
--success: var(--ok);
|
||||
--warning: #f59e0b;
|
||||
--error: var(--danger);
|
||||
--online: var(--ok);
|
||||
--away: #f59e0b;
|
||||
--offline: var(--faint);
|
||||
--bg-primary: #0e0e14;
|
||||
--bg-secondary: #17171f;
|
||||
--bg-tertiary: #22222c;
|
||||
--bg-hover: #2c2c38;
|
||||
--border-color: #3a3a48;
|
||||
/* High-contrast text (do not use faint gray for body copy) */
|
||||
--text-primary: #f4f4f8;
|
||||
--text-secondary: #d0d0dc;
|
||||
--text-muted: #a8a8b8;
|
||||
--accent-primary: #2dd4bf;
|
||||
--accent-primary-hover: #5eead4;
|
||||
--accent-secondary: #7dd3fc;
|
||||
--success: #4ade80;
|
||||
--warning: #fbbf24;
|
||||
--error: #fb7185;
|
||||
--online: #4ade80;
|
||||
--away: #fbbf24;
|
||||
--offline: #8b8b9a;
|
||||
--input-bg: #1c1c26;
|
||||
--input-border: #4a4a5a;
|
||||
}
|
||||
|
||||
* {
|
||||
@@ -34,13 +37,62 @@ html, body {
|
||||
body {
|
||||
font-family: var(--font);
|
||||
background:
|
||||
radial-gradient(900px 400px at 0% 0%, var(--glow-blue), transparent 50%),
|
||||
radial-gradient(900px 400px at 0% 0%, rgba(45, 212, 191, 0.1), transparent 50%),
|
||||
radial-gradient(700px 360px at 100% 0%, rgba(125, 211, 252, 0.08), transparent 55%),
|
||||
var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
font-size: 15px;
|
||||
line-height: 1.55;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.hidden { display: none !important; }
|
||||
|
||||
.bs-back-link {
|
||||
position: fixed;
|
||||
top: 0.45rem;
|
||||
left: 0.65rem;
|
||||
z-index: 60;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
padding: 0.2rem 0.45rem;
|
||||
border-radius: 6px;
|
||||
background: rgba(12, 12, 16, 0.55);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
.bs-back-link:hover { color: var(--accent-primary); }
|
||||
|
||||
.mobile-bar {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 44px;
|
||||
z-index: 55;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
padding: 0 0.5rem;
|
||||
background: var(--bg-secondary);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
.mobile-title {
|
||||
font-weight: 700;
|
||||
font-family: var(--font-display, var(--font));
|
||||
color: var(--accent-secondary);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.drawer-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
z-index: 70;
|
||||
}
|
||||
.drawer-backdrop.hidden { display: none !important; }
|
||||
|
||||
.app-container {
|
||||
display: grid;
|
||||
grid-template-columns: 240px 1fr 220px;
|
||||
@@ -70,6 +122,10 @@ body {
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar-header h2 {
|
||||
@@ -77,6 +133,23 @@ body {
|
||||
color: var(--accent-secondary);
|
||||
}
|
||||
|
||||
.btn-leave {
|
||||
font-size: 0.7rem !important;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
padding: 0.25rem 0.5rem !important;
|
||||
width: auto !important;
|
||||
height: auto !important;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 6px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.btn-leave:hover:not(:disabled) {
|
||||
border-color: var(--error);
|
||||
color: var(--error);
|
||||
}
|
||||
.btn-leave:disabled { opacity: 0.4; cursor: not-allowed; }
|
||||
|
||||
.user-profile {
|
||||
padding: 0.75rem;
|
||||
display: flex;
|
||||
@@ -111,12 +184,13 @@ body {
|
||||
|
||||
.user-info input {
|
||||
width: 100%;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-color);
|
||||
background: var(--input-bg);
|
||||
border: 1px solid var(--input-border);
|
||||
border-radius: 6px;
|
||||
padding: 0.4rem 0.6rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.user-info input:focus {
|
||||
@@ -125,13 +199,14 @@ body {
|
||||
}
|
||||
|
||||
.public-key {
|
||||
font-size: 0.65rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.72rem;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 0.3rem;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-family: var(--font-mono, ui-monospace, monospace);
|
||||
}
|
||||
|
||||
.public-key:hover {
|
||||
@@ -146,10 +221,10 @@ body {
|
||||
}
|
||||
|
||||
.section-header h3 {
|
||||
font-size: 0.75rem;
|
||||
font-size: 0.78rem;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
@@ -196,6 +271,8 @@ body {
|
||||
padding: 0.6rem 1rem;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.room:hover {
|
||||
@@ -204,15 +281,16 @@ body {
|
||||
|
||||
.room.active {
|
||||
background: var(--accent-primary);
|
||||
color: white;
|
||||
color: #0a0a10;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.room-icon {
|
||||
color: var(--text-muted);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.room.active .room-icon {
|
||||
color: white;
|
||||
color: #0a0a10;
|
||||
}
|
||||
|
||||
.room-name {
|
||||
@@ -222,12 +300,15 @@ body {
|
||||
.room-count {
|
||||
font-size: 0.75rem;
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--text-secondary);
|
||||
padding: 0.1rem 0.4rem;
|
||||
border-radius: 10px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.room.active .room-count {
|
||||
background: rgba(255,255,255,0.2);
|
||||
background: rgba(10, 10, 16, 0.22);
|
||||
color: #0a0a10;
|
||||
}
|
||||
|
||||
.user-item {
|
||||
@@ -253,6 +334,8 @@ body {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.user-status {
|
||||
@@ -286,11 +369,14 @@ body {
|
||||
|
||||
.chat-info h2 {
|
||||
font-size: 1.2rem;
|
||||
color: var(--text-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.room-topic {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.chat-actions {
|
||||
@@ -349,22 +435,25 @@ body {
|
||||
}
|
||||
|
||||
.message-author {
|
||||
font-weight: 600;
|
||||
color: var(--accent-secondary);
|
||||
font-weight: 700;
|
||||
color: #7dd3fc;
|
||||
}
|
||||
|
||||
.message.own .message-author {
|
||||
color: var(--accent-primary);
|
||||
color: #5eead4;
|
||||
}
|
||||
|
||||
.message-time {
|
||||
font-size: 0.7rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.message-text {
|
||||
word-wrap: break-word;
|
||||
line-height: 1.6;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.98rem;
|
||||
}
|
||||
|
||||
/* Markdown styling */
|
||||
@@ -409,7 +498,7 @@ body {
|
||||
.message-text .hljs-string { color: #98c379; }
|
||||
.message-text .hljs-number { color: #d19a66; }
|
||||
.message-text .hljs-function { color: #61afef; }
|
||||
.message-text .hljs-comment { color: #5c6370; font-style: italic; }
|
||||
.message-text .hljs-comment { color: #9aa0ad; font-style: italic; }
|
||||
.message-text .hljs-class { color: #e5c07b; }
|
||||
.message-text .hljs-variable { color: #e06c75; }
|
||||
.message-text .hljs-built_in { color: #e5c07b; }
|
||||
@@ -530,9 +619,10 @@ body {
|
||||
|
||||
.typing-indicator {
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
font-style: italic;
|
||||
font-weight: 500;
|
||||
display: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -580,26 +670,92 @@ body {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.compose-input {
|
||||
.empty-state, .empty-hint {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.9rem;
|
||||
text-align: center;
|
||||
padding: 1.5rem 1rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.empty-hint {
|
||||
list-style: none;
|
||||
text-align: left;
|
||||
padding: 0.5rem 0.25rem;
|
||||
}
|
||||
|
||||
.file-attachment {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
padding: 0.65rem 0.75rem;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
.file-attachment .muted { color: var(--text-muted); font-size: 0.8rem; }
|
||||
.btn-download {
|
||||
margin-left: auto;
|
||||
border: 1px solid var(--accent-border, rgba(45, 212, 191, 0.35));
|
||||
background: var(--accent-dim, rgba(45, 212, 191, 0.12));
|
||||
color: var(--accent-primary);
|
||||
border-radius: 6px;
|
||||
padding: 0.35rem 0.65rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-download:hover { filter: brightness(1.08); }
|
||||
|
||||
.file-item .file-meta {
|
||||
display: block;
|
||||
font-size: 0.7rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.status.error { color: var(--error); }
|
||||
|
||||
.compose-input {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.compose-input textarea {
|
||||
flex: 1;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-color);
|
||||
min-width: 0;
|
||||
background: var(--input-bg);
|
||||
border: 1px solid var(--input-border);
|
||||
border-radius: 8px;
|
||||
padding: 0.6rem;
|
||||
padding: 0.65rem 0.8rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.95rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1.45;
|
||||
resize: none;
|
||||
font-family: inherit;
|
||||
font-weight: 450;
|
||||
}
|
||||
|
||||
.compose-input textarea::placeholder {
|
||||
color: #9a9aac;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.compose-input textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-primary);
|
||||
box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.18);
|
||||
}
|
||||
|
||||
.compose-input textarea:disabled {
|
||||
opacity: 0.55;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-tool:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-send {
|
||||
@@ -629,21 +785,26 @@ body {
|
||||
}
|
||||
|
||||
.sidebar-section h3 {
|
||||
font-size: 0.75rem;
|
||||
font-size: 0.78rem;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
color: var(--text-secondary);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.info-item .label {
|
||||
color: var(--text-muted);
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.file-list {
|
||||
@@ -687,7 +848,9 @@ body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -735,23 +898,44 @@ body {
|
||||
}
|
||||
|
||||
.modal-content h3 {
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.modal-hint {
|
||||
font-size: 0.88rem;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 0.85rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.join-error {
|
||||
color: var(--error) !important;
|
||||
background: rgba(251, 113, 133, 0.1);
|
||||
border: 1px solid rgba(251, 113, 133, 0.3);
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem 0.65rem;
|
||||
}
|
||||
|
||||
.modal-content input {
|
||||
width: 100%;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-color);
|
||||
background: var(--input-bg);
|
||||
border: 1px solid var(--input-border);
|
||||
border-radius: 6px;
|
||||
padding: 0.6rem;
|
||||
padding: 0.65rem 0.75rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.95rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.modal-content input::placeholder {
|
||||
color: #9a9aac;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.modal-content input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-primary);
|
||||
box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.18);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
@@ -760,9 +944,10 @@ body {
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 0.3rem;
|
||||
font-size: 0.88rem;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
@@ -852,7 +1037,8 @@ body {
|
||||
}
|
||||
|
||||
.status {
|
||||
color: var(--text-muted);
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.connection-status {
|
||||
@@ -867,11 +1053,14 @@ body {
|
||||
color: var(--away);
|
||||
}
|
||||
|
||||
.system-message {
|
||||
.message.system-message {
|
||||
display: block;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
padding: 0.5rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
padding: 0.55rem;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.emoji-picker {
|
||||
@@ -902,6 +1091,10 @@ body {
|
||||
border-radius: 6px;
|
||||
font-size: 1.25rem;
|
||||
transition: transform 0.1s, background 0.1s;
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.emoji:hover {
|
||||
@@ -940,33 +1133,38 @@ textarea {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
@media (max-width: 1100px) {
|
||||
.app-container {
|
||||
grid-template-columns: 200px 1fr;
|
||||
}
|
||||
.right-sidebar {
|
||||
display: none;
|
||||
grid-template-columns: 220px 1fr 200px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
@media (max-width: 900px) {
|
||||
.mobile-bar { display: flex; }
|
||||
.bs-back-link { top: 3.15rem; }
|
||||
.app-container {
|
||||
grid-template-columns: 1fr;
|
||||
padding-top: 44px;
|
||||
}
|
||||
.sidebar {
|
||||
.sidebar,
|
||||
.right-sidebar {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 44px;
|
||||
bottom: 32px;
|
||||
width: min(300px, 86vw);
|
||||
z-index: 80;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
.user-profile {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.sidebar { left: 0; border-right: 1px solid var(--border-color); }
|
||||
.right-sidebar { right: 0; border-left: 1px solid var(--border-color); }
|
||||
.app-container.drawer-left .sidebar { display: flex; }
|
||||
.app-container.drawer-right .right-sidebar { display: flex; }
|
||||
.user-profile .avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.public-key {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 600px) {
|
||||
|
||||
Reference in New Issue
Block a user