rogerxavier commited on
Commit
b29bec8
·
verified ·
1 Parent(s): e1931eb

Update server/decoder.py

Browse files
Files changed (1) hide show
  1. server/decoder.py +5 -7
server/decoder.py CHANGED
@@ -1,3 +1,4 @@
 
1
  #!/usr/bin/env python
2
  # -*- coding: utf-8 -*-
3
  import re
@@ -51,14 +52,15 @@ class ListDecoder(BaseDecoder):
51
  # yield _encoded_config_str.replace('type=tcp==', '')+"&allowInsecure=1"+"#"+"随机节点"
52
  yield _encoded_config_str.replace('type=tcp==', '')+"&allowInsecure=1"+"#"+nameinfo
53
 
54
- if ("vmess" in config_str) :
55
  vmess_decoded_data = b64decode(_config_str).decode('utf-8')
56
  vmess_info_json = json.loads(vmess_decoded_data)
57
  vmess_info_str = json.dumps(vmess_info_json,ensure_ascii=False)#不转译中文
58
  if ('倍率提示'not in vmess_info_str)and('导航' not in vmess_info_str) and('443' not in vmess_info_str):
59
  yield config_str.replace('allowInsecure=0', 'allowInsecure=1')
60
-
61
-
 
62
 
63
  class ConfigDecoder(BaseDecoder):
64
  def get_json(self) -> Dict:
@@ -99,7 +101,3 @@ def decode_url_to_configs(url: str)->list:
99
  ##https://github.com/CareyWang/sub-web 成功用这个订阅解析解决了订阅被cf格挡问题,且可用于sspanel
100
  lst_encoded_cfg = _get_listencoded_cfg_from_encoded_str(encoded_str)#lst_encoded_cfg解析为节点后的列表,包含所有节点链接
101
  return lst_encoded_cfg
102
-
103
-
104
-
105
-
 
1
+
2
  #!/usr/bin/env python
3
  # -*- coding: utf-8 -*-
4
  import re
 
52
  # yield _encoded_config_str.replace('type=tcp==', '')+"&allowInsecure=1"+"#"+"随机节点"
53
  yield _encoded_config_str.replace('type=tcp==', '')+"&allowInsecure=1"+"#"+nameinfo
54
 
55
+ if ("vmess" in config_str):
56
  vmess_decoded_data = b64decode(_config_str).decode('utf-8')
57
  vmess_info_json = json.loads(vmess_decoded_data)
58
  vmess_info_str = json.dumps(vmess_info_json,ensure_ascii=False)#不转译中文
59
  if ('倍率提示'not in vmess_info_str)and('导航' not in vmess_info_str) and('443' not in vmess_info_str):
60
  yield config_str.replace('allowInsecure=0', 'allowInsecure=1')
61
+ if ("ss://" in config_str) and ("套餐" not in nameinfo) and('到期' not in nameinfo) and('流量' not in nameinfo) and('剩余' not in nameinfo):
62
+ #shadowsocks节点保留
63
+ yield config_str
64
 
65
  class ConfigDecoder(BaseDecoder):
66
  def get_json(self) -> Dict:
 
101
  ##https://github.com/CareyWang/sub-web 成功用这个订阅解析解决了订阅被cf格挡问题,且可用于sspanel
102
  lst_encoded_cfg = _get_listencoded_cfg_from_encoded_str(encoded_str)#lst_encoded_cfg解析为节点后的列表,包含所有节点链接
103
  return lst_encoded_cfg