mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
copy token to clipboard
This commit is contained in:
parent
0dc9b72106
commit
81c6eca69c
@ -18,6 +18,7 @@
|
|||||||
"filesystem.*",
|
"filesystem.*",
|
||||||
"storage.*",
|
"storage.*",
|
||||||
"window.*",
|
"window.*",
|
||||||
|
"clipboard.*",
|
||||||
"debug.log"
|
"debug.log"
|
||||||
],
|
],
|
||||||
"modes": {
|
"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
|
* Attempt login and launch game
|
||||||
*/
|
*/
|
||||||
@ -57,6 +63,7 @@ async function login() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await axios.post(url + '/grasscutter/login', reqBody)
|
const { data } = await axios.post(url + '/grasscutter/login', reqBody)
|
||||||
|
const tkData = parseJwt(data.jwt)
|
||||||
|
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
|
||||||
@ -79,6 +86,7 @@ async function login() {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// Success! Copy the JWT token to their clipboard
|
// Success! Copy the JWT token to their clipboard
|
||||||
|
await Neutralino.clipboard.writeText(tkData.token)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user