diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3fe4ffc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +``` +By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` diff --git a/common/modules/settings.js b/common/modules/settings.js index e4af0a9..2162d14 100644 --- a/common/modules/settings.js +++ b/common/modules/settings.js @@ -4,7 +4,7 @@ import IPC from '@/modules/ipc.js' import { toast } from 'svelte-sonner' import Debug from 'debug' -const debug = Debug('ui:anilist') +const debug = Debug('ui:settings') export let profiles = writable(JSON.parse(localStorage.getItem('profiles')) || []) /** @type {{viewer: import('./al').Query<{Viewer: import('./al').Viewer}>, token: string} | null} */ @@ -60,12 +60,15 @@ window.addEventListener('paste', ({ clipboardData }) => { handleToken(token) } } else if (text.includes("code=") && text.includes("&state")) { // is a MyAnimeList authorization - let code = line.split('code=')[1].split('&state')[0] - let state = line.split('&state=')[1] + let code = text.split('code=')[1].split('&state')[0] + let state = text.split('&state=')[1] if (code && state) { 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 + code = code.replace(/(\r\n|\n|\r)/gm, '') + state = state.replace(/(\r\n|\n|\r)/gm, '') handleMalToken(code, state) } }