Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

EdgeChat 从 `2.1.2` 起正式采用语义化版本。更早的版本号依据已经完成的主要里程碑补记,用于说明项目演进,不对应历史 Git 标签。

## 2.6.0 - 2026-09-13

- 新增所有已登录用户可用的站内通讯录,默认仅展示头像和姓名,支持姓名/用户名搜索,并按需复用既有资料卡与私信打开流程。
- 聊天与通讯录共享持久工作区和唯一 inbox 连接;切换时暂停隐藏房间连接,保留搜索、滚动位置与未发送草稿,不新增好友关系、数据库迁移或云资源。

## 2.5.0 - 2026-09-12

- 网页群聊与私聊正文统一支持安全 Markdown,保留结构化提及、HTTP(S) 自动链接、纯文本摘要和 Markdown 原文复制。
Expand Down
373 changes: 181 additions & 192 deletions README.en.md

Large diffs are not rendered by default.

371 changes: 180 additions & 191 deletions README.ja.md

Large diffs are not rendered by default.

372 changes: 194 additions & 178 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const DemoNavigator = globalThis.__EDGECHAT_DEMO__
<template>
<router-view v-slot="{ Component, route }">
<Transition :name="route.meta.transition || 'page'" mode="out-in">
<component :is="Component" :key="route.path" />
<component :is="Component" :key="route.meta.workspace ? 'workspace' : route.path" />
</Transition>
</router-view>
<component :is="DemoNavigator" v-if="DemoNavigator" />
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export default {
getUsers() {
return request('/users');
},
getContacts(options = {}) {
return request('/contacts', options);
},
getUserProfile(userId, options = {}) {
return request(`/users/${encodeURIComponent(userId)}/profile`, options);
},
Expand Down
20 changes: 17 additions & 3 deletions frontend/src/components/chat/MobileNavigationDrawer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { Bell, BellOff, LayoutDashboard, LogOut, Settings, X } from '@lucide/vue';
import { Bell, BellOff, ContactRound, LayoutDashboard, LogOut, MessageCircle, Settings, X } from '@lucide/vue';
import { ref, toRef } from 'vue';
import { useOverlayLifecycle } from '../../composables/useOverlayLifecycle.js';
import { t } from '../../i18n.js';
Expand All @@ -12,10 +12,11 @@ const props = defineProps({
showAdmin: { type: Boolean, default: false },
notificationsEnabled: { type: Boolean, default: false },
notificationLabel: { type: String, default: '' },
notificationDisabled: { type: Boolean, default: false }
notificationDisabled: { type: Boolean, default: false },
activeView: { type: String, default: 'chat' }
});

const emit = defineEmits(['close', 'settings', 'admin', 'notification', 'logout']);
const emit = defineEmits(['close', 'chat', 'contacts', 'settings', 'admin', 'notification', 'logout']);
const drawerEl = ref(null);

useOverlayLifecycle({
Expand Down Expand Up @@ -50,6 +51,14 @@ useOverlayLifecycle({
</header>

<nav class="mobile-navigation-drawer__actions" :aria-label="t('mobile.appNavigation')">
<button type="button" :aria-current="activeView === 'chat' ? 'page' : undefined" @click="emit('chat')">
<MessageCircle :size="21" aria-hidden="true" />
<span>{{ t('nav.chats') }}</span>
</button>
<button type="button" :aria-current="activeView === 'contacts' ? 'page' : undefined" @click="emit('contacts')">
<ContactRound :size="21" aria-hidden="true" />
<span>{{ t('contacts.title') }}</span>
</button>
<button type="button" @click="emit('settings')">
<Settings :size="21" aria-hidden="true" />
<span>{{ t('nav.personalSettings') }}</span>
Expand Down Expand Up @@ -183,6 +192,11 @@ useOverlayLifecycle({
opacity: 0.72;
}

.mobile-navigation-drawer__actions button[aria-current="page"] {
background: rgba(0, 128, 105, 0.1);
color: #008069;
}

.mobile-navigation-drawer__actions .mobile-navigation-drawer__danger {
color: #c62828;
}
Expand Down
19 changes: 14 additions & 5 deletions frontend/src/components/demo/DemoNavigator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const router = useRouter();

const pages = [
{ labelKey: 'demo.chat', value: '/' },
{ labelKey: 'demo.contacts', value: '/contacts' },
{ labelKey: 'demo.settings', value: '/settings' },
{ labelKey: 'demo.dashboard', value: '/admin/dashboard' },
{ labelKey: 'demo.users', value: '/admin/users' },
Expand Down Expand Up @@ -40,7 +41,10 @@ function resetDemo() {
<template>
<aside
class="demo-navigator"
:class="{ 'demo-navigator--admin': route.path.startsWith('/admin') }"
:class="{
'demo-navigator--admin': route.path.startsWith('/admin'),
'demo-navigator--contacts': route.path === '/contacts'
}"
:aria-label="t('demo.navigation')"
>
<span class="demo-navigator__badge">{{ t('demo.local') }}</span>
Expand Down Expand Up @@ -124,7 +128,8 @@ function resetDemo() {
width: 124px;
}

.demo-navigator--admin {
.demo-navigator--admin,
.demo-navigator--contacts {
top: auto;
bottom: 8px;
}
Expand All @@ -140,8 +145,12 @@ function resetDemo() {
}

/* 窄屏演示导航悬浮在输入区上方,因此给消息流留出同等空间,保证最新回复不会被遮住。 */
body:has(.pinned-message-bar) .chat-messages {
padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
body:has(.pinned-message-bar) .chat-messages {
padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

body:has(.contacts-page) .contacts-page__body {
padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
}
</style>
11 changes: 10 additions & 1 deletion frontend/src/composables/useChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function useChatRoom({
activeRoom,
session,
error,
roomVisible = { value: true },
onRoomActivity = () => {},
onRoomAccessRevoked = () => {},
roomApi = api,
Expand Down Expand Up @@ -91,7 +92,7 @@ export function useChatRoom({
}

function applyActiveRoomActivity(message) {
if (!activeRoom.value || !message) {
if (!activeRoom.value || !message || !roomVisible.value) {
return;
}

Expand Down Expand Up @@ -236,6 +237,13 @@ export function useChatRoom({
disconnectSocket();
}

function pauseRoom() {
// 离开聊天内容时只终止在途读取与实时连接,草稿和现有消息留给返回后的恢复流程。
messageLoadGeneration += 1;
loading.value = false;
disconnectSocket();
}

function connectSocket() {
if (!activeRoom.value) {
return;
Expand Down Expand Up @@ -451,6 +459,7 @@ export function useChatRoom({
loadMessages,
activateRoom,
deactivateRoom,
pauseRoom,
connectSocket,
disconnectSocket,
sendMessage,
Expand Down
65 changes: 65 additions & 0 deletions frontend/src/composables/useContacts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { computed, ref } from "vue";
import type { UserSummary } from "../../../shared/user-profile.ts";
import api from "../api.js";

type ContactsApi = {
getContacts: (options?: { signal?: AbortSignal }) => Promise<{ users: UserSummary[] }>;
};

export function useContacts(contactsApi: ContactsApi = api) {
const users = ref<UserSummary[]>([]);
const query = ref("");
const loading = ref(false);
const error = ref("");
let loaded = false;
let generation = 0;
let controller: AbortController | null = null;
const collator = new Intl.Collator(undefined, { sensitivity: "base", numeric: true });

const sortedUsers = computed(() =>
[...users.value].sort((left, right) => {
const leftName = left.displayName || left.username;
const rightName = right.displayName || right.username;
return collator.compare(leftName, rightName)
|| collator.compare(left.username, right.username)
|| left.id - right.id;
}),
);
const filteredUsers = computed(() => {
const needle = query.value.trim().toLocaleLowerCase();
if (!needle) return sortedUsers.value;
return sortedUsers.value.filter((user) =>
[user.displayName, user.username].some((value) =>
String(value || "").toLocaleLowerCase().includes(needle),
),
);
});

async function load(force = false) {
if (loading.value || (loaded && !force)) return;
controller?.abort();
controller = new AbortController();
const request = ++generation;
loading.value = true;
error.value = "";
try {
const payload = await contactsApi.getContacts({ signal: controller.signal });
if (request !== generation) return;
users.value = payload.users;
loaded = true;
} catch (cause) {
if (request !== generation) return;
error.value = (cause as Error).message;
} finally {
if (request === generation) loading.value = false;
}
}

function dispose() {
generation += 1;
controller?.abort();
controller = null;
}

return { users, query, loading, error, filteredUsers, load, dispose };
}
12 changes: 12 additions & 0 deletions frontend/src/demo/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ function bootstrapPayload() {
};
}

function contactsPayload() {
return {
users: demoState.users
.map(projectDemoUser)
.filter((user) => !user.isDisabled)
.map(({ id, username, displayName, avatarUrl }) => ({ id, username, displayName, avatarUrl }))
};
}

function telegramPayload() {
return cloneDemo({
config: demoState.telegram.config,
Expand Down Expand Up @@ -271,6 +280,9 @@ export async function requestDemo(path, options = {}) {
if (method === 'GET' && pathname === '/users') {
return { users: bootstrapPayload().users };
}
if (method === 'GET' && pathname === '/contacts') {
return contactsPayload();
}
let match = pathname.match(/^\/users\/([^/]+)\/profile$/);
if (method === 'GET' && match) {
const id = parseLocalUserId(match[1]);
Expand Down
26 changes: 25 additions & 1 deletion frontend/src/demo/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ export function createDemoFixtures() {
isPermanentlyDisabled: true,
disabledUntil: null,
createdAt: '2026-07-20T05:45:00.000Z'
},
{
id: 6,
username: 'alicia',
displayName: 'Alice',
bio: '',
avatarUrl: '',
isAdmin: false,
isDisabled: false,
isPermanentlyDisabled: false,
disabledUntil: null,
createdAt: '2026-08-02T11:20:00.000Z'
},
{
id: 7,
username: 'long-name',
displayName: '负责跨团队协作与超长姓名布局验证的演示用户',
bio: '用于验证长名称在通讯录与资料卡中的自然降级。',
avatarUrl: '',
isAdmin: false,
isDisabled: false,
isPermanentlyDisabled: false,
disabledUntil: null,
createdAt: '2026-08-03T12:30:00.000Z'
}
];

Expand Down Expand Up @@ -402,7 +426,7 @@ export function createDemoFixtures() {
}
]
},
nextUserId: 6,
nextUserId: 8,
nextChannelId: 5,
nextDmId: 11,
nextMessageId: 150,
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ export default {
'nav.githubRepository': 'GitHub repository',
'nav.openGithubRepository': 'Open the EdgeChat GitHub repository',
'nav.backToChat': 'Back to chat',
'nav.chats': 'Chats',
'contacts.title': 'Contacts',
'contacts.search': 'Search names or usernames',
'contacts.loading': 'Loading contacts...',
'contacts.loadFailed': 'Contacts could not be loaded. Try again.',
'contacts.empty': 'No users available',
'contacts.noResults': 'No matching users',
'contacts.list': 'Site users',
'chat.online': 'Online',
'chat.connecting': 'Connecting',
'chat.connected': 'Realtime connection active',
Expand Down Expand Up @@ -458,6 +466,7 @@ export default {
'updates.errors.network': 'The repository could not be reached because the network request failed.',
'updates.errors.invalidResponse': 'The repository returned unrecognized version information.',
'demo.chat': 'Chat',
'demo.contacts': 'Contacts',
'demo.settings': 'Personal settings',
'demo.dashboard': 'Admin dashboard',
'demo.users': 'User management',
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ export default {
'nav.githubRepository': 'GitHub 仓库',
'nav.openGithubRepository': '打开 EdgeChat GitHub 仓库',
'nav.backToChat': '返回聊天',
'nav.chats': '聊天',
'contacts.title': '通讯录',
'contacts.search': '搜索姓名或用户名',
'contacts.loading': '正在读取通讯录...',
'contacts.loadFailed': '通讯录读取失败,请重试。',
'contacts.empty': '暂无可用用户',
'contacts.noResults': '没有匹配的用户',
'contacts.list': '站内用户',
'chat.online': '在线',
'chat.connecting': '正在连接',
'chat.connected': '实时连接正常',
Expand Down Expand Up @@ -458,6 +466,7 @@ export default {
'updates.errors.network': '网络连接失败,无法访问代码仓库',
'updates.errors.invalidResponse': '代码仓库返回了无法识别的版本信息',
'demo.chat': '聊天前台',
'demo.contacts': '通讯录',
'demo.settings': '个人设置',
'demo.dashboard': '后台仪表盘',
'demo.users': '用户管理',
Expand Down
Loading
Loading