1
0
Fork 0

更新 'qq/q.user.js'

master
502647092 2020-10-10 02:08:05 +00:00
parent 9324859973
commit 625ae5ade3
1 changed files with 15 additions and 9 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name QQ小程序授权上报 // @name QQ小程序授权上报
// @namespace https://qq.yumc.pw/ // @namespace https://qq.yumc.pw/
// @version 0.1 // @version 0.2
// @description report ad manage monitoring! // @description report ad manage monitoring!
// @author MiaoWoo // @author MiaoWoo
// @match http*://q.qq.com // @match http*://q.qq.com
@ -9,22 +9,28 @@
// ==/UserScript== // ==/UserScript==
(function () { (function () {
'use strict'; 'use strict'
fetch('https://q.qq.com/pb3/GetPreCacheUrl') var taskId = undefined
.then(r => r.json()) async function reportQCookie() {
.then(res => { let path = location.hash.substr(1)
if (path == '/ad/manage' || path == '/home') {
let res = await fetch('https://q.qq.com/pb3/GetPreCacheUrl').then(r => r.json())
if (res.code == 0) { if (res.code == 0) {
clearInterval(taskId)
let cookies = document.cookie.split(';').map(s => s.trim().split('=', 2)).reduce((pre, cur, index) => { let cookies = document.cookie.split(';').map(s => s.trim().split('=', 2)).reduce((pre, cur, index) => {
pre[cur[0]] = cur[1] pre[cur[0]] = cur[1]
return pre return pre
}, {}) }, {})
fetch('https://reward.yumc.pw/callback/qcookie', { let report = await fetch('https://reward.yumc.pw/callback/qcookie', {
method: "POST", method: "POST",
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(cookies) body: JSON.stringify(cookies)
}) }).then(r => r.json())
console.log('小程序Cookie上报完毕', report)
} }
}) }
})(); }
taskId = setInterval(reportQCookie, 2000)
})()