aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar kytwb <kytwb@pm.me>2022-01-07 00:03:59 +0100
committerLibravatar kytwb <kytwb@pm.me>2022-01-07 00:03:59 +0100
commit71aeba7fda968f63c9469bce026267fa6b68ffd6 (patch)
tree41284779e0355b552519f8ce26ba509ffbf3a532
parentReview recipes routes (diff)
downloadferdium-app-71aeba7fda968f63c9469bce026267fa6b68ffd6.tar.gz
ferdium-app-71aeba7fda968f63c9469bce026267fa6b68ffd6.tar.zst
ferdium-app-71aeba7fda968f63c9469bce026267fa6b68ffd6.zip
Use window.fetch in getRecipePackage, removes electron-fetch
-rw-r--r--package-lock.json149
-rw-r--r--package.json1
-rw-r--r--src/api/server/ServerApi.ts8
3 files changed, 81 insertions, 77 deletions
diff --git a/package-lock.json b/package-lock.json
index c0bdee794..247ee0949 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -36,7 +36,6 @@
36 "dbus-next": "^0.10.2", 36 "dbus-next": "^0.10.2",
37 "debug": "^4.3.2", 37 "debug": "^4.3.2",
38 "electron-dl": "^3.2.1", 38 "electron-dl": "^3.2.1",
39 "electron-fetch": "^1.7.4",
40 "electron-find": "^1.0.7", 39 "electron-find": "^1.0.7",
41 "electron-react-titlebar": "^1.1.0", 40 "electron-react-titlebar": "^1.1.0",
42 "electron-updater": "^4.6.5", 41 "electron-updater": "^4.6.5",
@@ -5777,6 +5776,18 @@
5777 "node": ">=8" 5776 "node": ">=8"
5778 } 5777 }
5779 }, 5778 },
5779 "node_modules/all-contributors-cli/node_modules/node-fetch": {
5780 "version": "2.6.6",
5781 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
5782 "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
5783 "dev": true,
5784 "dependencies": {
5785 "whatwg-url": "^5.0.0"
5786 },
5787 "engines": {
5788 "node": "4.x || >=6.0.0"
5789 }
5790 },
5780 "node_modules/all-contributors-cli/node_modules/p-limit": { 5791 "node_modules/all-contributors-cli/node_modules/p-limit": {
5781 "version": "2.3.0", 5792 "version": "2.3.0",
5782 "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 5793 "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
@@ -5828,6 +5839,28 @@
5828 "node": ">=8" 5839 "node": ">=8"
5829 } 5840 }
5830 }, 5841 },
5842 "node_modules/all-contributors-cli/node_modules/tr46": {
5843 "version": "0.0.3",
5844 "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
5845 "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=",
5846 "dev": true
5847 },
5848 "node_modules/all-contributors-cli/node_modules/webidl-conversions": {
5849 "version": "3.0.1",
5850 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
5851 "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=",
5852 "dev": true
5853 },
5854 "node_modules/all-contributors-cli/node_modules/whatwg-url": {
5855 "version": "5.0.0",
5856 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
5857 "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
5858 "dev": true,
5859 "dependencies": {
5860 "tr46": "~0.0.3",
5861 "webidl-conversions": "^3.0.0"
5862 }
5863 },
5831 "node_modules/all-contributors-cli/node_modules/wrap-ansi": { 5864 "node_modules/all-contributors-cli/node_modules/wrap-ansi": {
5832 "version": "6.2.0", 5865 "version": "6.2.0",
5833 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", 5866 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
@@ -10916,17 +10949,6 @@
10916 "url": "https://github.com/sponsors/sindresorhus" 10949 "url": "https://github.com/sponsors/sindresorhus"
10917 } 10950 }
10918 }, 10951 },
10919 "node_modules/electron-fetch": {
10920 "version": "1.7.4",
10921 "resolved": "https://registry.npmjs.org/electron-fetch/-/electron-fetch-1.7.4.tgz",
10922 "integrity": "sha512-+fBLXEy4CJWQ5bz8dyaeSG1hD6JJ15kBZyj3eh24pIVrd3hLM47H/umffrdQfS6GZ0falF0g9JT9f3Rs6AVUhw==",
10923 "dependencies": {
10924 "encoding": "^0.1.13"
10925 },
10926 "engines": {
10927 "node": ">=6"
10928 }
10929 },
10930 "node_modules/electron-find": { 10952 "node_modules/electron-find": {
10931 "version": "1.0.7", 10953 "version": "1.0.7",
10932 "resolved": "https://registry.npmjs.org/electron-find/-/electron-find-1.0.7.tgz", 10954 "resolved": "https://registry.npmjs.org/electron-find/-/electron-find-1.0.7.tgz",
@@ -11233,6 +11255,8 @@
11233 "version": "0.1.13", 11255 "version": "0.1.13",
11234 "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", 11256 "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
11235 "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", 11257 "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
11258 "dev": true,
11259 "optional": true,
11236 "dependencies": { 11260 "dependencies": {
11237 "iconv-lite": "^0.6.2" 11261 "iconv-lite": "^0.6.2"
11238 } 11262 }
@@ -15458,6 +15482,7 @@
15458 "version": "0.6.3", 15482 "version": "0.6.3",
15459 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", 15483 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
15460 "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", 15484 "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
15485 "dev": true,
15461 "dependencies": { 15486 "dependencies": {
15462 "safer-buffer": ">= 2.1.2 < 3.0.0" 15487 "safer-buffer": ">= 2.1.2 < 3.0.0"
15463 }, 15488 },
@@ -21313,35 +21338,13 @@
21313 "integrity": "sha512-pFhMAqdN1avrFwtZs66HxYiVnbnH9wjXB4m8IKs5Z9+r7U5voqxT+EDbVkRfge+V7JnkOgKhN4HfKBn1o5g9Wg==" 21338 "integrity": "sha512-pFhMAqdN1avrFwtZs66HxYiVnbnH9wjXB4m8IKs5Z9+r7U5voqxT+EDbVkRfge+V7JnkOgKhN4HfKBn1o5g9Wg=="
21314 }, 21339 },
21315 "node_modules/node-fetch": { 21340 "node_modules/node-fetch": {
21316 "version": "2.6.6", 21341 "version": "2.6.1",
21317 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", 21342 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
21318 "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", 21343 "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
21319 "dependencies": {
21320 "whatwg-url": "^5.0.0"
21321 },
21322 "engines": { 21344 "engines": {
21323 "node": "4.x || >=6.0.0" 21345 "node": "4.x || >=6.0.0"
21324 } 21346 }
21325 }, 21347 },
21326 "node_modules/node-fetch/node_modules/tr46": {
21327 "version": "0.0.3",
21328 "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
21329 "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
21330 },
21331 "node_modules/node-fetch/node_modules/webidl-conversions": {
21332 "version": "3.0.1",
21333 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
21334 "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
21335 },
21336 "node_modules/node-fetch/node_modules/whatwg-url": {
21337 "version": "5.0.0",
21338 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
21339 "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
21340 "dependencies": {
21341 "tr46": "~0.0.3",
21342 "webidl-conversions": "^3.0.0"
21343 }
21344 },
21345 "node_modules/node-forge": { 21348 "node_modules/node-forge": {
21346 "version": "0.10.0", 21349 "version": "0.10.0",
21347 "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", 21350 "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
@@ -35520,6 +35523,15 @@
35520 "p-locate": "^4.1.0" 35523 "p-locate": "^4.1.0"
35521 } 35524 }
35522 }, 35525 },
35526 "node-fetch": {
35527 "version": "2.6.6",
35528 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
35529 "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
35530 "dev": true,
35531 "requires": {
35532 "whatwg-url": "^5.0.0"
35533 }
35534 },
35523 "p-limit": { 35535 "p-limit": {
35524 "version": "2.3.0", 35536 "version": "2.3.0",
35525 "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 35537 "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
@@ -35553,6 +35565,28 @@
35553 "has-flag": "^4.0.0" 35565 "has-flag": "^4.0.0"
35554 } 35566 }
35555 }, 35567 },
35568 "tr46": {
35569 "version": "0.0.3",
35570 "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
35571 "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=",
35572 "dev": true
35573 },
35574 "webidl-conversions": {
35575 "version": "3.0.1",
35576 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
35577 "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=",
35578 "dev": true
35579 },
35580 "whatwg-url": {
35581 "version": "5.0.0",
35582 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
35583 "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
35584 "dev": true,
35585 "requires": {
35586 "tr46": "~0.0.3",
35587 "webidl-conversions": "^3.0.0"
35588 }
35589 },
35556 "wrap-ansi": { 35590 "wrap-ansi": {
35557 "version": "6.2.0", 35591 "version": "6.2.0",
35558 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", 35592 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
@@ -39637,14 +39671,6 @@
39637 "unused-filename": "^2.1.0" 39671 "unused-filename": "^2.1.0"
39638 } 39672 }
39639 }, 39673 },
39640 "electron-fetch": {
39641 "version": "1.7.4",
39642 "resolved": "https://registry.npmjs.org/electron-fetch/-/electron-fetch-1.7.4.tgz",
39643 "integrity": "sha512-+fBLXEy4CJWQ5bz8dyaeSG1hD6JJ15kBZyj3eh24pIVrd3hLM47H/umffrdQfS6GZ0falF0g9JT9f3Rs6AVUhw==",
39644 "requires": {
39645 "encoding": "^0.1.13"
39646 }
39647 },
39648 "electron-find": { 39674 "electron-find": {
39649 "version": "1.0.7", 39675 "version": "1.0.7",
39650 "resolved": "https://registry.npmjs.org/electron-find/-/electron-find-1.0.7.tgz", 39676 "resolved": "https://registry.npmjs.org/electron-find/-/electron-find-1.0.7.tgz",
@@ -39899,6 +39925,8 @@
39899 "version": "0.1.13", 39925 "version": "0.1.13",
39900 "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", 39926 "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
39901 "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", 39927 "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
39928 "dev": true,
39929 "optional": true,
39902 "requires": { 39930 "requires": {
39903 "iconv-lite": "^0.6.2" 39931 "iconv-lite": "^0.6.2"
39904 } 39932 }
@@ -43259,6 +43287,7 @@
43259 "version": "0.6.3", 43287 "version": "0.6.3",
43260 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", 43288 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
43261 "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", 43289 "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
43290 "dev": true,
43262 "requires": { 43291 "requires": {
43263 "safer-buffer": ">= 2.1.2 < 3.0.0" 43292 "safer-buffer": ">= 2.1.2 < 3.0.0"
43264 } 43293 }
@@ -47732,33 +47761,9 @@
47732 "integrity": "sha512-pFhMAqdN1avrFwtZs66HxYiVnbnH9wjXB4m8IKs5Z9+r7U5voqxT+EDbVkRfge+V7JnkOgKhN4HfKBn1o5g9Wg==" 47761 "integrity": "sha512-pFhMAqdN1avrFwtZs66HxYiVnbnH9wjXB4m8IKs5Z9+r7U5voqxT+EDbVkRfge+V7JnkOgKhN4HfKBn1o5g9Wg=="
47733 }, 47762 },
47734 "node-fetch": { 47763 "node-fetch": {
47735 "version": "2.6.6", 47764 "version": "2.6.1",
47736 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", 47765 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
47737 "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", 47766 "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
47738 "requires": {
47739 "whatwg-url": "^5.0.0"
47740 },
47741 "dependencies": {
47742 "tr46": {
47743 "version": "0.0.3",
47744 "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
47745 "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
47746 },
47747 "webidl-conversions": {
47748 "version": "3.0.1",
47749 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
47750 "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
47751 },
47752 "whatwg-url": {
47753 "version": "5.0.0",
47754 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
47755 "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
47756 "requires": {
47757 "tr46": "~0.0.3",
47758 "webidl-conversions": "^3.0.0"
47759 }
47760 }
47761 }
47762 }, 47767 },
47763 "node-forge": { 47768 "node-forge": {
47764 "version": "0.10.0", 47769 "version": "0.10.0",
diff --git a/package.json b/package.json
index 3501ef08d..25632884d 100644
--- a/package.json
+++ b/package.json
@@ -72,7 +72,6 @@
72 "dbus-next": "^0.10.2", 72 "dbus-next": "^0.10.2",
73 "debug": "^4.3.2", 73 "debug": "^4.3.2",
74 "electron-dl": "^3.2.1", 74 "electron-dl": "^3.2.1",
75 "electron-fetch": "^1.7.4",
76 "electron-find": "^1.0.7", 75 "electron-find": "^1.0.7",
77 "electron-react-titlebar": "^1.1.0", 76 "electron-react-titlebar": "^1.1.0",
78 "electron-updater": "^4.6.5", 77 "electron-updater": "^4.6.5",
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts
index 0144a1069..c5c658df4 100644
--- a/src/api/server/ServerApi.ts
+++ b/src/api/server/ServerApi.ts
@@ -13,7 +13,6 @@ import {
13 removeSync, 13 removeSync,
14 PathOrFileDescriptor, 14 PathOrFileDescriptor,
15} from 'fs-extra'; 15} from 'fs-extra';
16import fetch from 'electron-fetch';
17 16
18import ServiceModel from '../../models/Service'; 17import ServiceModel from '../../models/Service';
19import RecipePreviewModel from '../../models/RecipePreview'; 18import RecipePreviewModel from '../../models/RecipePreview';
@@ -411,10 +410,11 @@ export default class ServerApi {
411 410
412 const packageUrl = `${apiBase()}/recipes/download/${recipeId}`; 411 const packageUrl = `${apiBase()}/recipes/download/${recipeId}`;
413 412
414 const res = await fetch(packageUrl); 413 const res = await window.fetch(packageUrl);
415 debug('Recipe downloaded', recipeId); 414 debug('Recipe downloaded', recipeId);
416 const buffer = await res.buffer(); 415 const blob = await res.blob();
417 writeFileSync(archivePath, buffer); 416 const buffer = await blob.arrayBuffer();
417 writeFileSync(tempArchivePath, Buffer.from(buffer));
418 } 418 }
419 debug(archivePath); 419 debug(archivePath);
420 420