🚀🚜司机社自动签到-懒人必备🚀

在任何网页下完成sijishes论坛自动签到, 使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"

目前为 2024-06-18 提交的版本。查看 最新版本

// ==UserScript==
// @name          🚀🚜司机社自动签到-懒人必备🚀
// @namespace    https://gf.qytechs.cn/zh-CN/users/412790
// @version      1.2.5
// @description  在任何网页下完成sijishes论坛自动签到, 使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"
// @require      https://cdn.jsdelivr.net/npm/sweetalert2@9
// @author       Your Name
// @match        http://*/*
// @match        https://*/*
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_openInTab
// @license MIT
// @noframes
// ==/UserScript==
/* global Swal */

const domains = [

    "https://sjsvv.vip" ,
    "https://sjs47.me/",
    "https://sjs47.cc/",
    "https://sjs474.com",
    "https://sjs474.net"
];

const checkNewDay = (ts) => {
    const t = new Date(ts);
    t.setMinutes(t.getMinutes());
    t.setHours(0, 0, 0, 0);
    const d = new Date();
    d.setMinutes(t.getMinutes());
    return (d - t > 86400e3);
};

const sign = () => {
    if (GM_getValue("notified")) {
        trySign(0);
    } else {
        Swal.fire(`由于脚本使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"`).then(() => {
            GM_setValue("notified", true);
            trySign(0);
        });
    }
};

const trySign = (index) => {
    if (index >= domains.length) {
        Swal.fire({
            icon: 'error',
            title: 'sijishes论坛自动签到',
            text: '所有域名均无法访问,请获取最新域名地址。',
        });
        return;
    }

    // 获取 formhash
    GM_xmlhttpRequest({
        method: "GET",
        url: `${domains[index]}/plugin.php?id=k_misign:sign`,
        timeout: 10e3,
        onload: response => {
            const formhashMatch = response.responseText.match(/name="formhash" value="([a-zA-Z0-9]+)"/);
            if (formhashMatch) {
                const formhash = formhashMatch[1];
                sendRequest(index, formhash);
            } else {
                // 如果未找到 formhash,尝试下一个域名
                trySign(index + 1);
            }
        },
        onerror: function () {
            trySign(index + 1);
        }
    });
};

const sendRequest = (index, formhash) => {
    GM_xmlhttpRequest({
        method: "GET",
        url: `${domains[index]}/plugin.php?id=k_misign:sign&operation=qiandao&formhash=${formhash}&format=empty`,
        timeout: 10e3,
        onload: response => {
            response = response.responseText;
            if (response.match("签到成功") !== null) {
                Swal.fire({
                    icon: 'success',
                    title: 'sijishes论坛自动签到',
                    html: `<strong>成功!</strong>`
                });
                GM_setValue("ts", Date.now());
            } else if (response.match("今日已签") !== null) {
                Swal.fire({
                    icon: 'warning',
                    title: 'sijishes论坛自动签到',
                    text: '您已经签到过了!'
                });
                GM_setValue("ts", Date.now());
            } else if (response.match("请先登录(不可用)") !== null) {
                Swal.fire({
                    icon: 'error',
                    title: 'sijishes论坛自动签到',
                    text: '您需要先登录(不可用)才能继续本操作!'
                });
            } else if (response.match("Discuz! System Error") !== null) {
                Swal.fire({
                    icon: 'error',
                    title: 'sijishes论坛自动签到',
                    text: '请求包含非法字符,已被系统拒绝。'
                });
            } else {
                console.log(response);
                Swal.fire({
                    icon: 'error',
                    title: 'sijishes论坛自动签到',
                    text: '未知返回信息❗ 请打开控制台查看详情。',
                    cancelButtonText: '取消',
                    confirmButtonText: '手动打开',
                    focusConfirm: true,
                    showCancelButton: true,
                    allowOutsideClick: false,
                    allowEscapeKey: false
                }).then(res => {
                    if (res.isConfirmed) {
                        GM_openInTab(`${domains[index]}/plugin.php?id=k_misign:sign&operation=qiandao&formhash=${formhash}&format=empty`, {
                            loadInBackground: true
                        });
                    }
                    Swal.fire({
                        icon: 'info',
                        title: 'sijishes论坛自动签到',
                        text: '今日是否不再尝试签到?',
                        cancelButtonText: '否',
                        confirmButtonText: '是',
                        focusConfirm: true,
                        showCancelButton: true,
                        allowOutsideClick: false,
                        allowEscapeKey: false
                    }).then(res => {
                        if (res.isConfirmed) {
                            GM_setValue("ts", Date.now());
                        } else {
                            trySign(index + 1);
                        }
                    });
                });
            }
        },
        onerror: function () {
            trySign(index + 1);
        }
    });
};

window.onload = () => {
    if (!window.location.href.match("sijishes.com") && (!GM_getValue("ts") || checkNewDay(GM_getValue("ts")))) {
        sign();
    }
};

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址