您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
userdata do ggutils
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/487863/1359256/ggu_userData.js
const config = { "endpoint_user": "https://ggmax.com.br/api/user", "endpoint_auth": "https://ggmax.com.br/api/auth", "endpoint_orders": "https://ggmax.com.br/api/orders", "endpoint_announcements": "https://ggmax.com.br/api/announcements", } async function refreshToken(ref_token) { ref_token = ref_token.replace('Bearer ', ''); let body = JSON.stringify({ refresh_token: ref_token }); var req = await fetch(`${config.endpoint_auth}/refresh-token`, { "headers": { "content-type": "application/json", }, "body": body, "method": "POST", "mode": "cors", "credentials": "include" }); let json = await req.json(); return json; } class user { constructor() { this.data = () => { let cookies = document.cookie.split('; '); let authData = cookies.find(cookie => cookie.startsWith('auth=')); authData = JSON.parse(decodeURIComponent(authData.split('=')[1])); return { token: authData.accessToken, refreshToken: authData.refreshToken } } } cookies() { return { get: (cname) => { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; }, set: (cname, cvalue) => { document.cookie = `${encodeURIComponent(cname)}=${encodeURIComponent(cvalue)}`; } } } async refresh() { let data = this.data(); const json = await refreshToken(data.refreshToken); if (json.success) { this.cookies().set('auth._refresh_token.local', json.data.token); } } async data() { let data = this.data(); return data; } }