chore: commit for test git action

This commit is contained in:
langhuihui
2025-04-27 15:58:10 +08:00
parent cf604cadc6
commit e29a22a875
4 changed files with 44 additions and 48 deletions

View File

@@ -27,11 +27,10 @@ jobs:
go-version: 1.23.4
- name: Cache Go modules
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: runner.osgo{ { hashFiles('**/go.sum') } }
restore-keys: ${{ runner.os }}-go-
key: ${{ runner.os }}go${{ hashFiles('**/go.sum') }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
@@ -84,7 +83,7 @@ jobs:
- name: docker build
if: success() && startsWith(github.ref, 'refs/tags/')
run: |
tar -zxvf bin/m7s_linux_amd64.tar.gz
tar -zxvf bin/m7s_v5_linux_amd64.tar.gz
mv m7s monibuca_linux
docker login -u langhuihui -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t langhuihui/monibuca:v5 .

View File

@@ -13,7 +13,7 @@ ENV HOME /monibuca
WORKDIR /
RUN git clone -b v5 --depth 1 https://github.com/langhuihui/monibuca
RUN git clone --depth 1 https://github.com/langhuihui/monibuca
# compile
WORKDIR /monibuca
@@ -28,7 +28,7 @@ WORKDIR /monibuca
COPY --from=builder /monibuca/build /monibuca/
RUN cp -r ./config.yaml /etc/monibuca
# Export necessary ports
EXPOSE 8080 8443 1935 554 5060 9000-20000
EXPOSE 5060/udp
EXPOSE 6000 8080 8443 1935 554 5060 9000-20000
EXPOSE 5060/udp 44944/udp
CMD [ "./monibuca", "-c", "/etc/monibuca/config.yaml" ]

View File

@@ -22,14 +22,16 @@ gb28181:
.* : $0
mp4:
# enable: false
publish:
delayclosetimeout: 3s
# publish:
# delayclosetimeout: 3s
# onpub:
# record:
# ^live/.+:
# fragment: 10s
# filepath: record/$0
# type: fmp4
# pull:
# live/test: /Users/dexter/Movies/1744963190.mp4
onsub:
pull:
^vod_mp4_\d+/(.+)$: $1
@@ -69,26 +71,21 @@ hls:
snap:
enable: false
ismanualmodesave: true # 手动截图是否保存文件
watermark:
text: "Monibuca $T{2006-01-02 15:04:05.000}"
fontpath: "/System/Library/Fonts/STHeiti Light.ttc" # mac字体路径
# fontpath: "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc" # linux字体路径 思源黑体
# fontpath: "C:/Windows/Fonts/msyh.ttf" # windows字体路径 微软雅黑
fontsize: 16
fontspacing: 2 # 添加字体间距配置
fontcolor: "rgba(255,165,0,1)"
offsetx: 10
offsety: 10
mode: 2 #截图模式0-时间间隔1-关键帧间隔 2-HTTP请求模式手动触发
timeinterval: 3s
savepath: "./snap"
iframeinterval: 3 # 截图i帧间隔默认为3即每隔3个i帧截图一次
querytimedelta: 3 # 查询截图时允许的最大时间差(秒)
filter: "^live/.*"
onpub:
transform:
.* : $0
.+:
output:
- watermark:
text: "abcd" # 水印文字内容
fontpath: /Users/dexter/Library/Fonts/MapleMono-NF-CN-Medium.ttf # 水印字体文件路径
fontcolor: "rgba(255,165,0,1)" # 水印字体颜色支持rgba格式
fontsize: 36 # 水印字体大小
offsetx: 0 # 水印位置X偏移
offsety: 0 # 水印位置Y偏移
timeinterval: 1s # 截图时间间隔
savepath: "snaps" # 截图保存路径
iframeinterval: 3 # 间隔多少帧截图
querytimedelta: 3 # 查询截图时允许的最大时间差(秒)
crypto:
enable: false

View File

@@ -66,10 +66,13 @@ type (
PullProxy []*PullProxyConfig
PushProxy []*PushProxyConfig
Admin struct {
EnableLogin bool `default:"false" desc:"启用登录机制"` //启用登录机制
FilePath string `default:"admin.zip" desc:"管理员界面文件路径"`
HomePage string `default:"home" desc:"管理员界面首页"`
Users []struct {
zipReader *zip.ReadCloser
zipLastModTime time.Time
lastCheckTime time.Time
EnableLogin bool `default:"false" desc:"启用登录机制"` //启用登录机制
FilePath string `default:"admin.zip" desc:"管理员界面文件路径"`
HomePage string `default:"home" desc:"管理员界面首页"`
Users []struct {
Username string `desc:"用户名"`
Password string `desc:"密码"`
Role string `default:"user" desc:"角色,可选值:admin,user"`
@@ -161,9 +164,6 @@ func exit() {
os.Exit(0)
}
var zipReader *zip.ReadCloser
var adminZipLastModTime time.Time
var lastCheckTime time.Time
var checkInterval = time.Second * 3 // 检查间隔为3秒
func init() {
@@ -172,17 +172,16 @@ func init() {
time.AfterFunc(3*time.Second, exit)
})
Servers.OnDispose(exit)
loadAdminZip()
}
func loadAdminZip() {
if zipReader != nil {
zipReader.Close()
zipReader = nil
func (s *Server) loadAdminZip() {
if s.Admin.zipReader != nil {
s.Admin.zipReader.Close()
s.Admin.zipReader = nil
}
if info, err := os.Stat("admin.zip"); err == nil {
adminZipLastModTime = info.ModTime()
zipReader, _ = zip.OpenReader("admin.zip")
if info, err := os.Stat(s.Admin.FilePath); err == nil {
s.Admin.zipLastModTime = info.ModTime()
s.Admin.zipReader, _ = zip.OpenReader(s.Admin.FilePath)
}
}
@@ -399,6 +398,7 @@ func (s *Server) Start() (err error) {
s.Streams.OnStart(func() {
s.Streams.AddTask(&CheckSubWaitTimeout{s: s})
})
s.loadAdminZip()
// s.Transforms.AddTask(&TransformsPublishEvent{Transforms: &s.Transforms})
s.Info("server started")
s.Post(func() error {
@@ -622,16 +622,16 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// 检查 admin.zip 是否需要重新加载
now := time.Now()
if now.Sub(lastCheckTime) > checkInterval {
if info, err := os.Stat("admin.zip"); err == nil && info.ModTime() != adminZipLastModTime {
if now.Sub(s.Admin.lastCheckTime) > checkInterval {
if info, err := os.Stat(s.Admin.FilePath); err == nil && info.ModTime() != s.Admin.zipLastModTime {
s.Info("admin.zip changed, reloading...")
loadAdminZip()
s.loadAdminZip()
}
lastCheckTime = now
s.Admin.lastCheckTime = now
}
if zipReader != nil {
http.ServeFileFS(w, r, zipReader, strings.TrimPrefix(r.URL.Path, "/admin"))
if s.Admin.zipReader != nil {
http.ServeFileFS(w, r, s.Admin.zipReader, strings.TrimPrefix(r.URL.Path, "/admin"))
return
}
if r.URL.Path == "/favicon.ico" {