2020-02-28 13:51:37 +08:00
|
|
|
|
/*
|
2022-07-11 16:08:25 +08:00
|
|
|
|
README:https://github.com/yichahucha/surge/tree/master
|
2020-02-28 13:51:37 +08:00
|
|
|
|
*/
|
|
|
|
|
|
2022-07-11 16:08:25 +08:00
|
|
|
|
const path1 = "/interface/sdk/sdkad.php";
|
|
|
|
|
const path2 = "/wbapplua/wbpullad.lua";
|
2020-02-28 13:51:37 +08:00
|
|
|
|
|
|
|
|
|
const url = $request.url;
|
2022-07-11 16:08:25 +08:00
|
|
|
|
let body = $response.body;
|
|
|
|
|
let obj;
|
|
|
|
|
if (url.indexOf(path1) !== -1) {
|
|
|
|
|
let re = /\{.*}/;
|
|
|
|
|
body = body.match(re);
|
|
|
|
|
obj = JSON.parse(body);
|
|
|
|
|
if (obj.background_delay_display_time) obj.background_delay_display_time = 60*60*24*365;
|
|
|
|
|
if (obj.show_push_splash_ad) obj.show_push_splash_ad = false;
|
|
|
|
|
if (obj.ads) obj.ads = [];
|
|
|
|
|
body = JSON.stringify(obj) + 'OK';
|
2020-02-28 13:51:37 +08:00
|
|
|
|
}
|
2022-07-11 16:08:25 +08:00
|
|
|
|
if (url.indexOf(path2) !== -1) {
|
|
|
|
|
obj = JSON.parse(body);
|
|
|
|
|
if (obj.cached_ad && obj.cached_ad.ads) obj.cached_ad.ads = [];
|
2020-02-28 13:51:37 +08:00
|
|
|
|
body = JSON.stringify(obj);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-11 16:08:25 +08:00
|
|
|
|
$done({body});
|