Skip to content

Commit

Permalink
5.10.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-X-Net committed Jun 11, 2024
1 parent 91a121f commit 90defa4
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 34 deletions.
28 changes: 11 additions & 17 deletions code/default/launcher/web_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def handle_one_request(self):
"Allow": "GET,POST,OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,POST,OPTIONS",
"Access-Control-Allow-Headers": "Authorization,Content-Type",
"Access-Control-Allow-Headers": "Authorization,Content-Type,Sec-Fetch-Site,Sec-Fetch-Mode,Sec-Fetch-Dest",
"Connection": "close",
"Content-Type": "text/html",
}


class Http_Handler(simple_http_server.HttpServerHandler):
deploy_proc = None

Expand Down Expand Up @@ -103,25 +103,19 @@ def load_module_menus(self):
# xlog.debug("m:%s id:%d", k, v['menu_sort_id'])

def do_OPTIONS(self):
# xlog.debug('%s "%s headers:%s from:%s', self.command, self.path, self.headers, self.address_string())
try:
# origin = utils.to_str(self.headers.get(b'Origin'))
origin = utils.to_str(self.headers.get(b'Origin'))
# if origin not in self.config.allow_web_origins:
# return

self.headers = utils.to_str(self.headers)
self.path = utils.to_str(self.path)

refer = self.headers.get('Referer')
if refer:
refer_loc = urlparse(refer).netloc
host = self.headers.get('Host')
if refer_loc != host and refer_loc not in config.allowed_refers:
xlog.warn("web control ref:%s host:%s", refer_loc, host)
return

self.set_CORS(CORS_header)

return self.send_response()
header = {
"Allow": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS",
"Access-Control-Allow-Origin": origin,
"Access-Control-Allow-Methods": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS",
"Access-Control-Allow-Headers": "Authorization,Content-Type",
}
return self.send_response(headers=header)
except Exception as e:
xlog.exception("options fail:%r", e)
return self.send_not_found()
Expand Down
2 changes: 1 addition & 1 deletion code/default/lib/noarch/xlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def keep_log(temp=False):
full_log = True
else:
for name, log in loggerDict.items():
log.keep_logs(temp)
log.keep_logs()


default_log = getLogger()
Expand Down
2 changes: 1 addition & 1 deletion code/default/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.10.5
5.10.7
1 change: 1 addition & 0 deletions code/default/x_tunnel/local/proxy_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def decrypt_data(data):
else:
return data


def traffic_readable(num, units=('B', 'KB', 'MB', 'GB')):
for unit in units:
if num >= 1024:
Expand Down
43 changes: 28 additions & 15 deletions code/default/x_tunnel/local/upload_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,36 @@ def mask_x_tunnel_password(fp):
return dat_str


def get_launcher_port():
launcher_config_fn = os.path.join(data_path, "launcher", "config.json")
try:
with open(launcher_config_fn, "r") as fd:
info = json.load(fd)
return info.get("control_port", 8085)
except Exception as e:
xlog.exception("get_launcher_port except:%r", e)
return 8085


def collect_debug_and_log():
port = get_launcher_port()

# collect debug info and save to folders
debug_infos = {
"system_info": "http://127.0.0.1:8085/debug",
"gae_info": "http://127.0.0.1:8085/module/gae_proxy/control/debug",
"gae_log": "http://127.0.0.1:8085/module/gae_proxy/control/log?cmd=get_new&last_no=1",
"xtunnel_info": "http://127.0.0.1:8085/module/x_tunnel/control/debug",
"xtunnel_status": "http://127.0.0.1:8085/module/x_tunnel/control/status",
"cloudflare_info": "http://127.0.0.1:8085/module/x_tunnel/control/cloudflare_front/debug",
"tls_info": "http://127.0.0.1:8085/module/x_tunnel/control/tls_relay_front/debug",
"seley_info": "http://127.0.0.1:8085/module/x_tunnel/control/seley_front/debug",
"cloudflare_log": "http://127.0.0.1:8085/module/x_tunnel/control/cloudflare_front/log?cmd=get_new&last_no=1",
"tls_log": "http://127.0.0.1:8085/module/x_tunnel/control/tls_relay_front/log?cmd=get_new&last_no=1",
"seley_log": "http://127.0.0.1:8085/module/x_tunnel/control/seley_front/log?cmd=get_new&last_no=1",
"xtunnel_log": "http://127.0.0.1:8085/module/x_tunnel/control/log?cmd=get_new&last_no=1",
"smartroute_log": "http://127.0.0.1:8085/module/smart_router/control/log?cmd=get_new&last_no=1",
"launcher_log": "http://127.0.0.1:8085/log?cmd=get_new&last_no=1"
"system_info": f"http://127.0.0.1:{port}/debug",
"gae_info": f"http://127.0.0.1:{port}/module/gae_proxy/control/debug",
"gae_log": f"http://127.0.0.1:{port}/module/gae_proxy/control/log?cmd=get_new&last_no=1",
"xtunnel_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/debug",
"xtunnel_status": f"http://127.0.0.1:{port}/module/x_tunnel/control/status",
"cloudflare_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/cloudflare_front/debug",
"tls_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/tls_relay_front/debug",
"seley_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/seley_front/debug",
"cloudflare_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/cloudflare_front/log?cmd=get_new&last_no=1",
"tls_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/tls_relay_front/log?cmd=get_new&last_no=1",
"seley_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/seley_front/log?cmd=get_new&last_no=1",
"xtunnel_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/log?cmd=get_new&last_no=1",
"smartroute_log": f"http://127.0.0.1:{port}/module/smart_router/control/log?cmd=get_new&last_no=1",
"launcher_log": f"http://127.0.0.1:{port}/log?cmd=get_new&last_no=1"
}

download_path = os.path.join(env_info.data_path, "downloads")
Expand Down Expand Up @@ -110,7 +123,7 @@ def list_files():
return other_files + log_files_list


def pack_logs(max_size=4 * 1024 * 1024):
def pack_logs(max_size=10 * 1024 * 1024):
content_size = 0

collect_debug_and_log()
Expand Down

0 comments on commit 90defa4

Please sign in to comment.