diff --git a/internal/db/models/http_web_dao.go b/internal/db/models/http_web_dao.go index d0553fe1..9a78f0a9 100644 --- a/internal/db/models/http_web_dao.go +++ b/internal/db/models/http_web_dao.go @@ -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 } diff --git a/internal/db/models/http_web_model.go b/internal/db/models/http_web_model.go index 4d8c8c1e..79c1d36a 100644 --- a/internal/db/models/http_web_model.go +++ b/internal/db/models/http_web_model.go @@ -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 { diff --git a/internal/rpc/services/service_http_web_community.go b/internal/rpc/services/service_http_web_community.go index 8bba8fe2..64c56060 100644 --- a/internal/rpc/services/service_http_web_community.go +++ b/internal/rpc/services/service_http_web_community.go @@ -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) { 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() +} diff --git a/internal/rpc/services/service_plan_community.go b/internal/rpc/services/service_plan_community.go index 6059cdac..3f4ed1a2 100644 --- a/internal/rpc/services/service_plan_community.go +++ b/internal/rpc/services/service_plan_community.go @@ -33,6 +33,11 @@ func (this *PlanService) FindEnabledPlan(ctx context.Context, req *pb.FindEnable 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 计算套餐数量 func (this *PlanService) CountAllEnabledPlans(ctx context.Context, req *pb.CountAllEnabledPlansRequest) (*pb.RPCCountResponse, error) { return this.SuccessCount(0) diff --git a/internal/setup/sql.json b/internal/setup/sql.json index d9a39c07..20c28dc5 100644 --- a/internal/setup/sql.json +++ b/internal/setup/sql.json @@ -103488,7 +103488,7 @@ "name": "edgeHTTPWebs", "engine": "InnoDB", "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": [ { "name": "id", @@ -103641,6 +103641,10 @@ { "name": "optimization", "definition": "json COMMENT '页面优化配置'" + }, + { + "name": "hls", + "definition": "json COMMENT 'HLS设置'" } ], "indexes": [