misc/version bump
This commit is contained in:
@@ -54,36 +54,40 @@ class XC(FastAPI):
|
||||
/xc
|
||||
Handle XC Commands
|
||||
"""
|
||||
key = data.key
|
||||
bid = data.bid
|
||||
cmd = data.cmd
|
||||
cmd_data = data.data
|
||||
req_type = 0
|
||||
|
||||
if bid in [1]:
|
||||
req_type = 2
|
||||
|
||||
if not self.util.check_key(path=request.url.path, req_type=req_type, key=key):
|
||||
raise HTTPException(status_code=403, detail="Unauthorized")
|
||||
|
||||
BID_ADDR_MAP = {
|
||||
0: '10.10.10.101:5991', # Thomas/Aces
|
||||
1: '10.10.10.100:5992' # MS & Waleed Combo
|
||||
}
|
||||
try:
|
||||
key = data.key
|
||||
bid = data.bid
|
||||
cmd = data.cmd
|
||||
cmd_data = data.data
|
||||
req_type = 0
|
||||
|
||||
if not bid in BID_ADDR_MAP:
|
||||
return {
|
||||
'err': True,
|
||||
'errorText': 'Invalid bot id'
|
||||
}
|
||||
if bid in [1]:
|
||||
req_type = 2
|
||||
|
||||
bot_api_url = f'http://{BID_ADDR_MAP[bid]}/'
|
||||
async with ClientSession() as session:
|
||||
async with await session.post(f"{bot_api_url}{cmd}", json=cmd_data, headers={
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
}, timeout=ClientTimeout(connect=5, sock_read=5)) as request:
|
||||
response = await request.json()
|
||||
return {
|
||||
'success': True,
|
||||
'response': response
|
||||
}
|
||||
if not self.util.check_key(path=request.url.path, req_type=req_type, key=key):
|
||||
raise HTTPException(status_code=403, detail="Unauthorized")
|
||||
|
||||
BID_ADDR_MAP = {
|
||||
0: '10.10.10.101:5991', # Thomas/Aces
|
||||
1: '10.10.10.100:5992' # MS & Waleed Combo
|
||||
}
|
||||
|
||||
if not bid in BID_ADDR_MAP:
|
||||
return {
|
||||
'err': True,
|
||||
'errorText': 'Invalid bot id'
|
||||
}
|
||||
|
||||
bot_api_url = f'http://{BID_ADDR_MAP[bid]}/'
|
||||
async with ClientSession() as session:
|
||||
async with await session.post(f"{bot_api_url}{cmd}", json=cmd_data, headers={
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
}, timeout=ClientTimeout(connect=5, sock_read=5)) as request:
|
||||
response = await request.json()
|
||||
return {
|
||||
'success': True,
|
||||
'response': response
|
||||
}
|
||||
except:
|
||||
pass
|
||||
Reference in New Issue
Block a user