mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-25 17:15:09 +00:00
Update test.js
This commit is contained in:
@@ -1,12 +1,21 @@
|
|||||||
// $request, $response, $notify(title, message), console.log(message)
|
const path1 = "/interface/sdk/sdkad.php";
|
||||||
// $request.scheme, $request.method, $request.url, $request.path, $request.body, $request.headers
|
const path2 = "/wbapplua/wbpullad.lua";
|
||||||
// $response.statusCode, $response.headers, $response.body
|
|
||||||
|
|
||||||
//var body = $response.body;
|
const url = $request.url;
|
||||||
//var obj = JSON.parse(body);
|
var body = $response.body;
|
||||||
|
if (url.indexOf(path1) != -1) {
|
||||||
|
let re = /\{.*\}/;
|
||||||
|
body = body.match(re);
|
||||||
|
var 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';
|
||||||
|
}
|
||||||
|
|
||||||
$notify("HAHA", "Sucess");
|
if (url.indexOf(path2) != -1) {
|
||||||
//obj['result'] = 0;
|
var obj = JSON.parse(body);
|
||||||
//body = JSON.stringify(obj);
|
if (obj.cached_ad && obj.cached_ad.ads) obj.cached_ad.ads = [];
|
||||||
|
body = JSON.stringify(obj);
|
||||||
//$done(body);
|
}
|
||||||
|
$done(body);
|
||||||
|
|||||||
Reference in New Issue
Block a user