提交 5fb6fe7c 编写于 作者: B baiy 提交者: ninecents

update

上级 44394c7e
...@@ -62,9 +62,8 @@ npm run build -adapter=[chrome|edge|utools|firefox|web] ...@@ -62,9 +62,8 @@ npm run build -adapter=[chrome|edge|utools|firefox|web]
|websocket调试|`websocket`,`在线调试`|×| |websocket调试|`websocket`,`在线调试`|×|
|单位换算|`长度`,`面积`,`体积`,`质量`,`温度`,`压力`,`功率`,`功`,`密度`,`力`,`时间`,`速度`,`数据存储`,`角度`|√| |单位换算|`长度`,`面积`,`体积`,`质量`,`温度`,`压力`,`功率`,`功`,`密度`,`力`,`时间`,`速度`,`数据存储`,`角度`|√|
|时间计算器| - |√| |时间计算器| - |√|
|JSON工具|`格式化`,`校验`,`压缩`,`转义`,`去除转义`,`Unicode转中文`,`中文转Unicode`,`转GET参数`|√| |JSON工具|`格式化`,`校验`,`压缩`,`转义`,`去除转义`,`Unicode转中文`,`中文转Unicode`,`转GET参数`,`Java`, `C#`, `Go`, `Dart`,`csv`,`table`|√|
|UUID|在线生成uuid|√| |UUID|在线生成uuid|√|
|JSON转实体类|`Java`, `C#`, `Go`, `Dart`|√|
|ascii编码转换|`十进制`, `十六进制`, `八进制`, `二进制`, `字符串`|√| |ascii编码转换|`十进制`, `十六进制`, `八进制`, `二进制`, `字符串`|√|
|变量名格式转换|`Var Name`, `var-name`, `VAR_NAME`, `VarName`, `varName`, `var_name`, `var name`|√| |变量名格式转换|`Var Name`, `var-name`, `VAR_NAME`, `VarName`, `varName`, `var_name`, `var name`|√|
|jwt解码|`header`, `payload`|√| |jwt解码|`header`, `payload`|√|
......
{ {
"name": "c-tool", "name": "c-tool",
"version": "1.9.3", "version": "1.9.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
...@@ -305,9 +305,9 @@ ...@@ -305,9 +305,9 @@
} }
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.16.4", "version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.7.tgz",
"integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==" "integrity": "sha512-sR4eaSrnM7BV7QPzGfEX5paG/6wrZM3I0HDzfIAK06ESvo9oy3xBuVBxE3MbQaKNhvg8g/ixjMWo2CGpzpHsDA=="
}, },
"@babel/plugin-proposal-async-generator-functions": { "@babel/plugin-proposal-async-generator-functions": {
"version": "7.13.15", "version": "7.13.15",
...@@ -866,9 +866,9 @@ ...@@ -866,9 +866,9 @@
} }
}, },
"@codemirror/language": { "@codemirror/language": {
"version": "0.19.6", "version": "0.19.7",
"resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.19.6.tgz", "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.19.7.tgz",
"integrity": "sha512-or5TU/bxhsQdhXT70SK/h9V/gX/rElDEQyG29VbEDnHZ8TaDo3xsX900EYP02/tpIj8sConefmuMQfrePr+OCA==", "integrity": "sha512-pNNUtYWMIMG0lUSKyUXJr8U0rFiCKsKFXbA2Oj17PC+S1FY99hV0z1vcntW67ekAIZw9DMEUQnLsKBuIbAUX7Q==",
"requires": { "requires": {
"@codemirror/state": "^0.19.0", "@codemirror/state": "^0.19.0",
"@codemirror/text": "^0.19.0", "@codemirror/text": "^0.19.0",
...@@ -878,9 +878,9 @@ ...@@ -878,9 +878,9 @@
} }
}, },
"@codemirror/rangeset": { "@codemirror/rangeset": {
"version": "0.19.2", "version": "0.19.5",
"resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.2.tgz", "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.5.tgz",
"integrity": "sha512-5d+X8LtmeZtfFtKrSx57bIHRUpKv2HD0b74clp4fGA7qJLLfYehF6FGkJJxJb8lKsqAga1gdjjWr0jiypmIxoQ==", "integrity": "sha512-L3b+RIwIRKOJ3pJLOtpkxCUjGnxZKFyPb0CjYWKnVLuzEIaEExWWK7sp6rsejxOy8RjYzfCHlFhYB4UdQN7brw==",
"requires": { "requires": {
"@codemirror/state": "^0.19.0" "@codemirror/state": "^0.19.0"
} }
...@@ -894,9 +894,9 @@ ...@@ -894,9 +894,9 @@
} }
}, },
"@codemirror/stream-parser": { "@codemirror/stream-parser": {
"version": "0.19.2", "version": "0.19.3",
"resolved": "https://registry.npmjs.org/@codemirror/stream-parser/-/stream-parser-0.19.2.tgz", "resolved": "https://registry.npmjs.org/@codemirror/stream-parser/-/stream-parser-0.19.3.tgz",
"integrity": "sha512-hBKRQlyu8GUOrY33xZ6/1kAfNZ8ZUm6cX9a7mPx8zAAqnpz/fpksC/qJRrkg1mPMBwxm+JG4fqAwDGJ3gLVniQ==", "integrity": "sha512-9fV6GgcZSLVvvPCd/SUt00G/Sqt91r0ojEQsgH7koWn4McTFvSujhOs0LHJlQGQRazuuWW1j3eqrv19+E9t40g==",
"requires": { "requires": {
"@codemirror/highlight": "^0.19.0", "@codemirror/highlight": "^0.19.0",
"@codemirror/language": "^0.19.0", "@codemirror/language": "^0.19.0",
...@@ -912,11 +912,11 @@ ...@@ -912,11 +912,11 @@
"integrity": "sha512-Syu5Xc7tZzeUAM/y4fETkT0zgGr48rDG+w4U38bPwSIUr+L9S/7w2wDE1WGNzjaZPz12F6gb1gxWiSTg9ocLow==" "integrity": "sha512-Syu5Xc7tZzeUAM/y4fETkT0zgGr48rDG+w4U38bPwSIUr+L9S/7w2wDE1WGNzjaZPz12F6gb1gxWiSTg9ocLow=="
}, },
"@codemirror/view": { "@codemirror/view": {
"version": "0.19.21", "version": "0.19.37",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.21.tgz", "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.37.tgz",
"integrity": "sha512-us5ENWr3ZFdXnIkylqVM3KCIPYepLyFhNmQqYMI3w2i/+ERoJGtyKPhiFuk5NpUjkONaZB3cHGBU+Z3mjqQFiw==", "integrity": "sha512-SLuLx9p0O1ZHXLehvl5MwSvUrQRcsNGemzTgJ0zRajmc3BBsNigI1PXxdo7tvBhO5DcAzRRBXoke9DZFUR6Qqg==",
"requires": { "requires": {
"@codemirror/rangeset": "^0.19.0", "@codemirror/rangeset": "^0.19.5",
"@codemirror/state": "^0.19.3", "@codemirror/state": "^0.19.3",
"@codemirror/text": "^0.19.0", "@codemirror/text": "^0.19.0",
"style-mod": "^4.0.0", "style-mod": "^4.0.0",
...@@ -960,13 +960,13 @@ ...@@ -960,13 +960,13 @@
} }
}, },
"@graphql-tools/delegate": { "@graphql-tools/delegate": {
"version": "8.4.2", "version": "8.4.3",
"resolved": "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-8.4.2.tgz", "resolved": "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-8.4.3.tgz",
"integrity": "sha512-CjggOhiL4WtyG2I3kux+1/p8lQxSFHBj0gwa0NxnQ6Vsnpw7Ig5VP1ovPnitFuBv2k4QdC37Nj2xv2n7DRn8fw==", "integrity": "sha512-hKTJdJXJnKL0+2vpU+Kt7OHQTIXZ9mBmNBwHsYiG5WNArz/vNI7910r6TC2XMf/e7zhyyK+mXxMDBmDQkkJagA==",
"requires": { "requires": {
"@graphql-tools/batch-execute": "^8.3.1", "@graphql-tools/batch-execute": "^8.3.1",
"@graphql-tools/schema": "^8.3.1", "@graphql-tools/schema": "^8.3.1",
"@graphql-tools/utils": "^8.5.3", "@graphql-tools/utils": "^8.5.4",
"dataloader": "2.0.0", "dataloader": "2.0.0",
"tslib": "~2.3.0", "tslib": "~2.3.0",
"value-or-promise": "1.0.11" "value-or-promise": "1.0.11"
...@@ -1059,9 +1059,9 @@ ...@@ -1059,9 +1059,9 @@
} }
}, },
"ignore": { "ignore": {
"version": "5.1.9", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
"integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==" "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ=="
}, },
"is-number": { "is-number": {
"version": "7.0.0", "version": "7.0.0",
...@@ -1103,11 +1103,11 @@ ...@@ -1103,11 +1103,11 @@
} }
}, },
"@graphql-tools/import": { "@graphql-tools/import": {
"version": "6.6.1", "version": "6.6.3",
"resolved": "https://registry.npmjs.org/@graphql-tools/import/-/import-6.6.1.tgz", "resolved": "https://registry.npmjs.org/@graphql-tools/import/-/import-6.6.3.tgz",
"integrity": "sha512-i9WA6k+erJMci822o9w9DoX+uncVBK60LGGYW8mdbhX0l7wEubUpA000thJ1aarCusYh0u+ZT9qX0HyVPXu25Q==", "integrity": "sha512-k/QkWCZ5rPVgFw1eE4GXPXltw9/mEiJj6F6bJvFKJr1C6im8Y60pl0Pv+SByGZQGuukXE0uR16Mv4OFGSMQIaQ==",
"requires": { "requires": {
"@graphql-tools/utils": "8.5.3", "@graphql-tools/utils": "8.5.5",
"resolve-from": "5.0.0", "resolve-from": "5.0.0",
"tslib": "~2.3.0" "tslib": "~2.3.0"
}, },
...@@ -1203,9 +1203,9 @@ ...@@ -1203,9 +1203,9 @@
} }
}, },
"ignore": { "ignore": {
"version": "5.1.9", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
"integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==" "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ=="
}, },
"is-number": { "is-number": {
"version": "7.0.0", "version": "7.0.0",
...@@ -1247,12 +1247,12 @@ ...@@ -1247,12 +1247,12 @@
} }
}, },
"@graphql-tools/load": { "@graphql-tools/load": {
"version": "7.4.1", "version": "7.5.0",
"resolved": "https://registry.npmjs.org/@graphql-tools/load/-/load-7.4.1.tgz", "resolved": "https://registry.npmjs.org/@graphql-tools/load/-/load-7.5.0.tgz",
"integrity": "sha512-UvBodW5hRHpgBUBVz5K5VIhJDOTFIbRRAGD6sQ2l9J5FDKBEs3u/6JjZDzbdL96br94D5cEd2Tk6auaHpTn7mQ==", "integrity": "sha512-f0k12xZzxfV4BxWyvt/f8opqICXvz4WzDrVVG4udHFgUJIjhGeE67SRTWFAK/jlIp4QgaDux7L1DXQkJnmx64w==",
"requires": { "requires": {
"@graphql-tools/schema": "8.3.1", "@graphql-tools/schema": "8.3.1",
"@graphql-tools/utils": "^8.5.1", "@graphql-tools/utils": "^8.5.5",
"p-limit": "3.1.0", "p-limit": "3.1.0",
"tslib": "~2.3.0" "tslib": "~2.3.0"
}, },
...@@ -1307,29 +1307,29 @@ ...@@ -1307,29 +1307,29 @@
} }
}, },
"@graphql-tools/url-loader": { "@graphql-tools/url-loader": {
"version": "7.5.3", "version": "7.7.0",
"resolved": "https://registry.npmjs.org/@graphql-tools/url-loader/-/url-loader-7.5.3.tgz", "resolved": "https://registry.npmjs.org/@graphql-tools/url-loader/-/url-loader-7.7.0.tgz",
"integrity": "sha512-VKMRJ4TOeVIdulkCLGSBUr4stRRwOGcVRXDeoUF+86K32Ufo0H2V0lz7QwS/bCl8GXV19FMgHZCDl4BMJyOXEA==", "integrity": "sha512-mBBb+aJqI4E0MVEzyfi76Pi/G6lGxGTVt/tP1YtKJly7UnonNoWOtDusdL3zIVAGhGgLsNrLbGhLDbwSd6TV6A==",
"requires": { "requires": {
"@graphql-tools/delegate": "^8.4.1", "@graphql-tools/delegate": "^8.4.1",
"@graphql-tools/utils": "^8.5.1", "@graphql-tools/utils": "^8.5.1",
"@graphql-tools/wrap": "^8.3.1", "@graphql-tools/wrap": "^8.3.1",
"@n1ru4l/graphql-live-query": "0.9.0", "@n1ru4l/graphql-live-query": "^0.9.0",
"@types/websocket": "1.0.4", "@types/websocket": "^1.0.4",
"@types/ws": "^8.0.0", "@types/ws": "^8.0.0",
"cross-undici-fetch": "^0.0.26", "cross-undici-fetch": "^0.1.4",
"dset": "^3.1.0", "dset": "^3.1.0",
"extract-files": "11.0.0", "extract-files": "^11.0.0",
"graphql-sse": "^1.0.1", "graphql-sse": "^1.0.1",
"graphql-ws": "^5.4.1", "graphql-ws": "^5.4.1",
"isomorphic-ws": "4.0.1", "isomorphic-ws": "^4.0.1",
"meros": "1.1.4", "meros": "^1.1.4",
"subscriptions-transport-ws": "^0.11.0", "subscriptions-transport-ws": "^0.11.0",
"sync-fetch": "0.3.1", "sync-fetch": "^0.3.1",
"tslib": "~2.3.0", "tslib": "^2.3.0",
"valid-url": "1.0.9", "valid-url": "^1.0.9",
"value-or-promise": "1.0.11", "value-or-promise": "^1.0.11",
"ws": "8.3.0" "ws": "^8.3.0"
}, },
"dependencies": { "dependencies": {
"tslib": { "tslib": {
...@@ -1338,16 +1338,16 @@ ...@@ -1338,16 +1338,16 @@
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
}, },
"ws": { "ws": {
"version": "8.3.0", "version": "8.4.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.3.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz",
"integrity": "sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==" "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ=="
} }
} }
}, },
"@graphql-tools/utils": { "@graphql-tools/utils": {
"version": "8.5.3", "version": "8.5.5",
"resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-8.5.3.tgz", "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-8.5.5.tgz",
"integrity": "sha512-HDNGWFVa8QQkoQB0H1lftvaO1X5xUaUDk1zr1qDe0xN1NL0E/CrQdJ5UKLqOvH4hkqVUPxQsyOoAZFkaH6rLHg==", "integrity": "sha512-y7zRXWIUI73X+9/rf/0KzrNFMlpRKFfzLiwdbIeWwgLs+NV9vfUOoVkX8luXX6LwQxhSypHATMiwZGM2ro/wJA==",
"requires": { "requires": {
"tslib": "~2.3.0" "tslib": "~2.3.0"
}, },
...@@ -1483,6 +1483,13 @@ ...@@ -1483,6 +1483,13 @@
"phin": "^2.9.1", "phin": "^2.9.1",
"pixelmatch": "^4.0.2", "pixelmatch": "^4.0.2",
"tinycolor2": "^1.4.1" "tinycolor2": "^1.4.1"
},
"dependencies": {
"file-type": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz",
"integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw=="
}
} }
}, },
"@jimp/custom": { "@jimp/custom": {
...@@ -1779,14 +1786,14 @@ ...@@ -1779,14 +1786,14 @@
} }
}, },
"@lezer/common": { "@lezer/common": {
"version": "0.15.9", "version": "0.15.11",
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.9.tgz", "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.11.tgz",
"integrity": "sha512-N86tOY/g9pZQuKbmUjL4TQTegm4/34TZXxp1TYYFGdd9Rnhd9RPjQ3zp4q5qp/2qs4xlF4Dheg19K+JqAtvZxg==" "integrity": "sha512-vv0nSdIaVCRcJ8rPuDdsrNVfBOYe/4Szr/LhF929XyDmBndLDuWiCCHooGlGlJfzELyO608AyDhVsuX/ZG36NA=="
}, },
"@lezer/lr": { "@lezer/lr": {
"version": "0.15.4", "version": "0.15.5",
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.4.tgz", "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.5.tgz",
"integrity": "sha512-vwgG80sihEGJn6wJp6VijXrnzVai/KPva/OzYKaWvIx0IiXKjoMQ8UAwcgpSBwfS4Fbz3IKOX/cCNXU3r1FvpQ==", "integrity": "sha512-DEcLyhdmBxD1foQe7RegLrSlfS/XaTMGLkO5evkzHWAQKh/JnFWp7j7iNB7s2EpxzRrBCh0U+W7JDCeFhv2mng==",
"requires": { "requires": {
"@lezer/common": "^0.15.0" "@lezer/common": "^0.15.0"
} }
...@@ -1865,6 +1872,11 @@ ...@@ -1865,6 +1872,11 @@
"strip-ansi": "^5" "strip-ansi": "^5"
} }
}, },
"@tokenizer/token": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",
"integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="
},
"@types/glob": { "@types/glob": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
...@@ -1918,25 +1930,25 @@ ...@@ -1918,25 +1930,25 @@
} }
}, },
"@types/ws": { "@types/ws": {
"version": "8.2.0", "version": "8.2.2",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
"integrity": "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==", "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==",
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {
"version": "5.4.0", "version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.4.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.1.tgz",
"integrity": "sha512-GjXNpmn+n1LvnttarX+sPD6+S7giO+9LxDIGlRl4wK3a7qMWALOHYuVSZpPTfEIklYjaWuMtfKdeByx0AcaThA==" "integrity": "sha512-L/FlWCCgnjKOLefdok90/pqInkomLnAcF9UAzNr+DSqMC3IffzumHTQTrINXhP1gVp9zlHiYYjvozVZDPleLcA=="
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "5.4.0", "version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.4.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.1.tgz",
"integrity": "sha512-nhlNoBdhKuwiLMx6GrybPT3SFILm5Gij2YBdPEPFlYNFAXUJWX6QRgvi/lwVoadaQEFsizohs6aFRMqsXI2ewA==", "integrity": "sha512-26lQ8l8tTbG7ri7xEcCFT9ijU5Fk+sx/KRRyyzCv7MQ+rZZlqiDPtMKWLC8P7o+dtCnby4c+OlxuX1tp8WfafQ==",
"requires": { "requires": {
"@typescript-eslint/types": "5.4.0", "@typescript-eslint/types": "5.8.1",
"@typescript-eslint/visitor-keys": "5.4.0", "@typescript-eslint/visitor-keys": "5.8.1",
"debug": "^4.3.2", "debug": "^4.3.2",
"globby": "^11.0.4", "globby": "^11.0.4",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
...@@ -1963,9 +1975,9 @@ ...@@ -1963,9 +1975,9 @@
} }
}, },
"debug": { "debug": {
"version": "4.3.2", "version": "4.3.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
"requires": { "requires": {
"ms": "2.1.2" "ms": "2.1.2"
} }
...@@ -2020,9 +2032,9 @@ ...@@ -2020,9 +2032,9 @@
} }
}, },
"ignore": { "ignore": {
"version": "5.1.9", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
"integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==" "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ=="
}, },
"is-glob": { "is-glob": {
"version": "4.0.3", "version": "4.0.3",
...@@ -2088,11 +2100,11 @@ ...@@ -2088,11 +2100,11 @@
} }
}, },
"@typescript-eslint/visitor-keys": { "@typescript-eslint/visitor-keys": {
"version": "5.4.0", "version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.4.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.1.tgz",
"integrity": "sha512-PVbax7MeE7tdLfW5SA0fs8NGVVr+buMPrcj+CWYWPXsZCH8qZ1THufDzbXm1xrZ2b2PA1iENJ0sRq5fuUtvsJg==", "integrity": "sha512-SWgiWIwocK6NralrJarPZlWdr0hZnj5GXHIgfdm8hNkyKvpeQuFyLP6YjSIe9kf3YBIfU6OHSZLYkQ+smZwtNg==",
"requires": { "requires": {
"@typescript-eslint/types": "5.4.0", "@typescript-eslint/types": "5.8.1",
"eslint-visitor-keys": "^3.0.0" "eslint-visitor-keys": "^3.0.0"
}, },
"dependencies": { "dependencies": {
...@@ -3276,7 +3288,8 @@ ...@@ -3276,7 +3288,8 @@
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz", "resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true
}, },
"atob": { "atob": {
"version": "2.1.2", "version": "2.1.2",
...@@ -3588,9 +3601,9 @@ ...@@ -3588,9 +3601,9 @@
"dev": true "dev": true
}, },
"bignumber.js": { "bignumber.js": {
"version": "9.0.1", "version": "9.0.2",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz",
"integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" "integrity": "sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw=="
}, },
"binary-extensions": { "binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
...@@ -4449,17 +4462,17 @@ ...@@ -4449,17 +4462,17 @@
"integrity": "sha512-472wqY+x6uc/pgV/+6bGnKvqvoHuPjb0O6pDNAfYKkFnAOqocTrro1mni69PZPMXFuE23ZSKdi9/37+uC0jI1Q==" "integrity": "sha512-472wqY+x6uc/pgV/+6bGnKvqvoHuPjb0O6pDNAfYKkFnAOqocTrro1mni69PZPMXFuE23ZSKdi9/37+uC0jI1Q=="
}, },
"codemirror": { "codemirror": {
"version": "5.64.0", "version": "5.65.0",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.64.0.tgz", "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.65.0.tgz",
"integrity": "sha512-fqr6CtDQdJ6iNMbD8NX2gH2G876nNDk+TO1rrYkgWnqQdO3O1Xa9tK6q+psqhJJgE5SpbaDcgdfLmukoUVE8pg==" "integrity": "sha512-gWEnHKEcz1Hyz7fsQWpK7P0sPI2/kSkRX2tc7DFA6TmZuDN75x/1ejnH/Pn8adYKrLEA1V2ww6L00GudHZbSKw=="
}, },
"codemirror-graphql": { "codemirror-graphql": {
"version": "1.2.4", "version": "1.2.11",
"resolved": "https://registry.npmjs.org/codemirror-graphql/-/codemirror-graphql-1.2.4.tgz", "resolved": "https://registry.npmjs.org/codemirror-graphql/-/codemirror-graphql-1.2.11.tgz",
"integrity": "sha512-ZinZ4W3wcnGieeMHfVtKoXBGYDUc3RJgCWc4HcTigw9RbO5hRc9iEHAr9cs7Br1CwXh5oueloNPNdvREYFdB0A==", "integrity": "sha512-pB3LVgrwj+qfO1vaVvnzTYBKhkms1hU/t0fiOM7tiov/Kq+l1BXCgYJyh5/muGDxpz7hqzg/fWJwIYNi40kLiA==",
"requires": { "requires": {
"@codemirror/stream-parser": "^0.19.2", "@codemirror/stream-parser": "^0.19.2",
"graphql-language-service": "^3.2.4" "graphql-language-service": "^4.1.4"
} }
}, },
"collection-visit": { "collection-visit": {
...@@ -4515,6 +4528,7 @@ ...@@ -4515,6 +4528,7 @@
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"requires": { "requires": {
"delayed-stream": "~1.0.0" "delayed-stream": "~1.0.0"
} }
...@@ -4933,26 +4947,15 @@ ...@@ -4933,26 +4947,15 @@
} }
}, },
"cross-undici-fetch": { "cross-undici-fetch": {
"version": "0.0.26", "version": "0.1.12",
"resolved": "https://registry.npmjs.org/cross-undici-fetch/-/cross-undici-fetch-0.0.26.tgz", "resolved": "https://registry.npmjs.org/cross-undici-fetch/-/cross-undici-fetch-0.1.12.tgz",
"integrity": "sha512-aMDRrLbWr0TGXfY92stlV+XOGpskeqFmWmrKSWsnc8w6gK5LPE83NBh7O7N6gCb2xjwHcm1Yn2nBXMEVH2RBcA==", "integrity": "sha512-JNUr0ANEwc3MEUT5xBl2fVnCJqcPa7hpQfEYNsrCG/7/M4pUH5W0nQOe6FKAQGB6SqFPyAeoEn8G375QXWxwWQ==",
"requires": { "requires": {
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^4.0.0", "form-data-encoder": "^1.7.1",
"formdata-node": "^4.3.1",
"node-fetch": "^2.6.5", "node-fetch": "^2.6.5",
"undici": "^4.9.3" "undici": "^4.9.3"
},
"dependencies": {
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
} }
}, },
"cryptiles": { "cryptiles": {
...@@ -5346,6 +5349,16 @@ ...@@ -5346,6 +5349,16 @@
} }
} }
}, },
"csv-parse": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.0.4.tgz",
"integrity": "sha512-5AIdl8l6n3iYQYxan5djB5eKDa+vBnhfWZtRpJTcrETWfVLYN0WSj3L9RwvgYt+psoO77juUr8TG8qpfGZifVQ=="
},
"csv-stringify": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.0.5.tgz",
"integrity": "sha512-7xpV3uweJCFF/Ssn56l3xsR/k2r3UqszwjEhej9qEn2cCPzyK1WyHCgoUVzBA792x8HbwonNX7CU9XM2K5s5yw=="
},
"current-script-polyfill": { "current-script-polyfill": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/current-script-polyfill/download/current-script-polyfill-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/current-script-polyfill/download/current-script-polyfill-1.0.0.tgz",
...@@ -5358,6 +5371,11 @@ ...@@ -5358,6 +5371,11 @@
"integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=",
"dev": true "dev": true
}, },
"darkreader": {
"version": "4.9.43",
"resolved": "https://registry.npmjs.org/darkreader/-/darkreader-4.9.43.tgz",
"integrity": "sha512-L6TryKvQiwLcR6YDggkITcPRh9OZeobYkUXHowJOzrV17gT6e0weldbaIJTwdPCoI9tdehTuyyXC8b76/wXhPQ=="
},
"dashdash": { "dashdash": {
"version": "1.14.1", "version": "1.14.1",
"resolved": "http://registry.npm.taobao.org/dashdash/download/dashdash-1.14.1.tgz", "resolved": "http://registry.npm.taobao.org/dashdash/download/dashdash-1.14.1.tgz",
...@@ -5605,7 +5623,8 @@ ...@@ -5605,7 +5623,8 @@
"delayed-stream": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"dev": true
}, },
"depd": { "depd": {
"version": "1.1.2", "version": "1.1.2",
...@@ -6653,9 +6672,14 @@ ...@@ -6653,9 +6672,14 @@
} }
}, },
"file-type": { "file-type": {
"version": "9.0.0", "version": "16.5.3",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz",
"integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==" "integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
"requires": {
"readable-web-to-node-stream": "^3.0.0",
"strtok3": "^6.2.4",
"token-types": "^4.1.1"
}
}, },
"file-uri-to-path": { "file-uri-to-path": {
"version": "1.0.0", "version": "1.0.0",
...@@ -6848,6 +6872,20 @@ ...@@ -6848,6 +6872,20 @@
"mime-types": "^2.1.12" "mime-types": "^2.1.12"
} }
}, },
"form-data-encoder": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz",
"integrity": "sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg=="
},
"formdata-node": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.1.tgz",
"integrity": "sha512-8xKSa9et4zb+yziWsD/bI+EYjdg1z2p9EpKr+o+Yk12F/wP66bmDdvjj2ZXd2K/MJlR3HBzWnuV7f82jzHRqCA==",
"requires": {
"node-domexception": "1.0.0",
"web-streams-polyfill": "4.0.0-beta.1"
}
},
"forwarded": { "forwarded": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "http://registry.npm.taobao.org/forwarded/download/forwarded-0.1.2.tgz", "resolved": "http://registry.npm.taobao.org/forwarded/download/forwarded-0.1.2.tgz",
...@@ -7084,98 +7122,63 @@ ...@@ -7084,98 +7122,63 @@
"cosmiconfig-toml-loader": "1.0.0", "cosmiconfig-toml-loader": "1.0.0",
"minimatch": "3.0.4", "minimatch": "3.0.4",
"string-env-interpolation": "1.0.1" "string-env-interpolation": "1.0.1"
},
"dependencies": {
"cosmiconfig": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
"integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
"requires": {
"@types/parse-json": "^4.0.0",
"import-fresh": "^3.2.1",
"parse-json": "^5.0.0",
"path-type": "^4.0.0",
"yaml": "^1.10.0"
}
},
"import-fresh": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
"integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
"requires": {
"parent-module": "^1.0.0",
"resolve-from": "^4.0.0"
}
},
"parse-json": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
"integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
"requires": {
"@babel/code-frame": "^7.0.0",
"error-ex": "^1.3.1",
"json-parse-even-better-errors": "^2.3.0",
"lines-and-columns": "^1.1.6"
}
},
"path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="
},
"resolve-from": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
}
} }
}, },
"graphql-language-service": { "graphql-language-service": {
"version": "3.2.4", "version": "4.1.4",
"resolved": "https://registry.npmjs.org/graphql-language-service/-/graphql-language-service-3.2.4.tgz", "resolved": "https://registry.npmjs.org/graphql-language-service/-/graphql-language-service-4.1.4.tgz",
"integrity": "sha512-s8WZnfem09gRJm/CmX8laT8O0V7eAcD9DaTZ4/OEAl6wnX4PrYfYC0Y7UxoXaQJDsuFfoQBSH59Kv4Fmf4dgZw==", "integrity": "sha512-LJk1vwwWwh8onewIzjbXXfa7C5mI6tNN67yztFbmQmfDQv1naZfqKLitudQWaDwJgLqAlpKIefRaeU3cNYHRFQ==",
"requires": { "requires": {
"graphql-language-service-interface": "^2.9.4", "graphql-language-service-interface": "^2.10.2",
"graphql-language-service-parser": "^1.10.3", "graphql-language-service-parser": "^1.10.4",
"graphql-language-service-types": "^1.8.6", "graphql-language-service-types": "^1.8.7",
"graphql-language-service-utils": "^2.6.3" "graphql-language-service-utils": "^2.7.1"
} }
}, },
"graphql-language-service-interface": { "graphql-language-service-interface": {
"version": "2.9.4", "version": "2.10.2",
"resolved": "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.9.4.tgz", "resolved": "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.10.2.tgz",
"integrity": "sha512-AVzes7j0Q5fHfqzZ2JcAUaIGn2PimxwZpPv6ag1xtmGrKl/FNTi8y5Z3QuL/576NvQxaNzVmlUKMzZDIvoFNxg==", "integrity": "sha512-RKIEBPhRMWdXY3fxRs99XysTDnEgAvNbu8ov/5iOlnkZsWQNzitjtd0O0l1CutQOQt3iXoHde7w8uhCnKL4tcg==",
"requires": { "requires": {
"graphql-config": "^4.1.0", "graphql-config": "^4.1.0",
"graphql-language-service-parser": "^1.10.3", "graphql-language-service-parser": "^1.10.4",
"graphql-language-service-types": "^1.8.6", "graphql-language-service-types": "^1.8.7",
"graphql-language-service-utils": "^2.6.3", "graphql-language-service-utils": "^2.7.1",
"vscode-languageserver-types": "^3.15.1" "vscode-languageserver-types": "^3.15.1"
} }
}, },
"graphql-language-service-parser": { "graphql-language-service-parser": {
"version": "1.10.3", "version": "1.10.4",
"resolved": "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.10.3.tgz", "resolved": "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.10.4.tgz",
"integrity": "sha512-vGHf7g4zxwIt2RxJI0YKkN5Zhjp3s4RmqRij2FS96K08V8lzPvGcaDRcr8Bzoeb20YZPwPAidZjSt/yYqzyX1w==", "integrity": "sha512-duDE+0aeKLFVrb9Kf28U84ZEHhHcvTjWIT6dJbIAQJWBaDoht0D4BK9EIhd94I3DtKRc1JCJb2+70y1lvP/hiA==",
"requires": { "requires": {
"graphql-language-service-types": "^1.8.6" "graphql-language-service-types": "^1.8.7"
} }
}, },
"graphql-language-service-types": { "graphql-language-service-types": {
"version": "1.8.6", "version": "1.8.7",
"resolved": "https://registry.npmjs.org/graphql-language-service-types/-/graphql-language-service-types-1.8.6.tgz", "resolved": "https://registry.npmjs.org/graphql-language-service-types/-/graphql-language-service-types-1.8.7.tgz",
"integrity": "sha512-1xH2kqkgKjvfsc/+fyDnzP21aSSofbVYfzyH8QcNCsxVF0zEvUij+3qyO/dHmQljIyc+Ss62J2udlnZEZM0hcA==", "integrity": "sha512-LP/Mx0nFBshYEyD0Ny6EVGfacJAGVx+qXtlJP4hLzUdBNOGimfDNtMVIdZANBXHXcM41MDgMHTnyEx2g6/Ttbw==",
"requires": { "requires": {
"graphql-config": "^4.1.0" "graphql-config": "^4.1.0",
"vscode-languageserver-types": "^3.15.1"
} }
}, },
"graphql-language-service-utils": { "graphql-language-service-utils": {
"version": "2.6.3", "version": "2.7.1",
"resolved": "https://registry.npmjs.org/graphql-language-service-utils/-/graphql-language-service-utils-2.6.3.tgz", "resolved": "https://registry.npmjs.org/graphql-language-service-utils/-/graphql-language-service-utils-2.7.1.tgz",
"integrity": "sha512-rc5SToegDZ3VlnC0J7EriWe3G9zxFsPspxNV/rqcMcMq2hON9Q53bxTdg75KTNRUY78h+1ZHsXPEgecQtVk+0w==", "integrity": "sha512-Wci5MbrQj+6d7rfvbORrA9uDlfMysBWYaG49ST5TKylNaXYFf3ixFOa74iM1KtM9eidosUbI3E1JlWi0JaidJA==",
"requires": { "requires": {
"graphql-language-service-types": "^1.8.6", "@types/json-schema": "7.0.9",
"graphql-language-service-types": "^1.8.7",
"nullthrows": "^1.0.0" "nullthrows": "^1.0.0"
},
"dependencies": {
"@types/json-schema": {
"version": "7.0.9",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
"integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ=="
}
} }
}, },
"graphql-sse": { "graphql-sse": {
...@@ -7369,6 +7372,11 @@ ...@@ -7369,6 +7372,11 @@
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==", "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==",
"dev": true "dev": true
}, },
"hexy": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/hexy/-/hexy-0.3.4.tgz",
"integrity": "sha512-P2V2yx+XhEJRjXCe9IlRzbcL33plTaIjn+OSvgWu0Z9+2WkL71d+eC4jQ91rooM+F0JNERnENH6mpHlpcT+qlA=="
},
"highlight.js": { "highlight.js": {
"version": "10.7.2", "version": "10.7.2",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.2.tgz", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.2.tgz",
...@@ -7842,8 +7850,7 @@ ...@@ -7842,8 +7850,7 @@
"inherits": { "inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
"dev": true
}, },
"inquirer": { "inquirer": {
"version": "6.5.2", "version": "6.5.2",
...@@ -8290,9 +8297,9 @@ ...@@ -8290,9 +8297,9 @@
"integrity": "sha512-+az2gi/hvex7eLTMTlbRLOhH6P6WFdk2ITI8HJsaH2VqYO0I594zXSYEP+tf4FW+8Cy68ScDXoAsQdyQanv3sw==" "integrity": "sha512-+az2gi/hvex7eLTMTlbRLOhH6P6WFdk2ITI8HJsaH2VqYO0I594zXSYEP+tf4FW+8Cy68ScDXoAsQdyQanv3sw=="
}, },
"js-base64": { "js-base64": {
"version": "2.6.4", "version": "3.7.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.2.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" "integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ=="
}, },
"js-calendar": { "js-calendar": {
"version": "1.2.3", "version": "1.2.3",
...@@ -8480,9 +8487,9 @@ ...@@ -8480,9 +8487,9 @@
"integrity": "sha512-dxLob7q65Xg2DvstYkRpkYtmKm2sPJ9oFhrhmudT1dZvNFFTlroai3AWSpLey/w5vMcLBXRgOJsbXpdN9HzU/A==" "integrity": "sha512-dxLob7q65Xg2DvstYkRpkYtmKm2sPJ9oFhrhmudT1dZvNFFTlroai3AWSpLey/w5vMcLBXRgOJsbXpdN9HzU/A=="
}, },
"jsrsasign": { "jsrsasign": {
"version": "10.5.0", "version": "10.5.1",
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-10.5.0.tgz", "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-10.5.1.tgz",
"integrity": "sha512-AC1kfL1LJASKBLGv4bLLl+auFlsBajOxEcggL7fn8cp7nMRPhyln3LK/Q9lEDCrxYFU35NGUeFtUBCbasoF2Uw==" "integrity": "sha512-yW0fq87KNZFw4Pn5ySllXs3ztZAROQZczEheKZTqmiNpCe/Xj9r5NhuAQ7MXTOyEZGJ/+MPHGTsfbgPFaLpwHQ=="
}, },
"jsrsasign-util": { "jsrsasign-util": {
"version": "1.0.5", "version": "1.0.5",
...@@ -9409,6 +9416,11 @@ ...@@ -9409,6 +9416,11 @@
"lower-case": "^1.1.1" "lower-case": "^1.1.1"
} }
}, },
"node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="
},
"node-fetch": { "node-fetch": {
"version": "2.6.6", "version": "2.6.6",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
...@@ -10184,6 +10196,11 @@ ...@@ -10184,6 +10196,11 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"peek-readable": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.1.tgz",
"integrity": "sha512-7qmhptnR0WMSpxT5rMHG9bW/mYSR1uqaPFj2MHvT+y/aOUu6msJijpKt5SkTDKySwg65OWG2JwTMBlgcbwMHrQ=="
},
"performance-now": { "performance-now": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz", "resolved": "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz",
...@@ -10356,9 +10373,9 @@ ...@@ -10356,9 +10373,9 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "8.4.4", "version": "8.4.5",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.4.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz",
"integrity": "sha512-joU6fBsN6EIer28Lj6GDFoC/5yOZzLCfn0zHAn/MYXI7aPt4m4hK5KC5ovEZXy+lnCjmYIbQWngvju2ddyEr8Q==", "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==",
"requires": { "requires": {
"nanoid": "^3.1.30", "nanoid": "^3.1.30",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
...@@ -11688,9 +11705,9 @@ ...@@ -11688,9 +11705,9 @@
"dev": true "dev": true
}, },
"prettier": { "prettier": {
"version": "2.5.0", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.0.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
"integrity": "sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==" "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg=="
}, },
"prettier-plugin-sql": { "prettier-plugin-sql": {
"version": "0.3.0", "version": "0.3.0",
...@@ -12098,6 +12115,26 @@ ...@@ -12098,6 +12115,26 @@
} }
} }
}, },
"readable-web-to-node-stream": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz",
"integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==",
"requires": {
"readable-stream": "^3.6.0"
},
"dependencies": {
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"readdirp": { "readdirp": {
"version": "3.5.0", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
...@@ -12509,8 +12546,7 @@ ...@@ -12509,8 +12546,7 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"dev": true
}, },
"safe-regex": { "safe-regex": {
"version": "1.1.0", "version": "1.1.0",
...@@ -12813,9 +12849,9 @@ ...@@ -12813,9 +12849,9 @@
} }
}, },
"sm-crypto": { "sm-crypto": {
"version": "0.1.4", "version": "0.3.7",
"resolved": "https://registry.npmjs.org/sm-crypto/-/sm-crypto-0.1.4.tgz", "resolved": "https://registry.npmjs.org/sm-crypto/-/sm-crypto-0.3.7.tgz",
"integrity": "sha512-zAu1lvSZNAqkR3B/gdfI4WRUPCHtr5joFd/jzouz1bEkYtH9pi/44YaYWerjlDZi6llZBoFs7MRPP7YEVtKPjw==", "integrity": "sha512-t9SVgGpFkqaQtA8P81+b+gNBDZUyGhSq46ojA8YWf1mKYk8qcRqeCPte+WxLSMaGT38CJLoj43ljfpKX3LZVfA==",
"requires": { "requires": {
"jsbn": "^1.1.0" "jsbn": "^1.1.0"
} }
...@@ -13460,7 +13496,6 @@ ...@@ -13460,7 +13496,6 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": { "requires": {
"safe-buffer": "~5.1.0" "safe-buffer": "~5.1.0"
} }
...@@ -13505,6 +13540,15 @@ ...@@ -13505,6 +13540,15 @@
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true "dev": true
}, },
"strtok3": {
"version": "6.2.4",
"resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.2.4.tgz",
"integrity": "sha512-GO8IcFF9GmFDvqduIspUBwCzCbqzegyVKIsSymcMgiZKeCfrN9SowtUoi8+b59WZMAjIzVZic/Ft97+pynR3Iw==",
"requires": {
"@tokenizer/token": "^0.3.0",
"peek-readable": "^4.0.1"
}
},
"style-mod": { "style-mod": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.0.0.tgz", "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.0.0.tgz",
...@@ -14007,6 +14051,15 @@ ...@@ -14007,6 +14051,15 @@
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
"dev": true "dev": true
}, },
"token-types": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-4.1.1.tgz",
"integrity": "sha512-hD+QyuUAyI2spzsI0B7gf/jJ2ggR4RjkAo37j3StuePhApJUwcWDjnHDOFdIWYSwNR28H14hpwm4EI+V1Ted1w==",
"requires": {
"@tokenizer/token": "^0.3.0",
"ieee754": "^1.2.1"
}
},
"toposort": { "toposort": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npm.taobao.org/toposort/download/toposort-1.0.7.tgz", "resolved": "https://registry.npm.taobao.org/toposort/download/toposort-1.0.7.tgz",
...@@ -14113,9 +14166,9 @@ ...@@ -14113,9 +14166,9 @@
"dev": true "dev": true
}, },
"typescript": { "typescript": {
"version": "4.5.2", "version": "4.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==" "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg=="
}, },
"uglify-js": { "uglify-js": {
"version": "3.14.3", "version": "3.14.3",
...@@ -14140,9 +14193,9 @@ ...@@ -14140,9 +14193,9 @@
"integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=" "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag="
}, },
"undici": { "undici": {
"version": "4.10.3", "version": "4.12.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-4.10.3.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-4.12.1.tgz",
"integrity": "sha512-oMfhoSsFdu7ft+10gBpQ98gfIGT6qovXXRxYPOe07xfUJwpVTcFs0xvuAEpNqtObhf4HQWuMW5kWzaD768YS4Q==" "integrity": "sha512-MSfap7YiQJqTPP12C11PFRs9raZuVicDbwsZHTjB0a8+SsCqt7KdUis54f373yf7ZFhJzAkGJLaKm0202OIxHg=="
}, },
"unicode-canonical-property-names-ecmascript": { "unicode-canonical-property-names-ecmascript": {
"version": "1.0.4", "version": "1.0.4",
...@@ -14425,8 +14478,7 @@ ...@@ -14425,8 +14478,7 @@
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz", "resolved": "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
"dev": true
}, },
"util.promisify": { "util.promisify": {
"version": "1.0.0", "version": "1.0.0",
...@@ -14580,9 +14632,9 @@ ...@@ -14580,9 +14632,9 @@
"dev": true "dev": true
}, },
"vue-i18n": { "vue-i18n": {
"version": "8.26.7", "version": "8.26.8",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.26.7.tgz", "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.26.8.tgz",
"integrity": "sha512-7apa5PvRg1YCLoraE3lOgpCG8hJGupLCtywQWedWsgBbvF0TOgFvhitqK9xRH0PBGG1G8aiJz9oklyNDFfDxLg==" "integrity": "sha512-BN2OXolO15AKS95yNF8oOtARibaO6RxyKkAYNV4XpOmL7S4eVZYMIDtyvDv+XGZaiUmBJSH9mdNqzexvGMnK2A=="
}, },
"vue-loader": { "vue-loader": {
"version": "15.9.6", "version": "15.9.6",
...@@ -14767,6 +14819,11 @@ ...@@ -14767,6 +14819,11 @@
"defaults": "^1.0.3" "defaults": "^1.0.3"
} }
}, },
"web-streams-polyfill": {
"version": "4.0.0-beta.1",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz",
"integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ=="
},
"webidl-conversions": { "webidl-conversions": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
...@@ -15325,11 +15382,11 @@ ...@@ -15325,11 +15382,11 @@
} }
}, },
"xml-formatter": { "xml-formatter": {
"version": "2.5.1", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/xml-formatter/-/xml-formatter-2.5.1.tgz", "resolved": "https://registry.npmjs.org/xml-formatter/-/xml-formatter-2.6.0.tgz",
"integrity": "sha512-qJwnz5uNMs4mc7jX3UH80taCK4BHnXX91MvByple+iOS2P1eNeifGAfPnKuteyHg8pehbhTBHPBunGOQ53nKdQ==", "integrity": "sha512-+bQeoiE5W3CJdDCHTlveYSWFfQWnYB3uHGeRJ6LlEsL5kT++mWy9iN1cMeEDfBbgOnXO2DNUbmQ6elkR/mCcjg==",
"requires": { "requires": {
"xml-parser-xo": "^3.1.2" "xml-parser-xo": "^3.2.0"
} }
}, },
"xml-parse-from-string": { "xml-parse-from-string": {
...@@ -15338,9 +15395,9 @@ ...@@ -15338,9 +15395,9 @@
"integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig=" "integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig="
}, },
"xml-parser-xo": { "xml-parser-xo": {
"version": "3.1.2", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/xml-parser-xo/-/xml-parser-xo-3.1.2.tgz", "resolved": "https://registry.npmjs.org/xml-parser-xo/-/xml-parser-xo-3.2.0.tgz",
"integrity": "sha512-Qyttmiy305unyg1ONpArT4FPDL3J+ohXWpMI1ecopClGMw53lCRHJ4FV/fVYHFU6qfEzMV0frqSlNaLo2dw15Q==" "integrity": "sha512-8LRU6cq+d7mVsoDaMhnkkt3CTtAs4153p49fRo+HIB3I1FD1o5CeXRjRH29sQevIfVJIcPjKSsPU/+Ujhq09Rg=="
}, },
"xml2js": { "xml2js": {
"version": "0.4.23", "version": "0.4.23",
......
{ {
"name": "c-tool", "name": "c-tool",
"version": "1.9.3", "version": "1.10.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve --port 8081", "serve": "vue-cli-service serve --port 8081",
...@@ -9,34 +9,39 @@ ...@@ -9,34 +9,39 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"@babel/parser": "^7.16.4", "@babel/parser": "^7.16.7",
"@prettier/plugin-php": "^0.17.6", "@prettier/plugin-php": "^0.17.6",
"@typescript-eslint/typescript-estree": "^5.4.0", "@typescript-eslint/typescript-estree": "^5.8.1",
"angular-html-parser": "^1.8.0", "angular-html-parser": "^1.8.0",
"axios": "^0.21.4", "axios": "^0.21.4",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"bignumber.js": "^9.0.1", "bignumber.js": "^9.0.2",
"code-formatter": "0.0.1", "code-formatter": "0.0.1",
"codemirror": "^5.64.0", "codemirror": "^5.65.0",
"codemirror-graphql": "^1.2.4", "codemirror-graphql": "^1.2.11",
"cosmiconfig": "^7.0.1", "cosmiconfig": "^7.0.1",
"cron-parser": "^2.16.3", "cron-parser": "^2.16.3",
"cronstrue": "^1.122.0", "cronstrue": "^1.122.0",
"crypto-js": "^3.3.0", "crypto-js": "^3.3.0",
"csv-parse": "^5.0.4",
"csv-stringify": "^6.0.5",
"darkreader": "^4.9.43",
"diff-match-patch": "^1.0.5", "diff-match-patch": "^1.0.5",
"file": "^0.2.2", "file": "^0.2.2",
"file-type": "^16.5.3",
"graphql": "15.7.2", "graphql": "15.7.2",
"hexy": "^0.3.4",
"ipinyinjs": "^1.0.0", "ipinyinjs": "^1.0.0",
"jian_fan": "^1.0.3", "jian_fan": "^1.0.3",
"jimp": "^0.16.1", "jimp": "^0.16.1",
"js-base64": "^2.6.4", "js-base64": "^3.7.2",
"js-htmlencode": "^0.3.0", "js-htmlencode": "^0.3.0",
"js-yaml": "^3.14.1", "js-yaml": "^3.14.1",
"jsbarcode": "^3.11.5", "jsbarcode": "^3.11.5",
"json-to-properties": "^1.1.3", "json-to-properties": "^1.1.3",
"json5": "^2.2.0", "json5": "^2.2.0",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"jsrsasign": "^10.5.0", "jsrsasign": "^10.5.1",
"jsrsasign-util": "^1.0.5", "jsrsasign-util": "^1.0.5",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
...@@ -44,28 +49,28 @@ ...@@ -44,28 +49,28 @@
"moment": "^2.29.1", "moment": "^2.29.1",
"php-array-reader": "^1.3.2", "php-array-reader": "^1.3.2",
"phparr": "^0.2.0", "phparr": "^0.2.0",
"postcss": "^8.4.4", "postcss": "^8.4.5",
"postcss-less": "^5.0.0", "postcss-less": "^5.0.0",
"postcss-scss": "^4.0.2", "postcss-scss": "^4.0.2",
"prettier": "^2.5.0", "prettier": "^2.5.1",
"prettier-plugin-sql": "^0.3.0", "prettier-plugin-sql": "^0.3.0",
"properties-to-json": "^0.1.7", "properties-to-json": "^0.1.7",
"qrcode": "^1.5.0", "qrcode": "^1.5.0",
"qrcode-parser": "^1.2.0", "qrcode-parser": "^1.2.0",
"query-string": "^6.14.1", "query-string": "^6.14.1",
"serialize-php": "^1.1.2", "serialize-php": "^1.1.2",
"sm-crypto": "^0.1.4", "sm-crypto": "^0.3.7",
"system": "^2.0.1", "system": "^2.0.1",
"typescript": "^4.5.2", "typescript": "^4.5.4",
"uglify-js": "3.14.3", "uglify-js": "3.14.3",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"view-design": "^4.7.0", "view-design": "^4.7.0",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-i18n": "^8.26.7", "vue-i18n": "^8.26.8",
"vue-router": "^3.5.3", "vue-router": "^3.5.3",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"x2js": "github:abdolence/x2js", "x2js": "github:abdolence/x2js",
"xml-formatter": "^2.5.1" "xml-formatter": "^2.6.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.12.1", "@vue/cli-plugin-babel": "^3.12.1",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Ctool 程序开发常用工具</title> <title>Ctool 程序开发常用工具</title>
</head> </head>
<body style="padding-bottom: 30px"> <body>
<div id="page" style="width: 800px;height: 550px;margin: 0 auto;padding: 0 10px;overflow-y:auto;"> <div id="page" style="width: 800px;height: 550px;margin: 0 auto;padding: 0 10px;overflow-y:auto;">
<div id="app"></div> <div id="app"></div>
</div> </div>
......
{ {
"name": "Ctool 程序开发常用工具", "name": "__MSG_main_manifest_name__",
"description": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等...", "description": "__MSG_main_manifest_description__",
"version": "##version##", "version": "##version##",
"author": "wo@baiy.org", "author": "wo@baiy.org",
"offline_enabled": true, "offline_enabled": true,
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"browser_action": { "browser_action": {
"default_icon": "img/icon_chrome.png", "default_icon": "img/icon_chrome.png",
"default_title": "常用开发工具", "default_title": "__MSG_main_manifest_default_title__",
"default_popup": "index.html" "default_popup": "index.html"
}, },
"background": { "background": {
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
], ],
"commands": { "commands": {
"panel": { "panel": {
"description": "打开独立工具窗口", "description": "__MSG_main_manifest_commands_panel_description__",
"global": true "global": true
} }
}, },
......
{ {
"name": "Ctool 程序开发常用工具", "name": "__MSG_main_manifest_name__",
"description": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等...", "description": "__MSG_main_manifest_description__",
"version": "##version##", "version": "##version##",
"author": "wo@baiy.org", "author": "wo@baiy.org",
"offline_enabled": true, "offline_enabled": true,
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"browser_action": { "browser_action": {
"default_icon": "img/icon_chrome.png", "default_icon": "img/icon_chrome.png",
"default_title": "常用开发工具", "default_title": "__MSG_main_manifest_default_title__",
"default_popup": "index.html" "default_popup": "index.html"
}, },
"background": { "background": {
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
], ],
"commands": { "commands": {
"panel": { "panel": {
"description": "打开独立工具窗口", "description": "__MSG_main_manifest_commands_panel_description__",
"global": true "global": true
} }
} }
......
export const openUrl = (url) => { export const openUrl = (url) => {
return browser.tabs.create({url:url}); return browser.tabs.create({url:url});
} }
export const getMessage = (messageName, values = {}, placeholders = []) => {
let substitutions = []
placeholders.forEach((key) => {
substitutions.push((key in values) ? values[key] : "")
})
return browser.i18n.getMessage(messageName, substitutions);
}
{ {
"name": "Ctool 程序开发常用工具", "name": "__MSG_main_manifest_name__",
"description": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等...", "description": "__MSG_main_manifest_description__",
"version": "##version##", "version": "##version##",
"author": "wo@baiy.org", "author": "wo@baiy.org",
"homepage_url": "https://github.com/baiy/Ctool", "homepage_url": "https://github.com/baiy/Ctool",
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
"manifest_version": 2, "manifest_version": 2,
"browser_action": { "browser_action": {
"default_icon": "img/icon_chrome.png", "default_icon": "img/icon_chrome.png",
"default_title": "常用开发工具", "default_title": "__MSG_main_manifest_default_title__",
"default_popup": "index.html" "default_popup": "index.html"
}, },
"default_locale": "zh_CN",
"background": { "background": {
"scripts": ["background.js"] "scripts": ["background.js"]
}, },
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
"commands": { "commands": {
"_execute_browser_action": {}, "_execute_browser_action": {},
"panel": { "panel": {
"description": "打开独立工具窗口" "description": "__MSG_main_manifest_commands_panel_description__"
} }
} }
} }
<template>
<div v-show="show" class="ctool-bottom">
<div class="ctool-bottom-block">
<notice-block/>
</div>
</div>
</template>
<script>
import Notice from './components/notice'
export default {
name: "bottom",
components: {
"notice-block": Notice
},
data() {
return {show: false}
},
methods: {
setShow() {
this.show = true
}
}
}
</script>
<style scoped>
.ctool-bottom {
width: 100%;
position: fixed;
z-index: 9999;
bottom: 0;
left: 0;
height: 30px;
overflow: hidden;
border-top: 1px solid #dcdee2;
background: #FFF;
}
.ctool-bottom-block {
height: 28px;
line-height: 28px;
overflow: hidden;
}
</style>
\ No newline at end of file
<template>
<div>
<div class="ctool-bottom">
<div class="ctool-bottom-right" style="width: 210px">
<Tooltip class="ctool-bottom-tooltip" transfer :content="$t('main_tool_'+currentTool) + ' -' + $t('main_history')" placement="top">
<Badge v-if="historyLength>0" dot :offset="[6,10]">
<Icon type="md-time" :size="22" @click="historyShow= true"/>
</Badge>
<template v-else>
<Icon type="md-time" :size="22" @click="historyShow= true"/>
</template>
</Tooltip>
<Tooltip class="ctool-bottom-tooltip" transfer content="Github" placement="top">
<Icon type="logo-github" :size="22" @click="openUrl('https://github.com/baiy/Ctool')"/>
</Tooltip>
<Tooltip class="ctool-bottom-tooltip" transfer :content="$t('main_ui_setting')" placement="top">
<Icon type="md-settings" :size="22" @click="settingShow = true"/>
</Tooltip>
<Tooltip class="ctool-bottom-tooltip" transfer :content="$t('main_ui_issues')" placement="top">
<Icon type="md-help-circle" :size="22" @click="openUrl('https://github.com/baiy/Ctool/issues')"/>
</Tooltip>
<Tooltip class="ctool-bottom-tooltip" transfer :content="$t('main_ui_open_full')" placement="top">
<Icon type="md-expand" :size="22" @click="openUrl('_new')" v-if="!isUtools"/>
</Tooltip>
</div>
<div class="ctool-bottom-block" style="margin-right: 210px">
<notice-block/>
</div>
</div>
<Drawer :title="$t('main_ui_setting')" v-model="settingShow" :width="400">
<setting-block v-if="settingShow"></setting-block>
</Drawer>
<Drawer :title="$t('main_tool_'+currentTool)+' - '+$t('main_history')" v-model="historyShow" :width="100">
<History v-if="historyShow" @close="historyShow = false"/>
</Drawer>
</div>
</template>
<script>
import Notice from './notice'
import History from './history'
import {isUtools, openUrl} from '../helper'
import settingBlock from "../views/setting/block"
import model from "../tool/model";
import historyFactory from "../tool/history";
export default {
name: "bottom",
components: {
"notice-block": Notice,
"setting-block": settingBlock,
History
},
data() {
return {
isUtools,
settingShow: false,
historyShow: false,
currentTool: model.getCurrentTool(),
currentToolSetInterval: null,
}
},
computed: {
historyLength() {
return historyFactory(this.currentTool).length()
}
},
created() {
this.currentToolSetInterval = setInterval(() => {
this.currentTool = model.getCurrentTool()
}, 2000);
},
methods: {
openUrl(url) {
openUrl(url === '_new' ? window.location.href : url)
}
},
destroyed() {
if (this.currentToolSetInterval !== null) {
clearInterval(this.currentToolSetInterval);
this.currentToolSetInterval = null
}
},
}
</script>
<style>
.ctool-bottom {
width: 100%;
position: fixed;
bottom: 0;
left: 0;
height: 33px;
padding-top: 2px;
overflow: hidden;
border-top: 1px solid #dcdee2;
background: #FFF;
}
.ctool-bottom-block {
height: 30px;
line-height: 30px;
overflow: hidden;
}
.ctool-bottom-right {
line-height: 30px;
float: right;
text-align: right;
}
.ctool-bottom-right .ivu-icon {
margin-right: 15px;
cursor: pointer;
}
.ctool-bottom-right .ivu-icon:hover {
color: #1abc9c;
}
</style>
<template>
<div>
<Table ref="historyTable" border :columns="columns" :data="lists" :height="tableHeight">
<template slot-scope="{ row }" slot="_value">
<div>{{ stringify(row.value) }}}</div>
</template>
<template slot-scope="{ index }" slot="_op">
<Button type="primary" size="small" @click="view(index)">{{ $t('main_ui_views') }}</Button>
<Button type="primary" style="margin-left: 5px" @click="load(index)" size="small">
{{ $t('main_ui_load') }}
</Button>
</template>
</Table>
<div class="drawer-footer">
<Button type="primary" @click="clear">{{ $t('main_history_clear') }}</Button>
</div>
</div>
</template>
<script>
import model from '../tool/model'
import historyFactory, {setForceLoadHistoryIndex} from "../tool/history";
export default {
name: "history",
data() {
return {
lists: [],
columns: [
{
title: this.$t('main_history_time'),
key: 'time',
width: 180
},
{
title: this.$t('main_history_data'),
slot: '_value',
ellipsis: true,
},
{
title: this.$t('main_history_op'),
slot: '_op',
width: 160
}
],
}
},
computed: {
tableHeight() {
// 设置表格高度
return window.innerHeight - 140
}
},
created() {
let history = historyFactory(this.currentTool())
if (history.length() < 1) {
return this.$Message.error(this.$t('main_history_null').toString())
}
this.lists = history.all()
},
methods: {
currentTool() {
return model.getCurrentTool()
},
stringify(value) {
return JSON.stringify(value)
},
view(index) {
this.$Modal.info({
render: (h) => {
return h('Input', {
props: {
type: "textarea",
rows: 10,
value: JSON.stringify(historyFactory(this.currentTool()).get(index), null, "\t"),
}
})
},
width: 700,
okText: this.$t('main_ui_close')
})
},
load(index) {
setForceLoadHistoryIndex(index)
this.close()
this.$router.push({
path: this.$router.currentRoute.fullPath,
query: {
t: Date.now(),
},
});
},
clear() {
historyFactory(model.getCurrentTool()).clear()
this.close()
},
close(){
this.$emit('close')
}
}
};
</script>
<style scoped>
.drawer-footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
</style>
...@@ -16,6 +16,8 @@ import cache from "../tool/cache"; ...@@ -16,6 +16,8 @@ import cache from "../tool/cache";
import user from "../tool/user"; import user from "../tool/user";
import axios from "axios"; import axios from "axios";
import _ from "lodash"; import _ from "lodash";
import {dispatchWindowResize} from '../tool/event'
import {getCurrentLocale} from "../i18n/index";
const CACHE_NAME = 'notice_item'; const CACHE_NAME = 'notice_item';
const CACHE_EXPIRY = 3600 * 24; const CACHE_EXPIRY = 3600 * 24;
...@@ -86,6 +88,7 @@ export default { ...@@ -86,6 +88,7 @@ export default {
url: 'https://www.baiy.org/chrome_tool/notice/', url: 'https://www.baiy.org/chrome_tool/notice/',
responseType: 'json', responseType: 'json',
params: { params: {
i: getCurrentLocale(),
v: env('version'), v: env('version'),
p: env('platform'), p: env('platform'),
u: user.uid(), u: user.uid(),
...@@ -114,9 +117,9 @@ export default { ...@@ -114,9 +117,9 @@ export default {
if (this.listData.length > 1) { if (this.listData.length > 1) {
this.timer = setInterval(this.scrollAnimate, 6000); this.timer = setInterval(this.scrollAnimate, 6000);
} }
if (this.listData.length > 0) { this.$nextTick(()=>{
this.$parent['setShow']() dispatchWindowResize()
} })
}, },
scrollAnimate() { scrollAnimate() {
this.animateUp = true this.animateUp = true
......
...@@ -4,30 +4,34 @@ ...@@ -4,30 +4,34 @@
</Form> </Form>
</template> </template>
<script> <script>
export default { export default {
name: 'optionBlock', name: 'optionBlock',
props: { props: {
center: { center: {
type: Boolean, type: Boolean,
default: false default: false
},
}, },
computed:{ disablePadding: {
style(){ type: Boolean,
let css = { default: false
padding:"10px 0", }
}; },
if (this.center){ computed: {
css.textAlign = "center" style() {
} let css = {
return css; padding: !this.disablePadding ? "10px 0" : "0",
};
if (this.center) {
css.textAlign = "center"
} }
return css;
} }
}; }
};
</script> </script>
<style> <style>
.option-block .ivu-form-item{ .option-block .ivu-form-item {
margin-bottom: 0; margin-bottom: 0;
} }
</style> </style>
import VueI18n from 'vue-i18n' import VueI18n from 'vue-i18n'
import Vue from 'vue' import Vue from 'vue'
import {getMessage as chromiumGetMessage} from "../adapter/chromium/helper" import {getMessage as chromiumGetMessage} from "../adapter/chromium/helper"
import {isChromium} from "../helper"; import {getMessage as firefoxGetMessage} from "../adapter/firefox/helper"
import {isChromium,isFirefox} from "../helper";
import locales from "./locales/build.js"; import locales from "./locales/build.js";
Vue.use(VueI18n) Vue.use(VueI18n)
...@@ -35,7 +36,7 @@ const translate = (code, key, values = {}) => { ...@@ -35,7 +36,7 @@ const translate = (code, key, values = {}) => {
if (!key) return ''; if (!key) return '';
let locale = code === "_default" ? DEFAULT_LOCALE : code; let locale = code === "_default" ? DEFAULT_LOCALE : code;
if (isChromium && code === "_default") { if (code === "_default" && (isChromium || isFirefox) ) {
let placeholders = [] let placeholders = []
if ( if (
(locale in LOCALE_DETAIL) (locale in LOCALE_DETAIL)
...@@ -44,7 +45,12 @@ const translate = (code, key, values = {}) => { ...@@ -44,7 +45,12 @@ const translate = (code, key, values = {}) => {
) { ) {
placeholders = LOCALE_DETAIL[locale][key]['placeholders'] placeholders = LOCALE_DETAIL[locale][key]['placeholders']
} }
return chromiumGetMessage(key, values, placeholders) if (isChromium){
return chromiumGetMessage(key, values, placeholders)
}
if (isFirefox){
return firefoxGetMessage(key, values, placeholders)
}
} }
let text = getMessage(code, key); let text = getMessage(code, key);
......
{ {
"input": "Input", "input": "Input",
"encode":"Encode", "encode": "Encode",
"decode": "Decode", "decode": "Decode",
"url_safe":"Url Safe", "url_safe": "Url Safe",
"upload_file": "Upload File", "output": "Output",
"output":"Output" "error": "error: {0}",
"hex_dump": "Hex Dump",
"setting": "Setting",
"hex_dump_show_mode": "Show Mode",
"hex_dump_format": "Format",
"hex_dump_caps": "Caps Lock",
"hex_dump_caps_lower": "Lower",
"hex_dump_caps_upper": "Upper",
"hex_dump_width": "Width",
"hex_dump_show_mode_hex": "Hex",
"hex_dump_show_mode_text": "Text",
"hex_dump_setting": "Hex Dump Setting",
"hex_dump_format_twos": "Twos",
"hex_dump_format_fours": "Fours",
"hex_dump_format_eights": "Eights",
"hex_dump_format_sixteens": "Sixteens",
"hex_dump_format_none": "None",
} }
{ {
"input": "Input", "input": "Input",
"content_empty": "Please enter content", "output": "Output",
"json_input_empty": "Please Enter Json Content",
"error": "Exception:{0}", "error": "Exception:{0}",
"format": "Format", "format": "Format",
"compress": "Compress", "compress": "Compress",
"escape": "Escape", "escape": "Escape",
"clear_escape": "Unescape", "clear_escape": "Unescape",
"add_escape":"Add Escape",
"unicode":"Unicode",
"unicode_to_zh": "Unicode->Zh", "unicode_to_zh": "Unicode->Zh",
"zh_to_unicode": "Zh->Unicode", "zh_to_unicode": "Zh->Unicode",
"to_get": "To Get", "complete": "Processing is complete",
"get_to_json": "Get=>Json", "get": "Get Query",
"clear": "Clear" "object":"To Object",
"csv": "CSV",
"table":"Html Table",
"add_quote":"Add Quote",
"column_name":"Column Name",
"json_type_json": "Json",
"json_type_keyed": "Keyed",
"json_type_array": "Array",
"json_type_column": "Column Array"
} }
{
"input": "Input",
"output":"Output",
"type_error": "Conversion type error",
"format": "Beautify",
"error":"Error:{0}"
}
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
"ui_views": "View", "ui_views": "View",
"ui_load": "Loading", "ui_load": "Loading",
"ui_close": "Close", "ui_close": "Close",
"ui_copy_text_ok": "Result Copied ^o^", "ui_issues": "Issues Feedback",
"ui_open_full": "Open Full Screen Tab",
"ui_copy_text_ok": "Copy Success ^o^",
"ui_copy_image_ok": "Image Copied ^o^", "ui_copy_image_ok": "Image Copied ^o^",
// views // views
"setting_language": "Language", "setting_language": "Language",
...@@ -60,7 +62,6 @@ ...@@ -60,7 +62,6 @@
"tool_unit": "Unit Convert", "tool_unit": "Unit Convert",
"tool_time": "Time Calculator", "tool_time": "Time Calculator",
"tool_uuid": "UUID", "tool_uuid": "UUID",
"tool_jsonToObject": "JSON to Object",
"tool_ascii": "ASCII", "tool_ascii": "ASCII",
"tool_variableConversion": "Variable Name", "tool_variableConversion": "Variable Name",
"tool_jwt": "JWT", "tool_jwt": "JWT",
...@@ -71,5 +72,10 @@ ...@@ -71,5 +72,10 @@
"tool_armConverter": "ARM/HEX", "tool_armConverter": "ARM/HEX",
// other // other
"css_main_category_item_style": "padding: 0 10px", "css_main_category_item_style": "padding: 0 10px",
"editor_line_wrapping": "Line Wrapping" "editor_line_wrapping": "Line Wrapping",
// manifest
"manifest_name": "Ctool Commonly Used Developer Tools",
"manifest_description": "Commonly Used Developer Tools: Hash/Encrypt/Decrypt/Code Convert/Timestamp/Qrcode/IP Query/Code Formatter/Unicode/Regex/...",
"manifest_default_title": "Commonly Used Developer Tools",
"manifest_commands_panel_description": "Open Popup Tool Winodws"
} }
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
"generate_error": "Generate Error:{0}", "generate_error": "Generate Error:{0}",
"reader_title": "Reader", "reader_title": "Reader",
"reader_input": "Please enter the QR code image url or click the button below to upload the image", "reader_input": "Please enter the QR code image url or click the button below to upload the image",
"reader_upload": "Upload Image",
"reader_output": "Output", "reader_output": "Output",
"reader_error": "Reader Error:{0}", "reader_error": "Reader Error:{0}",
"reader_parsing_failure": "Image parsing failure", "reader_parsing_failure": "Image parsing failure",
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"reference": "Reference", "reference": "Reference",
"expression": "Expression", "expression": "Expression",
"replace_content": "Replace Content", "replace_content": "Replace Content",
"replace": "Replace",
"delete": "Delete", "delete": "Delete",
"input": "Input", "input": "Input",
"global": "Global", "global": "Global",
...@@ -10,23 +11,4 @@ ...@@ -10,23 +11,4 @@
"output_count": "{0} Total Matches", "output_count": "{0} Total Matches",
"output_emty": "No match result, please check expression", "output_emty": "No match result, please check expression",
"error": "Error:{0}", "error": "Error:{0}",
"reference_url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions",
"type_zh": "Chinese",
"type_complex": "Double-byte characters (including Chinese characters)",
"type_blank": "Blank lines",
"type_email": "Email",
"type_url": "URL",
"type_cn_mobile": "China Mobile Phone Number",
"type_ip": "IP",
"type_cn_tel": "China Phone Number",
"type_tencent_qq": "Tencent QQ",
"type_cn_postcode": "China Postcode",
"type_date": "Data (YYYY-MM-DD)",
"type_positive_integer": "Positive Integer",
"type_negative_integer": "Negative Integer",
"type_integer": "Integer",
"type_non_negative_integer": "Non Negative Integer",
"type_non_positive_integer": "Non Positive Integer",
"type_positive_float": "Positive Float",
"type_negative_float": "Negative Float"
} }
...@@ -19,5 +19,12 @@ ...@@ -19,5 +19,12 @@
"day": "Day", "day": "Day",
"hour": "Hour", "hour": "Hour",
"minute": "Minute", "minute": "Minute",
"second": "Second" "second": "Second",
analyze: "Time Analyze",
analyze_year: "Year",
analyze_quarter: "Quarter",
analyze_month: "Month",
analyze_year_output: "{year}: Q{quarter},{weekOfYear} Week,{dayOfYear} Day,{hourOfYear} Hour,{minuteOfYear} Minute,{secondOfYear} Second",
analyze_quarter_output: "Q{quarter}:{weekOfQuarter} Week,{dayOfQuarter} Day,{hourOfQuarter} Hour,{minuteOfQuarter} Minute,{secondOfQuarter} Second",
analyze_month_output: "{month}:{weekOfMonth} Week,{hourOfMonth} Hour,{minuteOfMonth} Minute,{secondOfMonth} Second"
} }
{ {
"input": "输入", "input": "输入",
"encode":"编码", "encode": "编码",
"decode": "解码", "decode": "解码",
"url_safe":"Url 安全", "url_safe": "Url 安全",
"upload_file": "上传文件", "output": "输出",
"output":"输出" "error": "错误: {0}",
"hex_dump": "Hex Dump",
"setting": "配置",
"hex_dump_show_mode":"显示模式",
"hex_dump_format": "格式",
"hex_dump_caps": "大小写",
"hex_dump_caps_lower": "小写",
"hex_dump_caps_upper": "大写",
"hex_dump_width":"宽度",
"hex_dump_show_mode_hex": "十六进制",
"hex_dump_show_mode_text": "文本",
"hex_dump_setting": "十六进制显示配置",
"hex_dump_format_twos": "2位",
"hex_dump_format_fours": "4",
"hex_dump_format_eights": "8位",
"hex_dump_format_sixteens": "16位",
"hex_dump_format_none": "无分隔"
} }
{ {
"input": "输入", "input": "输入",
"content_empty": "请输入内容", "output": "输出",
"json_input_empty": "请输入JSON内容",
"error":"异常:{0}", "error":"异常:{0}",
"format": "格式化", "format": "格式化",
"compress":"压缩", "compress":"压缩",
"escape": "转移", "escape": "转义",
"clear_escape":"去除转移", "clear_escape":"去除转义",
"add_escape":"添加转义",
"unicode":"Unicode",
"unicode_to_zh": "Unicode转中文", "unicode_to_zh": "Unicode转中文",
"zh_to_unicode":"中文转Unicode", "zh_to_unicode":"中文转Unicode",
"to_get": "转Get参数", "complete": "处理完成",
"get_to_json":"Get参数转Json", "get": "Get参数",
"clear": "清空" "object":"转实体类",
"csv": "CSV",
"table":"Html Table",
"add_quote":"添加引号",
"column_name":"列名",
"json_type_json": "Json",
"json_type_keyed": "关联对象",
"json_type_array": "数组",
"json_type_column": "列数组",
} }
{
"input": "输入",
"output":"输出",
"type_error": "转换类型错误",
"format": "格式化",
"error":"错误:{0}"
}
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
"ui_views": "查看", "ui_views": "查看",
"ui_load": "加载", "ui_load": "加载",
"ui_close": "关闭", "ui_close": "关闭",
"ui_copy_text_ok": "结果已复制 ^o^", "ui_issues": "问题反馈",
"ui_open_full": "打开全屏窗口",
"ui_copy_text_ok": "复制成功 ^o^",
"ui_copy_image_ok": "图片已复制 ^o^", "ui_copy_image_ok": "图片已复制 ^o^",
// 界面 // 界面
"setting_language": "语言", "setting_language": "语言",
...@@ -55,12 +57,11 @@ ...@@ -55,12 +57,11 @@
"tool_randomString": "随机字符生成", "tool_randomString": "随机字符生成",
"tool_serializeConversion": "序列化转换", "tool_serializeConversion": "序列化转换",
"tool_diffs": "文本比对", "tool_diffs": "文本比对",
"tool_crontab": "crontab", "tool_crontab": "Crontab",
"tool_websocket": "websocket", "tool_websocket": "Websocket",
"tool_unit": "单位换算", "tool_unit": "单位换算",
"tool_time": "时间计算器", "tool_time": "时间计算器",
"tool_uuid": "UUID生成", "tool_uuid": "UUID生成",
"tool_jsonToObject": "JSON转实体类",
"tool_ascii": "ASCII", "tool_ascii": "ASCII",
"tool_variableConversion": "变量名", "tool_variableConversion": "变量名",
"tool_jwt": "JWT解码", "tool_jwt": "JWT解码",
...@@ -71,5 +72,10 @@ ...@@ -71,5 +72,10 @@
"tool_armConverter": "ARM/HEX", "tool_armConverter": "ARM/HEX",
// 其他 // 其他
"css_main_category_item_style": "padding: 0 20px", "css_main_category_item_style": "padding: 0 20px",
"editor_line_wrapping": "自动换行" "editor_line_wrapping": "自动换行",
// manifest
"manifest_name": "Ctool 程序开发常用工具",
"manifest_description": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等...",
"manifest_default_title": "常用开发工具",
"manifest_commands_panel_description": "打开独立工具窗口",
} }
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
"generate_error": "生成错误:{0}", "generate_error": "生成错误:{0}",
"reader_title": "二维码解析", "reader_title": "二维码解析",
"reader_input": "请输入二维码图片地址或点击下方按钮上传图片", "reader_input": "请输入二维码图片地址或点击下方按钮上传图片",
"reader_upload": "上传图片",
"reader_output": "输出", "reader_output": "输出",
"reader_error": "解析错误:{0}", "reader_error": "解析错误:{0}",
"reader_parsing_failure": "图片解析失败", "reader_parsing_failure": "图片解析失败",
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"reference": "参考", "reference": "参考",
"expression": "正则表达式", "expression": "正则表达式",
"replace_content": "替换内容", "replace_content": "替换内容",
"replace": "替换",
"delete": "删除", "delete": "删除",
"input": "输入待处理内容", "input": "输入待处理内容",
"global": "全局搜索", "global": "全局搜索",
...@@ -10,23 +11,4 @@ ...@@ -10,23 +11,4 @@
"output_count": "共 {0} 个匹配项", "output_count": "共 {0} 个匹配项",
"output_emty": "没有匹配结果,请检查正则", "output_emty": "没有匹配结果,请检查正则",
"error": "错误:{0}", "error": "错误:{0}",
"reference_url": "https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions",
"type_zh": "中文字符",
"type_complex": "双字节字符(包括汉字在内)",
"type_blank": "空白行",
"type_email": "Email地址",
"type_url": "网址URL",
"type_cn_mobile": "手机",
"type_ip": "IP地址",
"type_cn_tel": "国内电话号码",
"type_tencent_qq": "腾讯QQ号",
"type_cn_postcode": "中国邮政编码",
"type_date": "(年-月-日)格式日期",
"type_positive_integer": "正整数",
"type_negative_integer": "负整数",
"type_integer": "整数",
"type_non_negative_integer": "非负整数(正整数 + 0)",
"type_non_positive_integer": "非正整数(负整数 + 0)",
"type_positive_float": "正浮点数",
"type_negative_float": "负浮点数"
} }
...@@ -19,5 +19,12 @@ ...@@ -19,5 +19,12 @@
"day": "日", "day": "日",
"hour": "小时", "hour": "小时",
"minute": "分钟", "minute": "分钟",
"second": "秒" "second": "秒",
analyze: "时间分析",
analyze_year: "年",
analyze_quarter: "季度",
analyze_month: "月",
analyze_year_output: "{year}年:{quarter}季度,{weekOfYear}周,{dayOfYear}天,{hourOfYear}小时,{minuteOfYear}分钟,{secondOfYear}秒",
analyze_quarter_output: "{quarter}季度:{weekOfQuarter}周,{dayOfQuarter}天,{hourOfQuarter}小时,{minuteOfQuarter}分钟,{secondOfQuarter}秒",
analyze_month_output: "{month}月:{weekOfMonth}周,{hourOfMonth}小时,{minuteOfMonth}分钟,{secondOfMonth}秒"
} }
...@@ -4,7 +4,14 @@ ...@@ -4,7 +4,14 @@
@primary-color: #1abc9c; @primary-color: #1abc9c;
@link-color: #1abc9c; @link-color: #1abc9c;
.ivu-tooltip-content .ivu-tooltip-arrow{
display: none;
}
// 设置代码等宽字体 // 设置代码等宽字体
.CodeMirror-sizer { .CodeMirror-sizer
,.tool-monospace-font-family textarea
,.tool-monospace-font-family input
{
font-family: Consolas, Menlo, monospace, Courier; font-family: Consolas, Menlo, monospace, Courier;
} }
...@@ -3,23 +3,30 @@ import ViewUI from 'view-design' ...@@ -3,23 +3,30 @@ import ViewUI from 'view-design'
import './statics/theme.less' import './statics/theme.less'
import router from './tool.router' import router from './tool.router'
import optionBlock from './components/optionBlock' import optionBlock from './components/optionBlock'
import inputBlock from './components/inputBlock'
import {plugin as modelPlugin} from './tool/model' import {plugin as modelPlugin} from './tool/model'
import cache from './tool/cache' import cache from './tool/cache'
import setting from './tool/setting' import setting from './tool/setting'
import App from './tool.vue' import App from './tool.vue'
import {isUtools,setDisplayMode} from './helper' import {isUtools,isWeb} from './helper'
import theme from './tool/theme'
import {setCurrentLocale,i18n} from "./i18n";
const run = () => { const run = () => {
// 设置语言环境
setCurrentLocale(setting.locale())
// 设置显示模式 // 设置显示模式
setDisplayMode(setting.displayMode()) theme(setting.displayMode())
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ViewUI) Vue.use(ViewUI)
Vue.use(modelPlugin) Vue.use(modelPlugin)
Vue.component('option-block', optionBlock); Vue.component('option-block', optionBlock);
Vue.component('input-block', inputBlock);
new Vue({ new Vue({
i18n,
router, router,
render: h => h(App), render: h => h(App),
}).$mount('#app') }).$mount('#app')
...@@ -31,17 +38,13 @@ const run = () => { ...@@ -31,17 +38,13 @@ const run = () => {
} }
(function () { (function () {
if (document.body.clientWidth > 900 || isUtools) { if (document.body.clientWidth > 900 || isUtools || isWeb) {
console.log('调整窗口大小')
const page = document.getElementById('page') const page = document.getElementById('page')
page.style.width = 'auto' page.style.width = 'auto'
page.style.height = 'auto' page.style.height = 'auto'
page.style.minHeight = '550px'
} }
if (isUtools) { if (isUtools) {
window.utools.onPluginReady(() => { window.utools.onPluginReady(() => {
// 重设高度
window.utools.setExpendHeight(582)
run() run()
}) })
} else { } else {
......
...@@ -118,10 +118,6 @@ const routes = [ ...@@ -118,10 +118,6 @@ const routes = [
path: '/tool/uuid', path: '/tool/uuid',
component: r => require(['./views/tool/uuid.vue'], r) component: r => require(['./views/tool/uuid.vue'], r)
}, },
{
path: '/tool/jsonToObject',
component: r => require(['./views/tool/jsonToObject.vue'], r)
},
{ {
path: '/tool/ascii', path: '/tool/ascii',
component: r => require(['./views/tool/ascii.vue'], r) component: r => require(['./views/tool/ascii.vue'], r)
......
<template> <template>
<div> <div>
<Menu mode="horizontal" theme="light" :active-name="currentCategory" @on-select="categorySelect" <Menu class="tool-category-menu-block" mode="horizontal" theme="light" :active-name="currentCategory" @on-select="categorySelect"
style="height: 45px;line-height: 45px;"> style="height: 45px;line-height: 45px;">
<MenuItem :name="cat.name" v-for="(cat) in category" :key="cat.name"> <MenuItem :style="$t('main_css_main_category_item_style')" :name="cat.name" v-for="(cat) in category" :key="cat.name">
<Badge v-if="badgeCategoryIsShow(cat.name)" dot :offset="[15,-10]"> <Badge v-if="badgeCategoryIsShow(cat.name)" dot :offset="[15,-10]">
{{ cat.title }} {{ $t('main_category_'+cat.name) }}
</Badge> </Badge>
<template v-else> <template v-else>
{{ cat.title }} {{ $t('main_category_'+cat.name) }}
</template>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_new" v-if="!isUtools">
<Icon type="md-expand" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_feedback">
<Icon type="md-help-circle" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_setting">
<Icon type="md-settings" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_about">
<Icon type="logo-github" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_history">
<Badge v-if="historyLength>0" dot :offset="[10,-3]">
<Icon type="md-time" :size="24"/>
</Badge>
<template v-else>
<Icon type="md-time" :size="24"/>
</template> </template>
</MenuItem> </MenuItem>
</Menu> </Menu>
<RadioGroup :value="currentTool" @on-change="toolSelect" style="margin: 10px 0 10px 20px;line-height: 30px;"> <RadioGroup class="tool-select-block" :value="currentTool" @on-change="toolSelect" style="margin: 10px 0 10px 20px;line-height: 30px;">
<Radio :label="tool.name" v-for="(tool) in tools" :key="tool.name"> <Radio :label="tool.name" v-for="(tool) in tools" :key="tool.name">
<Badge v-if="badgeToolIsShow(tool.name)" dot :offset="[5,-5]"> <Badge v-if="badgeToolIsShow(tool.name)" dot :offset="[5,-5]">
{{ tool.title }} {{ $t('main_tool_'+tool.name) }}
</Badge> </Badge>
<template v-else> <template v-else>
{{ tool.title }} {{ $t('main_tool_'+tool.name) }}
</template> </template>
</Radio> </Radio>
</RadioGroup> </RadioGroup>
<div> <div>
<router-view v-if="isRouterAlive" :key="$route.path + $route.query.t"/> <router-view ref="routerView" v-if="isRouterAlive" :key="$route.path + $route.query.t"/>
</div> </div>
<Drawer :title="currentToolTitle+' - 历史记录'" v-model="historyShow" :width="100">
<Table ref="historyTable" border :columns="historyColumns" :data="historyData" :height="historyTableHeight">
<template slot-scope="{ row }" slot="_value">
<div>{{ historyValue(row.value) }}}</div>
</template>
<template slot-scope="{ index }" slot="_op">
<Button type="primary" size="small" @click="historyView(index)">查看</Button>
<Button type="primary" style="margin-left: 5px" @click="historyLoad(index)" size="small">加载</Button>
</template>
</Table>
<div class="drawer-footer">
<Button type="primary" @click="historyClear">清空历史记录</Button>
</div>
</Drawer>
<Drawer title="设置" v-model="settingShow" :width="400">
<setting-block v-if="settingShow"></setting-block>
</Drawer>
<bottom-block/> <bottom-block/>
</div> </div>
</template> </template>
<script> <script>
import config from './tool/config' import config from './tool/config'
import {dispatchCategoryClickEvent} from './tool/event' import {dispatchWindowResize, I18N_CHANGE} from './tool/event'
import instance from './tool/instance' import instance from './tool/instance'
import BottomBlock from './bottom' import BottomBlock from './components/bottom'
import settingBlock from "./views/setting/block"
import model from './tool/model' import model from './tool/model'
import historyFactory, {setLoadHistoryIndex} from './tool/history' import {isUtools} from './helper'
import {isUtools, openUrl} from './helper'
export default { export default {
components: { components: {
"setting-block": settingBlock,
"bottom-block": BottomBlock "bottom-block": BottomBlock
}, },
data() { data() {
...@@ -87,41 +47,11 @@ export default { ...@@ -87,41 +47,11 @@ export default {
category: config.category, category: config.category,
currentCategory: '', currentCategory: '',
currentTool: '', currentTool: '',
historyData: [],
settingShow: false,
historyShow: false,
historyColumns: [
{
title: '操作时间',
key: 'time',
width: 180
},
{
title: '数据',
slot: '_value',
ellipsis: true,
},
{
title: '操作',
slot: '_op',
width: 150
}
],
} }
}, },
computed: { computed: {
tools() { tools() {
return config.getToolByCategory(this.currentCategory) return config.getToolByCategory(this.currentCategory)
},
historyLength() {
return historyFactory(this.currentTool).length()
},
historyTableHeight() {
// 设置表格高度
return window.innerHeight - 140
},
currentToolTitle() {
return config.getToolTitle(this.currentTool)
} }
}, },
watch: { watch: {
...@@ -133,6 +63,7 @@ export default { ...@@ -133,6 +63,7 @@ export default {
created() { created() {
if (this.isUtools) { if (this.isUtools) {
window.utools.onPluginEnter(({code, payload, type}) => { window.utools.onPluginEnter(({code, payload, type}) => {
window.utools.showMainWindow()
let tool = ""; let tool = "";
let feature = ""; let feature = "";
if (code.indexOf('ctool-') !== -1) { if (code.indexOf('ctool-') !== -1) {
...@@ -145,9 +76,8 @@ export default { ...@@ -145,9 +76,8 @@ export default {
} }
// 写入正则匹配数据到固定数据数据 // 写入正则匹配数据到固定数据数据
if (type === "regex" && payload) { if (["over","regex"].includes(type) && payload) {
model.setFixeInputData(payload) model.setFixeInputData(payload)
} }
if (feature) { if (feature) {
// 设置工具内功能 // 设置工具内功能
...@@ -175,6 +105,10 @@ export default { ...@@ -175,6 +105,10 @@ export default {
}, },
mounted() { mounted() {
instance.set(this) instance.set(this)
window.addEventListener(I18N_CHANGE, ()=>{
this.$forceUpdate()
this.$refs.routerView.$forceUpdate()
});
}, },
methods: { methods: {
reload() { reload() {
...@@ -182,72 +116,13 @@ export default { ...@@ -182,72 +116,13 @@ export default {
this.$nextTick(() => (this.isRouterAlive = true)) this.$nextTick(() => (this.isRouterAlive = true))
}, },
categorySelect(name) { categorySelect(name) {
switch (name) { this.currentCategory = name
case '_feedback': model.setCategoryHistory(name)
openUrl('https://github.com/baiy/Ctool/issues') this.currentTool = model.getToolHistory(this.currentCategory)
break this.$nextTick(()=>{
case '_about': dispatchWindowResize()
openUrl('https://github.com/baiy/Ctool')
break
case '_setting':
this.settingShow = true;
break
case '_new':
openUrl(window.location.href)
break
case '_history':
this.history()
break
default:
this.currentCategory = name
model.setCategoryHistory(name)
this.currentTool = model.getToolHistory(this.currentCategory)
this.$nextTick(()=>{
dispatchCategoryClickEvent(name)
})
break
}
},
history() {
let history = historyFactory(this.currentTool)
if (history.length() < 1) {
return this.$Message.error('暂无历史记录')
}
this.historyData = history.all()
this.historyShow = true
},
historyValue(value) {
return JSON.stringify(value)
},
historyView(index) {
this.$Modal.info({
render: (h) => {
return h('Input', {
props: {
type: "textarea",
rows: 10,
value: JSON.stringify(historyFactory(this.currentTool).get(index), null, "\t"),
}
})
},
width: 700,
okText: "关闭"
}) })
}, },
historyClear() {
historyFactory(this.currentTool).clear()
this.historyShow = false;
},
historyLoad(index) {
setLoadHistoryIndex(index)
this.historyShow = false;
this.$router.push({
path: this.$router.currentRoute.fullPath,
query: {
t: Date.now(),
},
});
},
toolSelect(name) { toolSelect(name) {
model.setToolHistory(this.currentCategory, name) model.setToolHistory(this.currentCategory, name)
this.currentTool = name this.currentTool = name
...@@ -261,15 +136,3 @@ export default { ...@@ -261,15 +136,3 @@ export default {
}, },
} }
</script> </script>
<style scoped>
.drawer-footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
</style>
\ No newline at end of file
const path = require('path'); const path = require('path');
const _ = require('lodash'); const _ = require('lodash');
const fs = require('fs'); const fs = require('fs');
const i18nBuild = require('../i18n/build')
// 运行平台适配 // 运行平台适配
let platform = process.env.hasOwnProperty('npm_config_adapter') ? process.env.npm_config_adapter : ""; let platform = process.env.hasOwnProperty('npm_config_adapter') ? process.env.npm_config_adapter : "";
platform = ['chrome', 'utools', 'edge', 'firefox','web'].includes(platform) ? platform : "web" platform = ['chrome', 'utools', 'edge', 'firefox', 'web'].includes(platform) ? platform : "web"
const IS_CHROME = "chrome" === platform const IS_CHROME = "chrome" === platform
const IS_EDGE = "edge" === platform const IS_EDGE = "edge" === platform
...@@ -31,10 +32,54 @@ const removeFile = (filePath) => { ...@@ -31,10 +32,54 @@ const removeFile = (filePath) => {
fs.existsSync(filePath) && fs.unlinkSync(filePath) fs.existsSync(filePath) && fs.unlinkSync(filePath)
} }
// 删除目录
const removeDir = function (directoryPath) {
if (fs.existsSync(directoryPath)) {
fs.readdirSync(directoryPath).forEach((file) => {
const curPath = path.join(directoryPath, file);
if (fs.lstatSync(curPath).isDirectory()) {
removeDir(curPath);
} else {
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(directoryPath);
}
};
const chromiumAndFirefoxI18nBuild = ()=>{
// 生成语言包
const locales = i18nBuild.getLocales().detail
const localeDir = path.join(__dirname, '../../public/_locales/')
fs.mkdirSync(localeDir);
Object.keys(locales).forEach((_locale) => {
fs.mkdirSync(path.join(localeDir, _locale));
let messages = {}
Object.keys(locales[_locale]).forEach((key) => {
let message = {
message: locales[_locale][key]['message'].replace(new RegExp("{.+?}", 'g'), (item) => {
return `$${item.replace("{", "").replace("}", "").toUpperCase()}$`;
})
}
if ("placeholders" in locales[_locale][key]) {
message.placeholders = {}
let index = 1;
locales[_locale][key]['placeholders'].forEach((placeholder) => {
message.placeholders[placeholder] = {content: "$" + (index++)}
})
}
messages[key] = message
})
fs.writeFileSync(path.join(localeDir, `${_locale}/messages.json`), JSON.stringify(messages, null, 4));
})
}
const chromeConfigWrite = { const chromeConfigWrite = {
remove(){}, remove() {
write(){ },
if (!IS_CHROME){ write() {
if (!IS_CHROME) {
return; return;
} }
fs.writeFileSync( fs.writeFileSync(
...@@ -45,9 +90,10 @@ const chromeConfigWrite = { ...@@ -45,9 +90,10 @@ const chromeConfigWrite = {
} }
const edgeConfigWrite = { const edgeConfigWrite = {
remove(){}, remove() {
write(){ },
if (!IS_EDGE){ write() {
if (!IS_EDGE) {
return; return;
} }
fs.writeFileSync( fs.writeFileSync(
...@@ -58,28 +104,34 @@ const edgeConfigWrite = { ...@@ -58,28 +104,34 @@ const edgeConfigWrite = {
} }
const chromiumConfigWrite = { const chromiumConfigWrite = {
remove(){ remove() {
removeFile(path.join(__dirname, '../../public/manifest.json')); removeFile(path.join(__dirname, '../../public/manifest.json'));
removeFile(path.join(__dirname, '../../public/background.js')); removeFile(path.join(__dirname, '../../public/background.js'));
// 移除语言包目录
removeDir(path.join(__dirname, '../../public/_locales/'))
}, },
write(){ write() {
if (!IS_CHROMIUM){ if (!IS_CHROMIUM) {
return; return;
} }
fs.copyFileSync( fs.copyFileSync(
path.join(__dirname, "../adapter/chromium/background.js"), path.join(__dirname, "../adapter/chromium/background.js"),
path.join(__dirname, '../../public/background.js') path.join(__dirname, '../../public/background.js')
); );
// 生成语言包
chromiumAndFirefoxI18nBuild()
} }
} }
const firefoxConfigWrite ={ const firefoxConfigWrite = {
remove(){ remove() {
removeFile(path.join(__dirname, '../../public/manifest.json')); removeFile(path.join(__dirname, '../../public/manifest.json'));
removeFile(path.join(__dirname, '../../public/background.js')); removeFile(path.join(__dirname, '../../public/background.js'));
// 移除语言包目录
removeDir(path.join(__dirname, '../../public/_locales/'))
}, },
write(){ write() {
if (!IS_FIREFOX){ if (!IS_FIREFOX) {
return; return;
} }
fs.copyFileSync( fs.copyFileSync(
...@@ -90,17 +142,18 @@ const firefoxConfigWrite ={ ...@@ -90,17 +142,18 @@ const firefoxConfigWrite ={
path.join(__dirname, '../../public/manifest.json'), path.join(__dirname, '../../public/manifest.json'),
fs.readFileSync(path.join(__dirname, "../adapter/firefox/manifest.json")).toString().replace(/##version##/g, process.env.npm_package_version) fs.readFileSync(path.join(__dirname, "../adapter/firefox/manifest.json")).toString().replace(/##version##/g, process.env.npm_package_version)
); );
// 生成语言包
chromiumAndFirefoxI18nBuild()
} }
} }
const utoolsConfigWrite = { const utoolsConfigWrite = {
remove(){ remove() {
removeFile(path.join(__dirname, '../../public/plugin.json')); removeFile(path.join(__dirname, '../../public/plugin.json'));
}, },
write(){ write() {
if (!IS_UTOOLS){ if (!IS_UTOOLS) {
return; return;
} }
let pluginPath = path.join(__dirname, '../../public/plugin.json'); let pluginPath = path.join(__dirname, '../../public/plugin.json');
...@@ -110,11 +163,12 @@ const utoolsConfigWrite = { ...@@ -110,11 +163,12 @@ const utoolsConfigWrite = {
for (let tool of tools) { for (let tool of tools) {
// 初始化数据 // 初始化数据
let code = "ctool-" + tool.name; let code = "ctool-" + tool.name;
let toolTitle = i18nBuild.translate(`main_tool_${tool.name}`)
let toolFeatures = featureConfig.hasOwnProperty(tool.name) ? featureConfig[tool.name] : [] let toolFeatures = featureConfig.hasOwnProperty(tool.name) ? featureConfig[tool.name] : []
if (!utoolsToolFeature.hasOwnProperty(code)) { if (!utoolsToolFeature.hasOwnProperty(code)) {
utoolsToolFeature[code] = { utoolsToolFeature[code] = {
"code": code, "code": code,
"explain": tool.title, "explain": toolTitle,
"cmds": [] "cmds": []
} }
if (toolFeatures.length > 0) { if (toolFeatures.length > 0) {
...@@ -122,7 +176,7 @@ const utoolsConfigWrite = { ...@@ -122,7 +176,7 @@ const utoolsConfigWrite = {
let toolFeatureCode = code + '-' + toolFeature['name'] let toolFeatureCode = code + '-' + toolFeature['name']
utoolsToolFeature[toolFeatureCode] = { utoolsToolFeature[toolFeatureCode] = {
"code": toolFeatureCode, "code": toolFeatureCode,
"explain": tool.title + ' - ' + toolFeature['title'], "explain": toolTitle + ' - ' + toolFeature['title'],
"cmds": [] "cmds": []
} }
} }
...@@ -132,7 +186,7 @@ const utoolsConfigWrite = { ...@@ -132,7 +186,7 @@ const utoolsConfigWrite = {
// 关键字 // 关键字
let keyword = utoolsConfig['keyword'].hasOwnProperty(tool.name) ? utoolsConfig['keyword'][tool.name] : [] let keyword = utoolsConfig['keyword'].hasOwnProperty(tool.name) ? utoolsConfig['keyword'][tool.name] : []
utoolsToolFeature[code].cmds.push( utoolsToolFeature[code].cmds.push(
...Array.from(new Set([tool.name, tool.title, "ctool-" + tool.name, ...keyword])) ...Array.from(new Set([tool.name, toolTitle, "ctool-" + tool.name, ...keyword]))
) )
// cmds手动配置 // cmds手动配置
...@@ -144,13 +198,13 @@ const utoolsConfigWrite = { ...@@ -144,13 +198,13 @@ const utoolsConfigWrite = {
for (let _cmd of cmds) { for (let _cmd of cmds) {
let cmd = _.cloneDeep(_cmd); let cmd = _.cloneDeep(_cmd);
if (!cmd.hasOwnProperty('feature')) { if (!cmd.hasOwnProperty('feature')) {
cmd['label'] = tool.title cmd['label'] = toolTitle
utoolsToolFeature[code].cmds.push(cmd) utoolsToolFeature[code].cmds.push(cmd)
continue; continue;
} }
let toolFeatureCode = code + '-' + cmd.feature let toolFeatureCode = code + '-' + cmd.feature
if (utoolsToolFeature.hasOwnProperty(toolFeatureCode)) { if (utoolsToolFeature.hasOwnProperty(toolFeatureCode)) {
cmd['label'] = tool.title + ' - ' + getToolFeatureTitle(cmd.feature, toolFeatures) cmd['label'] = toolTitle + ' - ' + getToolFeatureTitle(cmd.feature, toolFeatures)
delete cmd.feature delete cmd.feature
utoolsToolFeature[toolFeatureCode].cmds.push(cmd) utoolsToolFeature[toolFeatureCode].cmds.push(cmd)
} }
...@@ -195,5 +249,7 @@ module.exports = { ...@@ -195,5 +249,7 @@ module.exports = {
edgeConfigWrite.write(); edgeConfigWrite.write();
firefoxConfigWrite.write(); firefoxConfigWrite.write();
utoolsConfigWrite.write(); utoolsConfigWrite.write();
// 生成运行时语言包
i18nBuild.generate()
} }
} }
// 定义分类点击事件 // 窗口大小调整事件
export const CATEGORY_CLICK_EVENT_NAME = "ctoolCategoryClick" export const WINDOW_RESIZE = "ctoolWindowResize"
export const dispatchCategoryClickEvent = (name) => { // 语言地区变化事件
const event = new CustomEvent(CATEGORY_CLICK_EVENT_NAME, {detail: {name}}) export const I18N_CHANGE = "ctoolI18nChange"
window.dispatchEvent(event); export const dispatchWindowResize = () => {
window.dispatchEvent(new CustomEvent(WINDOW_RESIZE));
}
export const dispatchI18nChange = () => {
window.dispatchEvent(new CustomEvent(I18N_CHANGE));
} }
// 原生窗口调整事件
window.addEventListener("resize", ()=>{
dispatchWindowResize()
});
import crypto from 'crypto-js' import crypto from 'crypto-js'
import moment from 'moment' import moment from 'moment'
import cache from './cache' import cache from './cache'
import { TOOL_DATA_EXPIRY } from './config' import {TOOL_DATA_EXPIRY} from './config'
import _ from "lodash";
let loadHistoryIndex = -1 let loadHistoryIndex = -1
let forceLoadHistory = false
function queueDataFactory (value) { function queueDataFactory(value) {
return { return {
'time': moment().format('YYYY-MM-DD HH:mm:ss'), 'time': moment().format('YYYY-MM-DD HH:mm:ss'),
'hash': crypto.MD5(JSON.stringify(value)).toString(), 'hash': crypto.MD5(JSON.stringify(value)).toString(),
...@@ -18,18 +20,23 @@ class queue { ...@@ -18,18 +20,23 @@ class queue {
name = '' name = ''
max = 10 max = 10
constructor (name, max = 50) { constructor(name, max = 50) {
this.name = name this.name = name
this.max = max this.max = max
// 初始化数据 // 初始化数据
this.data = cache.get(this.getCacheName(), []) this.data = cache.get(this.getCacheName(), [])
} }
getCacheName () { getCacheName() {
return 'tool_data_history_' + this.name return 'tool_data_history_' + this.name
} }
push (value) { push(value) {
// 过滤超大数据
if (JSON.stringify(value).length > 200 * 1024){
console.log("Data Too Big")
return;
}
let item = queueDataFactory(value) let item = queueDataFactory(value)
// 删除已有 // 删除已有
...@@ -49,23 +56,23 @@ class queue { ...@@ -49,23 +56,23 @@ class queue {
cache.set(this.getCacheName(), this.data, TOOL_DATA_EXPIRY) cache.set(this.getCacheName(), this.data, TOOL_DATA_EXPIRY)
} }
length () { length() {
return this.data.length return this.data.length
} }
all () { all() {
return this.data return this.data
} }
clear(){ clear() {
cache.remove(this.getCacheName()) cache.remove(this.getCacheName())
} }
get (index) { get(index) {
return this.data.hasOwnProperty(index) ? this.data[index].value : {} return _.cloneDeep(this.data.hasOwnProperty(index) ? this.data[index].value : {})
} }
current () { current() {
if (loadHistoryIndex < 0) { if (loadHistoryIndex < 0) {
return this.get(0) return this.get(0)
} }
...@@ -75,10 +82,22 @@ class queue { ...@@ -75,10 +82,22 @@ class queue {
} }
} }
export default (name) => { const history = (name) => {
return new queue(name) return new queue(name)
} }
export const setLoadHistoryIndex = (index) => { export const setForceLoadHistoryIndex = (index) => {
forceLoadHistory = true
loadHistoryIndex = index loadHistoryIndex = index
} }
\ No newline at end of file
export const getForceLoadHistory = (name) => {
if (forceLoadHistory) {
forceLoadHistory = false
let data = history(name).current()
return _.isEmpty(data) ? null : data
}
return null
}
export default history
...@@ -2,7 +2,7 @@ import config from './config' ...@@ -2,7 +2,7 @@ import config from './config'
import clipboard from './clipboard' import clipboard from './clipboard'
import setting from './setting' import setting from './setting'
import cache from './cache' import cache from './cache'
import history from './history.js' import history,{getForceLoadHistory} from './history.js'
import _ from "lodash"; import _ from "lodash";
let fixeInputData; let fixeInputData;
...@@ -52,12 +52,12 @@ const debounceSaveToolDataMethod = _.debounce(function () { ...@@ -52,12 +52,12 @@ const debounceSaveToolDataMethod = _.debounce(function () {
}, 1000) }, 1000)
const appendData = async function (check = "") { const appendData = async function (check = "",all) {
const result = (data = "") => { const result = (data = "") => {
if (data) { if (data) {
if ( if (
!check !check
|| (_.isFunction(check) && check(data)) // 函数校验 || (_.isFunction(check) && check(data,all)) // 函数校验
) { ) {
return data return data
} }
...@@ -89,6 +89,14 @@ export const plugin = { ...@@ -89,6 +89,14 @@ export const plugin = {
install: function (Vue) { install: function (Vue) {
Vue.prototype.$initToolData = function (input = "", inputCheck = "", field = "current", isLoadHistory = true) { Vue.prototype.$initToolData = function (input = "", inputCheck = "", field = "current", isLoadHistory = true) {
let current = _.cloneDeep(this[field]) let current = _.cloneDeep(this[field])
//强制使用历史数据
let forceHistory = getForceLoadHistory(model.getCurrentTool())
if (forceHistory){
Object.assign(current, forceHistory)
this[field] = current
return;
}
let inputHistory = "" let inputHistory = ""
let inputDefault = "" let inputDefault = ""
let inputAppend = "" let inputAppend = ""
...@@ -99,11 +107,11 @@ export const plugin = { ...@@ -99,11 +107,11 @@ export const plugin = {
// 历史数据 // 历史数据
if (isLoadHistory) { if (isLoadHistory) {
let history = this.$getToolData() let history = this.$getToolData()
Object.assign(current, history)
if (input && (input in history)) { if (input && (input in history)) {
inputHistory = history[input] inputHistory = history[input]
delete history[input] delete history[input]
} }
Object.assign(current, this.$getToolData())
} }
if (!input) { if (!input) {
...@@ -112,13 +120,13 @@ export const plugin = { ...@@ -112,13 +120,13 @@ export const plugin = {
} }
// 追加剪贴板等数据 // 追加剪贴板等数据
appendData(inputCheck).then((append) => { appendData(inputCheck,current).then((append) => {
inputAppend = append inputAppend = append
this[field] = Object.assign( this[field] = Object.assign(
current, current,
{ {
// 历史数据 > 追加数据 > 默认数据 // 追加数据 > 历史数据 > 默认数据
[input]: inputHistory ? inputHistory : (inputAppend ? inputAppend : inputDefault) [input]: inputAppend ? inputAppend : (inputHistory ? inputHistory : inputDefault)
} }
) )
}) })
...@@ -134,7 +142,12 @@ export const plugin = { ...@@ -134,7 +142,12 @@ export const plugin = {
debounceSaveToolDataMethod() debounceSaveToolDataMethod()
} }
Vue.prototype.$clipboardCopy = function (data, force = false) { Vue.prototype.$clipboardCopy = function (data, force = false) {
if ((setting.autoSaveCopy() || force) && data) { if ((setting.autoSaveCopy() || force)) {
this.$copy(data)
}
}
Vue.prototype.$copy = function (data) {
if (data) {
clipboard.copy(data, () => { clipboard.copy(data, () => {
this.$Message.success(this.$t('main_ui_copy_text_ok').toString()) this.$Message.success(this.$t('main_ui_copy_text_ok').toString())
}) })
......
export default (mode) => {
mode = ['light', 'dark', 'auto'].includes(mode) ? mode : 'light'
console.log(`set display mode:${mode}`)
document.getElementsByTagName('html')[0].setAttribute('theme-mode', mode);
}
...@@ -34,9 +34,11 @@ ...@@ -34,9 +34,11 @@
</template> </template>
<script> <script>
import {isChromium, isFirefox, isUtools, openUrl, setDisplayMode} from '../../helper' import {isChromium, isFirefox, isUtools, openUrl} from '../../helper'
import theme from '../../tool/theme'
import {LOCALE_LISTS, setCurrentLocale} from '../../i18n' import {LOCALE_LISTS, setCurrentLocale} from '../../i18n'
import setting from '../../tool/setting' import setting from '../../tool/setting'
import {dispatchI18nChange} from '../../tool/event'
import common from "./common" import common from "./common"
export default { export default {
components: { components: {
...@@ -59,10 +61,11 @@ export default { ...@@ -59,10 +61,11 @@ export default {
}, },
watch: { watch: {
display_mode(value) { display_mode(value) {
setDisplayMode(value) theme(value)
}, },
locale(value) { locale(value) {
setCurrentLocale(value) setCurrentLocale(value)
dispatchI18nChange()
} }
}, },
created() { created() {
......
...@@ -33,19 +33,19 @@ ...@@ -33,19 +33,19 @@
</div> </div>
</Card> </Card>
<heightResize :reduce="45" :append="['.page-option-output-block']" @resize="resize"> <heightResize :reduce="45" :append="['.page-option-output-block']" @resize="resize">
<input-block :text="'ARM64'+endianPlaceholder" @on-default-right-bottom-click="()=>copy(outputArm64)"> <input-block :text="'ARM64'+endianPlaceholder" @on-default-right-bottom-click="()=>$copy(outputArm64)">
<autoHeightTextarea :value="outputArm64" :height="outputHeight" :placeholder="'ARM64'+endianPlaceholder"/> <autoHeightTextarea :value="outputArm64" :height="outputHeight" :placeholder="'ARM64'+endianPlaceholder"/>
</input-block> </input-block>
<input-block :text="'ARM'+endianPlaceholder" @on-default-right-bottom-click="()=>copy(outputArm)"> <input-block :text="'ARM'+endianPlaceholder" @on-default-right-bottom-click="()=>$copy(outputArm)">
<autoHeightTextarea style="margin-top: 5px" :value="outputArm" :height="outputHeight" :placeholder="'ARM'+endianPlaceholder"/> <autoHeightTextarea style="margin-top: 5px" :value="outputArm" :height="outputHeight" :placeholder="'ARM'+endianPlaceholder"/>
</input-block> </input-block>
<input-block :text="'ARM Big Endian'" @on-default-right-bottom-click="()=>copy(outputArmBigEndian)" v-if="!isArmToHex"> <input-block :text="'ARM Big Endian'" @on-default-right-bottom-click="()=>$copy(outputArmBigEndian)" v-if="!isArmToHex">
<autoHeightTextarea style="margin-top: 5px" :value="outputArmBigEndian" :height="outputHeight" :placeholder="'ARM Big Endian'"/> <autoHeightTextarea style="margin-top: 5px" :value="outputArmBigEndian" :height="outputHeight" :placeholder="'ARM Big Endian'"/>
</input-block> </input-block>
<input-block :text="'THUMB'+endianPlaceholder" @on-default-right-bottom-click="()=>copy(outputThumb)"> <input-block :text="'THUMB'+endianPlaceholder" @on-default-right-bottom-click="()=>$copy(outputThumb)">
<autoHeightTextarea style="margin-top: 5px" :value="outputThumb" :height="outputHeight" :placeholder="'THUMB'+endianPlaceholder"/> <autoHeightTextarea style="margin-top: 5px" :value="outputThumb" :height="outputHeight" :placeholder="'THUMB'+endianPlaceholder"/>
</input-block> </input-block>
<input-block :text="'THUMB Big Endian'" @on-default-right-bottom-click="()=>copy(outputThumbBigEndian)" v-if="!isArmToHex"> <input-block :text="'THUMB Big Endian'" @on-default-right-bottom-click="()=>$copy(outputThumbBigEndian)" v-if="!isArmToHex">
<autoHeightTextarea style="margin-top: 5px" :value="outputThumbBigEndian" :height="outputHeight" :placeholder="'THUMB Big Endian'"/> <autoHeightTextarea style="margin-top: 5px" :value="outputThumbBigEndian" :height="outputHeight" :placeholder="'THUMB Big Endian'"/>
</input-block> </input-block>
</heightResize> </heightResize>
...@@ -102,11 +102,6 @@ export default { ...@@ -102,11 +102,6 @@ export default {
} }
}, },
methods: { methods: {
copy(data) {
if (data) {
this.$clipboardCopy(data)
}
},
resize(height) { resize(height) {
this.pageOutputHeight = height; this.pageOutputHeight = height;
}, },
......
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
</Col> </Col>
<Col span="16"> <Col span="16">
<input-block top="5px" :text="$t('binary_true_form')" <input-block top="5px" :text="$t('binary_true_form')"
@on-default-right-bottom-click="()=>copy(result('trueForm'))"> @on-default-right-bottom-click="()=>$copy(result('trueForm'))">
<autoHeightTextarea :value="result('trueForm')" :height="outputHeight" <autoHeightTextarea :value="result('trueForm')" :height="outputHeight"
:placeholder="$t('binary_true_form')" style="margin-bottom: 10px"/> :placeholder="$t('binary_true_form')" style="margin-bottom: 10px"/>
</input-block> </input-block>
<input-block top="5px" :text="$t('binary_inverse')" <input-block top="5px" :text="$t('binary_inverse')"
@on-default-right-bottom-click="()=>copy(result('inverse'))"> @on-default-right-bottom-click="()=>$copy(result('inverse'))">
<autoHeightTextarea :value="result('inverse')" :height="outputHeight" <autoHeightTextarea :value="result('inverse')" :height="outputHeight"
:placeholder="$t('binary_inverse')" style="margin-bottom: 10px"/> :placeholder="$t('binary_inverse')" style="margin-bottom: 10px"/>
</input-block> </input-block>
<input-block top="5px" :text="$t('binary_complement')" <input-block top="5px" :text="$t('binary_complement')"
@on-default-right-bottom-click="()=>copy(result('complement'))"> @on-default-right-bottom-click="()=>$copy(result('complement'))">
<autoHeightTextarea :value="result('complement')" :height="outputHeight" <autoHeightTextarea :value="result('complement')" :height="outputHeight"
:placeholder="$t('binary_complement')"/> :placeholder="$t('binary_complement')"/>
</input-block> </input-block>
...@@ -48,11 +48,6 @@ export default { ...@@ -48,11 +48,6 @@ export default {
}) })
}, },
methods: { methods: {
copy(data) {
if (data) {
this.$clipboardCopy(data)
}
},
resize(height) { resize(height) {
this.inputHeight = height this.inputHeight = height
this.outputHeight = Math.ceil((height - 20) / 3) this.outputHeight = Math.ceil((height - 20) / 3)
......
<template>
<div class="tool-disable-mask">
<div>
<div style="line-height: 24px;word-break:break-all;background-color: #fff;padding: 5px 10px;margin: 0 10px">
<slot></slot>
</div>
<div style="text-align: center;margin-top: 10px" v-if="!disableClose">
<Icon type="md-close-circle" style="cursor: pointer;" size="30" color="#FFF" @click="close" />
</div>
</div>
</div>
</template>
<script>
export default {
props:{
disableClose: {
type: Boolean,
default: false
},
},
methods:{
close(){
this.$emit('close')
}
}
};
</script>
<style scoped>
.tool-disable-mask{
position: absolute;
top: 0;
left: 0;
z-index: 8;
width: 100%;
height: 100%;
background-color: rgba(55, 55, 55, 0.2);
display: flex;
display: -webkit-flex;
align-items: center;
justify-content: center;
}
</style>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</div> </div>
</template> </template>
<script> <script>
import {CATEGORY_CLICK_EVENT_NAME} from '../../../tool/event' import {WINDOW_RESIZE} from '../../../tool/event'
function getAbsoluteHeight(select) { function getAbsoluteHeight(select) {
let el = document.querySelector(select) let el = document.querySelector(select)
if (el === null) { if (el === null) {
...@@ -72,12 +72,10 @@ export default { ...@@ -72,12 +72,10 @@ export default {
} }
}, },
destroyed() { destroyed() {
window.removeEventListener("resize", this.reportWindowSize); window.removeEventListener(WINDOW_RESIZE, this.reportWindowSize);
window.removeEventListener(CATEGORY_CLICK_EVENT_NAME, this.reportWindowSize);
}, },
mounted() { mounted() {
window.addEventListener("resize", this.reportWindowSize); window.addEventListener(WINDOW_RESIZE, this.reportWindowSize);
window.addEventListener(CATEGORY_CLICK_EVENT_NAME, this.reportWindowSize);
this.resize(); this.resize();
} }
}; };
......
<template> <template>
<div> <div style="display: inline">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
......
<template>
<div>
<Select @on-change="select" size="small" placeholder="Common" style="width:100px">
<Option v-for="(v,k) in expression" :value="v.regex" :key="k">{{ v.name }}</Option>
</Select>
<Button type="primary" style="margin-left: 5px" size="small" @click="referenceShow=true">Reference</Button>
<Drawer title="Reference" v-model="referenceShow" :width="100">
<Table :columns="referenceColumns" :data="reference">
<template slot-scope="{ row }" slot="_text">
<div v-html="row.text" style="padding: 10px 0"></div>
</template>
</Table>
</Drawer>
</div>
</template>
<script>
export default {
methods: {
select(regex) {
this.$emit('on-select', regex);
}
},
data() {
return {
referenceShow: false,
/* eslint-disable */
expression: [
{
regex: '(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*',
name: "All major credit cards regex"
},
{regex: '[a-zA-Z0-9]*', name: "Alpha-numeric characters"},
{regex: '[a-zA-Z0-9 ]*', name: "Alpha-numeric characters with spaces"},
{regex: '[a-zA-Z]*', name: "Alphabetic characters"},
{regex: '(3[47][0-9]{13})*', name: "Amex credit card regex"},
{
regex: '((0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2})|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2}))*',
name: "Australian Postal Codes"
},
{regex: '([ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9])*', name: "Canadian Postal Codes"},
{regex: '(?:AB|BC|MB|N[BLTSU]|ON|PE|QC|SK|YT)*', name: "Canadian Province Abbreviations"},
{
regex: '(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}',
name: "Date (MM/DD/YYYY)"
},
{
regex: '(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])',
name: "Date (YYYY/MM/DD)"
},
{regex: '(3(?:0[0-5]|[68][0-9])[0-9]{11})*', name: "Diner's Club credit card regex"},
{
regex: '((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*',
name: "IP address regex"
},
{regex: '([a-z])+', name: "Lowercase letters"},
{regex: '([A-Z])+', name: "Uppercase letters"},
{regex: '(5[1-5][0-9]{14})*', name: "MasterCard credit card numbers"},
{regex: '((([0-9]{1})*[- .(]*([0-9]{3})[- .)]*[0-9]{3}[- .]*[0-9]{4})+)*', name: "Phone number regex"},
{regex: '([0-9]{3}[-]*[0-9]{2}[-]*[0-9]{4})*', name: "SSN regex"},
{regex: '([A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2})*', name: "UK Postal Codes regex"},
{
regex: '(?:A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])*',
name: "US States regex"
},
{regex: '([0-9]{5}(?:-[0-9]{4})?)*', name: "US ZIP Codes regex"},
{regex: '(4[0-9]{12}(?:[0-9]{3})?)*', name: "Visa credit card numbers"},
{
regex: '(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})',
name: "All major credit cards regex"
},
{regex: '[a-zA-Z0-9]+', name: "alpha-numeric characters"},
{regex: '[a-zA-Z]+', name: "Alphabetic characters"},
{regex: '[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]', name: "Canadian Postal Codes"},
{regex: '[0-9]+', name: "digits"},
{regex: '[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}', name: "email regex"},
{
regex: '(([0-9]{1})*[- .(]*([0-9]{3})[- .)]*[0-9]{3}[- .]*[0-9]{4})+',
name: "phone number regex"
},
{
regex: '((http|https|ftp)://)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]/+=%&_\.~?\-]*)',
name: "URL regex"
},
{regex: '[0-9]{5}(?:-[0-9]{4})?', name: "US ZIP Codes regex"}
],
/* eslint-enable */
referenceColumns: [
{
title: 'Character',
key: 'name',
width: 120
},
{
title: 'What does it do?',
slot: '_text'
},
],
reference: [
{
"name": "\\",
"text": "Used to indicate that the next character should NOT be interpreted literally. For example, the character 'w' by itself will be interpreted as 'match the character w', but using '\\w' signifies 'match an alpha-numeric character including underscore'. Used to indicate that a metacharacter is to be interpreted literally. For example, the '.' metacharacter means 'match any single character but a new line', but if we would rather match a dot character instead, we would use '\\.'."
},
{
"name": "^",
"text": "Matches the beginning of the input. If in multiline mode, it also matches after a line break character, hence every new line. When used in a set pattern ([^abc]), it negates the set; match anything not enclosed in the brackets"
},
{
"name": "$",
"text": "Matches the end of the input. If in multiline mode, it also matches before a line break character, hence every end of line."
},
{
"name": "*",
"text": "Matches the preceding character 0 or more times."
},
{
"name": "+",
"text": "Matches the preceding character 1 or more times."
},
{
"name": "?",
"text": "Matches the preceding character 0 or 1 time. When used after the quantifiers *, +, ? or {}, makes the quantifier non-greedy; it will match the minimum number of times as opposed to matching the maximum number of times."
},
{
"name": ".",
"text": "Matches any single character except the newline character."
},
{
"name": "(x)",
"text": "Matches 'x' and remembers the match. Also known as capturing parenthesis."
},
{
"name": "(?:x)",
"text": "Matches 'x' but does NOT remember the match. Also known as NON-capturing parenthesis."
},
{
"name": "x(?=y)",
"text": "Matches 'x' only if 'x' is followed by 'y'. Also known as a lookahead."
},
{
"name": "x(?!y)",
"text": "Matches 'x' only if 'x' is NOT followed by 'y'. Also known as a negative lookahead."
},
{
"name": "x|y",
"text": "Matches 'x' OR 'y'."
},
{
"name": "{n}",
"text": "Matches the preceding character exactly n times."
},
{
"name": "{n,m}",
"text": "Matches the preceding character at least n times and at most m times. n and m can be omitted if zero.."
},
{
"name": "[abc]",
"text": "Matches any of the enclosed characters. Also known as a character set. You can create range of characters using the hyphen character such as A-Z (A to Z). Note that in character sets, special characters (., *, +) do not have any special meaning."
},
{
"name": "[^abc]",
"text": "Matches anything NOT enclosed by the brackets. Also known as a negative character set."
},
{
"name": "[\\b]",
"text": "Matches a backspace."
},
{
"name": "\\b",
"text": "Matches a word boundary. Boundaries are determined when a word character is NOT followed or NOT preceded with another word character."
},
{
"name": "\\B",
"text": "Matches a NON-word boundary. Boundaries are determined when two adjacent characters are word characters OR non-word characters."
},
{
"name": "\\cX",
"text": "Matches a control character. X must be between A to Z inclusive."
},
{
"name": "\\d",
"text": "Matches a digit character. Same as [0-9] or [0123456789]."
},
{
"name": "\\D",
"text": "Matches a NON-digit character. Same as [^0-9] or [^0123456789]."
},
{
"name": "\\f",
"text": "Matches a form feed."
},
{
"name": "\\n",
"text": "Matches a line feed."
},
{
"name": "\\r",
"text": "Matches a carriage return."
},
{
"name": "\\s",
"text": "Matches a single white space character. This includes space, tab, form feed and line feed."
},
{
"name": "\\S",
"text": "Matches anything OTHER than a single white space character. Anything other than space, tab, form feed and line feed."
},
{
"name": "\\t",
"text": "Matches a tab."
},
{
"name": "\\v",
"text": "Matches a vertical tab."
},
{
"name": "\\w",
"text": "Matches any alphanumeric character including underscore. Equivalent to [A-Za-z0-9_]."
},
{
"name": "\\W",
"text": "Matches anything OTHER than an alphanumeric character including underscore. Equivalent to [^A-Za-z0-9_]."
},
{
"name": "\\x",
"text": "A back reference to the substring matched by the x parenthetical expression. x is a positive integer."
},
{
"name": "\\0",
"text": "Matches a NULL character."
},
{
"name": "\\xhh",
"text": "Matches a character with the 2-digits hexadecimal code."
},
{
"name": "\\uhhhh",
"text": "Matches a character with the 4-digits hexadecimal code."
}
]
}
}
}
</script>
<template>
<div>
<Select @on-change="select" size="small" placeholder="常用" style="width:80px">
<Option v-for="(v,k) in expression" :value="v.regex" :key="k">{{v.name}}</Option>
</Select>
<Button type="primary" style="margin-left: 5px" size="small" @click="referenceShow=true">参考</Button>
<Drawer title="参考" v-model="referenceShow" :width="100">
<Table :columns="referenceColumns" :data="reference">
<template slot-scope="{ row }" slot="_text">
<div v-html="row.text" style="padding: 10px 0"></div>
</template>
</Table>
</Drawer>
</div>
</template>
<script>
export default {
methods:{
select(regex){
this.$emit('on-select',regex);
}
},
data(){
return {
referenceShow:false,
expression: [
{regex: "[\\u4e00-\\u9fa5]", name:"中文字符"},
{regex: "[^\\x00-\\xff]", name:"双字节字符(包括汉字在内)"},
{regex: "\\n\\s*\\r", name:"空白行"},
{
regex: "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?",
name:"Email地址"},
{regex: "[a-zA-z]+://[^\\s]*", name:"网址URL"},
{regex: "[1][3,4,5,7,8][0-9]{9}", name:"手机"},
{regex: "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}", name:"IP地址"},
{regex: "\\d{3}-\\d{8}|\\d{4}-\\d{7,8}", name:"国内电话号码"},
{regex: "[1-9][0-9]{4,}", name:"腾讯QQ号"},
{regex: "[1-9]\\d{5}(?!\\d)", name:"中国邮政编码"},
{
regex: "([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))",
name:"(年-月-日)格式日期"},
{regex: "[1-9]\\d*", name:"正整数"},
{regex: "-[1-9]\\d*", name:"负整数"},
{regex: "-?[1-9]\\d*", name:"整数"},
{regex: "[1-9]\\d*|0", name:"非负整数(正整数 + 0)"},
{regex: "-[1-9]\\d*|0", name:"非正整数(负整数 + 0)"},
{regex: "[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*", name:"正浮点数"},
{regex: "-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*", name:"负浮点数"},
],
referenceColumns: [
{
title: '字符',
key: 'name',
width: 100
},
{
title: '描述',
slot: '_text'
},
],
reference: [
{
name: "\\",
text: "将下一个字符标记为一个特殊字符、或一个原义字符、或一个向后引用、或一个八进制转义符。例如,“<code>n</code>”匹配字符“<code>n</code>”。“<code>\\n</code>”匹配一个换行符。串行“<code>\\\\</code>”匹配“<code>\\</code>”而“<code>\\(</code>”则匹配“<code>(</code>”。"
},
{
name: "^",
text: "匹配输入字符串的开始位置。如果设置了RegExp对象的Multiline属性,^也匹配“<code>\\n</code>”或“<code>\\r</code>”之后的位置。"
},
{
name: "$",
text: "匹配输入字符串的结束位置。如果设置了RegExp对象的Multiline属性,$也匹配“<code>\\n</code>”或“<code>\\r</code>”之前的位置。"
},
{
name: "*",
text: "匹配前面的子表达式零次或多次。例如,zo*能匹配“<code>z</code>”以及“<code>zoo</code>”。*等价于{0,}。"
},
{
name: "+",
text: "匹配前面的子表达式一次或多次。例如,“<code>zo+</code>”能匹配“<code>zo</code>”以及“<code>zoo</code>”,但不能匹配“<code>z</code>”。+等价于{1,}。"
},
{
name: "?",
text: "匹配前面的子表达式零次或一次。例如,“<code>do(es)?</code>”可以匹配“<code>does</code>”或“<code>does</code>”中的“<code>do</code>”。?等价于{0,1}。"
},
{
name: "{n}",
text: "n是一个非负整数。匹配确定的n次。例如,“<code>o{2}</code>”不能匹配“<code>Bob</code>”中的“<code>o</code>”,但是能匹配“<code>food</code>”中的两个o。"
},
{
name: "{n,}",
text: "n是一个非负整数。至少匹配n次。例如,“<code>o{2,}</code>”不能匹配“<code>Bob</code>”中的“<code>o</code>”,但能匹配“<code>foooood</code>”中的所有o。“<code>o{1,}</code>”等价于“<code>o+</code>”。“<code>o{0,}</code>”则等价于“<code>o*</code>”。"
},
{
name: "{n,m}",
text: "m和n均为非负整数,其中n&lt;=m。最少匹配n次且最多匹配m次。例如,“<code>o{1,3}</code>”将匹配“<code>fooooood</code>”中的前三个o。“<code>o{0,1}</code>”等价于“<code>o?</code>”。请注意在逗号和两个数之间不能有空格。"
},
{
name: "?",
text: "当该字符紧跟在任何一个其他限制符(*,+,?,{n},{n,},{n,m})后面时,匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串,而默认的贪婪模式则尽可能多的匹配所搜索的字符串。例如,对于字符串“<code>oooo</code>”,“<code>o+?</code>”将匹配单个“<code>o</code>”,而“<code>o+</code>”将匹配所有“<code>o</code>”。"
},
{
name: ".",
text: "匹配除“<code>\\</code><code>n</code>”之外的任何单个字符。要匹配包括“<code>\\</code><code>n</code>”在内的任何字符,请使用像“<code>(.|\\n)</code>”的模式。"
},
{
name: "(pattern)",
text: "匹配pattern并获取这一匹配。所获取的匹配可以从产生的Matches集合得到,在VBScript中使用SubMatches集合,在JScript中则使用$0…$9属性。要匹配圆括号字符,请使用“<code>\\(</code>”或“<code>\\)</code>”。"
},
{
name: "(?:pattern)",
text: "匹配pattern但不获取匹配结果,也就是说这是一个非获取匹配,不进行存储供以后使用。这在使用或字符“<code>(|)</code>”来组合一个模式的各个部分是很有用。例如“<code>industr(?:y|ies)</code>”就是一个比“<code>industry|industries</code>”更简略的表达式。"
},
{
name: "(?=pattern)",
text: "正向肯定预查,在任何匹配pattern的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。例如,“<code>Windows(?=95|98|NT|2000)</code>”能匹配“<code>Windows2000</code>”中的“<code>Windows</code>”,但不能匹配“<code>Windows3.1</code>”中的“<code>Windows</code>”。预查不消耗字符,也就是说,在一个匹配发生后,在最后一次匹配之后立即开始下一次匹配的搜索,而不是从包含预查的字符之后开始。"
},
{
name: "(?!pattern)",
text: "正向否定预查,在任何不匹配pattern的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。例如“<code>Windows(?!95|98|NT|2000)</code>”能匹配“<code>Windows3.1</code>”中的“<code>Windows</code>”,但不能匹配“<code>Windows2000</code>”中的“<code>Windows</code>”。预查不消耗字符,也就是说,在一个匹配发生后,在最后一次匹配之后立即开始下一次匹配的搜索,而不是从包含预查的字符之后开始"
},
{
name: "(?&lt;=pattern)",
text: "反向肯定预查,与正向肯定预查类拟,只是方向相反。例如,“<code>(?&lt;=95|98|NT|2000)Windows</code>”能匹配“<code>2000Windows</code>”中的“<code>Windows</code>”,但不能匹配“<code>3.1Windows</code>”中的“<code>Windows</code>”。"
},
{
name: "(?&lt;!pattern)",
text: "反向否定预查,与正向否定预查类拟,只是方向相反。例如“<code>(?&lt;!95|98|NT|2000)Windows</code>”能匹配“<code>3.1Windows</code>”中的“<code>Windows</code>”,但不能匹配“<code>2000Windows</code>”中的“<code>Windows</code>”。"
},
{
name: "x|y",
text: "匹配x或y。例如,“<code>z|food</code>”能匹配“<code>z</code>”或“<code>food</code>”。“<code>(z|f)ood</code>”则匹配“<code>zood</code>”或“<code>food</code>”。"
},
{
name: "[xyz]",
text: "字符集合。匹配所包含的任意一个字符。例如,“<code>[abc]</code>”可以匹配“<code>plain</code>”中的“<code>a</code>”。"
},
{
name: "[^xyz]",
text: "负值字符集合。匹配未包含的任意字符。例如,“<code>[^abc]</code>”可以匹配“<code>plain</code>”中的“<code>p</code>”。"
},
{
name: "[a-z]",
text: "字符范围。匹配指定范围内的任意字符。例如,“<code>[a-z]</code>”可以匹配“<code>a</code>”到“<code>z</code>”范围内的任意小写字母字符。"
},
{
name: "[^a-z]",
text: "负值字符范围。匹配任何不在指定范围内的任意字符。例如,“<code>[^a-z]</code>”可以匹配任何不在“<code>a</code>”到“<code>z</code>”范围内的任意字符。"
},
{
name: "\\b",
text: "匹配一个单词边界,也就是指单词和空格间的位置。例如,“<code>er\\b</code>”可以匹配“<code>never</code>”中的“<code>er</code>”,但不能匹配“<code>verb</code>”中的“<code>er</code>”。"
},
{
name: "\\B",
text: "匹配非单词边界。“<code>er\\B</code>”能匹配“<code>verb</code>”中的“<code>er</code>”,但不能匹配“<code>never</code>”中的“<code>er</code>”。"
},
{
name: "\\cx",
text: "匹配由x指明的控制字符。例如,<code>\\cM</code>匹配一个Control-M或回车符。x的值必须为A-Z或a-z之一。否则,将c视为一个原义的“<code>c</code>”字符。"
},
{
name: "\\d",
text: "匹配一个数字字符。等价于[0-9]。"
},
{
name: "\\D",
text: "匹配一个非数字字符。等价于[^0-9]。"
},
{
name: "\\f",
text: "匹配一个换页符。等价于\\x0c和\\cL。"
},
{
name: "\\n",
text: "匹配一个换行符。等价于\\x0a和\\cJ。"
},
{
name: "\\r",
text: "匹配一个回车符。等价于\\x0d和\\cM。"
},
{
name: "\\s",
text: "匹配任何空白字符,包括空格、制表符、换页符等等。等价于[ \\f\\n\\r\\t\\v]。"
},
{
name: "\\S",
text: "匹配任何非空白字符。等价于[^ \\f\\n\\r\\t\\v]。"
},
{
name: "\\t",
text: "匹配一个制表符。等价于\\x09和\\cI。"
},
{
name: "\\v",
text: "匹配一个垂直制表符。等价于\\x0b和\\cK。"
},
{
name: "\\w",
text: "匹配包括下划线的任何单词字符。等价于“<code>[A-Za-z0-9_]</code>”。"
},
{
name: "\\W",
text: "匹配任何非单词字符。等价于“<code>[^A-Za-z0-9_]</code>”。"
},
{
name: "\\xn",
text: "匹配n,其中n为十六进制转义值。十六进制转义值必须为确定的两个数字长。例如,“<code>\\x41</code>”匹配“<code>A</code>”。“<code>\\x041</code>”则等价于“<code>\\x04&amp;1</code>”。正则表达式中可以使用ASCII编码。."
},
{
name: "\\num",
text: "匹配num,其中num是一个正整数。对所获取的匹配的引用。例如,“<code>(.)\\1</code>”匹配两个连续的相同字符。"
},
{
name: "\\n",
text: "标识一个八进制转义值或一个向后引用。如果\\n之前至少n个获取的子表达式,则n为向后引用。否则,如果n为八进制数字(0-7),则n为一个八进制转义值。"
},
{
name: "\\nm",
text: "标识一个八进制转义值或一个向后引用。如果\\nm之前至少有nm个获得子表达式,则nm为向后引用。如果\\nm之前至少有n个获取,则n为一个后跟文字m的向后引用。如果前面的条件都不满足,若n和m均为八进制数字(0-7),则\\nm将匹配八进制转义值nm。"
},
{
name: "\\nml",
text: "如果n为八进制数字(0-3),且m和l均为八进制数字(0-7),则匹配八进制转义值nml。"
},
{
name: "\\un",
text: "匹配n,其中n是一个用四个十六进制数字表示的Unicode字符。例如,\\u00A9匹配版权符号(©)。"
}
]
}
}
}
</script>
<template>
<Upload style="display: inline-block" action="#" :before-upload="handleUpload" :format="format" :showUploadList="false">
<Button shape="circle" icon="md-cloud-upload"/>
<template v-if="!disablePaste">
<pasteClipboardFlie v-if="type==='file'" @on-paste-file="handleUpload"/>
<pasteClipboardFlie v-if="type==='image'" @on-paste-image="handleUpload"/>
</template>
</Upload>
</template>
<script>
import pasteClipboardFlie from './pasteClipboardFlie';
export default {
components: {
pasteClipboardFlie,
},
props: {
disablePaste: {
type: Boolean,
default: false
},
type: {
type: String,
default: "file" // file,image
}
},
computed: {
format() {
if (this.type === "image") {
return ['jpg', 'jpeg', 'png']
}
return [];
}
},
methods: {
handleUpload(file) {
this.$emit('success', file)
}
}
};
</script>
<template> <template>
<div style="padding: 0 70px"> <div style="padding: 0 70px">
<option-block> <option-block>
<Input v-model="current.input" placeholder="请输入待转换数字"> <Input v-model="current.input" :placeholder="$t('decimalConvert_input_placeholder')">
<div slot="prepend" style="width: 70px"><strong>转换数字</strong></div> <div slot="prepend" style="width: 70px"><strong>{{ $t('decimalConvert_input') }}</strong></div>
<Select v-model="current.decimal" slot="append" style="width:100px"> <Select v-model="current.decimal" slot="append" style="width:100px">
<OptionGroup :label="type.common.name"> <OptionGroup :label="$t('decimalConvert_input_type_common')">
<Option v-for="v in type.common.list" :value="v" :key="v">{{ v }} 进制</Option> <Option v-for="v in type.common" :value="v" :key="v">{{
$t('decimalConvert_base', [v])
}}
</Option>
</OptionGroup> </OptionGroup>
<OptionGroup :label="type.other.name"> <OptionGroup :label="$t('decimalConvert_input_type_other')">
<Option v-for="v in type.other.list" :value="v" :key="v">{{ v }} 进制</Option> <Option v-for="v in type.other" :value="v" :key="v">{{
$t('decimalConvert_base', [v])
}}
</Option>
</OptionGroup> </OptionGroup>
</Select> </Select>
</Input> </Input>
</option-block> </option-block>
<option-block v-for="n in [1,2,3,4,5,6]" :key="n"> <option-block v-for="n in [1,2,3,4,5,6]" :key="n">
<Input v-model="current['resultOutput'+n]" readonly> <Input v-model="current['resultOutput'+n]" readonly>
<div slot="prepend" style="width: 70px">转换结果{{ n }}</div> <div slot="prepend" style="width: 70px">{{ $t('decimalConvert_result', [n]) }}</div>
<Select slot="append" v-model="current['resultDecimal'+n]" style="width:100px"> <Select slot="append" v-model="current['resultDecimal'+n]" style="width:100px">
<OptionGroup :label="type.common.name"> <OptionGroup :label="$t('decimalConvert_input_type_common')">
<Option v-for="v in type.common.list" :value="v" :key="v">{{ v }} 进制</Option> <Option v-for="v in type.common" :value="v" :key="v">{{
$t('decimalConvert_base', [v])
}}
</Option>
</OptionGroup> </OptionGroup>
<OptionGroup :label="type.other.name"> <OptionGroup :label="$t('decimalConvert_input_type_other')">
<Option v-for="v in type.other.list" :value="v" :key="v">{{ v }} 进制</Option> <Option v-for="v in type.other" :value="v" :key="v">{{
$t('decimalConvert_base', [v])
}}
</Option>
</OptionGroup> </OptionGroup>
</Select> </Select>
</Input> </Input>
</option-block> </option-block>
<option-block> <option-block>
<Input v-model="current.alphabet"> <Input v-model="current.alphabet">
<div slot="prepend" style="width: 70px">64位字母表</div> <div slot="prepend">{{ $t('decimalConvert_alphabet') }}</div>
<Button slot="append" @click="current.alphabet=alphabet" :disabled="current.alphabet===alphabet">恢复默认 <Button slot="append" @click="current.alphabet=alphabet" :disabled="current.alphabet===alphabet">
{{ $t('decimalConvert_reset') }}
</Button> </Button>
</Input> </Input>
</option-block> </option-block>
...@@ -41,21 +54,40 @@ import Radix from './library/radix.js' ...@@ -41,21 +54,40 @@ import Radix from './library/radix.js'
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@"; const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@";
export default { export default {
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input',(input,current)=>{
try {
const radix = new Radix(current.alphabet);
radix.convent(input, current.decimal, 2, true)
} catch (e) {
return false;
}
return true
})
}, },
watch: { watch: {
convert: function (val) { convert: function (val) {
if (val.alphabet.length !== 64) { if (val.alphabet.length !== 64) {
return this.$Message.error("转换字母表必须是64位长度"); for (let n = 1; n <= 6; n++) {
this.current['resultOutput' + n] = this.$t('decimalConvert_alphabet_length_error').toString()
}
return;
} }
if (!val.input) { if (!val.input) {
return; return;
} }
const radix = new Radix(val.alphabet); const radix = new Radix(val.alphabet);
let isError = false;
for (let n = 1; n <= 6; n++) { for (let n = 1; n <= 6; n++) {
this.current['resultOutput' + n] = radix.convent(val.input, val.decimal, val['resultDecimal' + n]) try {
this.current['resultOutput' + n] = radix.convent(val.input, val.decimal, val['resultDecimal' + n], true)
} catch (e) {
isError = true
this.current['resultOutput' + n] = e.toString()
}
}
if (!isError){
this.$saveToolData(this.current);
} }
this.$saveToolData(this.current);
}, },
}, },
computed: { computed: {
...@@ -74,17 +106,11 @@ export default { ...@@ -74,17 +106,11 @@ export default {
}, },
type() { type() {
let type = { let type = {
common: { common: [2, 8, 10, 16],
name: "常用进制", other: []
list: [2, 8, 10, 16]
},
other: {
name: "其他进制",
list: []
}
} }
for (let i = 2; i <= 64; i++) { for (let i = 2; i <= 64; i++) {
type.common.list.includes(i) || type.other.list.push(i); type.common.includes(i) || type.other.push(i);
} }
return type return type
} }
......
<template> <template>
<div id="tool-hash"> <div id="tool-hash">
<Row :gutter="10"> <Row :gutter="10">
<Col span="8"> <Col span="10">
<input-block> <div style="position: relative;">
<heightResize> <input-block>
<autoHeightTextarea v-model="current.input" :placeholder="$t('hash_content')"/> <heightResize>
</heightResize> <autoHeightTextarea v-model="current.input" :placeholder="$t('hash_content')"/>
<Checkbox slot="extra" v-model="current.isUppercase">{{ $t('hash_uppercase') }}</Checkbox> </heightResize>
</input-block> <template slot="extra">
<updateFile @success="handleUpload"/>
<Checkbox style="margin-left: 10px" v-model="current.isUppercase">{{
$t('hash_uppercase')
}}
</Checkbox>
</template>
</input-block>
<disableMask v-if="isUploadFile" @close="uploadFile = {}">
{{ this.uploadFile.file.name }}
</disableMask>
</div>
</Col> </Col>
<Col span="16"> <Col span="14">
<heightResize @resize="resize"> <heightResize @resize="resize">
<input-block :style="`margin-top: ${no >0 ? 5 : 0}px;`" :text="type" v-for="(type,no) in types" :key="type" @on-default-right-bottom-click="()=>copy(type)"> <input-block :style="`margin-top: ${no >0 ? 5 : 0}px;`" :text="type" v-for="(type,no) in types"
:key="type" @on-default-right-bottom-click="()=>$copy(result(type))">
<autoHeightTextarea :value="result(type)" :height="outputHeight" :placeholder="type"/> <autoHeightTextarea :value="result(type)" :height="outputHeight" :placeholder="type"/>
</input-block> </input-block>
</heightResize> </heightResize>
...@@ -23,63 +35,77 @@ ...@@ -23,63 +35,77 @@
import crypto from "crypto-js" import crypto from "crypto-js"
import heightResize from "./components/heightResize"; import heightResize from "./components/heightResize";
import autoHeightTextarea from "./components/autoHeightTextarea"; import autoHeightTextarea from "./components/autoHeightTextarea";
import updateFile from './components/updateFile';
import disableMask from "./components/disableMask.vue";
const sm = require('sm-crypto'); const sm = require('sm-crypto');
export default { export default {
components: { components: {
updateFile,
heightResize, heightResize,
autoHeightTextarea autoHeightTextarea,
disableMask
}, },
created() { created() {
this.$initToolData('input') this.$initToolData('input')
}, },
computed: { computed: {
realInput() {
return this.isUploadFile ? this.uploadFile.data : this.current.input
},
md5() { md5() {
let result = crypto.MD5(this.current.input).toString(); let result = crypto.MD5(this.realInput).toString();
return this.current.isUppercase ? result.toUpperCase() : result; return this.current.isUppercase ? result.toUpperCase() : result;
}, },
sha1() { sha1() {
let result = crypto.SHA1(this.current.input).toString(); let result = crypto.SHA1(this.realInput).toString();
return this.current.isUppercase ? result.toUpperCase() : result; return this.current.isUppercase ? result.toUpperCase() : result;
}, },
sha256() { sha256() {
let result = crypto.SHA256(this.current.input).toString(); let result = crypto.SHA256(this.realInput).toString();
return this.current.isUppercase ? result.toUpperCase() : result; return this.current.isUppercase ? result.toUpperCase() : result;
}, },
sha512() { sha512() {
let result = crypto.SHA512(this.current.input).toString(); let result = crypto.SHA512(this.realInput).toString();
return this.current.isUppercase ? result.toUpperCase() : result; return this.current.isUppercase ? result.toUpperCase() : result;
}, },
sm3() { sm3() {
let result = sm.sm3(this.current.input); let result = sm.sm3(this.realInput);
return this.current.isUppercase ? result.toUpperCase() : result; return this.current.isUppercase ? result.toUpperCase() : result;
}, },
isUploadFile() {
return "file" in this.uploadFile
},
}, },
watch: { watch: {
current: { current: {
handler() { handler() {
if (this.current.input){ if (this.current.input) {
this.$saveToolData(this.current); this.$saveToolData(this.current);
} }
}, },
deep: true deep: true
} }
}, },
methods:{ methods: {
result(type){ result(type) {
if (!this.current.input) { if (!this.realInput) {
return ""; return "";
} }
return this[type] return this[type]
}, },
copy(type){ resize(height) {
if (this[type]){ this.outputHeight = (height - 20) / 5
this.$clipboardCopy(this[type]) },
handleUpload(file) {
let r = new FileReader()
r.readAsBinaryString(file)
r.onloadend = () => {
let data = crypto.enc.Latin1.parse(r.result);
if (data) {
this.uploadFile = {file, data}
}
} }
}, },
resize(height){
this.outputHeight = (height - 20)/5
}
}, },
data() { data() {
return { return {
...@@ -87,8 +113,9 @@ export default { ...@@ -87,8 +113,9 @@ export default {
input: "", input: "",
isUppercase: false, isUppercase: false,
}, },
uploadFile: {},
types: ['md5', 'sha1', 'sha256', 'sha512', "sm3"], types: ['md5', 'sha1', 'sha256', 'sha512', "sm3"],
outputHeight:100 outputHeight: 100
} }
}, },
} }
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
this.current.output = convert('utf8', 'hex')(this.current.input); this.current.output = convert('utf8', 'hex')(this.current.input);
break; break;
case "str": case "str":
this.current.output = convert('hex', 'utf8')(this.current.input); this.current.output = convert('hex', 'utf8')(this.current.input.trim().replace(/\s+/g, ""));
break; break;
default: default:
return; return;
......
<template>
<Row :gutter="10">
<Col span="10">
<Card :padding="0">
<p slot="title">JSON内容</p>
<code-editor v-model="current.json" :auto-height="330" language="json"></code-editor>
</Card>
<option-block>
<FormItem>
<Input v-model="current.package">
<div slot="prepend">namespace/package</div>
</Input>
</FormItem>
</option-block>
<option-block>
<FormItem>
<Input v-model="current.class">
<div slot="prepend">class/struct</div>
</Input>
</FormItem>
</option-block>
</Col>
<Col span="14">
<Card :padding="0">
<p slot="title">转换结果</p>
<template slot="extra">
<Button style="margin-right: 5px" size="small" v-for="(item,key) in type" :key="key" type="primary"
@click="handle(item)">{{ item }}
</Button>
</template>
<code-editor v-model="current.output" :auto-height="220" :language="languages[current.type]"></code-editor>
</Card>
</Col>
</Row>
</template>
<script>
import codeEditor from "./components/codeEditor";
import json2Go from './library/json2Go'
import json2CSharp from './library/json2CSharp'
import json2Java from './library/json2Java'
import json2Dart from './library/json2Dart'
export default {
components: {
codeEditor,
},
created() {
this.current = Object.assign(this.current, this.$getToolData())
},
methods: {
handle(type) {
try {
require('jsonlint').parse(this.current.json)
if (!this.type.includes(type)) {
throw new Error("转换类型错误")
}
this.current.type = type;
switch (type) {
case "Go":
this.current.output = json2Go(this.current.json, this.current.class, this.current.package).go
break;
case "Java":
this.current.output = json2Java(JSON.parse(this.current.json), this.current.class, this.current.package)
break;
case "Dart":
this.current.output = json2Dart(JSON.parse(this.current.json), this.current.class)
break;
case "C#":
this.current.output = json2CSharp.convert(JSON.parse(this.current.json), this.current.class, this.current.package)
break;
}
} catch (error) {
this.$Notice.error({
title: '错误提示',
desc: error.message,
})
return
}
this.$saveToolData(this.current)
}
},
data() {
return {
current: {
json: "",
type: "Java",
package: "pag",
class: "RootName",
output: "",
},
type: ["Java", "C#", "Go",'Dart'],
languages: {
"Java": "java",
"Dart": "dart",
"C#": "csharp",
"Go": "go"
},
}
},
}
</script>
...@@ -14,6 +14,8 @@ import "codemirror/mode/css/css.js"; ...@@ -14,6 +14,8 @@ import "codemirror/mode/css/css.js";
import "codemirror/mode/xml/xml.js"; import "codemirror/mode/xml/xml.js";
import "codemirror/mode/sql/sql.js"; import "codemirror/mode/sql/sql.js";
import "codemirror/mode/php/php.js"; import "codemirror/mode/php/php.js";
import "codemirror/mode/ruby/ruby.js";
import "codemirror/mode/python/python.js";
import "codemirror/mode/clike/clike.js"; import "codemirror/mode/clike/clike.js";
import "codemirror/mode/go/go.js"; import "codemirror/mode/go/go.js";
import "codemirror/mode/vue/vue.js"; import "codemirror/mode/vue/vue.js";
...@@ -41,8 +43,10 @@ const modes = { ...@@ -41,8 +43,10 @@ const modes = {
scss: "text/x-scss", scss: "text/x-scss",
graphql: "graphql", graphql: "graphql",
java: "text/x-java", java: "text/x-java",
ruby: "text/x-ruby",
markdown: "text/x-markdown", markdown: "text/x-markdown",
php: "text/x-php", php: "text/x-php",
python: "text/x-python",
sql: "text/x-sql", sql: "text/x-sql",
yaml: "text/x-yaml", yaml: "text/x-yaml",
ts: "application/typescript", ts: "application/typescript",
......
<template>
<input-block right="10px" bottom="40px">
<input-block right="10px" bottom="10px">
<code-editor :height="`${height}px`" :placeholder="`Csv ${$t('json_input')}`" v-model="options.input" language="text"/>
<template slot="extra">
<RadioGroup size="small" v-model="options.type" type="button" button-style="solid">
<Radio :label="item.k" v-for="item in types" :key="item.k">
<span>{{ item.n }}</span>
</Radio>
</RadioGroup>
</template>
</input-block>
<template slot="extra">
<Select size="small" v-model="options.keyed_key" v-if="options.type === 'keyed'" style="width: 150px">
<Option v-for="(key,k) in csvKeys" :key="k" :value="k">{{ key }}</Option>
</Select>
</template>
</input-block>
</template>
<script>
import jsonInstance from "../index";
import codeEditor from "../../../components/codeEditor";
import csvToJsonHandler from '../csvToJson';
export default {
props: {
value: {
type: Object,
default: function () {
return {}
}
},
height: {
type: Number,
default: 100
}
},
components: {
codeEditor
},
created() {
this.options = Object.assign(this.options, this.value)
},
computed: {
csvKeys() {
try {
let input = this.options.input.trim();
if (this.options.type === "keyed" && input) {
let json = csvToJsonHandler(this.options.input)
return Object.keys(json[0])
}
} catch {
//
}
return [];
}
},
watch: {
options: {
handler(val) {
let input = val.input.trim();
if (input) {
try {
const option = {
keyed_key: val.keyed_key,
type: val.type
}
// json变化事件
this.$emit('change', jsonInstance.csvToJson(input, option));
this.$emit('input', val);
// 保存数据
this.$emit('saveToolData');
} catch (e) {
this.$emit('change', this.$t('json_error', [e.message]).toString());
}
}
},
deep: true
}
},
data() {
return {
options: {
input: "",
type: "json",
keyed_key: 0
},
types: [
{k: "json", n: this.$t('json_json_type_json')},
{k: "keyed", n: this.$t('json_json_type_keyed')},
{k: "array", n: this.$t('json_json_type_array')},
{k: "column", n: this.$t('json_json_type_column')},
]
}
},
}
</script>
<template>
<input-block right="10px">
<code-editor :height="`${height}px`" :placeholder="`Csv ${$t('json_output')}`" :value="output"/>
<template slot="extra">
<Checkbox v-model="options.quoted">{{ $t('json_add_quote') }}</Checkbox>
<Checkbox v-model="options.header">{{ $t('json_column_name') }}</Checkbox>
</template>
</input-block>
</template>
<script>
import codeEditor from "../../../components/codeEditor";
import jsonInstance from "../index";
export default {
props: {
value: {
type: Object,
default: function () {
return {}
}
},
json: {
type: String,
default: ""
},
height: {
type: Number,
default: 100
}
},
created() {
this.options = Object.assign(this.options, this.value)
},
components: {
codeEditor,
},
computed: {
output() {
const json = this.json.trim();
if (!json) {
return "";
}
try {
let result = jsonInstance.jsonToCsv(JSON.parse(json), {quoted: this.options.quoted,header:this.options.header})
this.$emit('input', this.options);
// 保存数据
this.$emit('saveToolData');
return result;
} catch (error) {
return this.$t('json_error', [error.message]).toString()
}
}
},
data() {
return {
options: {
quoted: false,
header: true
}
}
},
}
</script>
<template>
<div>
<div>
<option-block disable-padding>
<Input v-model="options.packageName">
<div slot="prepend">namespace/package</div>
</Input>
</option-block>
<option-block>
<Input v-model="options.className">
<div slot="prepend">class/struct</div>
</Input>
</option-block>
</div>
<input-block bottom="10px" right="10px">
<code-editor :height="`${height - 84}px`" :placeholder="`Object ${$t('json_output')}`" :value="output"
:language="languages[options.type]"/>
<template slot="extra">
<RadioGroup size="small" v-model="options.type" type="button" button-style="solid">
<Radio :label="type" v-for="(type) in types" :key="type">
<span>{{ type }}</span>
</Radio>
</RadioGroup>
</template>
</input-block>
</div>
</template>
<script>
import codeEditor from "../../../components/codeEditor";
import json2Go from '../json2Go'
import json2CSharp from '../json2CSharp'
import json2Java from '../json2Java'
import json2Dart from '../json2Dart'
export default {
props: {
value: {
type: Object,
default: function () {
return {}
}
},
json: {
type: String,
default: ""
},
height: {
type: Number,
default: 100
}
},
created() {
this.options = Object.assign(this.options, this.value)
},
components: {
codeEditor,
},
computed: {
output() {
const json = this.json.trim();
if (!json) {
return "";
}
try {
let result = "";
require('jsonlint').parse(json)
switch (this.options.type) {
case "Go":
result = json2Go(json, this.options.className, this.options.packageName).go
break
case "Java":
result = json2Java(JSON.parse(json), this.options.className, this.options.packageName)
break
case "Dart":
result = json2Dart(JSON.parse(json), this.options.className)
break
case "C#":
result = json2CSharp.convert(JSON.parse(json), this.options.className, this.options.packageName)
break
default:
throw new Error('language type error')
}
this.$emit('input', this.options);
// 保存数据
this.$emit('saveToolData');
return result;
} catch (error) {
return this.$t('json_error', [error.message]).toString()
}
},
types() {
return Object.keys(this.languages)
}
},
data() {
return {
options: {
type: "Java",
packageName: "pag",
className: "RootName",
},
languages: {
"Java": "java",
"Dart": "dart",
"C#": "csharp",
"Go": "go"
},
}
},
}
</script>
<template>
<input-block right="10px">
<code-editor :height="`${height}px`" :placeholder="`Html Table ${$t('json_output')}`" :value="output" language="html"/>
<template slot="extra">
<Checkbox v-model="options.header">{{ $t('json_column_name') }}</Checkbox>
</template>
</input-block>
</template>
<script>
import codeEditor from "../../../components/codeEditor";
import jsonInstance from "../index";
export default {
props: {
value: {
type: Object,
default: function () {
return {}
}
},
json: {
type: String,
default: ""
},
height: {
type: Number,
default: 100
}
},
created() {
this.options = Object.assign(this.options, this.value)
},
components: {
codeEditor,
},
computed: {
output() {
const json = this.json.trim();
if (!json) {
return "";
}
try {
let result = jsonInstance.jsonToTable(JSON.parse(json), {header:this.options.header})
this.$emit('input', this.options);
// 保存数据
this.$emit('saveToolData');
return result;
} catch (error) {
return this.$t('json_error', [error.message]).toString()
}
}
},
data() {
return {
options: {
header: true
}
}
},
}
</script>
<template>
<input-block right="10px" bottom="40px">
<input-block right="10px" bottom="10px">
<code-editor :height="`${height}px`" :placeholder="`Html Table ${$t('json_input')}`" v-model="options.input" language="html"/>
<template slot="extra">
<RadioGroup size="small" v-model="options.type" type="button" button-style="solid">
<Radio :label="item.k" v-for="item in types" :key="item.k">
<span>{{ item.n }}</span>
</Radio>
</RadioGroup>
</template>
</input-block>
<template slot="extra">
<Select size="small" v-model="options.keyed_key" v-if="options.type === 'keyed'" style="width: 150px">
<Option v-for="(key,k) in tableKeys" :key="k" :value="k">{{ key }}</Option>
</Select>
</template>
</input-block>
</template>
<script>
import jsonInstance from "../index";
import codeEditor from "../../../components/codeEditor";
import {tableKeys} from '../tableToJson';
export default {
props: {
value: {
type: Object,
default: function () {
return {}
}
},
height: {
type: Number,
default: 100
}
},
components: {
codeEditor
},
created() {
this.options = Object.assign(this.options, this.value)
},
computed: {
tableKeys() {
try {
let input = this.options.input.trim();
if (this.options.type === "keyed" && input) {
return tableKeys(this.options.input)
}
} catch {
//
}
return [];
}
},
watch: {
options: {
handler(val) {
let input = val.input.trim();
if (input) {
try {
const option = {
keyed_key: val.keyed_key,
type: val.type
}
// json变化事件
this.$emit('change', jsonInstance.tableToJson(input, option));
this.$emit('input', val);
// 保存数据
this.$emit('saveToolData');
} catch (e) {
console.log(e)
this.$emit('change', this.$t('json_error', [e.message]).toString());
}
}
},
deep: true
}
},
data() {
return {
options: {
input: "",
type: "json",
keyed_key: 0
},
types: [
{k: "json", n: this.$t('json_json_type_json')},
{k: "keyed", n: this.$t('json_json_type_keyed')},
{k: "array", n: this.$t('json_json_type_array')},
{k: "column", n: this.$t('json_json_type_column')},
]
}
},
}
</script>
import {parse} from 'csv-parse/lib/sync';
import {jsonOutputFormat} from './helper';
const convert = (csv = "", {type = "json",keyed_key=0} = {}) => {
return jsonOutputFormat(
parse(csv, {columns: true, skip_empty_lines: true}),
type,
keyed_key
)
}
export default convert
export const createTempElement = (innerHTML = "", type = "div", id = "") => {
const el = document.createElement(type);
el.id = id ? id : `ctool-temp-${Math.ceil(Math.random() * 99999)}`
el.style.cssText = "display:none;"
document.body.appendChild(el);
// 移除script标签
el.innerHTML = innerHTML.replace(/<script/gmi, "<xxxxx")
return el;
}
export const jsonOutputFormat = (json, type = "json", keyed_key = 0) => {
if (type === "keyed") {
const keys = Object.keys(json[0])
let result = {}
for (let item of json) {
let item_key = keys[keyed_key]
result[item[item_key]] = item
}
return result
}
if (type === "array") {
let result = json.map((item) => {
return Object.values(item)
})
if (result.length > 0) {
result = [
Object.keys(json[0]),
...result
]
}
return result
}
if (type === "column") {
const keys = Object.keys(json[0])
let result = {}
for (let key of keys) {
result[key] = json.map((item) => {
return item[key]
})
}
return result
}
return json
}
import Unicode from "../unicode";
import formatter from "../formatter/json";
import csvToJson from './csvToJson';
import tableToJson from './tableToJson';
import jsonToTable from './jsonToTable';
import {stringify} from 'csv-stringify/lib/sync';
// 校验语法
export const check = (content) => {
require('jsonlint').parse(content)
return content;
}
// 美化
export const beautify = (content) => {
return formatter.beautify(check(content))
}
// 压缩
export const compress = (content) => {
return formatter.compress(content)
}
// unicode2zh
export const unicode2zh = (content) => {
return Unicode.decode(
content.replace(/\\U[0-9a-fA-F]{4}/g, (item) => {
// \Uxxxx=>\uxxxx
return item.replace("\\U", "\\u");
})
)
}
// zh2unicode
export const zh2unicode = (content) => {
if (content) {
let newStr = ''
for (let i = 0; i < content.length; i++) {
let str = content.charAt(i)
newStr += /[\u4e00-\u9fa5]/.test(str) ? '\\u' + str.charCodeAt(0).toString(16) : str
}
return newStr
}
return content
}
// 转义
export const escape = (content) => {
return content.trim().replace(/\\/g, '\\\\').replace(/"/g, '\\"')
}
// 去转义
export const clearEscape = (content) => {
return content.trim().replace(/\\\\/g, '\\').replace(/\\"/g, '"')
}
// 转get参数
export const toGet = (content) => {
check(content)
return require('query-string').stringify(
JSON.parse(content), {arrayFormat: 'bracket'}
)
}
// get转json
export const fromGet = (content) => {
return beautify(JSON.stringify(require('query-string').parse(content.trim(), {arrayFormat: 'bracket'})))
}
export default {
check,
beautify,
compress,
unicode2zh,
zh2unicode,
escape,
clearEscape,
toGet,
fromGet,
csvToJson: (csv = "", option = {}) => {
return beautify(JSON.stringify(csvToJson(csv, option)))
},
jsonToCsv: (json = [], {quoted = false, header = true} = {}) => {
return stringify(json, {quoted, header})
},
tableToJson: (table = "", option = {}) => {
return beautify(JSON.stringify(tableToJson(table, option)))
},
jsonToTable: (json = [], option = {}) => {
return jsonToTable(json, option)
},
}
/*
JSON-to-Go
by Matt Holt
https://github.com/mholt/json-to-go
A simple utility to translate JSON into a Go type definition.
*/
export default function (json, typename, pag, flatten = true) {
let data;
let scope;
let go = "";
let tabs = 0;
const seen = {};
const stack = [];
let accumulator = "";
let innerTabs = 0;
let parent = "";
try {
data = JSON.parse(json.replace(/:(\s*\d*)\.0/g, ":$1.1")); // hack that forces floats to stay as floats
scope = data;
} catch (e) {
return {
go: "",
error: e.message
};
}
typename = format(typename || "AutoGenerated");
append(`package ${pag}\n\n`);
append(`type ${typename} `);
parseScope(scope);
return {
go: flatten
? go += accumulator
: go
};
function parseScope(scope, depth = 0) {
if (typeof scope === "object" && scope !== null) {
if (Array.isArray(scope)) {
let sliceType;
const scopeLength = scope.length;
for (let i = 0; i < scopeLength; i++) {
const thisType = goType(scope[i]);
if (!sliceType)
sliceType = thisType;
else if (sliceType !== thisType) {
sliceType = mostSpecificPossibleGoType(thisType, sliceType);
if (sliceType === "interface{}")
break;
}
}
const slice = flatten && ["struct", "slice"].includes(sliceType)
? `[]${parent}`
: `[]`;
if (flatten && depth >= 2)
appender(slice);
else
append(slice)
if (sliceType === "struct") {
const allFields = {};
// for each field counts how many times appears
for (let i = 0; i < scopeLength; i++) {
const keys = Object.keys(scope[i])
for (let k in keys) {
let keyname = keys[k];
if (!(keyname in allFields)) {
allFields[keyname] = {
value: scope[i][keyname],
count: 0
}
} else {
const existingValue = allFields[keyname].value;
const currentValue = scope[i][keyname];
if (compareObjects(existingValue, currentValue)) {
const comparisonResult = compareObjectKeys(
Object.keys(currentValue),
Object.keys(existingValue)
)
if (!comparisonResult) {
keyname = `${keyname}_${uuidv4()}`;
allFields[keyname] = {
value: currentValue,
count: 0
};
}
}
}
allFields[keyname].count++;
}
}
// create a common struct with all fields found in the current array
// omitempty dict indicates if a field is optional
const keys = Object.keys(allFields), struct = {}, omitempty = {};
for (let k in keys) {
const keyname = keys[k], elem = allFields[keyname];
struct[keyname] = elem.value;
omitempty[keyname] = elem.count !== scopeLength;
}
parseStruct(depth + 1, innerTabs, struct, omitempty); // finally parse the struct !!
} else if (sliceType === "slice") {
parseScope(scope[0], depth)
} else {
if (flatten && depth >= 2) {
appender(sliceType || "interface{}");
} else {
append(sliceType || "interface{}");
}
}
} else {
if (flatten) {
if (depth >= 2) {
appender(parent)
} else {
append(parent)
}
}
parseStruct(depth + 1, innerTabs, scope);
}
} else {
if (flatten && depth >= 2) {
appender(goType(scope));
} else {
append(goType(scope));
}
}
}
function parseStruct(depth, innerTabs, scope, omitempty) {
if (flatten) {
stack.push(
depth >= 2
? "\n"
: ""
)
}
if (flatten && depth >= 2) {
const parentType = `type ${parent}`;
const scopeKeys = formatScopeKeys(Object.keys(scope));
// this can only handle two duplicate items
// future improvement will handle the case where there could
// three or more duplicate keys with different values
if (parent in seen && compareObjectKeys(scopeKeys, seen[parent])) {
stack.pop();
return
}
seen[parent] = scopeKeys;
appender(`${parentType} struct {\n`);
++innerTabs;
const keys = Object.keys(scope);
for (let i in keys) {
const keyname = getOriginalName(keys[i]);
indenter(innerTabs)
const typename = format(keyname)
appender(typename + " ");
parent = typename
parseScope(scope[keys[i]], depth);
appender(' `json:"' + keyname);
if (omitempty && omitempty[keys[i]] === true) {
appender(',omitempty');
}
appender('"`\n');
}
indenter(--innerTabs);
appender("}");
} else {
append("struct {\n");
++tabs;
const keys = Object.keys(scope);
for (let i in keys) {
const keyname = getOriginalName(keys[i]);
indent(tabs);
const typename = format(keyname);
append(typename + " ");
parent = typename
parseScope(scope[keys[i]], depth);
append(' `json:"' + keyname);
if (omitempty && omitempty[keys[i]] === true) {
append(',omitempty');
}
append('"`\n');
}
indent(--tabs);
append("}");
}
if (flatten)
accumulator += stack.pop();
}
function indent(tabs) {
for (let i = 0; i < tabs; i++)
go += '\t';
}
function append(str) {
go += str;
}
function indenter(tabs) {
for (let i = 0; i < tabs; i++)
stack[stack.length - 1] += '\t';
}
function appender(str) {
stack[stack.length - 1] += str;
}
// Sanitizes and formats a string to make an appropriate identifier in Go
function format(str) {
if (!str)
return "";
else if (str.match(/^\d+$/))
str = "Num" + str;
else if (str.charAt(0).match(/\d/)) {
const numbers = {
'0': "Zero_", '1': "One_", '2': "Two_", '3': "Three_",
'4': "Four_", '5': "Five_", '6': "Six_", '7': "Seven_",
'8': "Eight_", '9': "Nine_"
};
str = numbers[str.charAt(0)] + str.substr(1);
}
return toProperCase(str).replace(/[^a-z0-9]/ig, "") || "NAMING_FAILED";
}
// Determines the most appropriate Go type
function goType(val) {
if (val === null)
return "interface{}";
switch (typeof val) {
case "string":
if (/\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(\+\d\d:\d\d|Z)/.test(val))
return "time.Time";
else
return "string";
case "number":
if (val % 1 === 0) {
if (val > -2147483648 && val < 2147483647)
return "int";
else
return "int64";
} else
return "float64";
case "boolean":
return "bool";
case "object":
if (Array.isArray(val))
return "slice";
return "struct";
default:
return "interface{}";
}
}
// Given two types, returns the more specific of the two
function mostSpecificPossibleGoType(typ1, typ2) {
if (typ1.substr(0, 5) === "float"
&& typ2.substr(0, 3) === "int")
return typ1;
else if (typ1.substr(0, 3) === "int"
&& typ2.substr(0, 5) === "float")
return typ2;
else
return "interface{}";
}
// Proper cases a string according to Go conventions
function toProperCase(str) {
// https://github.com/golang/lint/blob/5614ed5bae6fb75893070bdc0996a68765fdd275/lint.go#L771-L810
const commonInitialisms = [
"ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP",
"HTTPS", "ID", "IP", "JSON", "LHS", "QPS", "RAM", "RHS", "RPC", "SLA",
"SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "UID", "UUID",
"URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS"
];
return str.replace(/(^|[^a-zA-Z])([a-z]+)/g, function (unused, sep, frag) {
if (commonInitialisms.indexOf(frag.toUpperCase()) >= 0)
return sep + frag.toUpperCase();
else
return sep + frag[0].toUpperCase() + frag.substr(1).toLowerCase();
}).replace(/([A-Z])([a-z]+)/g, function (unused, sep, frag) {
if (commonInitialisms.indexOf(sep + frag.toUpperCase()) >= 0)
return (sep + frag).toUpperCase();
else
return sep + frag;
});
}
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
function getOriginalName(unique) {
const reLiteralUUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
const uuidLength = 36;
if (unique.length >= uuidLength) {
const tail = unique.substr(-uuidLength);
if (reLiteralUUID.test(tail)) {
return unique.slice(0, -1 * (uuidLength + 1))
}
}
return unique
}
function compareObjects(objectA, objectB) {
const object = "[object Object]";
return Object.prototype.toString.call(objectA) === object
&& Object.prototype.toString.call(objectB) === object;
}
function compareObjectKeys(itemAKeys, itemBKeys) {
const lengthA = itemAKeys.length;
const lengthB = itemBKeys.length;
// nothing to compare, probably identical
if (lengthA === 0 && lengthB === 0)
return true;
// duh
if (lengthA !== lengthB)
return false;
for (let item of itemAKeys) {
if (!itemBKeys.includes(item))
return false;
}
return true;
}
function formatScopeKeys(keys) {
for (let i in keys) {
keys[i] = format(keys[i]);
}
return keys
}
}
\ No newline at end of file
const IMPORT_MAP = {'Date': 'java.util.Date', 'List': 'java.util.List'}
let attrClassAry = [];
function firstToUpperCase(str) {
return str.substr(0, 1).toUpperCase() + str.substr(1);
}
function camelCase(input) {
return input.toLowerCase().replace(/_(.)/g, function (match, group1) {
return group1.toUpperCase();
});
}
function camelCaseWithFirstCharUpper(input) {
if (!input) {
return ""
}
input = camelCase(input);
return input[0].toUpperCase() + input.substr(1);
}
function isDate(date) {
return new Date(date) !== "Invalid Date" && !isNaN(new Date(date)) && isNaN(+date);
}
function isInt(n) {
return n % 1 === 0;
}
function toBeanText(bean, packageName) {
let beanFields = bean.val;
let className = bean.name;
let importText = "";
let fieldText = "";
let setterText = "";
let typeSet = {};
let shoudImportJackson = false;
let tpl = " public void setA(T a) {\n \
this.a = a;\n \
}\n \
public T getA() {\n \
return a;\n \
}\n";
for (let key in beanFields) {
let camelKey = camelCase(key);
if (camelKey !== key) {
fieldText += ' @JsonProperty("' + key + '")\n';
shoudImportJackson = true;
}
fieldText += " private " + beanFields[key] + " " + camelKey + ";\n";
let type = beanFields[key];
if (type.indexOf("List<") > -1) {
type = beanFields[key].replace('List<', "");
type = type.replace('>', "");
typeSet["List"] = 'true';
}
typeSet[type] = 'true';
let tplMap = {a: camelKey, A: firstToUpperCase(camelKey), T: beanFields[key]};
setterText += tpl.replace(/a|A|T/g, function (matched) {
return tplMap[matched];
});
}
for (let t in typeSet) {
if (IMPORT_MAP[t]) {
importText += "import " + IMPORT_MAP[t] + ";\n";
}
}
if (shoudImportJackson) {
importText += "import org.codehaus.jackson.annotate.JsonIgnoreProperties;\nimport org.codehaus.jackson.annotate.JsonProperty;\n"
}
if (packageName) {
importText = "package " + packageName + ";\n" + importText;
}
return "/*=============="+className+".java file============*/\n"+importText + "\n" + "public class " + className + " {\n" + fieldText + setterText + "}\n\n";
}
function getBeanFieldFromJson(json, className) {
let jsonObject;
let text = JSON.stringify(json);
if (text[0] === "[" && text[text.length - 1] === "]") {
text = '{ "list": ' + text + '}';
jsonObject = JSON.parse(text).list[0];
} else {
jsonObject = JSON.parse(text);
}
let bean = {};
attrClassAry = []
for (let key in jsonObject) {
const val = jsonObject[key];
bean[key] = getTypeFromJsonVal(val, key, attrClassAry);
}
if (!className) {
className = "AtoolBean";
}
bean = {name: className, val: bean};
return [bean, ...attrClassAry];
}
function getTypeFromJsonVal(val, key, attrClassAry) {
if (val && val.replace) {
val = val.replace(/ /g, "");
}
let typeofStr = typeof (val);
if (typeofStr === 'number') {
if (isInt(val)) {
return "int";
} else {
return "double";
}
} else if (typeofStr === 'boolean') {
return typeofStr;
} else if (isDate(val)) {
return "Date";
} else if (!val) {
return "String";
} else if (typeofStr === 'string') {
return "String";
} else {
if (Array.isArray(val)) {
let type = getTypeFromJsonVal(val[0], key, attrClassAry);
return "List<" + type + ">";
} else {
let typeName = camelCaseWithFirstCharUpper(key);
let bean = {};
for (key in val) {
let fieldValue = val[key];
bean[key] = getTypeFromJsonVal(fieldValue, key, attrClassAry);
}
attrClassAry.push({name: typeName, val: bean});
return typeName;
}
}
}
export default (json, cls = "JsonRootBean", pag = "pag.json2bean") => {
let beans = [];
let temp = getBeanFieldFromJson(json, cls);
for (let key in temp) {
beans.push(toBeanText(temp[key], pag));
}
return beans.join("\n");
}
\ No newline at end of file
import _ from "lodash";
import {beautify} from "../formatter/html";
const convert = (json = [], {header = true} = {}) => {
if (!_.isArray(json) || json.length < 1) {
return ""
}
let html = ["<table>"];
let keys = Object.keys(json[0])
if (header) {
html.push(
'<thead>',
'<tr>',
...keys.map((item) => {
return `<th>${item}</th>`
}),
'</tr>',
'</thead>'
)
}
html.push("<tbody>")
for (let row of json) {
html.push("<tr>", ...keys.map((item) => {
return `<td>${item in row ? row[item] : ""}</td>`
}), '</tr>');
}
html.push("</tbody></table>")
return beautify(html.join(""))
}
export default convert
import {createTempElement, jsonOutputFormat} from "./helper";
import _ from "lodash";
const nodeFilter = (item) => {
if (item == null) {
return "";
}
const re = new RegExp("<\/?\\w+((\\s+\\w+(\\s*=\\s*(?:\".*?\"|'.*?'|[^'\">\\s]+))?)+\\s*|\\s*)\/?>", 'igm');
item = item.replace(/\r\n|\r|\n/gmi, ' ');
item = item.replace(/\n|<br>|<br\/>|<br \/>/gmi, '\n');
item = item.replace(re, '');
item = _.unescape(item);
item = item.replace(/&nbsp;/gmi, " ");
return item.trim();
}
export const tableKeys = (table) => {
table = table.trim();
if (!table) {
return [];
}
const tableElement = createTempElement(table).getElementsByTagName('table')[0];
let cells = tableElement.getElementsByTagName('tr')[0].querySelectorAll('td,th');
let result = [];
for (let n = 0; n < cells.length; n++) {
result.push(nodeFilter(cells[n].innerHTML))
}
return result;
}
const convert = (table = "", {
keyed_key = 0,
type = "json"
} = {}) => {
table = table.trim();
if (!table) {
return "";
}
let keys = tableKeys(table)
const rows = createTempElement(table).getElementsByTagName('table')[0].getElementsByTagName('tr')
let result = [];
for (let i = 1; i < rows.length; i++) {
const row = rows[i].querySelectorAll('td');
let resultRow = {}
for (let k = 0; k < keys.length; k++) {
resultRow[keys[k]] = nodeFilter(k in row ? row[k].innerHTML : "")
}
result.push(resultRow)
}
return jsonOutputFormat(
result,
type,
keyed_key
)
}
export default convert
...@@ -5,8 +5,14 @@ class Radix { ...@@ -5,8 +5,14 @@ class Radix {
BigNumber.config({ALPHABET: formatter}) BigNumber.config({ALPHABET: formatter})
} }
convent(base, source, target) { convent(base, source, target, debug = false) {
if (debug){
BigNumber.DEBUG = true
}
let sourceNum = new BigNumber(base, source); let sourceNum = new BigNumber(base, source);
if (debug){
BigNumber.DEBUG = false
}
return sourceNum.toString(target); return sourceNum.toString(target);
} }
} }
......
...@@ -21,13 +21,9 @@ ...@@ -21,13 +21,9 @@
<TabPane :label="$t('qrCode_reader_title')" name="reader"> <TabPane :label="$t('qrCode_reader_title')" name="reader">
<Row :gutter="16"> <Row :gutter="16">
<Col span="14"> <Col span="14">
<input-block style="margin-bottom: 10px" bottom="0px" right="10px" class="tool-reader-input"> <input-block style="margin-bottom: 10px" class="tool-reader-input">
<pasteClipboardFlie @on-paste-image="handleUpload"> <Input v-model="current.readerInput" :rows="5" type="textarea" :placeholder="$t('qrCode_reader_input')" />
<Input v-model="current.readerInput" :rows="5" type="textarea" :placeholder="$t('qrCode_reader_input')"></Input> <updateFile slot="extra" type="image" @success="handleUpload" />
</pasteClipboardFlie>
<Upload slot="extra" action="#" :before-upload="handleUpload">
<Button size="small" type="primary" icon="ios-cloud-upload-outline">{{ $t('qrCode_reader_upload') }}</Button>
</Upload>
</input-block> </input-block>
<heightResize :reduce="52" :append="['.tool-reader-input']"> <heightResize :reduce="52" :append="['.tool-reader-input']">
<autoHeightTextarea :value="readerOutput" :placeholder="$t('qrCode_reader_output')" /> <autoHeightTextarea :value="readerOutput" :placeholder="$t('qrCode_reader_output')" />
...@@ -48,13 +44,13 @@ import generator from 'qrcode' ...@@ -48,13 +44,13 @@ import generator from 'qrcode'
import qrcodeParser from 'qrcode-parser' import qrcodeParser from 'qrcode-parser'
import model from '../../tool/model' import model from '../../tool/model'
import Jimp from 'jimp'; import Jimp from 'jimp';
import pasteClipboardFlie from './components/pasteClipboardFlie'; import updateFile from './components/updateFile';
import heightResize from "./components/heightResize"; import heightResize from "./components/heightResize";
import autoHeightTextarea from "./components/autoHeightTextarea"; import autoHeightTextarea from "./components/autoHeightTextarea";
export default { export default {
components: { components: {
pasteClipboardFlie, updateFile,
heightResize, heightResize,
autoHeightTextarea autoHeightTextarea
}, },
......
<template> <template>
<div> <div>
<Row :gutter="10"> <heightResize :append="['.page-option-block']" ignore @resize="resize">
<Col span="12"> <Row :gutter="10">
<Card :padding="0"> <Col span="12">
<p slot="title">PEM格式公钥</p> <input-block top="5px" type="default" :text="$t('sign_sign_data')" @on-default-right-bottom-click="()=>copy('signData')">
<Input v-model="current.publicKey" :rows="6" type="textarea" placeholder="PEM格式公钥"></Input> <autoHeightTextarea :height="height1" v-model="current.signData"></autoHeightTextarea>
</Card> </input-block>
</Col> </Col>
<Col span="12"> <Col span="12">
<Card :padding="0"> <input-block top="5px" type="default" :text="$t('sign_verify_code')" @on-default-right-bottom-click="()=>copy('verifyCode')">
<p slot="title">PEM格式私钥</p> <autoHeightTextarea :height="height1" v-model="current.verifyCode"></autoHeightTextarea>
<Input v-model="current.privateKey" :rows="6" type="textarea" placeholder="PEM格式私钥"></Input> </input-block>
</Card> </Col>
</Col> </Row>
</Row> <option-block class="page-option-block" center>
<Row :gutter="10" style="margin-top: 5px"> <FormItem>
<Col span="12"> <Select v-model="current.algorithm" style="width: 200px">
<Card :padding="0"> <Option v-for="v in algorithm" :value="v" :key="v">{{ v }}</Option>
<p slot="title">待签名内容/验签数据</p> </Select>
<Input v-model="current.signData" :rows="6" type="textarea"></Input> </FormItem>
</Card> <FormItem>
</Col> <ButtonGroup>
<Col span="12"> <Button type="primary" @click="sign()">{{ $t('sign_sign') }}</Button>
<Card :padding="0"> <Button type="primary" @click="verify()">{{ $t('sign_verify') }}</Button>
<p slot="title">Base64编码后签名</p> </ButtonGroup>
<Input v-model="current.verifyCode" :rows="6" type="textarea"></Input> </FormItem>
</Card> <FormItem>
</Col> <Button type="default" @click="openGenerateKeypairBlock()">{{ $t('sign_generate_keypair') }}</Button>
</Row> </FormItem>
<option-block> </option-block>
<FormItem> <Row :gutter="10">
<Select v-model="current.algorithm" style="width: 200px"> <Col span="12">
<Option v-for="v in algorithm" :value="v" :key="v">{{ v }}</Option> <input-block top="5px" type="default" :text="$t('sign_public_key')" @on-default-right-bottom-click="()=>copy('publicKey')">
</Select> <autoHeightTextarea :height="height2" v-model="current.publicKey"></autoHeightTextarea>
</FormItem> </input-block>
<FormItem> </Col>
<ButtonGroup> <Col span="12">
<Button type="primary" @click="sign()">签名</Button> <input-block top="5px" type="default" :text="$t('sign_private_key')" @on-default-right-bottom-click="()=>copy('privateKey')">
<Button type="primary" @click="verify()">验签</Button> <autoHeightTextarea :height="height2" v-model="current.privateKey"></autoHeightTextarea>
</input-block>
</ButtonGroup> </Col>
</FormItem> </Row>
<FormItem> </heightResize>
<Button type="default" @click="openGenerateKeypairBloack()">生成公钥/私钥</Button> <Modal v-model="generateKeypairData.show" :title="$t('sign_generate_keypair')">
</FormItem>
</option-block>
<Modal
v-model="generateKeypairData.show"
title="生成公钥/私钥"
>
<Form :label-width="80"> <Form :label-width="80">
<FormItem label="密钥格式"> <FormItem :label="$t('sign_keypair_type')">
<Select v-model="generateKeypairData.type"> <Select v-model="generateKeypairData.type">
<Option value="PKCS8PRV">PKCS#8</Option> <Option value="PKCS8PRV">PKCS#8</Option>
<Option value="PKCS1PRV">PKCS#1</Option> <Option value="PKCS1PRV">PKCS#1</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="密钥长度"> <FormItem :label="$t('sign_keypair_length')">
<Select v-model="generateKeypairData.length"> <Select v-model="generateKeypairData.length">
<Option :value="512">512 bit</Option> <Option :value="512">512 bit</Option>
<Option :value="1024">1024 bit</Option> <Option :value="1024">1024 bit</Option>
...@@ -66,78 +60,67 @@ ...@@ -66,78 +60,67 @@
</FormItem> </FormItem>
</Form> </Form>
<div slot="footer"> <div slot="footer">
<Button type="text" @click="generateKeypairData.show = false">取消</Button> <Button type="text" @click="generateKeypairData.show = false">{{ $t('sign_generate_cancel') }}</Button>
<Button type="primary" disabled v-if="generateKeypairData.loading">生成中</Button> <Button type="primary" disabled v-if="generateKeypairData.loading">{{ $t('sign_generate_in') }}</Button>
<Button v-else type="primary" @click="generateKeypair()">生成</Button> <Button v-else type="primary" @click="generateKeypair()">{{ $t('sign_generate') }}</Button>
</div> </div>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import rs from "jsrsasign"; import rs from "jsrsasign";
import autoHeightTextarea from "./components/autoHeightTextarea";
import heightResize from "./components/heightResize";
export default { export default {
components:{
autoHeightTextarea,
heightResize
},
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
methods: { methods: {
sign() { sign() {
if (!this.current.signData || !this.current.privateKey){
return this.$Message.error('待签名内容/验签数据/PEM格式私钥 必填')
}
let rsaPrivateKey
try { try {
rsaPrivateKey = rs.KEYUTIL.getKey(this.current.privateKey) if (!this.current.signData || !this.current.privateKey){
} catch (e) { throw new Error(this.$t('sign_error_sign_content_empty').toString())
return this.$Message.error("无效私钥" + e) }
} let rsaPrivateKey = rs.KEYUTIL.getKey(this.current.privateKey)
let sign let sign = new rs.KJUR.crypto.Signature({alg: this.current.algorithm})
try { sign.init(rsaPrivateKey)
sign = new rs.KJUR.crypto.Signature({alg: this.current.algorithm}) sign.updateString(this.current.signData)
} catch (e) { let signResult = sign.sign()
return this.$Message.error("无效签名算法") // 转为base64
} this.current.verifyCode = rs.hex2b64(signResult)
sign.init(rsaPrivateKey) // 自动复制签名结果到剪切板
sign.updateString(this.current.signData) this.$clipboardCopy(this.current.verifyCode);
let signResult // 保存历史记录
try { this.$saveToolData(this.current);
signResult = sign.sign() }catch (e){
} catch (e) { this.$Message.error(this.$t('sign_error',[e.message]).toString())
return this.$Message.error("签名时出现异常" + e)
} }
// 转为base64
this.current.verifyCode = rs.hex2b64(signResult)
// 自动复制签名结果到剪切板
this.$clipboardCopy(this.current.verifyCode);
// 保存历史记录
this.$saveToolData(this.current);
}, },
verify() { verify() {
if (!this.current.verifyCode || !this.current.publicKey){
return this.$Message.error('Base64编码后签名/PEM格式公钥 必填')
}
let rsaPublicKey
try {
rsaPublicKey = rs.KEYUTIL.getKey(this.current.publicKey)
} catch (e) {
return this.$Message.error("无效公钥")
}
let sign
try { try {
sign = new rs.KJUR.crypto.Signature({alg: this.current.algorithm}) if (!this.current.verifyCode || !this.current.publicKey){
} catch (e) { throw new Error(this.$t('sign_error_verify_content_empty').toString())
return this.$Message.error("无效签名算法") }
} let rsaPublicKey = rs.KEYUTIL.getKey(this.current.publicKey)
sign.init(rsaPublicKey) let sign = new rs.KJUR.crypto.Signature({alg: this.current.algorithm})
sign.updateString(this.current.signData) sign.init(rsaPublicKey)
let hexData = rs.b64tohex(this.current.verifyCode) sign.updateString(this.current.signData)
let verifyResult = sign.verify(hexData) let hexData = rs.b64tohex(this.current.verifyCode)
if (verifyResult) { let verifyResult = sign.verify(hexData)
if (!verifyResult) {
throw new Error(this.$t('sign_verify_fail').toString())
}
// 保存历史记录 // 保存历史记录
this.$saveToolData(this.current); this.$saveToolData(this.current);
return this.$Message.info("验签成功") this.$Message.info(this.$t('sign_verify_ok').toString())
}catch (e){
this.$Message.error(this.$t('sign_error',[e.message]).toString())
} }
return this.$Message.error("验签失败")
}, },
generateKeypair() { generateKeypair() {
this.generateKeypairData.loading = true; this.generateKeypairData.loading = true;
...@@ -148,16 +131,25 @@ export default { ...@@ -148,16 +131,25 @@ export default {
this.current.publicKey = rs.KEYUTIL.getPEM(rsaKeypair.pubKeyObj) this.current.publicKey = rs.KEYUTIL.getPEM(rsaKeypair.pubKeyObj)
this.generateKeypairData.show = false this.generateKeypairData.show = false
} catch (e) { } catch (e) {
this.$Message.error("秘钥生成失败") this.$Message.error(this.$t('sign_error',[e.message]).toString())
} }
this.generateKeypairData.loading = false; this.generateKeypairData.loading = false;
}, 500) }, 500)
}, },
openGenerateKeypairBloack() { openGenerateKeypairBlock() {
this.generateKeypairData.show = true; this.generateKeypairData.show = true;
this.generateKeypairData.loading = false; this.generateKeypairData.loading = false;
this.generateKeypairData.type = "PKCS8PRV"; this.generateKeypairData.type = "PKCS8PRV";
this.generateKeypairData.length = 2048; this.generateKeypairData.length = 2048;
},
resize(height){
this.height1 = Math.min(160,Math.ceil(height/2))
this.height2 = height - this.height1
},
copy(type){
if ((type in this.current) && this.current[type]){
this.$copy(this.current[type],true);
}
} }
}, },
data() { data() {
...@@ -175,7 +167,9 @@ export default { ...@@ -175,7 +167,9 @@ export default {
loading: false, loading: false,
length: 2048, length: 2048,
type: "PKCS8PRV", type: "PKCS8PRV",
} },
height1:100,
height2:100,
} }
} }
} }
......
<template> <template>
<div> <div>
<Tabs name="default"> <Tabs name="default">
<TabPane label="差值计算器" name="default"> <TabPane :label="$t('time_diff_tool')" name="default">
<option-block> <option-block disable-padding>
<FormItem> <FormItem>
<DatePicker transfer v-model="current.poor.input1" :options="options" type="datetime" <DatePicker transfer v-model="current.poor.input1" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker> format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem> </FormItem>
<FormItem> <FormItem>
{{ $t('time_and') }}
</FormItem> </FormItem>
<FormItem> <FormItem>
<DatePicker transfer v-model="current.poor.input2" :options="options" type="datetime" <DatePicker transfer v-model="current.poor.input2" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker> format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem> </FormItem>
<FormItem> <FormItem>
相差 {{ $t('time_diff') }}
</FormItem> </FormItem>
<FormItem> <FormItem>
<Input v-model="poor"> <Input v-model="poor">
<Select transfer v-model="current.poor.unit" slot="append" style="width: 60px"> <Select transfer v-model="current.poor.unit" slot="append" style="width: 80px">
<Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{ v.n }}</Option> <Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{ v.n }}</Option>
</Select> </Select>
</Input> </Input>
...@@ -29,27 +29,47 @@ ...@@ -29,27 +29,47 @@
</Tabs> </Tabs>
<Tabs name="default"> <Tabs name="default">
<TabPane label="时间操作" name="default"> <TabPane :label="$t('time_operation')" name="default">
<option-block> <option-block disable-padding>
<FormItem> <FormItem>
<DatePicker transfer v-model="current.duration.input" :options="options" type="datetime" <DatePicker transfer v-model="current.duration.input" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker> format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Select transfer v-model="current.duration.type" style="width: 100px"> <Select transfer v-model="current.duration.type" style="width: 100px">
<Option value="+">添加</Option> <Option value="+">{{ $t('time_add') }}</Option>
<Option value="-">减少</Option> <Option value="-">{{ $t('time_reduce') }}</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Input v-model="current.duration.length" type="number" number> <Input v-model="current.duration.length" type="number" number>
<Select transfer v-model="current.duration.unit" slot="append" style="width: 60px"> <Select transfer v-model="current.duration.unit" slot="append" style="width: 80px">
<Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{ v.n }}</Option> <Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{ v.n }}</Option>
</Select> </Select>
</Input> </Input>
</FormItem> </FormItem>
<FormItem> <FormItem>
后, 为 <strong>{{ duration }}</strong> {{ $t('time_after') }}, {{ $t('time_is') }} <strong>{{ duration }}</strong>
</FormItem>
</option-block>
</TabPane>
</Tabs>
<Tabs name="default">
<TabPane :label="$t('time_analyze')" name="default">
<option-block disable-padding>
<FormItem>
<DatePicker transfer v-model="current.analyze.input" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
<Select transfer v-model="current.analyze.type" style="width: 90px">
<Option value="year">{{ $t('time_analyze_year') }}</Option>
<Option value="quarter">{{ $t('time_analyze_quarter') }}</Option>
<Option value="month">{{ $t('time_analyze_month') }}</Option>
</Select>
</FormItem>
<FormItem>
{{ analyze }}
</FormItem> </FormItem>
</option-block> </option-block>
</TabPane> </TabPane>
...@@ -61,24 +81,80 @@ import moment from 'moment' ...@@ -61,24 +81,80 @@ import moment from 'moment'
export default { export default {
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
computed: { computed: {
analyze() {
let input = moment(this.current.analyze.input)
let output = "";
const year = input.year();
const quarter = input.quarter();
if (this.current.analyze.type === "quarter") {
const quarterDate = moment(`${input.year()}-${(quarter - 1) * 3 + 1}-01`);
const weekOfQuarter = Math.ceil((input.unix() - quarterDate.unix()) / (86400 * 7));
const dayOfQuarter = Math.ceil((input.unix() - quarterDate.unix()) / 86400);
const hourOfQuarter = Math.ceil((input.unix() - quarterDate.unix()) / 3600);
const minuteOfQuarter = Math.ceil((input.unix() - quarterDate.unix()) / 60);
const secondOfQuarter = input.unix() - quarterDate.unix();
output = this.$t('time_analyze_quarter_output', {
quarter,
weekOfQuarter,
dayOfQuarter,
hourOfQuarter,
minuteOfQuarter,
secondOfQuarter
});
}
if (this.current.analyze.type === "month") {
const month = input.month() + 1
const monthDate = moment(`${input.year()}-${month}-01`);
const weekOfMonth = Math.ceil((input.unix() - monthDate.unix()) / (86400 * 7));
const hourOfMonth = Math.ceil((input.unix() - monthDate.unix()) / 3600);
const minuteOfMonth = Math.ceil((input.unix() - monthDate.unix()) / 60);
const secondOfMonth = input.unix() - monthDate.unix();
output = this.$t('time_analyze_month_output', {
month,
weekOfMonth,
hourOfMonth,
minuteOfMonth,
secondOfMonth
});
}
if (this.current.analyze.type === "year"){
const yearDate = moment(input.year() + '-01-01');
const weekOfYear = input.isoWeek();
const dayOfYear = input.dayOfYear();
const hourOfYear = Math.ceil((input.unix() - yearDate.unix()) / 3600);
const minuteOfYear = Math.ceil((input.unix() - yearDate.unix()) / 60);
const secondOfYear = input.unix() - yearDate.unix();
output = this.$t('time_analyze_year_output', {
year,
quarter,
weekOfYear,
dayOfYear,
hourOfYear,
minuteOfYear,
secondOfYear
});
}
this.saveToolData()
return output;
},
poor() { poor() {
let a = moment(this.current.poor.input1) let a = moment(this.current.poor.input1)
let b = moment(this.current.poor.input2) let b = moment(this.current.poor.input2)
this.$saveToolData(this.current) this.saveToolData()
return b.diff(a, this.current.poor.unit) return b.diff(a, this.current.poor.unit)
}, },
duration() { duration() {
if (!this.current.duration.length){ if (!this.current.duration.length) {
return ""; return "";
} }
let rate = this.getRate(this.current.duration.unit) let rate = this.getRate(this.current.duration.unit)
let result; let result;
if (rate === 0) { if (rate === 0) {
if (!Number.isInteger(this.current.duration.length)){ if (!Number.isInteger(this.current.duration.length)) {
return "年/月间隔只能是整数"; return this.$t('time_error', [this.$t('time_error_duration_length')])
} }
const type = this.current.duration.type === '+' ? 'add' : 'subtract' const type = this.current.duration.type === '+' ? 'add' : 'subtract'
result = moment(this.current.duration.input)[type](this.current.duration.length, this.current.duration.unit) result = moment(this.current.duration.input)[type](this.current.duration.length, this.current.duration.unit)
...@@ -88,11 +164,18 @@ export default { ...@@ -88,11 +164,18 @@ export default {
+ (rate * this.current.duration.length) * (this.current.duration.type === '+' ? 1 : -1) + (rate * this.current.duration.length) * (this.current.duration.type === '+' ? 1 : -1)
) )
} }
this.$saveToolData(this.current) this.saveToolData()
return result.format('YYYY-MM-DD HH:mm:ss'); return result.format('YYYY-MM-DD HH:mm:ss');
}, },
}, },
methods: { methods: {
saveToolData(){
this.current.poor.input1 = moment(this.current.poor.input1).format('YYYY-MM-DD HH:mm:ss')
this.current.poor.input2 = moment(this.current.poor.input2).format('YYYY-MM-DD HH:mm:ss')
this.current.duration.input = moment(this.current.duration.input).format('YYYY-MM-DD HH:mm:ss')
this.current.analyze.input = moment(this.current.analyze.input).format('YYYY-MM-DD HH:mm:ss')
this.$saveToolData(this.current)
},
getRate(unit) { getRate(unit) {
for (let item of this.poorUnit) { for (let item of this.poorUnit) {
if (item.v === unit) { if (item.v === unit) {
...@@ -107,25 +190,25 @@ export default { ...@@ -107,25 +190,25 @@ export default {
options: { options: {
shortcuts: [ shortcuts: [
{ {
text: '当前时间', text: this.$t('time_current_time'),
value() { value() {
return moment().toDate() return moment().toDate()
}, },
}, },
{ {
text: '当前日期', text: this.$t('time_current_date'),
value() { value() {
return moment(moment().format('YYYY-MM-DD')).toDate() return moment(moment().format('YYYY-MM-DD')).toDate()
}, },
}, },
{ {
text: '当月日期', text: this.$t('time_current_month_date'),
value() { value() {
return moment(moment().format('YYYY-MM-01')).toDate() return moment(moment().format('YYYY-MM-01')).toDate()
}, },
}, },
{ {
text: '当年日期', text: this.$t('time_current_year_date'),
value() { value() {
return moment(moment().format('YYYY-01-01')).toDate() return moment(moment().format('YYYY-01-01')).toDate()
}, },
...@@ -133,13 +216,13 @@ export default { ...@@ -133,13 +216,13 @@ export default {
], ],
}, },
poorUnit: [ poorUnit: [
{v: 'years', n: '', rate: 0}, {v: 'years', n: this.$t('time_year'), rate: 0},
{v: 'months', n: '', rate: 0}, {v: 'months', n: this.$t('time_month'), rate: 0},
{v: 'weeks', n: '', rate: 1000 * 60 * 60 * 24 * 7}, {v: 'weeks', n: this.$t('time_week'), rate: 1000 * 60 * 60 * 24 * 7},
{v: 'days', n: '', rate: 1000 * 60 * 60 * 24}, {v: 'days', n: this.$t('time_day'), rate: 1000 * 60 * 60 * 24},
{v: 'hours', n: '小时', rate: 1000 * 60 * 60}, {v: 'hours', n: this.$t('time_hour'), rate: 1000 * 60 * 60},
{v: 'minutes', n: '分钟', rate: 1000 * 60}, {v: 'minutes', n: this.$t('time_minute'), rate: 1000 * 60},
{v: 'seconds', n: '', rate: 1000}, {v: 'seconds', n: this.$t('time_second'), rate: 1000},
], ],
current: { current: {
poor: { poor: {
...@@ -153,8 +236,12 @@ export default { ...@@ -153,8 +236,12 @@ export default {
type: '+', type: '+',
length: 1, length: 1,
}, },
}, analyze: {
type: "year",
input: moment(moment().format('YYYY-MM-DD')).toDate()
}
}
} }
}, },
} }
</script> </script>
\ No newline at end of file
<template> <template>
<div> <heightResize class="tool-timestamp-page">
<Input v-model="current.input" :rows="7" type="textarea" placeholder="内容(标准时间(YYYY-MM-DD HH:mm:ss[.SSS])/时间戳(秒/毫秒))"></Input> <div class="tool-timestamp-block">
<option-block> <option-block>
<FormItem> <input-block bottom="8px" right="8px">
<Button type="primary" @click="handle()">转换</Button> <Input size="large" v-model="current.input">
<Dropdown style="margin-left: 10px" @on-click="currentTime"> <span slot="prepend">{{ $t('timestamp_input') }}</span>
<Button type="primary"> </Input>
当前时间 <template slot="extra">
<Icon type="ios-arrow-down"></Icon> <Dropdown @on-click="currentTime" transfer>
</Button> <Button size="small" type="primary">
<DropdownMenu slot="list"> {{ $t('timestamp_get') }}
<DropdownItem name="normalSecond">标准时间(秒)</DropdownItem> <Icon type="ios-arrow-down"></Icon>
<DropdownItem name="normalMillisecond">标准时间(毫秒)</DropdownItem> </Button>
<DropdownItem name="unixSecond">UNIX时间戳(秒)</DropdownItem> <DropdownMenu slot="list">
<DropdownItem name="unixMillisecond">UNIX时间戳(毫秒)</DropdownItem> <DropdownItem name="normalSecond">{{ $t('timestamp_normal_second') }}</DropdownItem>
</DropdownMenu> <DropdownItem name="normalMillisecond">{{
</Dropdown> $t('timestamp_normal_millisecond')
</FormItem> }}
</option-block> </DropdownItem>
<Input v-model="current.output" :rows="7" type="textarea" placeholder="结果"></Input> <DropdownItem name="unixSecond">{{ $t('timestamp_unix_second') }}</DropdownItem>
</div> <DropdownItem name="unixMillisecond">{{
$t('timestamp_unix_millisecond')
}}
</DropdownItem>
</DropdownMenu>
</Dropdown>
</template>
</input-block>
</option-block>
<option-block>
<input-block bottom="8px" right="8px">
<Input size="large" :value="output">
<span slot="prepend">{{ $t('timestamp_output') }}</span>
</Input>
<template slot="extra">
<Button size="small" type="primary" @click="()=>$copy(output)">{{
$t('timestamp_copy')
}}
</Button>
</template>
</input-block>
</option-block>
<Table :columns="exampleColumns" stripe border size="small" :data="example">
<template slot-scope="{ row }" slot="_value">
<Button size="small" type="text" @click="()=>$copy(row.value)">{{ row.value }}</Button>
</template>
</Table>
</div>
</heightResize>
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import heightResize from "./components/heightResize";
let inputType = { let inputType = {
'normalSecond': 1, 'normalSecond': 1,
'normalMillisecond': 2, 'normalMillisecond': 2,
'unixSecond': 3, 'unixSecond': 3,
'unixMillisecond': 4, 'unixMillisecond': 4,
'error': 0, 'error': 0,
} }
export default { export default {
created () { components: {
this.current = Object.assign(this.current, this.$getToolData('input')) heightResize
},
created() {
this.$initToolData('input', (data) => {
return (
(new RegExp(/^\d+-\d+-\d+ \d+:\d+:\d+$/)).test(data)
|| (new RegExp(/^\d+-\d+-\d+ \d+:\d+:\d+\.\d+$/)).test(data)
|| (new RegExp(/^\d{10}$/)).test(data)
|| (new RegExp(/^\d{13}$/)).test(data)
)
})
},
mounted() {
this.timer = setInterval(() => {
this.timestamp = moment().format('x')
}, 100);
},
beforeDestroy() {
clearInterval(this.timer);
},
computed: {
example() {
let time = moment(parseInt(this.timestamp))
return [
{format: this.$t('timestamp_normal_second'), value: time.format('YYYY-MM-DD HH:mm:ss')},
{format: this.$t('timestamp_unix_second'), value: time.format('X')},
{format: this.$t('timestamp_normal_millisecond'), value: time.format('YYYY-MM-DD HH:mm:ss.SSS')},
{format: this.$t('timestamp_unix_millisecond'), value: time.format('x')},
]
}, },
methods: { output() {
handle () { let result = "";
if (!this.current.input) {
return result;
}
try {
let type = function (input) { let type = function (input) {
if ((new RegExp(/^\d+-\d+-\d+ \d+:\d+:\d+$/)).test(input)) { if ((new RegExp(/^\d+-\d+-\d+ \d+:\d+:\d+$/)).test(input)) {
return inputType.normalSecond return inputType.normalSecond
...@@ -54,48 +115,73 @@ ...@@ -54,48 +115,73 @@
return inputType.error return inputType.error
}(this.current.input.trim()) }(this.current.input.trim())
if (type === inputType.error) { if (type === inputType.error) {
return this.$Message.error('输入时间格式错误') throw new Error(this.$t('timestamp_error_format').toString())
} }
switch (type) { switch (type) {
case inputType.normalSecond: case inputType.normalSecond:
this.current.output = moment(this.current.input).format('X') result = moment(this.current.input).format('X')
break break
case inputType.normalMillisecond: case inputType.normalMillisecond:
this.current.output = moment(this.current.input).format('x') result = moment(this.current.input).format('x')
break break
case inputType.unixSecond: case inputType.unixSecond:
this.current.output = moment(parseInt(this.current.input)*1000).format('YYYY-MM-DD HH:mm:ss') result = moment(parseInt(this.current.input) * 1000).format('YYYY-MM-DD HH:mm:ss')
break break
case inputType.unixMillisecond: case inputType.unixMillisecond:
this.current.output = moment(parseInt(this.current.input)).format('YYYY-MM-DD HH:mm:ss.SSS') result = moment(parseInt(this.current.input)).format('YYYY-MM-DD HH:mm:ss.SSS')
break break
} }
this.$clipboardCopy(this.current.output)
this.$saveToolData(this.current) this.$saveToolData(this.current)
}, } catch (e) {
currentTime (type) { result = this.$t('timestamp_error', [e.message])
if(type === "normalSecond"){ }
this.current.input = moment().format('YYYY-MM-DD HH:mm:ss') return result;
} }
else if(type === "normalMillisecond"){ },
this.current.input = moment().format('YYYY-MM-DD HH:mm:ss.SSS') methods: {
} currentTime(type) {
else if(type === "unixSecond"){ if (type === "normalSecond") {
this.current.input = moment().format('X') this.current.input = moment().format('YYYY-MM-DD HH:mm:ss')
} } else if (type === "normalMillisecond") {
else{ this.current.input = moment().format('YYYY-MM-DD HH:mm:ss.SSS')
this.current.input = moment().format('x') } else if (type === "unixSecond") {
} this.current.input = moment().format('X')
this.handle(); } else {
}, this.current.input = moment().format('x')
},
data () {
return {
current: {
input: '',
output: '',
},
} }
}, },
} },
</script> data() {
\ No newline at end of file return {
current: {
input: moment().format('YYYY-MM-DD HH:mm:ss')
},
timer: null,
timestamp: 0,
exampleColumns: [
{
title: this.$t('timestamp_format'),
key: 'format',
width: 200
},
{
title: this.$t('timestamp_value'),
slot: '_value',
}
]
}
},
}
</script>
<style>
.tool-timestamp-page {
display: flex;
display: -webkit-flex;
align-items: center;
justify-content: center;
}
.tool-timestamp-block {
width: 600px;
}
</style>
<template> <template>
<div> <heightResize ignore @resize="resize">
<Row :gutter="10"> <Row :gutter="10">
<Col span="6" style="margin-top: 10px"> <Col span="6">
<Card :padding="0"> <input-block top="4px" :text="$t('variableConversion_input')">
<p slot="title">输入变量名</p> <autoHeightTextarea :height="height1" v-model="current.input" :placeholder="$t('variableConversion_input_placeholder')" />
<template slot="extra"> </input-block>
<Button size="small" type="primary" @click="handle()">转换
</Button>
</template>
<Input v-model="current.input" :rows="4" type="textarea" placeholder="变量名 一行一个"></Input>
</Card>
</Col> </Col>
<Col span="6" v-for="(item,key) in resultColumns" :key="key" style="margin-top: 10px"> <Col span="6" v-for="(item,key) in resultColumns" :key="key" :style="`margin-top: ${key > 2 ? '10px' : '0'}`">
<Card :padding="0"> <input-block top="4px" type="default" :text="item.title" @on-default-right-bottom-click="()=>$copy(output[item.key])">
<p slot="title">{{ item.title }}</p> <autoHeightTextarea :height="key > 2 ? height2 : height1" :value="output[item.key]" :placeholder="item.title" />
<Input v-model="current.output[item.key]" :rows="4" type="textarea"></Input> </input-block>
</Card>
</Col> </Col>
</Row> </Row>
</div> </heightResize>
</template> </template>
<script> <script>
import varCamelCase from "./library/varCamelCase" import varCamelCase from "./library/varCamelCase"
import heightResize from "./components/heightResize";
import autoHeightTextarea from "./components/autoHeightTextarea";
export default { export default {
components: {
heightResize,
autoHeightTextarea
},
computed: { computed: {
resultColumns() { resultColumns() {
return varCamelCase.resultKey.map((item) => { return varCamelCase.resultKey.map((item) => {
...@@ -33,26 +33,29 @@ export default { ...@@ -33,26 +33,29 @@ export default {
} }
}); });
}, },
output() {
let result = varCamelCase.convent(this.current.input)
this.$saveToolData(this.current);
return result;
}
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
handle() { resize(height) {
if (!this.current.input) { this.height1 = Math.ceil(height/2);
return; this.height2 = height - this.height1 - 10;
}
this.current.output = varCamelCase.convent(this.current.input)
this.$saveToolData(this.current);
} }
}, },
data() { data() {
return { return {
current: { current: {
input: "", input: ""
output: [], },
} height1: 100,
height2: 100
} }
}, },
} }
</script> </script>
\ No newline at end of file
<template> <template>
<Row :gutter="10"> <div>
<Col span="10"> <Input v-model="current.url" class="page-option-block" style="margin-bottom: 10px">
<Row :gutter="6">
<Col span="18">
<Input v-model="current.url">
<span slot="prepend"> <span slot="prepend">
<Badge style="margin-left:10px" :status="status ? 'success' : 'error'"/> <Badge style="margin-left:10px" :status="status ? 'success' : 'error'"/>
</span> </span>
</Input> <Button slot="append" v-if="!status" @click="handle()">{{ $t('websocket_connect') }}</Button>
</Col> <Button slot="append" v-else @click="handle()">{{ $t('websocket_close') }}</Button>
<Col span="6"> </Input>
<Button long v-if="!status" type="success" @click="handle()">连接</Button> <Row :gutter="10">
<Button long v-else type="error" @click="handle()">断开</Button> <Col span="10">
</Col> <input-block top="7px" right="7px">
</Row> <heightResize :append="['.page-option-block']">
<Input style="margin: 10px 0 5px" v-model="sendContent" :rows="14" type="textarea" <autoHeightTextarea v-model="sendContent" :placeholder="$t('websocket_send_content')"/>
placeholder="发送内容"></Input> </heightResize>
<Button type="primary" @click="send()" long>发送</Button> <template slot="extra">
</Col> <Button :disabled="!status" type="primary" size="small" @click="send">{{
<Col span="14"> $t('websocket_send')
<Card> }}
<p slot="title">交互内容</p> </Button>
<template slot="extra"> </template>
<Button style="margin-right: 5px" size="small" type="primary" @click="copyAll()">复制全部</Button> </input-block>
<Button size="small" type="primary" @click="clear()">清空</Button> </Col>
</template> <Col span="14">
<input-block top="7px" right="7px" :text="$t('websocket_send')" @on-default-right-bottom-click="send">
<div class="lists-block" id="log" style="height: 300px;overflow: hidden;overflow-y:auto;"> <heightResize :append="['.page-option-block']" @resize="logHeightSet">
<div v-for="(item,key) in lists" :key="key"> <Card>
<div class="item" v-if="item.type === 'send'" style="color:green"> <div class="lists-block" id="log"
你 {{item.time}} :style="`height: ${logHeight}px;overflow: hidden;overflow-y:auto;`">
</div> <div v-if="lists.length === 0" style="font-size: 14px;color: #999999">
<div class="item" v-else-if="item.type === 'accept'" style="color:blue"> {{ $t('websocket_log_content') }}
服务端 {{item.time}} </div>
</div> <div v-else v-for="(item,key) in lists" :key="key">
<div class="item" v-else> <div class="item" v-if="item.type === 'send'" style="color:green">
{{item.time}} {{ $t('websocket_you') }} {{ item.time }}
</div> </div>
<div class="item"> <div class="item" v-else-if="item.type === 'accept'" style="color:blue">
<Icon style="cursor: pointer" type="md-copy" @click="copy(item.content)"/> {{ $t('websocket_server') }} {{ item.time }}
{{item.content}} </div>
</div> <div class="item" v-else>
</div> {{ item.time }}
</div> </div>
</Card> <div class="item">
</Col> <Icon style="cursor: pointer" type="md-copy" @click="$copy(item.content)"/>
</Row> {{ item.content }}
</div>
</div>
</div>
</Card>
</heightResize>
<template slot="extra">
<Button style="margin-right: 5px" size="small" type="primary" @click="copyAll()">
{{ $t('websocket_copy') }}
</Button>
<Button size="small" type="primary" @click="clear()">{{ $t('websocket_clear') }}</Button>
</template>
</input-block>
</Col>
</Row>
</div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import heightResize from "./components/heightResize";
import autoHeightTextarea from "./components/autoHeightTextarea";
export default { export default {
created() { components: {
this.current = Object.assign(this.current, this.$getToolData()) heightResize,
autoHeightTextarea
},
created() {
this.$initToolData()
},
methods: {
handle() {
if (this.status) {
return this.close();
}
return this.connect();
},
connect() {
if (!this.current.url.trim()) {
return
}
this.$saveToolData(this.current);
this.log(this.$t('websocket_connect_start', [this.current.url]).toString())
let websocket = new WebSocket(this.current.url);
websocket.onopen = (evt) => {
this.onOpen(evt)
};
websocket.onclose = (evt) => {
this.onClose(evt)
};
websocket.onmessage = (evt) => {
this.onMessage(evt)
};
websocket.onerror = (evt) => {
this.onError(evt)
};
this.ws = websocket;
},
close() {
this.log(this.$t('websocket_close_start', [this.current.url]).toString())
this.ws.close();
},
clear() {
this.lists = [];
}, },
methods: { log(content, type = "other") {
handle() { this.lists.push({content, type, time: moment().format("YYYY-MM-DD HH:mm:ss")});
if (this.status) { this.$nextTick(() => {
return this.close(); let log = document.getElementById('log');
log.scrollTop = log.scrollHeight;
})
},
copyAll() {
this.$copy(JSON.stringify(this.lists));
},
send() {
try {
if (!this.status) {
throw new Error(this.$t('websocket_error_connect').toString())
} }
return this.connect(); if (!this.sendContent) {
}, throw new Error(this.$t('websocket_error_content').toString())
connect() {
let websocket = new WebSocket(this.current.url);
websocket.onopen = (evt) => {
this.onOpen(evt)
};
websocket.onclose = (evt) => {
this.onClose(evt)
};
websocket.onmessage = (evt) => {
this.onMessage(evt)
};
websocket.onerror = (evt) => {
this.onError(evt)
};
this.ws = websocket;
},
close() {
this.ws.close();
},
clear() {
this.lists = [];
},
log(content, type = "other") {
this.lists.push({content, type,time:moment().format("YYYY-MM-DD HH:mm:ss")});
this.$nextTick(() => {
let log = document.getElementById('log');
log.scrollTop = log.scrollHeight;
})
},
copy(s) {
this.$clipboardCopy(s);
},
copyAll() {
this.copy(JSON.stringify(this.lists));
},
send() {
try {
if (!this.status) {
return this.$Message.error("ws还没有连接,或者连接失败,请检测");
}
if (!this.sendContent) {
return this.$Message.error("发送内容不能为空");
}
this.ws.send(this.sendContent);
this.log(this.sendContent, 'send')
} catch (e) {
this.log('错误异常: ' + e)
} }
}, this.ws.send(this.sendContent);
onOpen() { this.log(this.sendContent, 'send')
this.status = true; } catch (e) {
this.log("连接成功") this.log(this.$t('websocket_error', [e.message]).toString())
},
onClose() {
this.status = false;
this.log("连接关闭")
},
onMessage(evt) {
this.log(evt.data, 'accept')
},
onError(evt) {
this.log('错误异常: ' + evt.data())
} }
}, },
data() { onOpen() {
return { this.status = true;
current: { this.log(this.$t('websocket_connect_ok').toString())
url: "wss://echo.websocket.org", },
}, onClose() {
status: false, this.status = false;
wx: null, this.log(this.$t('websocket_close_ok').toString())
sendContent: "",
lists: [],
}
}, },
} onMessage(evt) {
this.log(evt.data, 'accept')
},
onError(evt) {
this.log(this.$t('websocket_error', [evt.data()]).toString())
},
logHeightSet(height) {
this.logHeight = Math.max(height - 34, 100)
}
},
data() {
return {
current: {
url: "wss://echo.websocket.events",
},
status: false,
wx: null,
sendContent: "",
lists: [],
logHeight: 100,
}
},
}
</script> </script>
<style scoped> <style scoped>
.lists-block { .lists-block {
font-size: 12px; font-size: 14px;
} line-height: 28px;
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册