mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-25 17:35:42 +00:00
copy token to clipboard
This commit is contained in:
parent
0dc9b72106
commit
81c6eca69c
@ -18,6 +18,7 @@
|
||||
"filesystem.*",
|
||||
"storage.*",
|
||||
"window.*",
|
||||
"clipboard.*",
|
||||
"debug.log"
|
||||
],
|
||||
"modes": {
|
||||
|
@ -39,6 +39,12 @@ async function setRegisterSection(fromLogin = false) {
|
||||
}
|
||||
}
|
||||
|
||||
function parseJwt(token) {
|
||||
const base64Url = token.split('.')[1];
|
||||
const base64 = base64Url.replace('-', '+').replace('_', '/');
|
||||
return JSON.parse(window.atob(base64));
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt login and launch game
|
||||
*/
|
||||
@ -57,6 +63,7 @@ async function login() {
|
||||
}
|
||||
|
||||
const { data } = await axios.post(url + '/grasscutter/login', reqBody)
|
||||
const tkData = parseJwt(data.jwt)
|
||||
|
||||
console.log(data)
|
||||
|
||||
@ -79,6 +86,7 @@ async function login() {
|
||||
|
||||
default:
|
||||
// Success! Copy the JWT token to their clipboard
|
||||
await Neutralino.clipboard.writeText(tkData.token)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user