Skip to content

Commit 92ae84d

Browse files
committed
小改动
1 parent ede782b commit 92ae84d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

OlivOS/core/boot/bootDataAPI.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@
548548
"server": {
549549
"auto": True,
550550
"host": "0.0.0.0",
551-
"port": 55011,
551+
"port": 55666,
552552
"token": "114514"
553553
}
554554
},

OlivOS/core/core/accountAPI.py

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import socket
1919
from contextlib import closing
2020
import platform
21+
import random
22+
import hashlib
2123

2224
import OlivOS
2325

@@ -114,6 +116,8 @@ def accountFix(basic_conf_models, bot_info_dict, logger_proc):
114116
and basic_conf_models[basic_conf_models_this]['type'] == 'astralqsign_lib_exe_model' \
115117
and basic_conf_models[basic_conf_models_this]['server']['auto'] is True:
116118
basic_conf_models[basic_conf_models_this]['server']['host'] = '0.0.0.0'
119+
basic_conf_models[basic_conf_models_this]['server']['port'] = random.randint(10000, 65535)
120+
basic_conf_models[basic_conf_models_this]['server']['token'] = getToken(str(random.randint(10000, 65535)))
117121
if isInuse(
118122
'127.0.0.1',
119123
basic_conf_models[basic_conf_models_this]['server']['port']
@@ -189,3 +193,9 @@ def get_free_port():
189193
s.bind(('', 0))
190194
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
191195
return s.getsockname()[1]
196+
197+
def getToken(src:str):
198+
hash_tmp = hashlib.new('md5')
199+
hash_tmp.update(str(src).encode(encoding='UTF-8'))
200+
hash_tmp.update(str(114514666).encode(encoding='UTF-8'))
201+
return hash_tmp.hexdigest()

0 commit comments

Comments
 (0)