-
Notifications
You must be signed in to change notification settings - Fork 9
/
update_config.py
42 lines (33 loc) · 1.34 KB
/
update_config.py
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
import requests
import json
with open("config/config.json") as f:
config = json.load(f)
old_resVersion = config["version"]["android"]["resVersion"]
old_clientVersion = config["version"]["android"]["clientVersion"]
old_funcVer = config["networkConfig"]["cn"]["content"]["funcVer"]
try:
version = requests.get(
"https://ak-conf.hypergryph.com/config/prod/official/Android/version"
).json()
resVersion = version["resVersion"]
clientVersion = version["clientVersion"]
if resVersion != old_resVersion:
config["version"]["android"]["resVersion"] = resVersion
if clientVersion != old_clientVersion:
config["version"]["android"]["clientVersion"] = clientVersion
except Exception:
pass
try:
network_config = requests.get(
"https://ak-conf.hypergryph.com/config/prod/official/network_config"
).json()
content = json.loads(network_config["content"])
funcVer = content["funcVer"]
if funcVer != old_funcVer:
config["networkConfig"]["cn"]["content"]["funcVer"] = funcVer
config["networkConfig"]["cn"]["content"]["configs"][funcVer] = config["networkConfig"]["cn"]["content"]["configs"][old_funcVer]
del config["networkConfig"]["cn"]["content"]["configs"][old_funcVer]
except Exception:
pass
with open("config/config.json", "w") as f:
json.dump(config, f, indent=4)