// # Source: https://github.com/Wenmoux/checkbox/blob/master/scripts/tsdm.js
// # Raw: https://raw.githubusercontent.com/Wenmoux/checkbox/master/scripts/tsdm.js
// # Repo: Wenmoux/checkbox
// # Path: scripts/tsdm.js
// # UploadedAt: 2023-11-01T04:40:54Z
// # SHA256: c051ba94048fcba570f5b35beea78d89b8bb9350f5ac8f4d8c258efd07d1bd3d
// # Category: web版/账密
// # Evidence: web/H5关键词 + username/password/login
// 

const rules = {
    name: "【天使动漫】： ",
    cookie: config.tsdm.cookie,
    url: "https://www.tsdm39.com/plugin.php?id=dsu_paulsign:sign&mobile=yes", //用于获取formhash的链接     
    formhash: 'formhash=(.+?)\&', //formhash正则
    verify: "您需要先登录才能继续本操作", //验证cookie状态
    op: [{
            name: "签到",
            method: "post",
            url: "https://www.tsdm39.com/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=0&inajax=0&mobile=yes", //签到链接
            data: "formhash=@formhash&qdxq=kx&qdmode=3&todaysay=&fastreply=1"
        },
        {
            name: "打工",
            ua: "pc",
            method: "post", 
            url: "https://www.tsdm39.com/plugin.php?id=np_cliworkdz:work",
            data: "act=getcre"
        }]
};
async function tsdm() {
var sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
   const template = await require("../Template");
    for(i=0;i<8;i++) {    
    let dg= await require("axios").post("https://www.tsdm39.com/plugin.php?id=np_cliworkdz:work","act=clickad", {headers: {cookie: rules.cookie,referer: rules.url,"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Safari/537.36"}})
    if((""+dg.data).match(/才可再次进行。/)) break;
    console.log("第"+(i+1)+"次打工："+dg.data)
    await sleep(1500)
    }    
    return rules.name + await template(rules)
}
module.exports = tsdm
