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
2 changes: 2 additions & 0 deletions .github/workflows/capacitor-android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
java-version: "21"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: platform-tools
- name: Install Android SDK 36
run: sdkmanager "platforms;android-36" "build-tools;36.0.0"
- name: Validate Gradle wrappers
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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

## 2.7.1 - 2026-09-15

- 修复 Capacitor Android CI 初始化阶段请求已下架 Android SDK `tools` 包的问题,显式仅安装仍可用的 `platform-tools` 后再安装既有 SDK 36;不改动 Android 源码或功能。

## 2.7.0 - 2026-09-15

- Telegram 桥接由仅支持公开群组扩展为支持公开与私有群组,管理员可在同一后台列表中查看群名、区分群类型并统一配置映射。
- 私有群的 Telegram 入站、出站、附件、回复、实时广播与未读投影复用现有群聊链路;一对一私信继续保持不可映射。
- 同步更新生产与 demo 契约、三语言界面和部署文档;不新增数据库迁移、云资源或 Android 原生改动。

## 2.6.2 - 2026-09-15

- 新增繁体中文界面,右上角语言入口改为简体中文、繁体中文与 English 三项菜单,并按当前语言异步加载独立语言包。
Expand Down
4 changes: 2 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The project itself is free and open source. Cloud service costs depend on your C

**You do not have to move everyone into the same application.**

Administrators can bind EdgeChat groups to Telegram groups and relay messages in both directions through a Telegram Bot: messages sent on the web can be synchronized to Telegram, and messages in the Telegram group return to EdgeChat.
Administrators can view both public and private EdgeChat groups in the admin console and bind any group to a Telegram group. A Telegram Bot relays messages in both directions: messages sent on the web can be synchronized to Telegram, and messages in the Telegram group return to EdgeChat. One-to-one direct messages are never bridged.

This suits teams and communities that already have Telegram groups but also need an independent web chat entry point.

Expand Down Expand Up @@ -129,7 +129,7 @@ This suits teams and communities that already have Telegram groups but also need

### 🔌 Connections and Extensions

- Two-way Telegram group message bridging, including voice message synchronization.
- Administrator-configured two-way Telegram bridging for public and private groups, including voice message synchronization.
- WebMCP site tools: in compatible client environments, provides login, conversation queries, message reading, sending, and related capabilities.

## Privacy and Encryption
Expand Down
4 changes: 2 additions & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ EdgeChat は、**自分のチャットスペースを持ちたいが、そのた

**全員を同じアプリに移行させる必要はありません。**

管理者は EdgeChat のグループと Telegram のグループを紐付け、Telegram Bot を介してメッセージを双方向に転送できます。Web 上で送信したメッセージは Telegram に同期され、Telegram グループのメッセージも EdgeChat に戻ってきます。
管理者は管理画面で EdgeChat の公開・非公開グループを確認し、任意のグループを Telegram グループに紐付けられます。Telegram Bot を介してメッセージが双方向に転送され、Web 上で送信したメッセージは Telegram に同期され、Telegram グループのメッセージも EdgeChat に戻ってきます。一対一のダイレクトメッセージはブリッジされません。

Telegram グループがすでにあり、同時に独立した Web チャット入口も必要とするチームやコミュニティに適しています。

Expand Down Expand Up @@ -129,7 +129,7 @@ Telegram グループがすでにあり、同時に独立した Web チャット

### 🔌 接続と拡張

- Telegram グループとの双方向メッセージブリッジ。音声メッセージの同期にも対応。
- 管理者が設定する公開・非公開グループと Telegram の双方向メッセージブリッジ。音声メッセージの同期にも対応。
- WebMCP サイトツール:対応クライアント環境で、ログイン、会話の検索、メッセージの読み取り・送信などを提供。

## プライバシーと暗号化
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ EdgeChat 面向这样一种需求:**想拥有一个自己的聊天空间,又

**不用把所有人都搬进同一个应用。**

管理员可以将 EdgeChat 群组与 Telegram 群组绑定,通过 Telegram Bot 双向转发消息:在网页里发出的消息可以同步到 Telegram,Telegram 群里的消息也会回到 EdgeChat。
管理员可以在后台查看 EdgeChat 的公开与私有群组,并将任一群组与 Telegram 群组绑定。Telegram Bot 会双向转发消息:在网页里发出的消息可以同步到 Telegram,Telegram 群里的消息也会回到 EdgeChat;一对一私信不会进入桥接。

适合已经有 Telegram 群、同时又需要一个独立网页聊天入口的团队和社区。

Expand Down Expand Up @@ -129,7 +129,7 @@ EdgeChat 面向这样一种需求:**想拥有一个自己的聊天空间,又

### 🔌 连接与扩展

- Telegram 群组双向消息桥接,支持语音消息同步。
- 公开与私有群组均可由管理员配置 Telegram 双向消息桥接,并支持语音消息同步。
- WebMCP 站点工具:在兼容的客户端环境中,提供登录、查询会话、读取与发送消息等能力。

## 隐私与加密
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/demo/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from './state.js';

import { demoMaintenanceReport } from './maintenance.ts';
import { isGroupChannelKind } from '../../../shared/group-channel.ts';
import { parseLocalUserId, validateBio } from '../../../shared/user-profile.ts';

const DEMO_DELAY_MS = 90;
Expand Down Expand Up @@ -75,8 +76,8 @@ function telegramPayload() {
return cloneDemo({
config: demoState.telegram.config,
channels: demoState.channels
.filter((channel) => channel.kind === 'public')
.map(({ id, name }) => ({ id, name })),
.filter((channel) => isGroupChannelKind(channel.kind))
.map(({ id, name, kind }) => ({ id, name, kind })),
mappings: demoState.telegram.mappings
});
}
Expand Down Expand Up @@ -498,11 +499,14 @@ export async function requestDemo(path, options = {}) {
}
if (method === 'POST' && pathname === '/admin/telegram/mappings') {
const channel = findDemoChannel(body.channelId);
if (!channel) fail('请选择公开群组');
if (!channel || !isGroupChannelKind(channel.kind) || !/^-\d+$/.test(String(body.telegramChatId || ''))) {
fail('请选择群组并填写有效的 Telegram 群 ID');
}
demoState.telegram.mappings.push({
id: demoState.nextMappingId++,
channelId: channel.id,
channelName: channel.name,
channelKind: channel.kind,
telegramChatTitle: 'Telegram 演示群',
telegramChatId: String(body.telegramChatId || ''),
enabled: true
Expand Down
1 change: 1 addition & 0 deletions frontend/src/demo/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ export function createDemoFixtures() {
id: 1,
channelId: 3,
channelName: 'Telegram 联动',
channelKind: 'public',
telegramChatTitle: 'EdgeChat 演示群',
telegramChatId: '-1002345678901',
enabled: true
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/demo/realtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getDemoDirectMessageBlockStatus,
roomKey
} from './state.js';
import { isGroupChannelKind } from '../../../shared/group-channel.ts';

const roomSockets = new Map();
const inboxSockets = new Set();
Expand Down Expand Up @@ -73,7 +74,7 @@ function telegramSender() {
}

function hasEnabledTelegramMapping(kind, roomId) {
return kind === 'public' && demoState.telegram.mappings.some(
return isGroupChannelKind(kind) && demoState.telegram.mappings.some(
(mapping) => Number(mapping.channelId) === Number(roomId) && mapping.enabled
);
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export default {
'admin.nav.createUser': 'Create user',
'admin.nav.registrationLinks': 'Registration links',
'admin.nav.telegram': 'Telegram integration',
'admin.nav.telegramDescription': 'Manage the bot and public group mappings',
'admin.nav.telegramDescription': 'Manage the bot and group mappings',
'admin.nav.site': 'Site settings',
'admin.nav.siteDescription': 'Manage site appearance and version status',
'admin.nav.siteAppearance': 'Site appearance',
Expand Down Expand Up @@ -395,7 +395,7 @@ export default {
'invites.copy': 'Copy',
'invites.revoke': 'Disable link',
'telegram.title': 'Telegram integration',
'telegram.description': 'Connect a Telegram bot and link public groups to Telegram chats.',
'telegram.description': 'Connect a Telegram bot and link public or private groups to Telegram chats.',
'telegram.botConnected': 'Bot connected. Webhook updated.',
'telegram.mappingSaved': 'Group mapping saved.',
'telegram.confirmDeleteMapping': 'Delete the Telegram mapping for {name}?',
Expand All @@ -410,7 +410,7 @@ export default {
'telegram.connectBot': 'Connect bot',
'telegram.groupMappings': 'Group mappings',
'telegram.mappingCount': '{count} Telegram groups linked',
'telegram.edgechatPublicGroup': 'EdgeChat public group',
'telegram.edgechatGroup': 'EdgeChat group',
'telegram.selectGroup': 'Select group',
'telegram.chatId': 'Telegram group ID',
'telegram.saveMapping': 'Save mapping',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/locales/server-errors/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const fixedErrorTranslations = new Map([
['Webhook 验证失败', 'Webhook verification failed'],
['Telegram Bot Token 不能为空', 'Telegram Bot Token cannot be empty'],
['Telegram 配置保存失败', 'Failed to save Telegram configuration'],
['请选择公开群组并填写有效的 Telegram 群 ID', 'Select a public group and enter a valid Telegram group ID'],
['请选择群组并填写有效的 Telegram 群 ID', 'Select a group and enter a valid Telegram group ID'],
['请先连接 Telegram Bot', 'Connect the Telegram Bot first'],
['目标必须是 Telegram 群组或超级群组', 'The target must be a Telegram group or supergroup'],
['这个 EdgeChat 群组或 Telegram 群已经绑定', 'This EdgeChat group or Telegram group is already linked'],
Expand All @@ -79,7 +79,7 @@ const fixedErrorTranslations = new Map([
['请输入群组名称', 'Please enter a group name'],
['请输入新密码', 'Please enter a new password'],
['请输入 Bot Token', 'Please enter a Bot token'],
['请选择公开群组', 'Please select a public group']
['请选择群组', 'Please select a group']
]);

const dynamicErrorTranslations = [
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/locales/server-errors/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const fixedErrorTranslations = new Map([
["Webhook 验证失败", "Webhook 驗證失敗"],
["Telegram Bot Token 不能为空", "Telegram Bot Token 不能為空"],
["Telegram 配置保存失败", "Telegram 配置保存失敗"],
["请选择公开群组并填写有效的 Telegram 群 ID", "請選擇公開群組並填寫有效的 Telegram 群 ID"],
["请选择群组并填写有效的 Telegram 群 ID", "請選擇群組並填寫有效的 Telegram 群 ID"],
["请先连接 Telegram Bot", "請先連接 Telegram Bot"],
["目标必须是 Telegram 群组或超级群组", "目標必須是 Telegram 群組或超級群組"],
["这个 EdgeChat 群组或 Telegram 群已经绑定", "這個 EdgeChat 群組或 Telegram 群已經綁定"],
Expand All @@ -79,7 +79,7 @@ const fixedErrorTranslations = new Map([
["请输入群组名称", "請輸入群組名稱"],
["请输入新密码", "請輸入新密碼"],
["请输入 Bot Token", "請輸入 Bot Token"],
["请选择公开群组", "請選擇公開群組"]
["请选择群组", "請選擇群組"]
]);

const dynamicErrorTranslations = [
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export default {
'admin.nav.createUser': '创建用户',
'admin.nav.registrationLinks': '注册链接',
'admin.nav.telegram': 'Telegram 互通',
'admin.nav.telegramDescription': '管理 Bot 与公开群组映射',
'admin.nav.telegramDescription': '管理 Bot 与群组映射',
'admin.nav.site': '网站设置',
'admin.nav.siteDescription': '维护站点外观与版本状态',
'admin.nav.siteAppearance': '站点外观',
Expand Down Expand Up @@ -395,7 +395,7 @@ export default {
'invites.copy': '复制',
'invites.revoke': '停用链接',
'telegram.title': 'Telegram 互通',
'telegram.description': '连接一个 Telegram Bot,并将公开群组绑定到 Telegram 群聊。',
'telegram.description': '连接一个 Telegram Bot,并将公开或私有群组绑定到 Telegram 群聊。',
'telegram.botConnected': 'Bot 已连接,Webhook 已更新。',
'telegram.mappingSaved': '群组映射已保存。',
'telegram.confirmDeleteMapping': '确认删除 {name} 的 Telegram 映射吗?',
Expand All @@ -410,7 +410,7 @@ export default {
'telegram.connectBot': '连接 Bot',
'telegram.groupMappings': '群组映射',
'telegram.mappingCount': '{count} 个 Telegram 群已绑定',
'telegram.edgechatPublicGroup': 'EdgeChat 公开群组',
'telegram.edgechatGroup': 'EdgeChat 群组',
'telegram.selectGroup': '选择群组',
'telegram.chatId': 'Telegram 群 ID',
'telegram.saveMapping': '保存映射',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/locales/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export default {
"admin.nav.createUser": "創建用戶",
"admin.nav.registrationLinks": "註冊鏈接",
"admin.nav.telegram": "Telegram 互通",
"admin.nav.telegramDescription": "管理 Bot 與公開群組映射",
"admin.nav.telegramDescription": "管理 Bot 與群組映射",
"admin.nav.site": "網站設置",
"admin.nav.siteDescription": "維護站點外觀與版本狀態",
"admin.nav.siteAppearance": "站點外觀",
Expand Down Expand Up @@ -462,7 +462,7 @@ export default {
"invites.copy": "複製",
"invites.revoke": "停用鏈接",
"telegram.title": "Telegram 互通",
"telegram.description": "連接一個 Telegram Bot,並將公開群組綁定到 Telegram 群聊。",
"telegram.description": "連接一個 Telegram Bot,並將公開或私有群組綁定到 Telegram 群聊。",
"telegram.botConnected": "Bot 已連接,Webhook 已更新。",
"telegram.mappingSaved": "群組映射已保存。",
"telegram.confirmDeleteMapping": "確認刪除 {name} 的 Telegram 映射嗎?",
Expand All @@ -477,7 +477,7 @@ export default {
"telegram.connectBot": "連接 Bot",
"telegram.groupMappings": "群組映射",
"telegram.mappingCount": "{count} 個 Telegram 群已綁定",
"telegram.edgechatPublicGroup": "EdgeChat 公開群組",
"telegram.edgechatGroup": "EdgeChat 群組",
"telegram.selectGroup": "選擇群組",
"telegram.chatId": "Telegram 群 ID",
"telegram.saveMapping": "保存映射",
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/pages/AdminTelegramPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ onMounted(loadState);
</div>
<form class="telegram-mapping-form" @submit.prevent="createMapping">
<label class="field">
<span>{{ t('telegram.edgechatPublicGroup') }}</span>
<span>{{ t('telegram.edgechatGroup') }}</span>
<select v-model="mappingForm.channelId" required>
<option disabled value="">{{ t('telegram.selectGroup') }}</option>
<option v-for="channel in state.channels" :key="channel.id" :value="channel.id">
{{ channel.name }}
{{ channel.name }} ({{ t(channel.kind === 'private' ? 'chat.privateGroup' : 'chat.publicGroup') }})
</option>
</select>
</label>
Expand All @@ -165,7 +165,10 @@ onMounted(loadState);
<tr v-if="loading && !state.mappings.length"><td colspan="4" class="muted">{{ t('telegram.loadingMappings') }}</td></tr>
<tr v-else-if="!state.mappings.length"><td colspan="4" class="muted">{{ t('telegram.emptyMappings') }}</td></tr>
<tr v-for="mapping in state.mappings" :key="mapping.id">
<td><strong>{{ mapping.channelName }}</strong></td>
<td>
<strong>{{ mapping.channelName }}</strong>
<div class="muted">{{ t(mapping.channelKind === 'private' ? 'chat.privateGroup' : 'chat.publicGroup') }}</div>
</td>
<td>
<strong>{{ mapping.telegramChatTitle || t('telegram.unnamedChat') }}</strong>
<div class="muted telegram-chat-id">{{ mapping.telegramChatId }}</div>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edgechat",
"version": "2.6.2",
"version": "2.7.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions shared/group-channel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const GROUP_CHANNEL_KINDS = ["public", "private"] as const;

export type GroupChannelKind = (typeof GROUP_CHANNEL_KINDS)[number];

export function isGroupChannelKind(kind: unknown): kind is GroupChannelKind {
return kind === "public" || kind === "private";
}
4 changes: 3 additions & 1 deletion test/admin-ui.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,16 @@ test('仪表盘复用现有概况接口并只展示可验证统计', () => {
assert.match(dashboardSource, /t\('dashboard\.systemOverview'\)/);
});

test('Telegram 互通页由管理员路由保护并分别管理 Bot 与公开群组映射', () => {
test('Telegram 互通页由管理员路由保护并统一管理公开与私有群组映射', () => {
assert.match(routerSource, /import AdminTelegramPage/);
assert.match(routerSource, /path: 'telegram'/);
assert.match(routerSource, /adminTitleKey: 'admin\.nav\.telegram'/);
assert.match(telegramSource, /api\.saveAdminTelegramConfig/);
assert.match(telegramSource, /api\.createAdminTelegramMapping/);
assert.match(telegramSource, /type="checkbox"/);
assert.match(telegramSource, /t\('telegram\.chatId'\)/);
assert.match(telegramSource, /t\('telegram\.edgechatGroup'\)/);
assert.match(telegramSource, /channel\.kind === 'private'/);
});

test('仪表盘在中等桌面宽度提前重排且快捷入口文字保持完整', () => {
Expand Down
1 change: 1 addition & 0 deletions test/capacitor-android.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ test("Capacitor Android CI builds an independent tested APK", () => {
const viteConfig = read("../frontend/vite.capacitor.config.js");
assert.match(workflow, /actions\/setup-node@v5/);
assert.match(workflow, /node-version: "24"/);
assert.match(workflow, /android-actions\/setup-android@v3[\s\S]*packages: platform-tools/);
assert.match(workflow, /gradle\/actions\/wrapper-validation@v4/);
assert.match(workflow, /npm run build:capacitor/);
assert.match(workflow, /edgechat-capacitor-debug/);
Expand Down
34 changes: 34 additions & 0 deletions test/demo-runtime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ test('demo backend exposes chat, contacts, admin, storage and Telegram fixture d
assert.equal(storage.items.some((item) => item.ownerType === 'telegram'), true);
assert.equal(telegram.config.configured, true);
assert.equal(telegram.mappings[0].enabled, true);
assert.equal(telegram.channels.some((channel) => channel.kind === 'private'), true);
assert.equal(telegram.channels.every((channel) => channel.kind !== 'dm'), true);
});

test('demo backend keeps group and admin mutations in browser memory', async () => {
Expand Down Expand Up @@ -275,3 +277,35 @@ test('Telegram replies increment the inbox unread projection', async () => {
roomSocket.close();
inboxSocket.close();
});

test('demo Telegram bridge accepts a private group mapping', async () => {
const state = await requestDemo('/admin/telegram/mappings', {
method: 'POST',
body: { channelId: 2, telegramChatId: '-1002345678902' }
});
assert.equal(state.mappings.at(-1).channelKind, 'private');

const frames = [];
let roomSocket;
await new Promise((resolve) => {
roomSocket = connectDemoRoomSocket({
kind: 'private',
roomId: 2,
onMessage(frame) {
frames.push(JSON.parse(frame));
},
onStatus(event) {
if (event.status === 'open') resolve();
}
});
});

roomSocket.send(JSON.stringify({ type: 'send', content: '私有群桥接测试' }));
await new Promise((resolve) => setTimeout(resolve, 720));

assert.equal(
frames.some((frame) => frame.message?.sender?.source === 'telegram'),
true
);
roomSocket.close();
});
Loading
Loading