VikACG 自动签到

打开 VikACG 主站时自动签到

  1. // ==UserScript==
  2. // @name VikACG 自动签到
  3. // @description 打开 VikACG 主站时自动签到
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.2.6
  6. // @author Howard Wu
  7. // @license GPLv3
  8. // @match https://www.vikacg.com/
  9. // @icon http://vikacg.com/favicon.ico
  10. // @grant GM_xmlhttpRequest
  11. // ==/UserScript==
  12.  
  13. function getCookies(name) {
  14. function read(value) {
  15. if (value[0] === '"') {
  16. value = value.slice(1, -1)
  17. }
  18. return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
  19. }
  20. if (typeof document === 'undefined' || (arguments.length && !name)) {
  21. return
  22. }
  23.  
  24. // To prevent the for loop in the first place assign an empty array
  25. // in case there are no cookies at all.
  26. var cookies = document.cookie ? document.cookie.split('; ') : []
  27. var jar = {}
  28. for (var i = 0; i < cookies.length; i++) {
  29. var parts = cookies[i].split('=')
  30. var value = parts.slice(1).join('=')
  31.  
  32. try {
  33. var found = decodeURIComponent(parts[0])
  34. jar[found] = read(value, found)
  35.  
  36. if (name === found) {
  37. break
  38. }
  39. } catch (e) { }
  40. }
  41.  
  42. return name ? jar[name] : jar
  43. }
  44.  
  45. (function () {
  46. 'use strict';
  47. var b2_token = getCookies('b2_token')
  48. GM_xmlhttpRequest({
  49. "url": "https://www.vikacg.com/wp-json/b2/v1/getUserMission",
  50. "headers": {
  51. "accept": "application/json, text/plain, */*",
  52. "accept-language": "zh-CN,zh;q=0.9",
  53. "authorization": "Bearer " + b2_token,
  54. "cache-control": "no-cache",
  55. "content-type": "application/x-www-form-urlencoded",
  56. "pragma": "no-cache",
  57. "sec-ch-ua": "\"Microsoft Edge\";v=\"105\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"105\"",
  58. "sec-ch-ua-mobile": "?0",
  59. "sec-ch-ua-platform": "\"Windows\"",
  60. "sec-fetch-dest": "empty",
  61. "sec-fetch-mode": "cors",
  62. "sec-fetch-site": "same-origin"
  63. },
  64. "referrer": "https://www.vikacg.com/mission/today",
  65. "referrerPolicy": "strict-origin-when-cross-origin",
  66. "body": "count=0&paged=1",
  67. "method": "POST",
  68. "mode": "cors",
  69. "credentials": "include",
  70. "onload": function (result) {
  71. if (result.status == 200) {
  72. const json = JSON.parse(result.response)
  73. var data = json.mission
  74. var checkinDate = data.date
  75. var checkGetMission = data.credit
  76. var my_credit = data.my_credit
  77. var always = data.always
  78. if (checkGetMission == 0) {
  79. console.log("目前积分:" + my_credit)
  80. GM_xmlhttpRequest({
  81. "url": "https://www.vikacg.com/wp-json/b2/v1/userMission",
  82. "headers": {
  83. "accept": "application/json, text/plain, */*",
  84. "accept-language": "zh-CN,zh;q=0.9",
  85. "authorization": 'Bearer ' + b2_token,
  86. "cache-control": "no-cache",
  87. "pragma": "no-cache",
  88. "sec-ch-ua": "\"Microsoft Edge\";v=\"105\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"105\"",
  89. "sec-ch-ua-mobile": "?0",
  90. "sec-ch-ua-platform": "\"Windows\"",
  91. "sec-fetch-dest": "empty",
  92. "sec-fetch-mode": "cors",
  93. "sec-fetch-site": "same-origin"
  94. },
  95. "referrer": "https://www.vikacg.com/mission/today",
  96. "referrerPolicy": "strict-origin-when-cross-origin",
  97. "body": null,
  98. "method": "POST",
  99. "mode": "cors",
  100. "credentials": "include",
  101. "onload": function (result) {
  102. if (result.status == 200) {
  103. const json = JSON.parse(result.response)
  104. var date = json.date
  105. var credit = json.credit
  106. var my_credit = json.mission.my_credit
  107. console.log(date + " 签到成功,获得积分:" + credit + " 目前积分:" + my_credit + " 请查看积分是否有变动");
  108. } else {
  109. console.log("签到失败");
  110. }
  111. },
  112. });
  113. } else {
  114. console.log("签到时间:" + checkinDate + ",签到获得积分:" + checkGetMission + ",目前积分:" + my_credit)
  115. console.log("今天已经签到,如有问题请尝试手动签到");
  116. }
  117. } else {
  118. console.log("请求失败,是否未登录(不可用)?");
  119. }
  120. },
  121. });
  122. })();

QingJ © 2025

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