1
0
Fork 0
UserScript/weixin/pay.user.js

37 lines
1.0 KiB
JavaScript

// ==UserScript==
// @name 微信商户登录通知
// @namespace https://miaowoo.cc/
// @version 0.1
// @description 自动化登录通知
// @author MiaoWoo
// @match https://pay.weixin.qq.com/index.php/core/home/login**
// @grant none
// ==/UserScript==
(function() {
'use strict';
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
async function post(url, data) {
return await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
}).then(r => r.json())
}
async function main() {
let qrcode = null
while (!(qrcode = document.getElementById('IDQrcodeImg'))) {
await sleep(100)
}
let url = null
while (!(url = qrcode.getAttribute('title'))) {
await sleep(100)
}
await post('https://oauthtest.yumc.pw/qr/wxpay', {url})
}
main()
})();