自定义页面增加例外URL和限制URL设置

This commit is contained in:
刘祥超
2023-11-13 10:45:23 +08:00
parent f0b5f6ed76
commit 30ff3ecde5
4 changed files with 125 additions and 37 deletions

View File

@@ -14898,7 +14898,7 @@
}, },
{ {
"name": "CreateHTTPPageRequest", "name": "CreateHTTPPageRequest",
"code": "message CreateHTTPPageRequest {\n\trepeated string statusList = 1;\n\tstring bodyType = 5;\n\tstring url = 2;\n\tstring body = 4;\n\tint32 newStatus = 3;\n}", "code": "message CreateHTTPPageRequest {\n\trepeated string statusList = 1; // 状态码列表\n\tstring bodyType = 5; // 页面类型html|url|redirectURL\n\tstring url = 2; // 读取或者跳转的URL\n\tstring body = 4; // HTML内容\n\tint32 newStatus = 3; // 新的状态码\n\tbytes exceptURLPatternsJSON = 6; // 例外URL列表\n\tbytes onlyURLPatternsJSON = 7; // 限制URL列表\n}",
"doc": "创建Page" "doc": "创建Page"
}, },
{ {
@@ -21743,7 +21743,7 @@
}, },
{ {
"name": "UpdateHTTPPageRequest", "name": "UpdateHTTPPageRequest",
"code": "message UpdateHTTPPageRequest {\n\tint64 httpPageId = 1;\n\trepeated string statusList = 2;\n\tstring bodyType = 6;\n\tstring url = 3;\n\tstring body = 5;\n\tint32 newStatus = 4;\n}", "code": "message UpdateHTTPPageRequest {\n\tint64 httpPageId = 1;\n\trepeated string statusList = 2;\n\tstring bodyType = 6; // 页面类型html|url|redirectURL\n\tstring url = 3;\n\tstring body = 5;\n\tint32 newStatus = 4;\n\tbytes exceptURLPatternsJSON = 7; // 例外URL列表\n\tbytes onlyURLPatternsJSON = 8; // 限制URL列表\n}",
"doc": "修改Page" "doc": "修改Page"
}, },
{ {

View File

@@ -26,11 +26,13 @@ type CreateHTTPPageRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
StatusList []string `protobuf:"bytes,1,rep,name=statusList,proto3" json:"statusList,omitempty"` StatusList []string `protobuf:"bytes,1,rep,name=statusList,proto3" json:"statusList,omitempty"` // 状态码列表
BodyType string `protobuf:"bytes,5,opt,name=bodyType,proto3" json:"bodyType,omitempty"` BodyType string `protobuf:"bytes,5,opt,name=bodyType,proto3" json:"bodyType,omitempty"` // 页面类型html|url|redirectURL
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` // 读取或者跳转的URL
Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` // HTML内容
NewStatus int32 `protobuf:"varint,3,opt,name=newStatus,proto3" json:"newStatus,omitempty"` NewStatus int32 `protobuf:"varint,3,opt,name=newStatus,proto3" json:"newStatus,omitempty"` // 新的状态码
ExceptURLPatternsJSON []byte `protobuf:"bytes,6,opt,name=exceptURLPatternsJSON,proto3" json:"exceptURLPatternsJSON,omitempty"` // 例外URL列表
OnlyURLPatternsJSON []byte `protobuf:"bytes,7,opt,name=onlyURLPatternsJSON,proto3" json:"onlyURLPatternsJSON,omitempty"` // 限制URL列表
} }
func (x *CreateHTTPPageRequest) Reset() { func (x *CreateHTTPPageRequest) Reset() {
@@ -100,6 +102,20 @@ func (x *CreateHTTPPageRequest) GetNewStatus() int32 {
return 0 return 0
} }
func (x *CreateHTTPPageRequest) GetExceptURLPatternsJSON() []byte {
if x != nil {
return x.ExceptURLPatternsJSON
}
return nil
}
func (x *CreateHTTPPageRequest) GetOnlyURLPatternsJSON() []byte {
if x != nil {
return x.OnlyURLPatternsJSON
}
return nil
}
type CreateHTTPPageResponse struct { type CreateHTTPPageResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -153,12 +169,14 @@ type UpdateHTTPPageRequest struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
HttpPageId int64 `protobuf:"varint,1,opt,name=httpPageId,proto3" json:"httpPageId,omitempty"` HttpPageId int64 `protobuf:"varint,1,opt,name=httpPageId,proto3" json:"httpPageId,omitempty"`
StatusList []string `protobuf:"bytes,2,rep,name=statusList,proto3" json:"statusList,omitempty"` StatusList []string `protobuf:"bytes,2,rep,name=statusList,proto3" json:"statusList,omitempty"`
BodyType string `protobuf:"bytes,6,opt,name=bodyType,proto3" json:"bodyType,omitempty"` BodyType string `protobuf:"bytes,6,opt,name=bodyType,proto3" json:"bodyType,omitempty"` // 页面类型html|url|redirectURL
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
Body string `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` Body string `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
NewStatus int32 `protobuf:"varint,4,opt,name=newStatus,proto3" json:"newStatus,omitempty"` NewStatus int32 `protobuf:"varint,4,opt,name=newStatus,proto3" json:"newStatus,omitempty"`
ExceptURLPatternsJSON []byte `protobuf:"bytes,7,opt,name=exceptURLPatternsJSON,proto3" json:"exceptURLPatternsJSON,omitempty"` // 例外URL列表
OnlyURLPatternsJSON []byte `protobuf:"bytes,8,opt,name=onlyURLPatternsJSON,proto3" json:"onlyURLPatternsJSON,omitempty"` // 限制URL列表
} }
func (x *UpdateHTTPPageRequest) Reset() { func (x *UpdateHTTPPageRequest) Reset() {
@@ -235,6 +253,20 @@ func (x *UpdateHTTPPageRequest) GetNewStatus() int32 {
return 0 return 0
} }
func (x *UpdateHTTPPageRequest) GetExceptURLPatternsJSON() []byte {
if x != nil {
return x.ExceptURLPatternsJSON
}
return nil
}
func (x *UpdateHTTPPageRequest) GetOnlyURLPatternsJSON() []byte {
if x != nil {
return x.OnlyURLPatternsJSON
}
return nil
}
// 查找单个Page配置 // 查找单个Page配置
type FindEnabledHTTPPageConfigRequest struct { type FindEnabledHTTPPageConfigRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
@@ -336,7 +368,7 @@ var file_service_http_page_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70, 0x0a, 0x17, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70,
0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x19, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x19, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74,
0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69,
@@ -346,22 +378,35 @@ var file_service_http_page_proto_rawDesc = []byte{
0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x62, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x22, 0x38, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x75, 0x73, 0x12, 0x34, 0x0a, 0x15, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x55, 0x52, 0x4c, 0x50,
0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06, 0x20, 0x01, 0x28,
0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x0c, 0x52, 0x15, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x55, 0x52, 0x4c, 0x50, 0x61, 0x74, 0x74,
0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x22, 0xb7, 0x01, 0x0a, 0x65, 0x72, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x30, 0x0a, 0x13, 0x6f, 0x6e, 0x6c, 0x79,
0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x52, 0x55, 0x52, 0x4c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6f, 0x6e, 0x6c, 0x79, 0x55, 0x52, 0x4c, 0x50, 0x61,
0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x38, 0x0a, 0x16, 0x43, 0x72,
0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x67, 0x65,
0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x64, 0x79, 0x54, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61,
0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x64, 0x79, 0x54, 0x79, 0x67, 0x65, 0x49, 0x64, 0x22, 0x9f, 0x02, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48,
0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e,
0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x0a, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x28, 0x03, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1e,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x42, 0x0a, 0x20, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a,
0x0a, 0x08, 0x62, 0x6f, 0x64, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x62, 0x6f, 0x64, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04,
0x62, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79,
0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x34,
0x0a, 0x15, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x55, 0x52, 0x4c, 0x50, 0x61, 0x74, 0x74, 0x65,
0x72, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x15, 0x65,
0x78, 0x63, 0x65, 0x70, 0x74, 0x55, 0x52, 0x4c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73,
0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x30, 0x0a, 0x13, 0x6f, 0x6e, 0x6c, 0x79, 0x55, 0x52, 0x4c, 0x50,
0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x13, 0x6f, 0x6e, 0x6c, 0x79, 0x55, 0x52, 0x4c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72,
0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x42, 0x0a, 0x20, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x74, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x74,
0x74, 0x70, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x70, 0x50, 0x61, 0x67, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,

View File

@@ -19,11 +19,13 @@ service HTTPPageService {
// 创建Page // 创建Page
message CreateHTTPPageRequest { message CreateHTTPPageRequest {
repeated string statusList = 1; repeated string statusList = 1; // 状态码列表
string bodyType = 5; string bodyType = 5; // 页面类型html|url|redirectURL
string url = 2; string url = 2; // 读取或者跳转的URL
string body = 4; string body = 4; // HTML内容
int32 newStatus = 3; int32 newStatus = 3; // 新的状态码
bytes exceptURLPatternsJSON = 6; // 例外URL列表
bytes onlyURLPatternsJSON = 7; // 限制URL列表
} }
message CreateHTTPPageResponse { message CreateHTTPPageResponse {
@@ -34,10 +36,12 @@ message CreateHTTPPageResponse {
message UpdateHTTPPageRequest { message UpdateHTTPPageRequest {
int64 httpPageId = 1; int64 httpPageId = 1;
repeated string statusList = 2; repeated string statusList = 2;
string bodyType = 6; string bodyType = 6; // 页面类型html|url|redirectURL
string url = 3; string url = 3;
string body = 5; string body = 5;
int32 newStatus = 4; int32 newStatus = 4;
bytes exceptURLPatternsJSON = 7; // 例外URL列表
bytes onlyURLPatternsJSON = 8; // 限制URL列表
} }
// 查找单个Page配置 // 查找单个Page配置

View File

@@ -28,7 +28,6 @@ func FindAllHTTPPageBodyTypes() []*shared.Definition {
} }
// HTTPPageConfig 特殊页面配置 // HTTPPageConfig 特殊页面配置
// TODO 需要支持Header定义
type HTTPPageConfig struct { type HTTPPageConfig struct {
Id int64 `yaml:"id" json:"id"` // 页面ID Id int64 `yaml:"id" json:"id"` // 页面ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 TODO IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 TODO
@@ -39,6 +38,9 @@ type HTTPPageConfig struct {
URL string `yaml:"url" json:"url"` // URL URL string `yaml:"url" json:"url"` // URL
Body string `yaml:"body" json:"body"` // 输出的内容 Body string `yaml:"body" json:"body"` // 输出的内容
OnlyURLPatterns []*shared.URLPattern `yaml:"onlyURLPatterns" json:"onlyURLPatterns"` // 仅限的URL
ExceptURLPatterns []*shared.URLPattern `yaml:"exceptURLPatterns" json:"exceptURLPatterns"` // 排除的URL
statusList []*WildcardStatus statusList []*WildcardStatus
hasStatusList bool hasStatusList bool
} }
@@ -57,6 +59,21 @@ func (this *HTTPPageConfig) Init() error {
this.statusList = append(this.statusList, NewWildcardStatus(s)) this.statusList = append(this.statusList, NewWildcardStatus(s))
} }
this.hasStatusList = len(this.statusList) > 0 this.hasStatusList = len(this.statusList) > 0
for _, urlPattern := range this.OnlyURLPatterns {
err := urlPattern.Init()
if err != nil {
return err
}
}
for _, urlPattern := range this.ExceptURLPatterns {
err := urlPattern.Init()
if err != nil {
return err
}
}
return nil return nil
} }
@@ -72,3 +89,25 @@ func (this *HTTPPageConfig) Match(status int) bool {
} }
return false return false
} }
func (this *HTTPPageConfig) MatchURL(url string) bool {
// except
if len(this.ExceptURLPatterns) > 0 {
for _, pattern := range this.ExceptURLPatterns {
if pattern.Match(url) {
return false
}
}
}
if len(this.OnlyURLPatterns) > 0 {
for _, pattern := range this.OnlyURLPatterns {
if pattern.Match(url) {
return true
}
}
return false
}
return true
}