-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
87 lines (77 loc) · 2.4 KB
/
main.js
File metadata and controls
87 lines (77 loc) · 2.4 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const ENABLE_LOCAL_VIP = true;
const ENABLE_LOCAL_SVIP = true;
const VIP_LEVEL = 5;
window.hookRequestAfter = function (path, response) {
// console.log("path", path);
// console.log("response", response);
if (response.code != 200) {
return;
}
if (path.includes("/batch")) {
if ('/api/music-vip-membership/client/vip/info' in response) {
return unblockLocalVIP(response);
}
}
else if (path.includes("/vipauth/app/auth/query")) {
return unblockLyricsEffects(response);
}
};
const unblockLocalVIP = (obj) => {
console.log('unblockLocalVIP() has been triggered.');
let info = obj['/api/music-vip-membership/client/vip/info'];
if (info && ENABLE_LOCAL_VIP) {
const defaultPackage = {
iconUrl: null,
dynamicIconUrl: null,
isSign: false,
isSignIap: false,
isSignDeduct: false,
isSignIapDeduct: false,
};
const nVipLevel = VIP_LEVEL;
const expireTime = info.data.now + 31622400000;
info.data.redVipLevel = 7;
info.data.redVipAnnualCount = 1;
info.data.musicPackage = {
...defaultPackage,
...info.data.musicPackage,
vipCode: 230,
vipLevel: nVipLevel,
expireTime,
};
info.data.associator = {
...defaultPackage,
...info.data.associator,
vipCode: 100,
vipLevel: nVipLevel,
expireTime,
};
if (ENABLE_LOCAL_SVIP) {
info.data.redplus = {
...defaultPackage,
...info.data.redplus,
vipCode: 300,
vipLevel: nVipLevel,
expireTime,
};
info.data.albumVip = {
...defaultPackage,
...info.data.albumVip,
vipCode: 400,
vipLevel: 0,
expireTime,
};
}
}
obj['/api/music-vip-membership/client/vip/info'] = info;
};
const unblockLyricsEffects = (obj) => {
console.log('unblockLyricsEffects() has been triggered.');
const { data, code } = obj;
if (code === 200 && Array.isArray(data)) {
data.forEach((item) => {
if ('canUse' in item) item.canUse = true;
if ('canNotUseReasonCode' in item) item.canNotUseReasonCode = 200;
});
}
};