// ==UserScript== // @name 信创技术联盟_DSU每日自动签到(上云版) // @namespace https://www.cnxclm.com/ // @version 0.1.1 // @description 信创技术联盟论坛-DSU每日自动签到 // @author superuser // @crontab * * once * * // @grant GM_notification // @grant GM_xmlhttpRequest // @grant GM_log // @cloudcat // @connect www.cnxclm.com // @exportcookie domain=.cnxclm.com // @original-author Ne-21 // @original-script https://scriptcat.org/script-show-page/332/ // ==/UserScript== return new Promise((resolve, reject) => { GM_xmlhttpRequest({ url:"https://www.cnxclm.com/plugin.php?id=dsu_paulsign:sign", method: 'GET', onload:function (xhr) { var res = xhr.responseText var formhash = getStr(res,'') resolve(formhash); }, }) }).then(async (formhash) => { return await new Promise((resolve_1, reject_1) => { GM_xmlhttpRequest({ method:'POST', url:'https://www.cnxclm.com/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&inajax=1', data:'formhash='+ encodeURIComponent(formhash) +'&qdxq=1kx&qdmode=1&todaysay='+ encodeURIComponent('签到咯~~~') + '&fastreply=0', headers:{ 'content-type': 'application/x-www-form-urlencoded', 'Referer' : 'https://www.cnxclm.com/plugin.php?id=dsu_paulsign:sign' }, onload:function (xhr_1) { console.log(xhr_1.responseText) var res_1 = xhr_1.responseText.replace(/\s/g,"") var msg = getStr(res_1,'',']]>') GM_log(msg,"info") GM_notification('信创技术联盟自动签到:\n' + msg) resolve_1() }, }) }) }); // 正则匹配 function getStr(str, start, end) { let res = str.match(new RegExp(`${start}(.*?)${end}`)) return res ? res[1] : null }