From d3137a15f7559295d1632d799b1a60a8c3c415da Mon Sep 17 00:00:00 2001 From: SaintShit Date: Wed, 28 Feb 2024 19:46:12 +0330 Subject: [PATCH] fix: remove redundant data in v2ray default.json also, insert outbound to json's outbounds instead of appending --- app/subscription/v2ray.py | 4 +- app/templates/v2ray/default.json | 132 ++++++++++++------------------- 2 files changed, 54 insertions(+), 82 deletions(-) diff --git a/app/subscription/v2ray.py b/app/subscription/v2ray.py index b5d0c8b7c..1fc04201b 100644 --- a/app/subscription/v2ray.py +++ b/app/subscription/v2ray.py @@ -212,9 +212,9 @@ def __init__(self): def add_outbound(self, remarks, outbound_data, proxy_outbound): json_template = json.loads(self.template) json_template["remarks"] = remarks - json_template["outbounds"].append(outbound_data) + json_template["outbounds"].insert(0, (outbound_data)) if proxy_outbound: - json_template["outbounds"].append(proxy_outbound) + json_template["outbounds"].insert(0, (proxy_outbound)) self.config.append(json_template) def render(self): diff --git a/app/templates/v2ray/default.json b/app/templates/v2ray/default.json index e9a7551ad..d842a9f79 100644 --- a/app/templates/v2ray/default.json +++ b/app/templates/v2ray/default.json @@ -1,86 +1,58 @@ { - "log": { - "access": "", - "error": "", - "loglevel": "warning" - }, - "inbounds": [ - { - "tag": "socks", - "port": 10808, - "listen": "0.0.0.0", - "protocol": "socks", - "sniffing": { - "enabled": true, - "destOverride": [ - "http", - "tls" - ], - "routeOnly": false - }, - "settings": { - "auth": "noauth", - "udp": true, - "allowTransparent": false - } + "log": { + "access": "", + "error": "", + "loglevel": "warning" + }, + "inbounds": [ + { + "tag": "socks", + "port": 10808, + "listen": "0.0.0.0", + "protocol": "socks", + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ], + "routeOnly": false }, - { - "tag": "http", - "port": 10809, - "listen": "0.0.0.0", - "protocol": "http", - "sniffing": { - "enabled": true, - "destOverride": [ - "http", - "tls" - ], - "routeOnly": false - }, - "settings": { - "auth": "noauth", - "udp": true, - "allowTransparent": false - } + "settings": { + "auth": "noauth", + "udp": true, + "allowTransparent": false } - ], - "outbounds": [ - { - "tag": "direct", - "protocol": "freedom", - "settings": {} + }, + { + "tag": "http", + "port": 10809, + "listen": "0.0.0.0", + "protocol": "http", + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ], + "routeOnly": false }, - { - "tag": "block", - "protocol": "blackhole", - "settings": { - "response": { - "type": "http" - } - } + "settings": { + "auth": "noauth", + "udp": true, + "allowTransparent": false } - ], - "dns": { - "servers": [ - "1.1.1.1", - "8.8.8.8" - ] - }, - "routing": { - "domainStrategy": "AsIs", - "rules": [ - { - "type": "field", - "inboundTag": [ - "api" - ], - "outboundTag": "api" - }, - { - "type": "field", - "port": "0-65535", - "outboundTag": "proxy" - } - ] } - } \ No newline at end of file + ], + "outbounds": [], + "dns": { + "servers": [ + "1.1.1.1", + "8.8.8.8" + ] + }, + "routing": { + "domainStrategy": "AsIs", + "rules": [] + } +} \ No newline at end of file