diff --git a/App.tsx b/App.tsx index 888eb1551..e3f87ccc8 100644 --- a/App.tsx +++ b/App.tsx @@ -1,4 +1,5 @@ import 'react-native-gesture-handler'; +import 'react-native-url-polyfill/auto'; import { enableFreeze } from 'react-native-screens'; enableFreeze(true); diff --git a/package-lock.json b/package-lock.json index ba690a529..64221bafb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,6 @@ "i18n-js": "^3.8.0", "lodash-es": "^4.17.21", "protobufjs": "^7.2.6", - "qs": "^6.12.0", "react": "18.2.0", "react-native": "0.72.10", "react-native-background-actions": "^3.0.1", @@ -55,6 +54,7 @@ "react-native-screens": "^3.22.0", "react-native-shimmer-placeholder": "^2.0.9", "react-native-tab-view": "^3.5.2", + "react-native-url-polyfill": "^2.0.0", "react-native-vector-icons": "^9.0.0", "react-native-webview": "^13.10.5", "react-native-zip-archive": "^7.0.0", @@ -10352,6 +10352,18 @@ "version": "3.9.2", "license": "MIT" }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ieee754": { "version": "1.2.1", "funding": [ @@ -14558,6 +14570,15 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/qrcode-terminal": { "version": "0.11.0", "bin": { @@ -15027,6 +15048,18 @@ "react-native-pager-view": "*" } }, + "node_modules/react-native-url-polyfill": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/react-native-url-polyfill/-/react-native-url-polyfill-2.0.0.tgz", + "integrity": "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA==", + "license": "MIT", + "dependencies": { + "whatwg-url-without-unicode": "8.0.0-3" + }, + "peerDependencies": { + "react-native": "*" + } + }, "node_modules/react-native-vector-icons": { "version": "9.2.0", "license": "MIT", @@ -16819,14 +16852,6 @@ "punycode": "^2.1.0" } }, - "node_modules/uri-js/node_modules/punycode": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/url": { "version": "0.11.3", "license": "MIT", @@ -16853,21 +16878,13 @@ }, "node_modules/urlencode": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/urlencode/-/urlencode-2.0.0.tgz", + "integrity": "sha512-K4+koEq4II9FqKKdLyMwfVFiWvTLJsdsIihXCprumjlOwpviO44E4hAhLYBLb6CEVTZh9hXXMTQHIT+Hwv5BPw==", "license": "MIT", "dependencies": { "iconv-lite": "~0.6.3" } }, - "node_modules/urlencode/node_modules/iconv-lite": { - "version": "0.6.3", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/use-latest-callback": { "version": "0.1.11", "license": "MIT", @@ -16966,6 +16983,29 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/whatwg-url-without-unicode": { + "version": "8.0.0-3", + "resolved": "https://registry.npmjs.org/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-3.tgz", + "integrity": "sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig==", + "license": "MIT", + "dependencies": { + "buffer": "^5.4.3", + "punycode": "^2.1.1", + "webidl-conversions": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/whatwg-url-without-unicode/node_modules/webidl-conversions": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", + "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=8" + } + }, "node_modules/which": { "version": "2.0.2", "license": "ISC", diff --git a/package.json b/package.json index 1308f0995..409f69844 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "i18n-js": "^3.8.0", "lodash-es": "^4.17.21", "protobufjs": "^7.2.6", - "qs": "^6.12.0", "react": "18.2.0", "react-native": "0.72.10", "react-native-background-actions": "^3.0.1", @@ -62,6 +61,7 @@ "react-native-screens": "^3.22.0", "react-native-shimmer-placeholder": "^2.0.9", "react-native-tab-view": "^3.5.2", + "react-native-url-polyfill": "^2.0.0", "react-native-vector-icons": "^9.0.0", "react-native-webview": "^13.10.5", "react-native-zip-archive": "^7.0.0", diff --git a/src/plugins/pluginManager.ts b/src/plugins/pluginManager.ts index 120690fff..5a73f6df4 100644 --- a/src/plugins/pluginManager.ts +++ b/src/plugins/pluginManager.ts @@ -5,7 +5,6 @@ import { store } from './helpers/storage'; // packages for plugins import { load } from 'cheerio'; import dayjs from 'dayjs'; -import qs from 'qs'; import { NovelStatus, Plugin, PluginItem } from './types'; import { FilterTypes } from './types/filterTypes'; import { isUrlAbsolute } from './helpers/isAbsoluteUrl'; @@ -23,7 +22,6 @@ const packages: Record = { 'htmlparser2': { Parser }, 'cheerio': { load }, 'dayjs': dayjs, - 'qs': qs, 'urlencode': { encode, decode }, '@libs/novelStatus': { NovelStatus }, '@libs/fetch': { fetchApi, fetchText, fetchProto }, diff --git a/src/services/Trackers/myAnimeList.ts b/src/services/Trackers/myAnimeList.ts index 5dd64ddc4..b4e4c7bc0 100644 --- a/src/services/Trackers/myAnimeList.ts +++ b/src/services/Trackers/myAnimeList.ts @@ -1,6 +1,5 @@ import * as Linking from 'expo-linking'; import * as WebBrowser from 'expo-web-browser'; -import qs from 'qs'; import { MYANIMELIST_CLIENT_ID } from '@env'; import { Tracker, UserListStatus } from './index'; @@ -51,12 +50,12 @@ export const myAnimeListTracker: Tracker = { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, - body: qs.stringify({ + body: new URLSearchParams({ client_id: clientId, grant_type: 'authorization_code', code, code_verifier: challenge, - }), + }).toString(), }); const tokenResponse = await response.json(); @@ -72,10 +71,10 @@ export const myAnimeListTracker: Tracker = { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, - body: qs.stringify({ + body: new URLSearchParams({ grant_type: 'refresh_token', refresh_token: auth.refreshToken, - }), + }).toString(), }); const tokenResponse = await response.json(); @@ -143,12 +142,12 @@ export const myAnimeListTracker: Tracker = { Authorization: `Bearer ${auth.accessToken}`, 'Content-Type': 'application/x-www-form-urlencoded', }, - body: qs.stringify({ + body: new URLSearchParams({ status, is_rereading: repeating, num_chapters_read: payload.progress, score: payload.score, - }), + }).toString(), }); const data = await res.json(); diff --git a/src/services/download/downloadChapter.ts b/src/services/download/downloadChapter.ts index dfb89a2d4..9a6157957 100644 --- a/src/services/download/downloadChapter.ts +++ b/src/services/download/downloadChapter.ts @@ -45,7 +45,7 @@ const downloadFiles = async ( const url = elem.attr('src'); if (url) { const fileurl = `${folder}/${i}.b64.png`; - elem.attr('src', `file://${fileurl}`); + elem.attr('src', 'file://' + fileurl); try { const absoluteURL = new URL(url, plugin.site).href; await downloadFile(absoluteURL, fileurl, plugin.imageRequestInit);