forked from Guding88/Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCountThis.js
69 lines (65 loc) · 2.29 KB
/
CountThis.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
CountThis:https://apps.apple.com/app/id1553863458
[rewrite_local]
^https?:\/\/buy\.itunes\.apple\.com\/verifyReceipt$ url script-response-body https://raw.githubusercontent.com/Guding88/Script/main/CountThis.js
[MITM]
hostname = buy.itunes.apple.com
*/
var guding = {};
var guding6 = JSON.parse(typeof $response != "undefined" && $response.body || null);
var headers = {};
for (var key in $request.headers) {
const reg = /^[a-z]+$/;
if (key === "User-Agent" && !reg.test(key)) {
var lowerkey = key.toLowerCase();
$request.headers[lowerkey] = $request.headers[key];
delete $request.headers[key];
}
}
var UA = $request.headers['user-agent'];
var uaProductMapping = {
'Count': {product_id: 'counter.sub.gr1.1w'},
};
var receipt = {
"quantity": "1",
"purchase_date_ms": "1686002766000",
"expires_date": "6666-06-06 06:06:06 Etc\/GMT",
"expires_date_pst": "6666-06-06 06:06:06 America\/Los_Angeles",
"is_in_intro_offer_period": "false",
"transaction_id": "666666666666666",
"is_trial_period": "false",
"original_transaction_id": "666666666666666",
"purchase_date": "2023-06-06 06:06:06 Etc\/GMT",
"product_id": "https://t.me/Guding88",
"original_purchase_date_pst": "2023-06-06 06:06:06 America\/Los_Angeles",
"in_app_ownership_type": "PURCHASED",
"subscription_group_identifier": "20877951",
"original_purchase_date_ms": "1686002766000",
"web_order_line_item_id": "666666666666666",
"expires_date_ms": "148204937166000",
"purchase_date_pst": "2023-06-06 06:06:06 America\/Los_Angeles",
"original_purchase_date": "2023-06-06 06:06:06 Etc\/GMT"
}
var renewal = {
"expiration_intent": "1",
"product_id": "https://t.me/Guding88",
"is_in_billing_retry_period": "0",
"auto_renew_product_id": "https://t.me/Guding88",
"original_transaction_id": "666666666666666",
"auto_renew_status": "0"
}
for (var uaKey in uaProductMapping) {
if (UA && UA.includes(uaKey)) {
var productInfo = uaProductMapping[uaKey];
var product_id = productInfo.product_id;
receipt.product_id = product_id;
renewal.product_id = product_id;
renewal.auto_renew_product_id = product_id;
guding6.receipt.in_app = [receipt];
guding6.latest_receipt_info = [receipt];
guding.pending_renewal_info = [renewal];
break;
}
}
guding = guding6;
$done({ body: JSON.stringify(guding) });