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

This commit is contained in:
GoEdgeLab
2024-01-14 20:36:47 +08:00
parent def973175f
commit da9026fff1
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 { if cacheMap != nil {
cacheMap.Put(cacheKey, config) cacheMap.Put(cacheKey, config)
} }
@@ -1464,6 +1476,10 @@ func (this *HTTPWebDAO) FindWebReferers(tx *dbs.Tx, webId int64) ([]byte, error)
// UpdateWebUserAgent 修改User-Agent设置 // UpdateWebUserAgent 修改User-Agent设置
func (this *HTTPWebDAO) UpdateWebUserAgent(tx *dbs.Tx, webId int64, userAgentConfig *serverconfigs.UserAgentConfig) error { func (this *HTTPWebDAO) UpdateWebUserAgent(tx *dbs.Tx, webId int64, userAgentConfig *serverconfigs.UserAgentConfig) error {
if webId <= 0 {
return errors.New("require 'webId'")
}
if userAgentConfig == nil { if userAgentConfig == nil {
return nil return nil
} }

View File

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

View File

@@ -32,3 +32,13 @@ func (this *HTTPWebService) FindHTTPWebCC(ctx context.Context, req *pb.FindHTTPW
func (this *HTTPWebService) UpdateHTTPWebRequestScripts(ctx context.Context, req *pb.UpdateHTTPWebRequestScriptsRequest) (*pb.RPCSuccess, error) { func (this *HTTPWebService) UpdateHTTPWebRequestScripts(ctx context.Context, req *pb.UpdateHTTPWebRequestScriptsRequest) (*pb.RPCSuccess, error) {
return nil, this.NotImplementedYet() return nil, this.NotImplementedYet()
} }
// UpdateHTTPWebHLS 修改HLS设置
func (this *HTTPWebService) UpdateHTTPWebHLS(ctx context.Context, req *pb.UpdateHTTPWebHLSRequest) (*pb.RPCSuccess, error) {
return nil, this.NotImplementedYet()
}
// FindHTTPWebHLS 查找HLS设置
func (this *HTTPWebService) FindHTTPWebHLS(ctx context.Context, req *pb.FindHTTPWebHLSRequest) (*pb.FindHTTPWebHLSResponse, error) {
return nil, this.NotImplementedYet()
}

View File

@@ -33,6 +33,11 @@ func (this *PlanService) FindEnabledPlan(ctx context.Context, req *pb.FindEnable
return &pb.FindEnabledPlanResponse{Plan: nil}, nil return &pb.FindEnabledPlanResponse{Plan: nil}, nil
} }
// FindBasicPlan 查找套餐基本信息
func (this *PlanService) FindBasicPlan(ctx context.Context, req *pb.FindBasicPlanRequest) (*pb.FindBasicPlanResponse, error) {
return nil, this.NotImplementedYet()
}
// CountAllEnabledPlans 计算套餐数量 // CountAllEnabledPlans 计算套餐数量
func (this *PlanService) CountAllEnabledPlans(ctx context.Context, req *pb.CountAllEnabledPlansRequest) (*pb.RPCCountResponse, error) { func (this *PlanService) CountAllEnabledPlans(ctx context.Context, req *pb.CountAllEnabledPlansRequest) (*pb.RPCCountResponse, error) {
return this.SuccessCount(0) return this.SuccessCount(0)

View File

@@ -103488,7 +103488,7 @@
"name": "edgeHTTPWebs", "name": "edgeHTTPWebs",
"engine": "InnoDB", "engine": "InnoDB",
"charset": "utf8mb4_general_ci", "charset": "utf8mb4_general_ci",
"definition": "CREATE TABLE `edgeHTTPWebs` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `templateId` int(11) unsigned DEFAULT '0' COMMENT '模版ID',\n `adminId` int(11) unsigned DEFAULT '0' COMMENT '管理员ID',\n `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `root` json DEFAULT NULL COMMENT '根目录',\n `charset` json DEFAULT NULL COMMENT '字符集',\n `shutdown` json DEFAULT NULL COMMENT '临时关闭页面配置',\n `pages` json DEFAULT NULL COMMENT '特殊页面',\n `redirectToHttps` json DEFAULT NULL COMMENT '跳转到HTTPS设置',\n `indexes` json DEFAULT NULL COMMENT '首页文件列表',\n `maxRequestBodySize` json DEFAULT NULL COMMENT '最大允许的请求内容尺寸',\n `requestHeader` json DEFAULT NULL COMMENT '请求Header配置',\n `responseHeader` json DEFAULT NULL COMMENT '响应Header配置',\n `accessLog` json DEFAULT NULL COMMENT '访问日志配置',\n `stat` json DEFAULT NULL COMMENT '统计配置',\n `gzip` json DEFAULT NULL COMMENT 'Gzip配置v0.3.2弃用)',\n `compression` json DEFAULT NULL COMMENT '压缩配置',\n `cache` json DEFAULT NULL COMMENT '缓存配置',\n `firewall` json DEFAULT NULL COMMENT '防火墙设置',\n `locations` json DEFAULT NULL COMMENT '路由规则配置',\n `websocket` json DEFAULT NULL COMMENT 'Websocket设置',\n `rewriteRules` json DEFAULT NULL COMMENT '重写规则配置',\n `hostRedirects` json DEFAULT NULL COMMENT '域名跳转',\n `fastcgi` json DEFAULT NULL COMMENT 'Fastcgi配置',\n `auth` json DEFAULT NULL COMMENT '认证策略配置',\n `webp` json DEFAULT NULL COMMENT 'WebP配置',\n `remoteAddr` json DEFAULT NULL COMMENT '客户端IP配置',\n `mergeSlashes` tinyint(1) unsigned DEFAULT '0' COMMENT '是否合并路径中的斜杠',\n `requestLimit` json DEFAULT NULL COMMENT '请求限制',\n `requestScripts` json DEFAULT NULL COMMENT '请求脚本',\n `uam` json DEFAULT NULL COMMENT 'UAM设置',\n `cc` json DEFAULT NULL COMMENT 'CC设置',\n `referers` json DEFAULT NULL COMMENT '防盗链设置',\n `userAgent` json DEFAULT NULL COMMENT 'UserAgent设置',\n `optimization` json DEFAULT NULL COMMENT '页面优化配置',\n PRIMARY KEY (`id`),\n KEY `userId` (`userId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='HTTP Web'", "definition": "CREATE TABLE `edgeHTTPWebs` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `templateId` int(11) unsigned DEFAULT '0' COMMENT '模版ID',\n `adminId` int(11) unsigned DEFAULT '0' COMMENT '管理员ID',\n `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `root` json DEFAULT NULL COMMENT '根目录',\n `charset` json DEFAULT NULL COMMENT '字符集',\n `shutdown` json DEFAULT NULL COMMENT '临时关闭页面配置',\n `pages` json DEFAULT NULL COMMENT '特殊页面',\n `redirectToHttps` json DEFAULT NULL COMMENT '跳转到HTTPS设置',\n `indexes` json DEFAULT NULL COMMENT '首页文件列表',\n `maxRequestBodySize` json DEFAULT NULL COMMENT '最大允许的请求内容尺寸',\n `requestHeader` json DEFAULT NULL COMMENT '请求Header配置',\n `responseHeader` json DEFAULT NULL COMMENT '响应Header配置',\n `accessLog` json DEFAULT NULL COMMENT '访问日志配置',\n `stat` json DEFAULT NULL COMMENT '统计配置',\n `gzip` json DEFAULT NULL COMMENT 'Gzip配置v0.3.2弃用)',\n `compression` json DEFAULT NULL COMMENT '压缩配置',\n `cache` json DEFAULT NULL COMMENT '缓存配置',\n `firewall` json DEFAULT NULL COMMENT '防火墙设置',\n `locations` json DEFAULT NULL COMMENT '路由规则配置',\n `websocket` json DEFAULT NULL COMMENT 'Websocket设置',\n `rewriteRules` json DEFAULT NULL COMMENT '重写规则配置',\n `hostRedirects` json DEFAULT NULL COMMENT '域名跳转',\n `fastcgi` json DEFAULT NULL COMMENT 'Fastcgi配置',\n `auth` json DEFAULT NULL COMMENT '认证策略配置',\n `webp` json DEFAULT NULL COMMENT 'WebP配置',\n `remoteAddr` json DEFAULT NULL COMMENT '客户端IP配置',\n `mergeSlashes` tinyint(1) unsigned DEFAULT '0' COMMENT '是否合并路径中的斜杠',\n `requestLimit` json DEFAULT NULL COMMENT '请求限制',\n `requestScripts` json DEFAULT NULL COMMENT '请求脚本',\n `uam` json DEFAULT NULL COMMENT 'UAM设置',\n `cc` json DEFAULT NULL COMMENT 'CC设置',\n `referers` json DEFAULT NULL COMMENT '防盗链设置',\n `userAgent` json DEFAULT NULL COMMENT 'UserAgent设置',\n `optimization` json DEFAULT NULL COMMENT '页面优化配置',\n `hls` json DEFAULT NULL COMMENT 'HLS设置',\n PRIMARY KEY (`id`),\n KEY `userId` (`userId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='HTTP Web'",
"fields": [ "fields": [
{ {
"name": "id", "name": "id",
@@ -103641,6 +103641,10 @@
{ {
"name": "optimization", "name": "optimization",
"definition": "json COMMENT '页面优化配置'" "definition": "json COMMENT '页面优化配置'"
},
{
"name": "hls",
"definition": "json COMMENT 'HLS设置'"
} }
], ],
"indexes": [ "indexes": [