Skip to content

Commit

Permalink
link fixing (#1302)
Browse files Browse the repository at this point in the history
* test

* Update downloadChapter.ts

* react-native-url-polyfill

* -urlencode

* oops

* +urlencode

* fix prettier

* wrong
  • Loading branch information
Rider21 authored Nov 6, 2024
1 parent bc5e2f1 commit 4bc3638
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 30 deletions.
1 change: 1 addition & 0 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'react-native-gesture-handler';
import 'react-native-url-polyfill/auto';
import { enableFreeze } from 'react-native-screens';

enableFreeze(true);
Expand Down
78 changes: 59 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/pluginManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -23,7 +22,6 @@ const packages: Record<string, any> = {
'htmlparser2': { Parser },
'cheerio': { load },
'dayjs': dayjs,
'qs': qs,
'urlencode': { encode, decode },
'@libs/novelStatus': { NovelStatus },
'@libs/fetch': { fetchApi, fetchText, fetchProto },
Expand Down
13 changes: 6 additions & 7 deletions src/services/Trackers/myAnimeList.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/services/download/downloadChapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4bc3638

Please sign in to comment.