Make a fork of the google-translate-api package using fetch for credentials omit

This commit is contained in:
bad 2022-04-22 21:34:53 +02:00
parent 33bf4d05c9
commit caf14b616b
3 changed files with 10 additions and 3 deletions

View file

@ -4,7 +4,7 @@
"description": "Flashlang is a small browser extension to help you learn languages",
"main": "webpack.config.js",
"dependencies": {
"@asmagin/google-translate-api": "^8.0.2",
"@asmagin/google-translate-api": "git+https://github.com/MaeIsBad/google-translate-api.git",
"@sveltejs/svelte-virtual-list": "^3.0.1",
"svelte-feather-icons": "^4.0.0",
"svelte-select": "^4.4.7",

View file

@ -18,10 +18,10 @@ export class GTranslate extends Translator {
toTranslate: string,
langs: LanguagePair
): Promise<Translation> {
const resp = await translate(toTranslate, {
const resp = await (translate as any)(toTranslate, {
from: langs.srcLang.code,
to: langs.dstLang.code,
});
}, {credentials: "omit"});
return {
src: resp.from.text.value,
languages: langs,

View file

@ -10,6 +10,13 @@
axios "^0.21.1"
querystring "^0.2.1"
"@asmagin/google-translate-api@git+https://github.com/MaeIsBad/google-translate-api.git":
version "8.0.2"
resolved "git+https://github.com/MaeIsBad/google-translate-api.git#3cd4d4dabcde8a4bddab6c7dd074e92444408c1a"
dependencies:
axios "^0.21.1"
querystring "^0.2.1"
"@babel/code-frame@^7.0.0":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"