mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-03-09 15:40:05 +00:00
Add XRay Shadowsocks method changes
This commit is contained in:
parent
a671b9171e
commit
a24cc293db
1 changed files with 8 additions and 2 deletions
10
omr-admin.py
10
omr-admin.py
|
|
@ -1716,6 +1716,7 @@ async def config(userid: Optional[int] = Query(None), serial: Optional[str] = Qu
|
||||||
xray_ss_ukey = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-shadowsocks-tunnel' + '"' + ") | .settings.clients[] | select(.email=" + '"' + username + '"' + ") | .password' /etc/xray/xray-server.json").read().rstrip()
|
xray_ss_ukey = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-shadowsocks-tunnel' + '"' + ") | .settings.clients[] | select(.email=" + '"' + username + '"' + ") | .password' /etc/xray/xray-server.json").read().rstrip()
|
||||||
xray_ss_key = xray_ss_skey + ':' + xray_ss_ukey
|
xray_ss_key = xray_ss_skey + ':' + xray_ss_ukey
|
||||||
xray_port = os.popen('jq -r .inbounds[0].port /etc/xray/xray-server.json').read().rstrip()
|
xray_port = os.popen('jq -r .inbounds[0].port /etc/xray/xray-server.json').read().rstrip()
|
||||||
|
xray_ss_method = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-shadowsocks-tunnel' + '"' + ") | .settings.method' /etc/xray/xray-server.json").read().rstrip()
|
||||||
xray_vless_reality_public_key = ''
|
xray_vless_reality_public_key = ''
|
||||||
if os.path.isfile('/etc/xray/xray-vless-reality.json'):
|
if os.path.isfile('/etc/xray/xray-vless-reality.json'):
|
||||||
xray_vless_reality_public_key = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-vless-reality' + '"' + ") | .streamSettings.realitySettings.publicKey' /etc/xray/xray-vless-reality.json").read().rstrip()
|
xray_vless_reality_public_key = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-vless-reality' + '"' + ") | .streamSettings.realitySettings.publicKey' /etc/xray/xray-vless-reality.json").read().rstrip()
|
||||||
|
|
@ -1724,7 +1725,7 @@ async def config(userid: Optional[int] = Query(None), serial: Optional[str] = Qu
|
||||||
vless_reality = True
|
vless_reality = True
|
||||||
else:
|
else:
|
||||||
vless_reality = False
|
vless_reality = False
|
||||||
xray_conf = { 'key': xray_key, 'port': xray_port, 'sskey': xray_ss_key, 'vless_reality': vless_reality, 'vless_reality_key': xray_vless_reality_public_key }
|
xray_conf = { 'key': xray_key, 'port': xray_port, 'sskey': xray_ss_key, 'vless_reality': vless_reality, 'vless_reality_key': xray_vless_reality_public_key, 'ss_method': xray_ss_method }
|
||||||
modif_config_user(username, {'xray': xray_conf})
|
modif_config_user(username, {'xray': xray_conf})
|
||||||
else:
|
else:
|
||||||
xray_conf = omr_config_data['users'][0][username]['xray']
|
xray_conf = omr_config_data['users'][0][username]['xray']
|
||||||
|
|
@ -2332,6 +2333,7 @@ def v2ray(*, params: V2rayconfig, current_user: User = Depends(get_current_user)
|
||||||
class Xrayconfig(BaseModel):
|
class Xrayconfig(BaseModel):
|
||||||
userid: str
|
userid: str
|
||||||
vless_reality: bool = Query(False, title="Enable or disable VLESS Reality")
|
vless_reality: bool = Query(False, title="Enable or disable VLESS Reality")
|
||||||
|
ss_method: str = "2022-blake3-aes-256-gcm"
|
||||||
|
|
||||||
@app.post('/xray', summary="Set xray settings")
|
@app.post('/xray', summary="Set xray settings")
|
||||||
def xray(*, params: Xrayconfig, current_user: User = Depends(get_current_user)):
|
def xray(*, params: Xrayconfig, current_user: User = Depends(get_current_user)):
|
||||||
|
|
@ -2353,6 +2355,10 @@ def xray(*, params: Xrayconfig, current_user: User = Depends(get_current_user)):
|
||||||
for inbounds in xray_config['inbounds']:
|
for inbounds in xray_config['inbounds']:
|
||||||
if inbounds['tag'] == 'omrin-vless-reality':
|
if inbounds['tag'] == 'omrin-vless-reality':
|
||||||
xray_config['inbounds'].remove(inbounds)
|
xray_config['inbounds'].remove(inbounds)
|
||||||
|
for inbounds in xray_config['inbounds']:
|
||||||
|
if inbounds['tag'] == 'omrin-shadowsocks-tunnel':
|
||||||
|
inbounds['settings']['method'] = params.ss_method
|
||||||
|
|
||||||
with open('/etc/xray/xray-server.json', 'w') as outfile:
|
with open('/etc/xray/xray-server.json', 'w') as outfile:
|
||||||
json.dump(xray_config, outfile, indent=4)
|
json.dump(xray_config, outfile, indent=4)
|
||||||
#with open('/etc/xray/xray-server.json') as f:
|
#with open('/etc/xray/xray-server.json') as f:
|
||||||
|
|
@ -2377,7 +2383,7 @@ def xray(*, params: Xrayconfig, current_user: User = Depends(get_current_user)):
|
||||||
vless_reality = False
|
vless_reality = False
|
||||||
if os.path.isfile('/etc/xray/xray-vless-reality.json'):
|
if os.path.isfile('/etc/xray/xray-vless-reality.json'):
|
||||||
xray_vless_reality_public_key = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-vless-reality' + '"' + ") | .streamSettings.realitySettings.publicKey' /etc/xray/xray-vless-reality.json").read().rstrip()
|
xray_vless_reality_public_key = os.popen("jq -r '.inbounds[] | select(.tag==" + '"' + 'omrin-vless-reality' + '"' + ") | .streamSettings.realitySettings.publicKey' /etc/xray/xray-vless-reality.json").read().rstrip()
|
||||||
xray_conf = { 'key': xray_key, 'port': xray_port, 'sskey': xray_ss_key, 'vless_reality_key': xray_vless_reality_public_key, 'vless_reality': vless_reality}
|
xray_conf = { 'key': xray_key, 'port': xray_port, 'sskey': xray_ss_key, 'vless_reality_key': xray_vless_reality_public_key, 'vless_reality': vless_reality, 'ss_method': params.ss_method }
|
||||||
modif_config_user(username, {'xray': xray_conf})
|
modif_config_user(username, {'xray': xray_conf})
|
||||||
if initial_md5 != final_md5:
|
if initial_md5 != final_md5:
|
||||||
if params.vless_reality and not chk_vless_reality:
|
if params.vless_reality and not chk_vless_reality:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue