-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathDrops.js
55 lines (51 loc) · 1.98 KB
/
Drops.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
/*
Drops:https://apps.apple.com/app/id939540371
[rewrite_local]
^https?:\/\/api\.revenuecat\.com\/v1\/(subscribers\/[^\/]+$|receipts$) url script-response-body https://raw.githubusercontent.com/Guding88/Script/main/Drops.js
^https?:\/\/api\.revenuecat\.com\/v1\/(subscribers\/[^\/]+$|receipts$) url script-request-header https://raw.githubusercontent.com/Guding88/Script/main/Drops.js
[MITM]
hostname = api.revenuecat.com
*/
const guding = {};
const guding6 = JSON.parse(typeof $response != "undefined" && $response.body || null);
if (typeof $response == "undefined") {
delete $request.headers["x-revenuecat-etag"];
delete $request.headers["X-RevenueCat-ETag"];
guding.headers = $request.headers;
} else if (guding6 && guding6.subscriber) {
guding6.subscriber.subscriptions = guding6.subscriber.subscriptions || {};
guding6.subscriber.entitlements = guding6.subscriber.entitlements || {};
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'];
const app = 'gd';
const UAMappings = {
'Drops':{ name: 'premium', id: 'premium_yearly_full_price_tier_c_free_trial_7_int'},
};
const data = {
"expires_date": "6666-06-06T06:06:06Z",
"original_purchase_date": "2023-02-23T02:33:33Z",
"purchase_date": "2023-02-23T02:33:33Z",
"ownership_type": "PURCHASED",
"store": "app_store"
};
for (const i in UAMappings) {
if (new RegExp(`^${i}`, 'i').test(UA)) {
const { name, id } = UAMappings[i];
guding6.subscriber.subscriptions = {};
guding6.subscriber.subscriptions[id] = data;
guding6.subscriber.entitlements[name] = JSON.parse(JSON.stringify(data));
guding6.subscriber.entitlements[name].product_identifier = id;
break;
}
}
guding.body = JSON.stringify(guding6);
}
$done(guding);