WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 90defa4

Browse files
committed
5.10.7 release
1 parent 91a121f commit 90defa4

File tree

5 files changed

+42
-34
lines changed

5 files changed

+42
-34
lines changed

code/default/launcher/web_control.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ def handle_one_request(self):
7171
"Allow": "GET,POST,OPTIONS",
7272
"Access-Control-Allow-Origin": "*",
7373
"Access-Control-Allow-Methods": "GET,POST,OPTIONS",
74-
"Access-Control-Allow-Headers": "Authorization,Content-Type",
74+
"Access-Control-Allow-Headers": "Authorization,Content-Type,Sec-Fetch-Site,Sec-Fetch-Mode,Sec-Fetch-Dest",
7575
"Connection": "close",
76-
"Content-Type": "text/html",
7776
}
7877

78+
7979
class Http_Handler(simple_http_server.HttpServerHandler):
8080
deploy_proc = None
8181

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

105105
def do_OPTIONS(self):
106+
# xlog.debug('%s "%s headers:%s from:%s', self.command, self.path, self.headers, self.address_string())
106107
try:
107-
# origin = utils.to_str(self.headers.get(b'Origin'))
108+
origin = utils.to_str(self.headers.get(b'Origin'))
108109
# if origin not in self.config.allow_web_origins:
109110
# return
110111

111-
self.headers = utils.to_str(self.headers)
112-
self.path = utils.to_str(self.path)
113-
114-
refer = self.headers.get('Referer')
115-
if refer:
116-
refer_loc = urlparse(refer).netloc
117-
host = self.headers.get('Host')
118-
if refer_loc != host and refer_loc not in config.allowed_refers:
119-
xlog.warn("web control ref:%s host:%s", refer_loc, host)
120-
return
121-
122-
self.set_CORS(CORS_header)
123-
124-
return self.send_response()
112+
header = {
113+
"Allow": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS",
114+
"Access-Control-Allow-Origin": origin,
115+
"Access-Control-Allow-Methods": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS",
116+
"Access-Control-Allow-Headers": "Authorization,Content-Type",
117+
}
118+
return self.send_response(headers=header)
125119
except Exception as e:
126120
xlog.exception("options fail:%r", e)
127121
return self.send_not_found()

code/default/lib/noarch/xlog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def keep_log(temp=False):
367367
full_log = True
368368
else:
369369
for name, log in loggerDict.items():
370-
log.keep_logs(temp)
370+
log.keep_logs()
371371

372372

373373
default_log = getLogger()

code/default/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.10.5
1+
5.10.7

code/default/x_tunnel/local/proxy_session.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def decrypt_data(data):
3434
else:
3535
return data
3636

37+
3738
def traffic_readable(num, units=('B', 'KB', 'MB', 'GB')):
3839
for unit in units:
3940
if num >= 1024:

code/default/x_tunnel/local/upload_logs.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,36 @@ def mask_x_tunnel_password(fp):
4040
return dat_str
4141

4242

43+
def get_launcher_port():
44+
launcher_config_fn = os.path.join(data_path, "launcher", "config.json")
45+
try:
46+
with open(launcher_config_fn, "r") as fd:
47+
info = json.load(fd)
48+
return info.get("control_port", 8085)
49+
except Exception as e:
50+
xlog.exception("get_launcher_port except:%r", e)
51+
return 8085
52+
53+
4354
def collect_debug_and_log():
55+
port = get_launcher_port()
56+
4457
# collect debug info and save to folders
4558
debug_infos = {
46-
"system_info": "http://127.0.0.1:8085/debug",
47-
"gae_info": "http://127.0.0.1:8085/module/gae_proxy/control/debug",
48-
"gae_log": "http://127.0.0.1:8085/module/gae_proxy/control/log?cmd=get_new&last_no=1",
49-
"xtunnel_info": "http://127.0.0.1:8085/module/x_tunnel/control/debug",
50-
"xtunnel_status": "http://127.0.0.1:8085/module/x_tunnel/control/status",
51-
"cloudflare_info": "http://127.0.0.1:8085/module/x_tunnel/control/cloudflare_front/debug",
52-
"tls_info": "http://127.0.0.1:8085/module/x_tunnel/control/tls_relay_front/debug",
53-
"seley_info": "http://127.0.0.1:8085/module/x_tunnel/control/seley_front/debug",
54-
"cloudflare_log": "http://127.0.0.1:8085/module/x_tunnel/control/cloudflare_front/log?cmd=get_new&last_no=1",
55-
"tls_log": "http://127.0.0.1:8085/module/x_tunnel/control/tls_relay_front/log?cmd=get_new&last_no=1",
56-
"seley_log": "http://127.0.0.1:8085/module/x_tunnel/control/seley_front/log?cmd=get_new&last_no=1",
57-
"xtunnel_log": "http://127.0.0.1:8085/module/x_tunnel/control/log?cmd=get_new&last_no=1",
58-
"smartroute_log": "http://127.0.0.1:8085/module/smart_router/control/log?cmd=get_new&last_no=1",
59-
"launcher_log": "http://127.0.0.1:8085/log?cmd=get_new&last_no=1"
59+
"system_info": f"http://127.0.0.1:{port}/debug",
60+
"gae_info": f"http://127.0.0.1:{port}/module/gae_proxy/control/debug",
61+
"gae_log": f"http://127.0.0.1:{port}/module/gae_proxy/control/log?cmd=get_new&last_no=1",
62+
"xtunnel_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/debug",
63+
"xtunnel_status": f"http://127.0.0.1:{port}/module/x_tunnel/control/status",
64+
"cloudflare_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/cloudflare_front/debug",
65+
"tls_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/tls_relay_front/debug",
66+
"seley_info": f"http://127.0.0.1:{port}/module/x_tunnel/control/seley_front/debug",
67+
"cloudflare_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/cloudflare_front/log?cmd=get_new&last_no=1",
68+
"tls_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/tls_relay_front/log?cmd=get_new&last_no=1",
69+
"seley_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/seley_front/log?cmd=get_new&last_no=1",
70+
"xtunnel_log": f"http://127.0.0.1:{port}/module/x_tunnel/control/log?cmd=get_new&last_no=1",
71+
"smartroute_log": f"http://127.0.0.1:{port}/module/smart_router/control/log?cmd=get_new&last_no=1",
72+
"launcher_log": f"http://127.0.0.1:{port}/log?cmd=get_new&last_no=1"
6073
}
6174

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

112125

113-
def pack_logs(max_size=4 * 1024 * 1024):
126+
def pack_logs(max_size=10 * 1024 * 1024):
114127
content_size = 0
115128

116129
collect_debug_and_log()

0 commit comments

Comments
 (0)