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

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

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

  1. // ==UserScript==
  2. // @name 🚀司机社论坛自动签到-懒人必备🚀
  3. // @namespace https://gf.qytechs.cn/zh-CN/users/412790
  4. // @version 1.2.6
  5. // @description 在任何网页下完成sijishes论坛自动签到, 使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"
  6. // @require https://cdn.jsdelivr.net/npm/sweetalert2@9
  7. // @author Your Name
  8. // @match http://*/*
  9. // @match https://*/*
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // @grant GM_openInTab
  14. // @license MIT
  15. // @noframes
  16. // ==/UserScript==
  17. /* global Swal */
  18.  
  19. const domains = [
  20.  
  21. "https://sjsvv.vip" ,
  22. "https://sjs47.me/",
  23. "https://sjs47.cc/",
  24. "https://sjs474.com",
  25. "https://sjs474.net"
  26. ];
  27.  
  28. const checkNewDay = (ts) => {
  29. const t = new Date(ts);
  30. t.setMinutes(t.getMinutes());
  31. t.setHours(0, 0, 0, 0);
  32. const d = new Date();
  33. d.setMinutes(t.getMinutes());
  34. return (d - t > 86400e3);
  35. };
  36.  
  37. const sign = () => {
  38. if (GM_getValue("notified")) {
  39. trySign(0);
  40. } else {
  41. Swal.fire(`由于脚本使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"`).then(() => {
  42. GM_setValue("notified", true);
  43. trySign(0);
  44. });
  45. }
  46. };
  47.  
  48. const trySign = (index) => {
  49. if (index >= domains.length) {
  50. Swal.fire({
  51. icon: 'error',
  52. title: 'sijishes论坛自动签到',
  53. text: '所有域名均无法访问,请获取最新域名地址。',
  54. });
  55. return;
  56. }
  57.  
  58. // 获取 formhash
  59. GM_xmlhttpRequest({
  60. method: "GET",
  61. url: `${domains[index]}/plugin.php?id=k_misign:sign`,
  62. timeout: 10e3,
  63. onload: response => {
  64. const formhashMatch = response.responseText.match(/name="formhash" value="([a-zA-Z0-9]+)"/);
  65. if (formhashMatch) {
  66. const formhash = formhashMatch[1];
  67. sendRequest(index, formhash);
  68. } else {
  69. // 如果未找到 formhash,尝试下一个域名
  70. trySign(index + 1);
  71. }
  72. },
  73. onerror: function () {
  74. trySign(index + 1);
  75. }
  76. });
  77. };
  78.  
  79. const sendRequest = (index, formhash) => {
  80. GM_xmlhttpRequest({
  81. method: "GET",
  82. url: `${domains[index]}/plugin.php?id=k_misign:sign&operation=qiandao&formhash=${formhash}&format=empty`,
  83. timeout: 10e3,
  84. onload: response => {
  85. response = response.responseText;
  86. if (response.match("签到成功") !== null) {
  87. Swal.fire({
  88. icon: 'success',
  89. title: 'sijishes论坛自动签到',
  90. html: `<strong>成功!</strong>`
  91. });
  92. GM_setValue("ts", Date.now());
  93. } else if (response.match("今日已签") !== null) {
  94. Swal.fire({
  95. icon: 'warning',
  96. title: 'sijishes论坛自动签到',
  97. text: '您已经签到过了!'
  98. });
  99. GM_setValue("ts", Date.now());
  100. } else if (response.match("请先登录(不可用)") !== null) {
  101. Swal.fire({
  102. icon: 'error',
  103. title: 'sijishes论坛自动签到',
  104. text: '您需要先登录(不可用)才能继续本操作!'
  105. });
  106. } else if (response.match("Discuz! System Error") !== null) {
  107. Swal.fire({
  108. icon: 'error',
  109. title: 'sijishes论坛自动签到',
  110. text: '请求包含非法字符,已被系统拒绝。'
  111. });
  112. } else {
  113. console.log(response);
  114. Swal.fire({
  115. icon: 'error',
  116. title: 'sijishes论坛自动签到',
  117. text: '未知返回信息❗ 请打开控制台查看详情。',
  118. cancelButtonText: '取消',
  119. confirmButtonText: '手动打开',
  120. focusConfirm: true,
  121. showCancelButton: true,
  122. allowOutsideClick: false,
  123. allowEscapeKey: false
  124. }).then(res => {
  125. if (res.isConfirmed) {
  126. GM_openInTab(`${domains[index]}/plugin.php?id=k_misign:sign&operation=qiandao&formhash=${formhash}&format=empty`, {
  127. loadInBackground: true
  128. });
  129. }
  130. Swal.fire({
  131. icon: 'info',
  132. title: 'sijishes论坛自动签到',
  133. text: '今日是否不再尝试签到?',
  134. cancelButtonText: '否',
  135. confirmButtonText: '是',
  136. focusConfirm: true,
  137. showCancelButton: true,
  138. allowOutsideClick: false,
  139. allowEscapeKey: false
  140. }).then(res => {
  141. if (res.isConfirmed) {
  142. GM_setValue("ts", Date.now());
  143. } else {
  144. trySign(index + 1);
  145. }
  146. });
  147. });
  148. }
  149. },
  150. onerror: function () {
  151. trySign(index + 1);
  152. }
  153. });
  154. };
  155.  
  156. window.onload = () => {
  157. if (!window.location.href.match("sijishes.com") && (!GM_getValue("ts") || checkNewDay(GM_getValue("ts")))) {
  158. sign();
  159. }
  160. };

QingJ © 2025

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