diff options
author | 2022-04-30 21:02:01 -0500 | |
---|---|---|
committer | 2022-04-30 22:09:51 -0500 | |
commit | 694f24f7ff9767b81e7e2b0f68febe2441177119 (patch) | |
tree | 447e49d1bbd9d64a0a7421a770c53d4752d47667 | |
parent | 6.0.0-nightly.17 [skip ci] (diff) | |
download | ferdium-app-694f24f7ff9767b81e7e2b0f68febe2441177119.tar.gz ferdium-app-694f24f7ff9767b81e7e2b0f68febe2441177119.tar.zst ferdium-app-694f24f7ff9767b81e7e2b0f68febe2441177119.zip |
Replace dependency on 'cld' with 'languagedetect' to remove native compilation issu
-rw-r--r-- | package-lock.json | 163 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/electron/ipc-api/cld.ts | 28 | ||||
-rw-r--r-- | src/electron/ipc-api/index.ts | 4 | ||||
-rw-r--r-- | src/electron/ipc-api/languageDetect.ts | 19 |
5 files changed, 93 insertions, 123 deletions
diff --git a/package-lock.json b/package-lock.json index 09f1d24fa..7519803a6 100644 --- a/package-lock.json +++ b/package-lock.json | |||
@@ -28,7 +28,6 @@ | |||
28 | "auto-launch": "^5.0.5", | 28 | "auto-launch": "^5.0.5", |
29 | "btoa": "^1.2.1", | 29 | "btoa": "^1.2.1", |
30 | "classnames": "^2.3.1", | 30 | "classnames": "^2.3.1", |
31 | "cld": "^2.7.1", | ||
32 | "color": "^4.2.3", | 31 | "color": "^4.2.3", |
33 | "csstype": "^3.0.11", | 32 | "csstype": "^3.0.11", |
34 | "darkreader": "^4.9.46", | 33 | "darkreader": "^4.9.46", |
@@ -43,6 +42,7 @@ | |||
43 | "fs-extra": "^10.1.0", | 42 | "fs-extra": "^10.1.0", |
44 | "jsonwebtoken": "^8.5.1", | 43 | "jsonwebtoken": "^8.5.1", |
45 | "jss": "^10.9.0", | 44 | "jss": "^10.9.0", |
45 | "languagedetect": "2.0.0", | ||
46 | "lodash": "^4.17.21", | 46 | "lodash": "^4.17.21", |
47 | "macos-version": "^5.2.1", | 47 | "macos-version": "^5.2.1", |
48 | "mime-types": "^2.1.35", | 48 | "mime-types": "^2.1.35", |
@@ -8792,20 +8792,6 @@ | |||
8792 | "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", | 8792 | "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", |
8793 | "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" | 8793 | "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" |
8794 | }, | 8794 | }, |
8795 | "node_modules/cld": { | ||
8796 | "version": "2.7.1", | ||
8797 | "resolved": "https://registry.npmjs.org/cld/-/cld-2.7.1.tgz", | ||
8798 | "integrity": "sha512-4RusGBKlhW/f7hrv4wFf19n461aO1XCCC4/pCawTJNGaNT+i4OIeAwREY9oeqT0vJyBmtY2dM9IG4cQyu5Pcng==", | ||
8799 | "hasInstallScript": true, | ||
8800 | "dependencies": { | ||
8801 | "glob": "7", | ||
8802 | "node-addon-api": "*", | ||
8803 | "underscore": "^1.12.1" | ||
8804 | }, | ||
8805 | "engines": { | ||
8806 | "node": ">=12.0.0" | ||
8807 | } | ||
8808 | }, | ||
8809 | "node_modules/clean-css": { | 8795 | "node_modules/clean-css": { |
8810 | "version": "4.2.4", | 8796 | "version": "4.2.4", |
8811 | "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", | 8797 | "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", |
@@ -14348,6 +14334,15 @@ | |||
14348 | "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", | 14334 | "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", |
14349 | "dev": true | 14335 | "dev": true |
14350 | }, | 14336 | }, |
14337 | "node_modules/gulp-cli/node_modules/invert-kv": { | ||
14338 | "version": "1.0.0", | ||
14339 | "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", | ||
14340 | "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", | ||
14341 | "dev": true, | ||
14342 | "engines": { | ||
14343 | "node": ">=0.10.0" | ||
14344 | } | ||
14345 | }, | ||
14351 | "node_modules/gulp-cli/node_modules/is-fullwidth-code-point": { | 14346 | "node_modules/gulp-cli/node_modules/is-fullwidth-code-point": { |
14352 | "version": "1.0.0", | 14347 | "version": "1.0.0", |
14353 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", | 14348 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", |
@@ -14360,6 +14355,18 @@ | |||
14360 | "node": ">=0.10.0" | 14355 | "node": ">=0.10.0" |
14361 | } | 14356 | } |
14362 | }, | 14357 | }, |
14358 | "node_modules/gulp-cli/node_modules/lcid": { | ||
14359 | "version": "1.0.0", | ||
14360 | "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", | ||
14361 | "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", | ||
14362 | "dev": true, | ||
14363 | "dependencies": { | ||
14364 | "invert-kv": "^1.0.0" | ||
14365 | }, | ||
14366 | "engines": { | ||
14367 | "node": ">=0.10.0" | ||
14368 | } | ||
14369 | }, | ||
14363 | "node_modules/gulp-cli/node_modules/normalize-package-data": { | 14370 | "node_modules/gulp-cli/node_modules/normalize-package-data": { |
14364 | "version": "2.5.0", | 14371 | "version": "2.5.0", |
14365 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", | 14372 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", |
@@ -14372,6 +14379,18 @@ | |||
14372 | "validate-npm-package-license": "^3.0.1" | 14379 | "validate-npm-package-license": "^3.0.1" |
14373 | } | 14380 | } |
14374 | }, | 14381 | }, |
14382 | "node_modules/gulp-cli/node_modules/os-locale": { | ||
14383 | "version": "1.4.0", | ||
14384 | "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", | ||
14385 | "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", | ||
14386 | "dev": true, | ||
14387 | "dependencies": { | ||
14388 | "lcid": "^1.0.0" | ||
14389 | }, | ||
14390 | "engines": { | ||
14391 | "node": ">=0.10.0" | ||
14392 | } | ||
14393 | }, | ||
14375 | "node_modules/gulp-cli/node_modules/path-exists": { | 14394 | "node_modules/gulp-cli/node_modules/path-exists": { |
14376 | "version": "2.1.0", | 14395 | "version": "2.1.0", |
14377 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", | 14396 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", |
@@ -15966,15 +15985,6 @@ | |||
15966 | "loose-envify": "^1.0.0" | 15985 | "loose-envify": "^1.0.0" |
15967 | } | 15986 | } |
15968 | }, | 15987 | }, |
15969 | "node_modules/invert-kv": { | ||
15970 | "version": "1.0.0", | ||
15971 | "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", | ||
15972 | "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", | ||
15973 | "dev": true, | ||
15974 | "engines": { | ||
15975 | "node": ">=0.10.0" | ||
15976 | } | ||
15977 | }, | ||
15978 | "node_modules/ip": { | 15988 | "node_modules/ip": { |
15979 | "version": "1.1.5", | 15989 | "version": "1.1.5", |
15980 | "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", | 15990 | "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", |
@@ -19335,6 +19345,14 @@ | |||
19335 | "language-subtag-registry": "~0.3.2" | 19345 | "language-subtag-registry": "~0.3.2" |
19336 | } | 19346 | } |
19337 | }, | 19347 | }, |
19348 | "node_modules/languagedetect": { | ||
19349 | "version": "2.0.0", | ||
19350 | "resolved": "https://registry.npmjs.org/languagedetect/-/languagedetect-2.0.0.tgz", | ||
19351 | "integrity": "sha512-AZb/liiQ+6ZoTj4f1J0aE6OkzhCo8fyH+tuSaPfSo8YHCWLFJrdSixhtO2TYdIkjcDQNaR4RmGaV2A5FJklDMQ==", | ||
19352 | "engines": { | ||
19353 | "node": ">= 0.4.8" | ||
19354 | } | ||
19355 | }, | ||
19338 | "node_modules/last-run": { | 19356 | "node_modules/last-run": { |
19339 | "version": "1.1.1", | 19357 | "version": "1.1.1", |
19340 | "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", | 19358 | "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", |
@@ -19388,18 +19406,6 @@ | |||
19388 | "node": ">= 0.6.3" | 19406 | "node": ">= 0.6.3" |
19389 | } | 19407 | } |
19390 | }, | 19408 | }, |
19391 | "node_modules/lcid": { | ||
19392 | "version": "1.0.0", | ||
19393 | "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", | ||
19394 | "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", | ||
19395 | "dev": true, | ||
19396 | "dependencies": { | ||
19397 | "invert-kv": "^1.0.0" | ||
19398 | }, | ||
19399 | "engines": { | ||
19400 | "node": ">=0.10.0" | ||
19401 | } | ||
19402 | }, | ||
19403 | "node_modules/lead": { | 19409 | "node_modules/lead": { |
19404 | "version": "1.0.0", | 19410 | "version": "1.0.0", |
19405 | "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", | 19411 | "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", |
@@ -22059,18 +22065,6 @@ | |||
22059 | "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", | 22065 | "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", |
22060 | "dev": true | 22066 | "dev": true |
22061 | }, | 22067 | }, |
22062 | "node_modules/os-locale": { | ||
22063 | "version": "1.4.0", | ||
22064 | "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", | ||
22065 | "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", | ||
22066 | "dev": true, | ||
22067 | "dependencies": { | ||
22068 | "lcid": "^1.0.0" | ||
22069 | }, | ||
22070 | "engines": { | ||
22071 | "node": ">=0.10.0" | ||
22072 | } | ||
22073 | }, | ||
22074 | "node_modules/os-name": { | 22068 | "node_modules/os-name": { |
22075 | "version": "4.0.1", | 22069 | "version": "4.0.1", |
22076 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", | 22070 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", |
@@ -28438,11 +28432,6 @@ | |||
28438 | "node": ">=0.10.0" | 28432 | "node": ">=0.10.0" |
28439 | } | 28433 | } |
28440 | }, | 28434 | }, |
28441 | "node_modules/underscore": { | ||
28442 | "version": "1.13.3", | ||
28443 | "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.3.tgz", | ||
28444 | "integrity": "sha512-QvjkYpiD+dJJraRA8+dGAU4i7aBbb2s0S3jA45TFOvg2VgqvdCDd/3N6CqA8gluk1W91GLoXg5enMUx560QzuA==" | ||
28445 | }, | ||
28446 | "node_modules/undertaker": { | 28435 | "node_modules/undertaker": { |
28447 | "version": "1.3.0", | 28436 | "version": "1.3.0", |
28448 | "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.3.0.tgz", | 28437 | "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.3.0.tgz", |
@@ -37970,16 +37959,6 @@ | |||
37970 | "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", | 37959 | "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", |
37971 | "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" | 37960 | "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" |
37972 | }, | 37961 | }, |
37973 | "cld": { | ||
37974 | "version": "2.7.1", | ||
37975 | "resolved": "https://registry.npmjs.org/cld/-/cld-2.7.1.tgz", | ||
37976 | "integrity": "sha512-4RusGBKlhW/f7hrv4wFf19n461aO1XCCC4/pCawTJNGaNT+i4OIeAwREY9oeqT0vJyBmtY2dM9IG4cQyu5Pcng==", | ||
37977 | "requires": { | ||
37978 | "glob": "7", | ||
37979 | "node-addon-api": "*", | ||
37980 | "underscore": "^1.12.1" | ||
37981 | } | ||
37982 | }, | ||
37983 | "clean-css": { | 37962 | "clean-css": { |
37984 | "version": "4.2.4", | 37963 | "version": "4.2.4", |
37985 | "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", | 37964 | "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", |
@@ -42420,6 +42399,12 @@ | |||
42420 | "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", | 42399 | "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", |
42421 | "dev": true | 42400 | "dev": true |
42422 | }, | 42401 | }, |
42402 | "invert-kv": { | ||
42403 | "version": "1.0.0", | ||
42404 | "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", | ||
42405 | "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", | ||
42406 | "dev": true | ||
42407 | }, | ||
42423 | "is-fullwidth-code-point": { | 42408 | "is-fullwidth-code-point": { |
42424 | "version": "1.0.0", | 42409 | "version": "1.0.0", |
42425 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", | 42410 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", |
@@ -42429,6 +42414,15 @@ | |||
42429 | "number-is-nan": "^1.0.0" | 42414 | "number-is-nan": "^1.0.0" |
42430 | } | 42415 | } |
42431 | }, | 42416 | }, |
42417 | "lcid": { | ||
42418 | "version": "1.0.0", | ||
42419 | "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", | ||
42420 | "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", | ||
42421 | "dev": true, | ||
42422 | "requires": { | ||
42423 | "invert-kv": "^1.0.0" | ||
42424 | } | ||
42425 | }, | ||
42432 | "normalize-package-data": { | 42426 | "normalize-package-data": { |
42433 | "version": "2.5.0", | 42427 | "version": "2.5.0", |
42434 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", | 42428 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", |
@@ -42441,6 +42435,15 @@ | |||
42441 | "validate-npm-package-license": "^3.0.1" | 42435 | "validate-npm-package-license": "^3.0.1" |
42442 | } | 42436 | } |
42443 | }, | 42437 | }, |
42438 | "os-locale": { | ||
42439 | "version": "1.4.0", | ||
42440 | "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", | ||
42441 | "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", | ||
42442 | "dev": true, | ||
42443 | "requires": { | ||
42444 | "lcid": "^1.0.0" | ||
42445 | } | ||
42446 | }, | ||
42444 | "path-exists": { | 42447 | "path-exists": { |
42445 | "version": "2.1.0", | 42448 | "version": "2.1.0", |
42446 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", | 42449 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", |
@@ -43719,12 +43722,6 @@ | |||
43719 | "loose-envify": "^1.0.0" | 43722 | "loose-envify": "^1.0.0" |
43720 | } | 43723 | } |
43721 | }, | 43724 | }, |
43722 | "invert-kv": { | ||
43723 | "version": "1.0.0", | ||
43724 | "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", | ||
43725 | "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", | ||
43726 | "dev": true | ||
43727 | }, | ||
43728 | "ip": { | 43725 | "ip": { |
43729 | "version": "1.1.5", | 43726 | "version": "1.1.5", |
43730 | "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", | 43727 | "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", |
@@ -46243,6 +46240,11 @@ | |||
46243 | "language-subtag-registry": "~0.3.2" | 46240 | "language-subtag-registry": "~0.3.2" |
46244 | } | 46241 | } |
46245 | }, | 46242 | }, |
46243 | "languagedetect": { | ||
46244 | "version": "2.0.0", | ||
46245 | "resolved": "https://registry.npmjs.org/languagedetect/-/languagedetect-2.0.0.tgz", | ||
46246 | "integrity": "sha512-AZb/liiQ+6ZoTj4f1J0aE6OkzhCo8fyH+tuSaPfSo8YHCWLFJrdSixhtO2TYdIkjcDQNaR4RmGaV2A5FJklDMQ==" | ||
46247 | }, | ||
46246 | "last-run": { | 46248 | "last-run": { |
46247 | "version": "1.1.1", | 46249 | "version": "1.1.1", |
46248 | "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", | 46250 | "resolved": "https://registry.npmjs.org/last-run/-/last-run-1.1.1.tgz", |
@@ -46284,15 +46286,6 @@ | |||
46284 | "readable-stream": "^2.0.5" | 46286 | "readable-stream": "^2.0.5" |
46285 | } | 46287 | } |
46286 | }, | 46288 | }, |
46287 | "lcid": { | ||
46288 | "version": "1.0.0", | ||
46289 | "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", | ||
46290 | "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", | ||
46291 | "dev": true, | ||
46292 | "requires": { | ||
46293 | "invert-kv": "^1.0.0" | ||
46294 | } | ||
46295 | }, | ||
46296 | "lead": { | 46289 | "lead": { |
46297 | "version": "1.0.0", | 46290 | "version": "1.0.0", |
46298 | "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", | 46291 | "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", |
@@ -48384,15 +48377,6 @@ | |||
48384 | "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", | 48377 | "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", |
48385 | "dev": true | 48378 | "dev": true |
48386 | }, | 48379 | }, |
48387 | "os-locale": { | ||
48388 | "version": "1.4.0", | ||
48389 | "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", | ||
48390 | "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", | ||
48391 | "dev": true, | ||
48392 | "requires": { | ||
48393 | "lcid": "^1.0.0" | ||
48394 | } | ||
48395 | }, | ||
48396 | "os-name": { | 48380 | "os-name": { |
48397 | "version": "4.0.1", | 48381 | "version": "4.0.1", |
48398 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", | 48382 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-4.0.1.tgz", |
@@ -53494,11 +53478,6 @@ | |||
53494 | "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", | 53478 | "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", |
53495 | "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" | 53479 | "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" |
53496 | }, | 53480 | }, |
53497 | "underscore": { | ||
53498 | "version": "1.13.3", | ||
53499 | "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.3.tgz", | ||
53500 | "integrity": "sha512-QvjkYpiD+dJJraRA8+dGAU4i7aBbb2s0S3jA45TFOvg2VgqvdCDd/3N6CqA8gluk1W91GLoXg5enMUx560QzuA==" | ||
53501 | }, | ||
53502 | "undertaker": { | 53481 | "undertaker": { |
53503 | "version": "1.3.0", | 53482 | "version": "1.3.0", |
53504 | "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.3.0.tgz", | 53483 | "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.3.0.tgz", |
diff --git a/package.json b/package.json index ad35a7733..f60c3cb78 100644 --- a/package.json +++ b/package.json | |||
@@ -62,7 +62,6 @@ | |||
62 | "auto-launch": "^5.0.5", | 62 | "auto-launch": "^5.0.5", |
63 | "btoa": "^1.2.1", | 63 | "btoa": "^1.2.1", |
64 | "classnames": "^2.3.1", | 64 | "classnames": "^2.3.1", |
65 | "cld": "^2.7.1", | ||
66 | "color": "^4.2.3", | 65 | "color": "^4.2.3", |
67 | "csstype": "^3.0.11", | 66 | "csstype": "^3.0.11", |
68 | "darkreader": "^4.9.46", | 67 | "darkreader": "^4.9.46", |
@@ -77,6 +76,7 @@ | |||
77 | "fs-extra": "^10.1.0", | 76 | "fs-extra": "^10.1.0", |
78 | "jsonwebtoken": "^8.5.1", | 77 | "jsonwebtoken": "^8.5.1", |
79 | "jss": "^10.9.0", | 78 | "jss": "^10.9.0", |
79 | "languagedetect": "2.0.0", | ||
80 | "lodash": "^4.17.21", | 80 | "lodash": "^4.17.21", |
81 | "macos-version": "^5.2.1", | 81 | "macos-version": "^5.2.1", |
82 | "mime-types": "^2.1.35", | 82 | "mime-types": "^2.1.35", |
diff --git a/src/electron/ipc-api/cld.ts b/src/electron/ipc-api/cld.ts deleted file mode 100644 index a6332e22d..000000000 --- a/src/electron/ipc-api/cld.ts +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | import { ipcMain } from 'electron'; | ||
2 | // @ts-ignore | ||
3 | import cld from 'cld'; | ||
4 | |||
5 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:cld'); | ||
6 | |||
7 | export default async () => { | ||
8 | ipcMain.handle('detect-language', async (_event, { sample }) => { | ||
9 | if (!cld) { | ||
10 | return null; | ||
11 | } | ||
12 | try { | ||
13 | const result = await cld.detect(sample); | ||
14 | debug('Checking language', 'probability', result.languages); | ||
15 | if (result.reliable) { | ||
16 | debug( | ||
17 | 'Language detected reliably, setting spellchecker language to', | ||
18 | result.languages[0].code, | ||
19 | ); | ||
20 | |||
21 | return result.languages[0].code; | ||
22 | } | ||
23 | } catch (error) { | ||
24 | console.error(error); | ||
25 | return null; | ||
26 | } | ||
27 | }); | ||
28 | }; | ||
diff --git a/src/electron/ipc-api/index.ts b/src/electron/ipc-api/index.ts index 1f69c04ee..f8306d591 100644 --- a/src/electron/ipc-api/index.ts +++ b/src/electron/ipc-api/index.ts | |||
@@ -5,7 +5,7 @@ import sessionStorage from './sessionStorage'; | |||
5 | import appIndicator from './appIndicator'; | 5 | import appIndicator from './appIndicator'; |
6 | import download from './download'; | 6 | import download from './download'; |
7 | import localServer from './localServer'; | 7 | import localServer from './localServer'; |
8 | import cld from './cld'; | 8 | import languageDetect from './languageDetect'; |
9 | import dnd from './dnd'; | 9 | import dnd from './dnd'; |
10 | import focusState from './focusState'; | 10 | import focusState from './focusState'; |
11 | 11 | ||
@@ -20,7 +20,7 @@ export default (params: { | |||
20 | appIndicator(params); | 20 | appIndicator(params); |
21 | download(params); | 21 | download(params); |
22 | localServer(params); | 22 | localServer(params); |
23 | cld(); | 23 | languageDetect(); |
24 | dnd(); | 24 | dnd(); |
25 | focusState(params); | 25 | focusState(params); |
26 | }; | 26 | }; |
diff --git a/src/electron/ipc-api/languageDetect.ts b/src/electron/ipc-api/languageDetect.ts new file mode 100644 index 000000000..d344f7097 --- /dev/null +++ b/src/electron/ipc-api/languageDetect.ts | |||
@@ -0,0 +1,19 @@ | |||
1 | import { ipcMain } from 'electron'; | ||
2 | |||
3 | import LanguageDetect from 'languagedetect'; | ||
4 | |||
5 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:languageDetect'); | ||
6 | |||
7 | export default async () => { | ||
8 | ipcMain.handle('detect-language', async (_event, { sample }) => { | ||
9 | if (!LanguageDetect) { | ||
10 | return null; | ||
11 | } | ||
12 | const langDetector = new LanguageDetect(); | ||
13 | langDetector.setLanguageType('iso2'); | ||
14 | debug('Checking language for sample:', sample); | ||
15 | const result = langDetector.detect(sample, 1); | ||
16 | debug('Language detection result:', result); | ||
17 | return result[0][0]; | ||
18 | }); | ||
19 | }; | ||