Skip to content

Commit f498616

Browse files
committed
feat: use mermaid plugin
1 parent fd26a2e commit f498616

File tree

14 files changed

+1152
-132
lines changed

14 files changed

+1152
-132
lines changed

.vitepress/config.mts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { defineConfig } from 'vitepress';
2+
import { withMermaid } from 'vitepress-plugin-mermaid';
23
import translations from "./i18n";
34
const nav = {
45
en: [],
56
zh: [
67
{
7-
text: 'v4', link : 'http://v4.monibuca.com'
8+
text: 'v4', link: 'http://v4.monibuca.com'
89
},
910
{
1011
text: '联系我们', link: '/#contact'
@@ -100,7 +101,7 @@ const commonThemeConfig = (locales: '' | 'zh' | 'en' = '', translation = transla
100101
}
101102
});
102103

103-
export default defineConfig({
104+
export default defineConfig(withMermaid({
104105
title: 'Monibuca v5',
105106
description: '高性能流媒体服务器框架',
106107
lastUpdated: true,
@@ -156,6 +157,15 @@ export default defineConfig({
156157
},
157158
// 优化依赖预构建
158159
optimizeDeps: {
160+
// 包含 dayjs 及其被 mermaid 使用的插件,以确保它们被正确处理
161+
include: [
162+
'dayjs',
163+
'dayjs/plugin/advancedFormat.js',
164+
'dayjs/plugin/isoWeek.js',
165+
'dayjs/plugin/customParseFormat.js',
166+
'dayjs/plugin/toArray.js',
167+
'dayjs/plugin/toObject.js',
168+
],
159169
// 排除不需要预构建的依赖
160170
exclude: ['@vueuse/core', '@vueuse/head']
161171
},
@@ -196,4 +206,4 @@ export default defineConfig({
196206
}
197207
}
198208
}
199-
});
209+
}));

docs/develop/config.md

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,15 @@ func (p *Plugin) SaveConfig() (err error)
8080

8181
```yaml
8282
global:
83-
settingDir: ".m7s" # 设置文件目录
84-
fatalDir: "fatal" # 错误日志目录
85-
pulseInterval: "5s" # 心跳间隔
86-
disableAll: false # 是否禁用所有插件
87-
streamAlias: # 流别名配置
83+
disableall: false # 是否禁用所有插件
84+
streamalias: # 流别名配置
8885
pattern: "target" # 正则表达式 -> 目标路径
8986
location: # HTTP 路由转发规则
9087
pattern: "target" # 正则表达式 -> 目标地址
9188
admin: # 管理界面配置
92-
enableLogin: false # 是否启用登录机制
93-
filePath: "admin.zip" # 管理界面文件路径
94-
homePage: "home" # 管理界面首页
89+
enablelogin: false # 是否启用登录机制
90+
filepath: "admin.zip" # 管理界面文件路径
91+
homepage: "home" # 管理界面首页
9592
users: # 用户列表(仅在启用登录时生效)
9693
- username: "admin" # 用户名
9794
password: "admin" # 密码
@@ -111,7 +108,7 @@ global:
111108
global:
112109
db:
113110
dsn: "" # 数据库连接字符串
114-
type: "" # 数据库类型
111+
dbtype: "" # 数据库类型
115112
```
116113

117114
### 代理配置
@@ -125,14 +122,14 @@ global:
125122
name: "proxy1" # 代理名称
126123
url: "rtmp://..." # 代理地址
127124
type: "rtmp" # 代理类型
128-
pullOnStart: true # 是否启动时拉流
125+
pullonstart: true # 是否启动时拉流
129126
130127
pushProxy: # 推流代理配置
131128
- id: 1 # 代理ID
132129
name: "proxy1" # 代理名称
133130
url: "rtmp://..." # 代理地址
134131
type: "rtmp" # 代理类型
135-
pushOnStart: true # 是否启动时推流
132+
pushonstart: true # 是否启动时推流
136133
audio: true # 是否推送音频
137134
```
138135

@@ -142,10 +139,10 @@ global:
142139

143140
```yaml
144141
rtmp: # RTMP插件配置
145-
port: 1935 # 监听端口
142+
tcp: :1935 # 监听端口
146143
147144
rtsp: # RTSP插件配置
148-
port: 554 # 监听端口
145+
tcp: :554 # 监听端口
149146
```
150147

151148
## 配置优先级
@@ -161,18 +158,18 @@ rtsp: # RTSP插件配置
161158
```yaml
162159
rtmp:
163160
publish:
164-
audio: true
161+
pubaudio: true
165162
subscribe:
166-
audio: true
163+
subaudio: true
167164
```
168165

169166
3. 全局配置 - 在 global 节点下的配置项
170167
```yaml
171168
global:
172169
publish:
173-
audio: true
170+
pubaudio: true
174171
subscribe:
175-
audio: true
172+
subaudio: true
176173
```
177174
178175
## 通用配置
@@ -184,23 +181,23 @@ rtsp: # RTSP插件配置
184181
1. 发布配置(Publish)
185182
```yaml
186183
publish:
187-
audio: true # 是否包含音频
188-
video: true # 是否包含视频
189-
bufferLength: 1000 # 缓冲长度
184+
pubaudio: true # 是否包含音频
185+
pubvideo: true # 是否包含视频
186+
bufferlength: 1000 # 缓冲长度
190187
```
191188
192189
2. 订阅配置(Subscribe)
193190
```yaml
194191
subscribe:
195-
audio: true # 是否订阅音频
196-
video: true # 是否订阅视频
197-
bufferLength: 1000 # 缓冲长度
192+
subaudio: true # 是否订阅音频
193+
subvideo: true # 是否订阅视频
194+
bufferlength: 1000 # 缓冲长度
198195
```
199196
200197
3. HTTP 配置
201198
```yaml
202199
http:
203-
listenAddr: ":8080" # 监听地址
200+
listenaddr: :8080 # 监听地址
204201
```
205202
206203
4. 其他通用配置
@@ -215,21 +212,21 @@ rtsp: # RTSP插件配置
215212
# 全局配置
216213
global:
217214
publish:
218-
audio: true
219-
video: true
215+
pubaudio: true
216+
pubvideo: true
220217
subscribe:
221-
audio: true
222-
video: true
218+
subaudio: true
219+
subvideo: true
223220

224221
# 插件配置(优先级高于全局配置)
225222
rtmp:
226223
publish:
227-
audio: false # 覆盖全局配置
224+
pubaudio: false # 覆盖全局配置
228225
subscribe:
229-
video: false # 覆盖全局配置
226+
subvideo: false # 覆盖全局配置
230227

231228
# URL 查询参数(最高优先级)
232-
# rtmp://localhost/live/stream?audio=true&video=false
229+
# rtmp://localhost/live/stream?subaudio=true&subvideo=false
233230
```
234231

235232
## 配置热更新
@@ -250,25 +247,22 @@ rtmp:
250247

251248
```yaml
252249
global:
253-
settingDir: ".m7s"
254-
fatalDir: "fatal"
255-
pulseInterval: "5s"
256-
disableAll: false
257-
streamAlias:
258-
"live/(.*)": "record/$1"
250+
disableall: false
251+
streamalias:
252+
live/(.*): "record/$1"
259253
location:
260-
"^/live/(.*)": "/hls/$1"
254+
^/live/(.*): "/hls/$1"
261255
admin:
262-
enableLogin: true
263-
filePath: "admin.zip"
264-
homePage: "home"
256+
enablelogin: true
257+
filepath: "admin.zip"
258+
homepage: "home"
265259
users:
266260
- username: "admin"
267261
password: "admin"
268262
role: "admin"
269263
db:
270264
dsn: "host=localhost user=postgres password=postgres dbname=monibuca port=5432 sslmode=disable TimeZone=Asia/Shanghai"
271-
type: "postgres"
265+
dbtype: "postgres"
272266
pullProxy:
273267
- id: 1
274268
name: "proxy1"
@@ -280,12 +274,12 @@ global:
280274
name: "proxy1"
281275
url: "rtmp://example.com/live/stream"
282276
type: "rtmp"
283-
pushOnStart: true
277+
pushonstart: true
284278
audio: true
285279

286280
rtmp:
287-
port: 1935
281+
tcp: :1935
288282

289283
rtsp:
290-
port: 554
284+
tcp: :554
291285
```

docs/develop/db.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ Monibuca 提供了数据库支持功能,可以在全局配置和插件中分
1010

1111
```yaml
1212
global:
13-
dsn: "数据库连接字符串"
14-
dbType: "数据库类型"
13+
db:
14+
dsn: "数据库连接字符串"
15+
dbType: "数据库类型"
1516
```
1617
1718
### 插件配置
@@ -20,8 +21,9 @@ global:
2021
2122
```yaml
2223
pluginName:
23-
dsn: "数据库连接字符串"
24-
dbType: "数据库类型"
24+
db:
25+
dsn: "数据库连接字符串"
26+
dbType: "数据库类型"
2527
```
2628
2729
## 数据库初始化流程

docs/develop/log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Monibuca 使用 Go 标准库的 `slog` 作为日志系统,提供了结构化
1616

1717
```yaml
1818
global:
19-
LogLevel: "debug" # 设置日志级别为 debug
19+
loglevel: debug # 设置日志级别为 debug
2020
```
2121
2222
## 日志格式

0 commit comments

Comments
 (0)