本帖最后由 unwake 于 2022-10-19 21:26 编辑
网站是通过fetch /api/user 来决定当前用户是不是VIP,我写了个脚本,通过替换返回值来伪装VIP用户
下面的脚本在edgev106桌面版本+tempermonkey测试通过,装到X浏览器上就无效。希望您能指出下面的脚本哪些地方
需要改动下,好适用于X浏览器
目标是fetch /api/user返回的
"paid":false,"paypal":false,"expired":true,"expireInDays":-346'
替换成
'"paid":true,"paypal":true,"expired":false,"expireInDays":346'
替换后的效果
但是我在手机X浏览器上却没有效果,请问为什么?
// ==UserScript==
// @name ReabbleVIP
// @namespace GuoQingyuan
// @version 0.1
// @description Change your Reabble account to VIP
// @author GuoQingyuan
// @match https://reabble.cn/app
// @icon https://reabble.cn/static/img/icons/favicon.ico
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
let oldfetch = fetch;
function fuckfetch() {
return new Promise((resolve, reject) => {
oldfetch.apply(this, arguments).then(response => {
if (arguments[0].indexOf('/api/user') > -1) {
const oldtext = response.text;
response.text = function() {
return new Promise((resolve, reject) => {
oldtext.apply(this, arguments).then(result => {
result = result.replace('"paid":false,"paypal":false,"expired":true,"expireInDays":-','"paid":true,"paypal":true,"expired":false,"expireInDays":');
console.log(result)
resolve(result);
});
});
};
};
resolve(response);
});
});
}
window.fetch = fuckfetch;
})();