forked from zgaoliang520/langkhach270389-Scripting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dayone.surge.js
27 lines (27 loc) · 1.06 KB
/
dayone.surge.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if ($response.status == 200) {
if ($request.url.endsWith("account-status")) {
$done({body: JSON.stringify({
"expirationDate": 1893427199000,
"startDate": 1546272000000,
"subscriptionPlan": "com.bloombuilt.dayoneios.subscription.premium.yearly_discounted_trial",
"lastRenewalDate": 1546531200000,
"subscriptionName": "premium",
"bundleReason": "purchase",
"cancellationDate": 0
} )});
}
else { let body= $response.body;
let obj= JSON.parse(body);
const feature= {"bundleName":"premium","features":[{"name":"imagesPerEntry","limit":30,"canUpgrade":false},{"name":"printingDiscount","canUpgrade":false},{"name":"syncMac","canUpgrade":false},{"name":"prioritySupport","canUpgrade":false},{"name":"sync","canUpgrade":false},{"name":"journalLimit","limit":100,"canUpgrade":false},{"name":"audioPerEntry","limit":10,"canUpgrade":false}]};
if(body.indexOf("featureBundle") !=-1)
{
obj["featureBundle"]= feature;
}
else {
obj["bundle"]= feature;
}
$done({body: JSON.stringify(obj)});
}
} else {
$done({});
}