// ==UserScript== // @name 智能电视网签到 // @namespace https://github.com/geoi6sam1 // @version 0.1.0 // @description 智能电视网每日自动签到,支持自动登录 // @author geoi6sam1@qq.com // @icon https://www.znds.com/favicon.ico // @supportURL https://github.com/geoi6sam1/FuckScripts/issues // @crontab * * once * * // @grant GM_xmlhttpRequest // @grant GM_notification // @grant GM_getValue // @grant GM_setValue // @grant GM_log // @cloudcat // @connect znds.com // @exportcookie domain=.znds.com // @antifeature ads // @antifeature miner // @antifeature payment // @antifeature tracking // @antifeature membership // @antifeature referral-link // @license GPL-3.0 // ==/UserScript== /* ==UserConfig== Login: way: title: 登录方式 type: select default: 用户名 values: [用户名,邮箱] log: title: 登录账号 pwd: title: 登录密码 password: true ==/UserConfig== */ GM_getValue("Login.way") || GM_setValue("Login.way", "用户名") GM_getValue("Login.log") || GM_setValue("Login.log", "") GM_getValue("Login.pwd") || GM_setValue("Login.pwd", "") GM_setValue("reLogTimes", 0) return new Promise((resolve, reject) => { var reLogTimes = 0 function login_h(callback) { GM_xmlhttpRequest({ url: "https://www.znds.com/member.php?mod=logging&action=login", onload(xhr) { var res = xhr.responseText var loginhash = res.match(/loginhash=(.*)?"/) var formhash = res.match(/formhash=(.*)?'/) loginhash = loginhash[1] formhash = formhash[1] var hasharr = [loginhash, formhash] callback(hasharr) }, }) } function daka_h(callback) { GM_xmlhttpRequest({ url: "https://www.znds.com/forum.php", onload(xhr) { var res = xhr.responseText var formhash = res.match(/formhash=(.*)?"/) if (!formhash) { login() } else { formhash = formhash[1] callback(formhash) } }, }) } function login() { var way = GM_getValue("Login.way") var log = encodeURIComponent(GM_getValue("Login.log")) var pwd = encodeURIComponent(GM_getValue("Login.pwd")) if (way == "邮箱") { way = "email" } else { way = "username" } if (log && pwd) { reLogTimes += 1 GM_setValue("reLogTimes", reLogTimes) login_h((hash) => { var loginhash = encodeURIComponent(hash[0]) var formhash = encodeURIComponent(hash[1]) GM_xmlhttpRequest({ url: `https://www.znds.com/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=${loginhash}&inajax=1&formhash=${formhash}&referer=https%3A%2F%2Fwww.znds.com%2F.%2F&loginfield=${way}&username=${log}&password=${pwd}&questionid=0&answer=&cookietime=2592000`, onload(xhr) { var stat = xhr.status if (stat == 200) { if (GM_getValue("reLogTimes") > 2) { reMsg("失败", "登录失败,请检查账号密码!") reject() } else { main() } } else { reMsg("失败", "登录请求失败!状态码:" + stat) reject() } }, onerror(err) { reMsg("出错", "登录出错,请查看运行日志!") GM_log(err) reject() }, }) }) } else { reMsg("失败", "尚未登录,请登录后再运行!") reject() } } function main() { daka_h((hash) => { var formhash = encodeURIComponent(hash) GM_xmlhttpRequest({ url: `https://www.znds.com/plugin.php?id=ljdaka:daka&action=msg&formhash=${formhash}&infloat=yes&handlekey=ljdaka&inajax=1&ajaxtarget=fwin_content_ljdaka`, onload(xhr) { var stat = xhr.status var res = xhr.responseText if (stat == 200) { var msg = res.match(/class="alert_info">

(.*)?<\/p>/) msg = msg[1] reMsg("成功", msg) resolve() } else { reMsg("失败", "打卡请求失败!状态码:" + stat) reject() } }, onerror(err) { reMsg("出错", "打卡出错,请查看运行日志!") GM_log(err) reject() }, }) }) } main() }) function reMsg(title, text) { GM_notification({ text: text, title: "智能电视网签到" + title, image: "https://www.znds.com/favicon.ico", }) }