diff --git a/xiaomai.js b/xiaomai.js new file mode 100644 index 0000000..f9ae11d --- /dev/null +++ b/xiaomai.js @@ -0,0 +1,43 @@ +[rewrite_local] +^https?:\/\/www\.xiaomaigongkao\.com\/AppApi\/(vip|StartPage\/welcome|Member\/indexHangingWindow|Course\/(curriculum|details)) url script-response-body https://raw.githubusercontent.com/halgfdc/113/main/delay.js// + +[mitm] +hostname = www.xiaomaigongkao.com + +*************************************/ + + +var chxm1023 = JSON.parse($response.body); +const vip = /AppApi\/vip\/index/; //会员信息 +const user = /AppApi\/vip\/userInfo/; //用户会员 +const ad = /AppApi\/(StartPage\/welcome|Member\/indexHangingWindow)/; //开屏/浮窗 +const kc = /AppApi\/(Course\/(curriculum|details)|vip\/ebook)/; //解锁课程 + +if(vip.test($request.url)){ + chxm1023.data.vip_user = { + ...chxm1023.data.vip_user, + "status": "1", + "end_valid_time": "4092599349" + }; + searchAndModify(chxm1023, 'is_vip_user', true, 'is_free', 1); +} + +if(user.test($request.url)){ + chxm1023.data = { + ...chxm1023.data, + "status" : "1", + "end_valid_time" : "4092599349" + }; +} + +if(ad.test($request.url)){ + chxm1023.data = null; +} + +if(kc.test($request.url)){ + searchAndModify(chxm1023, 'is_free', 2, 'is_buy', 1, 'is_vip_user', true); +} + +$done({ body: JSON.stringify(chxm1023) }); + +function searchAndModify(obj, ...args) {for (let i = 0; i < args.length; i += 2) {const key = args[i];const value = args[i + 1];for (var prop in obj) {if (obj.hasOwnProperty(prop)) {if (typeof obj[prop] === 'object') {searchAndModify(obj[prop], ...args);} else if (prop === key) {obj[prop] = value;}}}}};