/*

[rewrite_local]

^https:\/\/(vas|account)\.wps\.cn\/(query\/api\/v\d\/list_purchase_info|api\/users\/\d+\/overview) url script-response-body https://raw.githubusercontent.com/510004015/Quantumult_X/Remote/Premium/WPSOffice.js

[mitm]

hostname = vas.wps.cn, account.wps.cn

*/

var url = $request.url;
var modified = JSON.parse($response.body);
const URL1 = 'overview';
const URL2 = 'list_purchase_info';
if (url.indexOf(URL1) != -1) {
    modified = {
        "exp": 0,
        "level": 1,
        "privilege": [{"spid": "pdf_sign", "times": 0, "expire_time": 4070880000}, {
            "spid": "pdf_split",
            "times": 0,
            "expire_time": 4070880000
        }, {"spid": "data_recover", "times": 0, "expire_time": 4070880000}, {
            "spid": "ocr",
            "times": 0,
            "expire_time": 4070880000
        }, {"spid": "pdf2doc", "times": 0, "expire_time": 4070880000}, {
            "spid": "pdf_merge",
            "times": 0,
            "expire_time": 4070880000
        }],
        "result": "ok",
        "server_time": modified.server_time,
        "total_buy": 0,
        "total_cost": 0,
        "userid": modified.userid,
        "vip": {
            "name": "超级会员",
            "has_ad": 0,
            "memberid": 40,
            "expire_time": 4070880000,
            "enabled": [{"memberid": 40, "name": "超级会员", "expire_time": 4070880000}, {
                "memberid": 12,
                "name": "稻壳会员",
                "expire_time": 4070880000
            }, {"memberid": 20, "name": "WPS会员", "expire_time": 4070880000}]
        },
        "wealth": 0
    };
}
if (url.indexOf(URL2) != -1) {
    modified.data.token = "eyJhbGciOiJFUzI1NiIsImtleV92ZXJzaW9uIjoyMCwic2NvcGUiOiIqIiwidG9rZW5fdHlwZSI6InByaXZpbGVnZSIsInR5cCI6IkpXVCJ9.[encoded data, 35680 characters].aCnyBF6F9aceTm31tgj5y22n4iThNgsTrQplsqGecEH8mKh_jOwHlp7LfOEQY6M-loSVPribkIGzMUtxss8VuA";
    modified.data.merchandises = [{
        "sku_key": "40",
        "effect_time": 1672502400,
        "expire_time": 4070880000,
        "name": "超级会员",
        "type": "vip"
    }];
}
$done({body: JSON.stringify(modified)});