Skip to content
Open
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,23 @@ MTProto 服务的 `host`/`port` 是实际监听地址;Bridge 的 `serverHost`/
token: your-qqnt-bridge-token # 省略时读取环境变量 QQNT_BRIDGE_TOKEN
```

### 图片存储

在 bridge 配置中启用 `imageStorage.enabled`,服务器会在接收群聊、私聊和图文多图消息后主动保存图片,无需客户端在线或打开会话。默认关闭,不保存视频、头像和普通附件,也不回填历史消息;未保存且已过期的图片无法恢复。

```yaml
imageStorage:
enabled: true
path: data/bridge-images
adminUserIds: []
```

图片存储查询和删除需要现有 SSO 登录服务及显式管理员白名单。先在 WebUI 的「Your account」页面登录;通过现有 `GET /sso/me`(请求头 `Authorization: Bearer <登录令牌>`)读取自己的用户 `id`,由维护者将该数值加入 `imageStorage.adminUserIds`,例如 `[1]`。普通注册用户不会自动获得权限。未启用 SSO、未登录、令牌失效或白名单为空时一律拒绝管理请求;这不影响新图自动保存、Telegram 账号读取自己的副本及既有匿名账号发现。

原图及平台提供的独立预览图分别保存,按各自的格式和字节范围通过现有 MTProto 媒体下载读取,不公开新的 HTTP 文件地址。图片数仅计算原图,容量包含原图和预览图的实际文件字节数,删除会同时清理两种副本。关闭开关只停止新下载,已有副本仍可读取和管理。下载失败不会阻断消息接收,待处理和失败的新图任务会在账号重新连接或服务重启后重试。

WebUI 的「图片存储」页面可按账号、会话及消息日期筛选,以 UTC 自然日统计图片数和实际文件字节数,按会话或日期分页汇总。删除仅清理指定范围内的服务端副本,不删除平台消息或原图;同一消息重复推送不会重新生成主动删除的副本。删除失败会保留可重试记录。数据库与 `imageStorage.path` 目录应一起备份,修改目录不会自动迁移旧文件。

### Linux 生产部署

```sh
Expand Down
4 changes: 4 additions & 0 deletions app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
name: '@mtproto-relay/bridge'
config:
serverHost: 127.0.0.1
imageStorage:
enabled: false
path: data/bridge-images
adminUserIds: []
groupFilesMiniApp:
enabled: true
path: /group-files
Expand Down
2 changes: 2 additions & 0 deletions packages/bridge/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Page0 from './accounts.js'
import Page1 from './stickers.js'
import Page2 from './bots.js'
import StoragePage from './storage.js'
import './style.css'
import type { ClientModule } from 'cordis-webui-solidjs/client'
export default { pages: [
{ path: "/platform-accounts", title: "Platform accounts", icon: "○", group: "Workspace", component: Page0 },
{ path: "/sticker-packs", title: "Sticker collections", icon: "✦", group: "Workspace", component: Page1 },
{ path: "/bots", title: "Your bots", icon: "◇", group: "Workspace", component: Page2 },
{ path: "/image-storage", title: "Image storage", icon: "▣", group: "Workspace", component: StoragePage },
] } satisfies ClientModule
Loading
Loading