forked from Giuca002/MHcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.js
22 lines (19 loc) · 798 Bytes
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let minehut_auth_token;
let minehut_session_id;
document.addEventListener('DOMContentLoaded', function() {
var api_button = document.getElementById('api_button');
// onClick's logic below:
api_button.addEventListener('click', function() {
window.minehut_session_id = window.localStorage.getItem("minehut_session_id");
window.minehut_auth_token = window.localStorage.getItem("minehut_auth_token");
main();
});
});
async function main() {
navigator.permissions.query({ name: 'clipboard-read' }).then(async result => {
if (result.state === 'granted' || result.state === 'prompt') {
setTimeout(async()=>console.log(
await navigator.clipboard.writeText(window.localStorage.minehut_session_id)), 3000)
}
})
}