Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 同步后端 rules.json #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cases/111.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"message": "强制性标签 '<meta http-equiv=\"/Content-Type/i\" content=\"/charset=utf-8/i\">'或'<meta charset=\"/^utf-8$/i\">' 缺失或错误",
"message": "强制性标签 '<meta http-equiv=\"/Content-Type/i\" content=\"/charset=(utf)|(UTF)-8/\">'或'<meta charset=\"/^(utf)|(UTF-8)/\">' 缺失或错误",
"code": "06200101",
"line": 0,
"col": 0,
Expand Down
2 changes: 1 addition & 1 deletion cases/144.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"input": "<script src=\"https://c.mipcdn.com/static/v1/mip.js\"></script><script src=\"./bn_files/ds.js\"></script>"
},
{
"message": "强制性标签 '<link rel=\"/^(miphtml)|(canonical)$/\">' 缺失或错误",
"message": "强制性标签 '<link rel=\"/^(miphtml)|(canonical)$/\" href=\"/^(http(s)?:)?///\">' 缺失或错误",
"code": "06200101",
"line": 0,
"col": 0,
Expand Down
8 changes: 8 additions & 0 deletions cases/216.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[
{
"message": "标签 '<link rel=\"/^(miphtml)|(standardhtml)$/\">' 只能出现一次",
"code": "06200701",
"line": 8,
"col": 9,
"offset": 339,
"input": " <link rel=\"miphtml\" href=\"https://www.mipengine.org/test_xxx.html\">"
},
{
"message": "标签 '<link rel=\"/^(miphtml)|(canonical)$/\">' 只能出现一次",
"code": "06200701",
Expand Down
8 changes: 8 additions & 0 deletions cases/218.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"col": 9,
"offset": 263,
"input": " <link rel=\"canonical\" href=\"/www.mipengine.org/test_xxx.html\">"
},
{
"message": "强制性标签 '<link rel=\"/^(miphtml)|(canonical)$/\" href=\"/^(http(s)?:)?///\">' 缺失或错误",
"code": "06200101",
"line": 0,
"col": 0,
"offset": 0,
"input": ""
}
]
8 changes: 8 additions & 0 deletions cases/219.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"col": 9,
"offset": 263,
"input": " <link rel=\"miphtml\" href=\"/www.mipengine.org/test_xxx.html\">"
},
{
"message": "强制性标签 '<link rel=\"/^(miphtml)|(canonical)$/\" href=\"/^(http(s)?:)?///\">' 缺失或错误",
"code": "06200101",
"line": 0,
"col": 0,
"offset": 0,
"input": ""
}
]
64 changes: 36 additions & 28 deletions dist/mip-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17047,7 +17047,7 @@ arguments[4][4][0].apply(exports,arguments)
},{"./support/isBuffer":62,"_process":42,"dup":4,"inherits":12}],64:[function(require,module,exports){
module.exports={
"name": "mip-validator",
"version": "1.6.2",
"version": "1.6.4",
"description": "MIP validator",
"main": "index.js",
"dependencies": {
Expand Down Expand Up @@ -17179,7 +17179,7 @@ module.exports={
}, {
"http-equiv": "/Content-Type/i"
}, {
"charset": "/^utf-8$/i"
"charset": "/^(UTF-8)/i"
}],
"attrs": {
"content": [{
Expand All @@ -17194,9 +17194,9 @@ module.exports={
},
"mandatory_or": [{
"http-equiv": "/Content-Type/i",
"content": "/charset=utf-8/i"
"content": "/charset=(utf)|(UTF)-8/"
}, {
"charset": "/^utf-8$/i"
"charset": "/^(utf)|(UTF-8)/"
}],
"mandatory": {
"name": "/^(viewport)?/",
Expand All @@ -17206,28 +17206,33 @@ module.exports={
},
"link": {
"mandatory": [{
"rel": "/^(miphtml)|(canonical)$/"
"rel": "/^(miphtml)|(canonical)$/",
"href": "/^(http(s)?:)?\/\//"
}, {
"rel": "/^stylesheet$/",
"href": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(mipcache\\.bdstatic\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(\\S+\\.sm-tc\\.cn\/static\/v\\d\/mip\\.css)|(\\S+\\.transcode\\.cn\/static\/v\\d\/mip\\.css))$/"
}],
"mandatory_parent": "head",
"duplicate": [{
"rel": "/^(miphtml)|(standardhtml)$/"
}, {
"rel": "/^(miphtml)|(canonical)$/"
}, {
"rel": "/^stylesheet$/",
"href": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|(c.mipcdn.com\/static\/mipmain)/"
}],
"attrs": {
"href": [{
"value": "/^(http(s)?:)?\/\//",
"match": {
"rel": "/^((canonical)|(miphtml))$/"
"rel": "/^(miphtml)|(canonical)$/"
}
}, {
"value": "/^(?!\/[^\/])/",
"match": {
"rel": "/^(?!((miphtml)|(canonical))$)/"
}
}]

}
},
"script": [
Expand Down Expand Up @@ -17287,6 +17292,9 @@ module.exports={
"frameset": {
"disallow": true
},
"iframe": {
"disallow": true
},
"object": {
"disallow": true
},
Expand All @@ -17302,9 +17310,6 @@ module.exports={
"form": {
"disallow": true
},
"iframe": {
"disallow": true
},
"input": {
"mandatory_ancestor": "mip-form"
},
Expand Down Expand Up @@ -17457,15 +17462,34 @@ module.exports={
}
}
},
"mip-vd-baidu": {
"attrs": {
"src": {
"mandatory": true,
"value": "/^(http(s)?:)?\/\//"
},
"title": {
"mandatory": true,
"value": "/^\\S+$/"
},
"poster": {
"mandatory": true,
"value": "/^\\S+$/"
}
}
},
"mip-shell": {
"duplicate": true
},
"head": {
"duplicate": true,
"mandatory": true,
"mandatory_parent": "html"
},
"body": {
"duplicate": true,
"mandatory": true,
"mandatory_parent": "html",
"duplicate": true
"mandatory_parent": "html"
},
"style": {
"attrs": {
Expand Down Expand Up @@ -17500,22 +17524,6 @@ module.exports={
"value": "/^\/$/"
}
}
},
"mip-vd-baidu": {
"attrs": {
"src": {
"mandatory": true,
"value": "/^(http(s)?:)?\/\//"
},
"title": {
"mandatory": true,
"value": "/^\\S+$/"
},
"poster": {
"mandatory": true,
"value": "/^\\S+$/"
}
}
}
}
},{}],67:[function(require,module,exports){
Expand Down
2 changes: 1 addition & 1 deletion dist/mip-validator.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mip-validator",
"version": "1.6.2",
"version": "1.6.4",
"description": "MIP validator",
"main": "index.js",
"dependencies": {
Expand Down
62 changes: 35 additions & 27 deletions rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}, {
"http-equiv": "/Content-Type/i"
}, {
"charset": "/^utf-8$/i"
"charset": "/^(UTF-8)/i"
}],
"attrs": {
"content": [{
Expand All @@ -41,9 +41,9 @@
},
"mandatory_or": [{
"http-equiv": "/Content-Type/i",
"content": "/charset=utf-8/i"
"content": "/charset=(utf)|(UTF)-8/"
}, {
"charset": "/^utf-8$/i"
"charset": "/^(utf)|(UTF-8)/"
}],
"mandatory": {
"name": "/^(viewport)?/",
Expand All @@ -53,28 +53,33 @@
},
"link": {
"mandatory": [{
"rel": "/^(miphtml)|(canonical)$/"
"rel": "/^(miphtml)|(canonical)$/",
"href": "/^(http(s)?:)?\/\//"
}, {
"rel": "/^stylesheet$/",
"href": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(mipcache\\.bdstatic\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(\\S+\\.sm-tc\\.cn\/static\/v\\d\/mip\\.css)|(\\S+\\.transcode\\.cn\/static\/v\\d\/mip\\.css))$/"
}],
"mandatory_parent": "head",
"duplicate": [{
"rel": "/^(miphtml)|(standardhtml)$/"
}, {
"rel": "/^(miphtml)|(canonical)$/"
}, {
"rel": "/^stylesheet$/",
"href": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|(c.mipcdn.com\/static\/mipmain)/"
}],
"attrs": {
"href": [{
"value": "/^(http(s)?:)?\/\//",
"match": {
"rel": "/^((canonical)|(miphtml))$/"
"rel": "/^(miphtml)|(canonical)$/"
}
}, {
"value": "/^(?!\/[^\/])/",
"match": {
"rel": "/^(?!((miphtml)|(canonical))$)/"
}
}]

}
},
"script": [
Expand Down Expand Up @@ -134,6 +139,9 @@
"frameset": {
"disallow": true
},
"iframe": {
"disallow": true
},
"object": {
"disallow": true
},
Expand All @@ -149,9 +157,6 @@
"form": {
"disallow": true
},
"iframe": {
"disallow": true
},
"input": {
"mandatory_ancestor": "mip-form"
},
Expand Down Expand Up @@ -304,15 +309,34 @@
}
}
},
"mip-vd-baidu": {
"attrs": {
"src": {
"mandatory": true,
"value": "/^(http(s)?:)?\/\//"
},
"title": {
"mandatory": true,
"value": "/^\\S+$/"
},
"poster": {
"mandatory": true,
"value": "/^\\S+$/"
}
}
},
"mip-shell": {
"duplicate": true
},
"head": {
"duplicate": true,
"mandatory": true,
"mandatory_parent": "html"
},
"body": {
"duplicate": true,
"mandatory": true,
"mandatory_parent": "html",
"duplicate": true
"mandatory_parent": "html"
},
"style": {
"attrs": {
Expand Down Expand Up @@ -347,21 +371,5 @@
"value": "/^\/$/"
}
}
},
"mip-vd-baidu": {
"attrs": {
"src": {
"mandatory": true,
"value": "/^(http(s)?:)?\/\//"
},
"title": {
"mandatory": true,
"value": "/^\\S+$/"
},
"poster": {
"mandatory": true,
"value": "/^\\S+$/"
}
}
}
}