Replace the line that removes the linefeed to somewhere that makes more sense

This commit is contained in:
jubiman 2024-09-09 23:05:40 +02:00
parent 0277b171e0
commit f165ba8469

View file

@ -66,6 +66,8 @@ window.addEventListener('paste', ({ clipboardData }) => {
if (code.endsWith('/')) code = code.slice(0, -1)
if (state.endsWith('/')) state = state.slice(0, -1)
if (state.includes('%')) state = decodeURIComponent(state)
// remove linefeed characters from the state
state = state.replace(/(\r\n|\n|\r)/gm, '')
handleMalToken(code, state)
}
}
@ -98,8 +100,6 @@ async function handleMalToken (code, state) {
debug(`Failed to get the state and code from MyAnimeList.`)
return
}
// remove linefeed characters from the state
state = state.replace(/(\r\n|\n|\r)/gm, '')
const response = await fetch('https://myanimelist.net/v1/oauth2/token', {
method: 'POST',
headers: {