网站设置增加HLS加密功能(商业版本

This commit is contained in:
刘祥超
2024-01-14 20:36:47 +08:00
parent 534cfb2180
commit 66a31f599d
5 changed files with 39 additions and 1 deletions

View File

@@ -554,6 +554,18 @@ func (this *HTTPWebDAO) ComposeWebConfig(tx *dbs.Tx, webId int64, isLocationOrGr
}
}
// hls
if IsNotNull(web.Hls) {
var hlsConfig = &serverconfigs.HLSConfig{}
err = json.Unmarshal(web.Hls, hlsConfig)
if err != nil {
return nil, err
}
if this.shouldCompose(isLocationOrGroup, forNode, hlsConfig.IsPrior, true) {
config.HLS = hlsConfig
}
}
if cacheMap != nil {
cacheMap.Put(cacheKey, config)
}
@@ -1464,6 +1476,10 @@ func (this *HTTPWebDAO) FindWebReferers(tx *dbs.Tx, webId int64) ([]byte, error)
// UpdateWebUserAgent 修改User-Agent设置
func (this *HTTPWebDAO) UpdateWebUserAgent(tx *dbs.Tx, webId int64, userAgentConfig *serverconfigs.UserAgentConfig) error {
if webId <= 0 {
return errors.New("require 'webId'")
}
if userAgentConfig == nil {
return nil
}

View File

@@ -41,6 +41,7 @@ const (
HTTPWebField_Referers dbs.FieldName = "referers" // 防盗链设置
HTTPWebField_UserAgent dbs.FieldName = "userAgent" // UserAgent设置
HTTPWebField_Optimization dbs.FieldName = "optimization" // 页面优化配置
HTTPWebField_Hls dbs.FieldName = "hls" // HLS设置
)
// HTTPWeb HTTP Web
@@ -83,6 +84,7 @@ type HTTPWeb struct {
Referers dbs.JSON `field:"referers"` // 防盗链设置
UserAgent dbs.JSON `field:"userAgent"` // UserAgent设置
Optimization dbs.JSON `field:"optimization"` // 页面优化配置
Hls dbs.JSON `field:"hls"` // HLS设置
}
type HTTPWebOperator struct {
@@ -124,6 +126,7 @@ type HTTPWebOperator struct {
Referers any // 防盗链设置
UserAgent any // UserAgent设置
Optimization any // 页面优化配置
Hls any // HLS设置
}
func NewHTTPWebOperator() *HTTPWebOperator {