Skip to content

Commit 0e457fc

Browse files
committed
v1.1.0 - More capability & improvements
1 parent a622b9a commit 0e457fc

6 files changed

Lines changed: 122 additions & 13 deletions

File tree

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tch-filector",
33
"productName": "FileCtor",
4-
"version": "1.0.2",
4+
"version": "1.1.0",
55
"author": "Tomas Chyly <chyly@tomas-chyly.com> (https://tomas-chyly.com/en/)",
66
"license": "GPL v3",
77
"description": "File inspector with interactive javascript console.",
@@ -19,7 +19,7 @@
1919
"devDependencies": {
2020
"concurrently": "^4.1.0",
2121
"cross-env": "^5.2.0",
22-
"electron": "^5.0.6",
22+
"electron": "^5.0.7",
2323
"electron-devtools-installer": "^2.2.4",
2424
"electron-rebuild": "^1.8.5",
2525
"find-free-port": "^2.0.0",
@@ -41,6 +41,7 @@
4141
"fs-extra": "^8.1.0",
4242
"nedb": "^1.8.0",
4343
"open": "^6.4.0",
44+
"sanitize-html": "^1.20.1",
4445
"systeminformation": "^4.14.1",
4546
"tch-database": "^0.5.1",
4647
"tinify": "^1.6.0-beta.2",

src/main/api/Console.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const ReferenceWindow = require ('../Reference').Reference;
1010
const Snippet = require ('../model/Snippet');
1111
const {WHERE_CONDITIONS} = require ('tch-database');
1212
const tinify = require ('tinify');
13+
const axios = require ('axios');
14+
const sanitizeHtml = require ('sanitize-html');
1315

1416
const Console_static = {
1517
main: undefined,
@@ -80,7 +82,12 @@ class Console {
8082
createInterface: readline.createInterface
8183
},
8284
renameFilePromise: promisify (fs.rename),
83-
tinify: tinify
85+
tinify: tinify,
86+
axios: {
87+
get: axios.get,
88+
post: axios.post
89+
},
90+
sanitizeHtml: sanitizeHtml
8491
};
8592

8693
sandbox = extend (sandbox, message.parameters);

src/main/api/functions.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,31 @@ async function TinyPNGResizeCropFile (file, params) {
7373
await tinify.fromFile (file).preserve ('copyright', 'creation').resize (params).toFile (newName);
7474
}
7575

76+
async function Fetch (url, type = 'GET', params = null) {
77+
let response = null;
78+
79+
switch (type) {
80+
case 'GET':
81+
response = await axios.get (url);
82+
break;
83+
case 'POST':
84+
response = await axios.post (url, params || {});
85+
break;
86+
}
87+
88+
if (response) {
89+
response = sanitizeHtml (response.data);
90+
}
91+
92+
return response;
93+
}
94+
7695
module.exports = {
7796
Init,
7897
ReadDirectory,
7998
RenameFiles,
8099
RenameFilesPart,
81100
TinyPNGCompressFile,
82-
TinyPNGResizeCropFile
101+
TinyPNGResizeCropFile,
102+
Fetch
83103
};

src/view/About.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ class About extends Component {
7474
</div>
7575

7676
<div className="socials">
77+
<Button type="button" className="button icon icon-larger" onClick={this.Twitter.bind (this)}><Twitter/></Button>
7778
<Button type="button" className="button icon icon-larger" onClick={this.Github.bind (this)}><Github/></Button>
7879
<Button type="button" className="button icon icon-larger" onClick={this.Npm.bind (this)}><Npm/></Button>
7980
<Button type="button" className="button icon icon-larger" onClick={this.StackOverflow.bind (this)}><StackOverflow/></Button>
80-
<Button type="button" className="button icon icon-larger" onClick={this.Twitter.bind (this)}><Twitter/></Button>
8181
</div>
8282

8383
<p>Icons used in this app are from the great <Link href="https://fontawesome.com/">Font Awesome</Link>. The <Link href="https://fontawesome.com/license/free">free version</Link> is used.</p>

src/view/Reference.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class Reference extends Component {
4545
label: 'console.log ()',
4646
description: 'Parameters: any[, ...]\nUse this function like you would standard console.log (). Value/s will be shown as output after script is done executing.'
4747
},
48+
'fetch': {
49+
label: 'Fetch ()',
50+
description: 'Parameters: string, GET|POST, object\nFirst parameter is valid url, second is either GET or POST request type, third is data as object if POST is used. Can be awaited. This function returns contents of called url.'
51+
},
4852
'fs-createReadStream': {
4953
label: 'fs.createReadStream ()',
5054
description: 'Parameters: string, object\nUse this function like you would join Node\'s fs.createReadStream ().'

yarn.lock

Lines changed: 85 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,7 @@ array-union@^1.0.1:
21242124
dependencies:
21252125
array-uniq "^1.0.1"
21262126

2127-
array-uniq@^1.0.1:
2127+
array-uniq@^1.0.1, array-uniq@^1.0.2:
21282128
version "1.0.3"
21292129
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
21302130
integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=
@@ -3957,7 +3957,7 @@ domain-browser@^1.1.1:
39573957
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
39583958
integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==
39593959

3960-
domelementtype@1:
3960+
domelementtype@1, domelementtype@^1.3.1:
39613961
version "1.3.1"
39623962
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f"
39633963
integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==
@@ -3981,6 +3981,13 @@ domhandler@2.1:
39813981
dependencies:
39823982
domelementtype "1"
39833983

3984+
domhandler@^2.3.0:
3985+
version "2.4.2"
3986+
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803"
3987+
integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==
3988+
dependencies:
3989+
domelementtype "1"
3990+
39843991
domutils@1.1:
39853992
version "1.1.6"
39863993
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.1.6.tgz#bddc3de099b9a2efacc51c623f28f416ecc57485"
@@ -3996,7 +4003,7 @@ domutils@1.5.1:
39964003
dom-serializer "0"
39974004
domelementtype "1"
39984005

3999-
domutils@^1.7.0:
4006+
domutils@^1.5.1, domutils@^1.7.0:
40004007
version "1.7.0"
40014008
resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a"
40024009
integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==
@@ -4104,10 +4111,10 @@ electron-to-chromium@^1.3.122, electron-to-chromium@^1.3.127:
41044111
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.129.tgz#bff32e1840775554aafa301e9dc5002d565aae80"
41054112
integrity sha512-puirJsgZnedlFEmRa7WEUIaS8ZgHHn7d7inph+RiapCc0x80hdoDyEEpR9z3aRUSZy4fGxOTOFcxnGmySlrmhA==
41064113

4107-
electron@^5.0.6:
4108-
version "5.0.6"
4109-
resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.6.tgz#e3ca4a58b5716fceef3fb64e1fd2222dd9c51de0"
4110-
integrity sha512-0L53lv26eDhaaNxL6DqXGQrQOEAYbrQg40stRSb2pzrY06kwPbABzXEiaCvEsBuKUQ+9OQBbVyyvXRbLJlun/A==
4114+
electron@^5.0.7:
4115+
version "5.0.7"
4116+
resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.7.tgz#a48fcbd13d30f16f7d7887908b68e52156e90259"
4117+
integrity sha512-OMMz8DhatxLuBFbnW7KYcAUjflGYFn0IQEtKR0iZhMAm89FgNOd9SVbxXWAGNxvRR6C0gORXwhTh6BCqqqcR6Q==
41114118
dependencies:
41124119
"@types/node" "^10.12.18"
41134120
electron-download "^4.1.0"
@@ -4169,7 +4176,7 @@ enhanced-resolve@^4.1.0:
41694176
memory-fs "^0.4.0"
41704177
tapable "^1.0.0"
41714178

4172-
entities@~1.1.1:
4179+
entities@^1.1.1, entities@~1.1.1:
41734180
version "1.1.2"
41744181
resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56"
41754182
integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==
@@ -5432,6 +5439,18 @@ html-webpack-plugin@4.0.0-beta.5:
54325439
tapable "^1.1.0"
54335440
util.promisify "1.0.0"
54345441

5442+
htmlparser2@^3.10.0:
5443+
version "3.10.1"
5444+
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f"
5445+
integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==
5446+
dependencies:
5447+
domelementtype "^1.3.1"
5448+
domhandler "^2.3.0"
5449+
domutils "^1.5.1"
5450+
entities "^1.1.1"
5451+
inherits "^2.0.1"
5452+
readable-stream "^3.1.1"
5453+
54355454
htmlparser2@~3.3.0:
54365455
version "3.3.0"
54375456
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.3.0.tgz#cc70d05a59f6542e43f0e685c982e14c924a9efe"
@@ -6956,21 +6975,46 @@ lodash.assign@^4.2.0:
69566975
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
69576976
integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=
69586977

6978+
lodash.clonedeep@^4.5.0:
6979+
version "4.5.0"
6980+
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
6981+
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
6982+
69596983
lodash.debounce@^4.0.8:
69606984
version "4.0.8"
69616985
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
69626986
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
69636987

6988+
lodash.escaperegexp@^4.1.2:
6989+
version "4.1.2"
6990+
resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347"
6991+
integrity sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=
6992+
69646993
lodash.get@^4.4.2:
69656994
version "4.4.2"
69666995
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
69676996
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
69686997

6998+
lodash.isplainobject@^4.0.6:
6999+
version "4.0.6"
7000+
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
7001+
integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=
7002+
7003+
lodash.isstring@^4.0.1:
7004+
version "4.0.1"
7005+
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
7006+
integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=
7007+
69697008
lodash.memoize@^4.1.2:
69707009
version "4.1.2"
69717010
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
69727011
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=
69737012

7013+
lodash.mergewith@^4.6.1:
7014+
version "4.6.2"
7015+
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55"
7016+
integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==
7017+
69747018
lodash.sortby@^4.7.0:
69757019
version "4.7.0"
69767020
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@@ -9473,6 +9517,15 @@ readable-stream@^3.0.6:
94739517
string_decoder "^1.1.1"
94749518
util-deprecate "^1.0.1"
94759519

9520+
readable-stream@^3.1.1:
9521+
version "3.4.0"
9522+
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc"
9523+
integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==
9524+
dependencies:
9525+
inherits "^2.0.3"
9526+
string_decoder "^1.1.1"
9527+
util-deprecate "^1.0.1"
9528+
94769529
readable-stream@~1.1.9:
94779530
version "1.1.14"
94789531
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
@@ -9891,6 +9944,22 @@ sane@^4.0.3:
98919944
minimist "^1.1.1"
98929945
walker "~1.0.5"
98939946

9947+
sanitize-html@^1.20.1:
9948+
version "1.20.1"
9949+
resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-1.20.1.tgz#f6effdf55dd398807171215a62bfc21811bacf85"
9950+
integrity sha512-txnH8TQjaQvg2Q0HY06G6CDJLVYCpbnxrdO0WN8gjCKaU5J0KbyGYhZxx5QJg3WLZ1lB7XU9kDkfrCXUozqptA==
9951+
dependencies:
9952+
chalk "^2.4.1"
9953+
htmlparser2 "^3.10.0"
9954+
lodash.clonedeep "^4.5.0"
9955+
lodash.escaperegexp "^4.1.2"
9956+
lodash.isplainobject "^4.0.6"
9957+
lodash.isstring "^4.0.1"
9958+
lodash.mergewith "^4.6.1"
9959+
postcss "^7.0.5"
9960+
srcset "^1.0.0"
9961+
xtend "^4.0.1"
9962+
98949963
sass-loader@7.1.0:
98959964
version "7.1.0"
98969965
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.1.0.tgz#16fd5138cb8b424bf8a759528a1972d72aad069d"
@@ -10328,6 +10397,14 @@ sprintf-js@~1.0.2:
1032810397
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
1032910398
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
1033010399

10400+
srcset@^1.0.0:
10401+
version "1.0.0"
10402+
resolved "https://registry.yarnpkg.com/srcset/-/srcset-1.0.0.tgz#a5669de12b42f3b1d5e83ed03c71046fc48f41ef"
10403+
integrity sha1-pWad4StC87HV6D7QPHEEb8SPQe8=
10404+
dependencies:
10405+
array-uniq "^1.0.2"
10406+
number-is-nan "^1.0.0"
10407+
1033110408
sshpk@^1.7.0:
1033210409
version "1.16.1"
1033310410
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877"

0 commit comments

Comments
 (0)