🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/27 03:05:24
🔄 下次更新时间:2026/01/27 04:05:24
手动刷新缓存

ggu_userData

userdata do ggutils

このスクリプトは単体で利用できません。右のようなメタデータを含むスクリプトから、ライブラリとして読み込まれます: // @require https://update.greasyfork.org/scripts/487863/1359256/ggu_userData.js

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
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;
    }


}