Skip to content

Commit

Permalink
Fix Buffer undefined issue with Base64
Browse files Browse the repository at this point in the history
  • Loading branch information
kymotsujason committed Jan 13, 2025
1 parent 594b672 commit b120148
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@paperback/toolchain": "^0.8.7",
"@paperback/types": "^0.8.7",
"cheerio": "^1.0.0",
"html-entities": "^2.5.2"
"html-entities": "^2.5.2",
"js-base64": "^3.7.7"
}
}
2 changes: 1 addition & 1 deletion src/MangaDex/MangaDex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const MangaDexInfo: SourceInfo = {
description: 'Extension that pulls manga from MangaDex',
icon: 'icon.png',
name: 'MangaDex',
version: '3.0.5',
version: '3.0.6',
authorWebsite: 'https://github.com/nar1n',
websiteBaseURL: MANGADEX_DOMAIN,
contentRating: ContentRating.EVERYONE,
Expand Down
4 changes: 2 additions & 2 deletions src/MangaDex/MangaDexSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
MDRatings,
MDImageQuality
} from './MangaDexHelper'

import { Base64 } from 'js-base64'

export async function getLanguages(stateManager: SourceStateManager) {
return (await stateManager.retrieve('languages') ?? MDLanguages.getDefault())
Expand Down Expand Up @@ -152,7 +152,7 @@ export async function parseAccessToken(accessToken: string | undefined) {
const tokenBodyBase64 = accessToken.split('.')[1]
if (!tokenBodyBase64) return undefined

const tokenBodyJSON = Buffer.from(tokenBodyBase64, 'base64').toString('ascii')
const tokenBodyJSON = Base64.decode(tokenBodyBase64)
return JSON.parse(tokenBodyJSON)
}

Expand Down

0 comments on commit b120148

Please sign in to comment.