石之家自动签到

自动完成石之家迎新庆典每日活动

// ==UserScript==
// @name         石之家自动签到
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  自动完成石之家迎新庆典每日活动
// @author       mephisto
// @match        https://ff14risingstones.web.sdo.com/*
// @icon         https://ff14risingstones.web.sdo.com/
// @license MIT
// ==/UserScript==

(async function () {
  "use strict";

  var currentHref = location.href;
  console.log("currentHref==>", currentHref);
  const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

  const corsFetch = (url, options = {}) =>
    fetch(url, {
      ...options,
      mode: "cors",
      credentials: "include",
    }).then((res) => res.json());

  /** 签到 */
  const signin = () =>
    corsFetch("https://apiff14risingstones.web.sdo.com/api/home/sign/signIn", {
      method: "POST",
    }).then((res) => {
      console.log(res.msg);
    });

  await wait(1000);
  const qiandao = document.querySelector(".signin");
  const checkText = qiandao.innerText;
  console.log("checkText==>", checkText);
  if (checkText != null && checkText !== "已签到") {
    await signin();
  }
})();