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

View File

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

View File

@@ -22,14 +22,16 @@ gb28181:
.* : $0 .* : $0
mp4: mp4:
# enable: false # enable: false
publish: # publish:
delayclosetimeout: 3s # delayclosetimeout: 3s
# onpub: # onpub:
# record: # record:
# ^live/.+: # ^live/.+:
# fragment: 10s # fragment: 10s
# filepath: record/$0 # filepath: record/$0
# type: fmp4 # type: fmp4
# pull:
# live/test: /Users/dexter/Movies/1744963190.mp4
onsub: onsub:
pull: pull:
^vod_mp4_\d+/(.+)$: $1 ^vod_mp4_\d+/(.+)$: $1
@@ -69,26 +71,21 @@ hls:
snap: snap:
enable: false 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: onpub:
transform: 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: crypto:
enable: false enable: false

View File

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