From 0489a9df2cf26dcc2a18ea93aa3b96b7ef9f40e6 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 19 Mar 2024 23:29:27 +0800 Subject: [PATCH] Update config_api.py --- class/core/config_api.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/class/core/config_api.py b/class/core/config_api.py index dea5c3ef93..d5e95adeb2 100755 --- a/class/core/config_api.py +++ b/class/core/config_api.py @@ -586,35 +586,35 @@ def setPanelSslApi(self): conf = mw.readFile(dst_panel_path) if conf: - rep = "\s+ssl_certificate\s+.+;\s+ssl_certificate_key\s+.+;" + rep = "\\s+ssl_certificate\\s+.+;\\s+ssl_certificate_key\\s+.+;" conf = re.sub(rep, '', conf) - rep = "\s+ssl_protocols\s+.+;\n" + rep = "\\s+ssl_protocols\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_ciphers\s+.+;\n" + rep = "\\s+ssl_ciphers\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_prefer_server_ciphers\s+.+;\n" + rep = "\\s+ssl_prefer_server_ciphers\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_session_cache\s+.+;\n" + rep = "\\s+ssl_session_cache\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_session_timeout\s+.+;\n" + rep = "\\s+ssl_session_timeout\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_ecdh_curve\s+.+;\n" + rep = "\\s+ssl_ecdh_curve\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_session_tickets\s+.+;\n" + rep = "\\s+ssl_session_tickets\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_stapling\s+.+;\n" + rep = "\\s+ssl_stapling\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl_stapling_verify\s+.+;\n" + rep = "\\s+ssl_stapling_verify\\s+.+;\n" conf = re.sub(rep, '', conf) - rep = "\s+ssl\s+on;" + rep = "\\s+ssl\\s+on;" conf = re.sub(rep, '', conf) - rep = "\s+error_page\s497.+;" + rep = "\\s+error_page\\s497.+;" conf = re.sub(rep, '', conf) - rep = "\s+if.+server_port.+\n.+\n\s+\s*}" + rep = "\\s+if.+server_port.+\n.+\n\\s+\\s*}" conf = re.sub(rep, '', conf) - rep = "\s+listen\s+443.*;" + rep = "\\s+listen\\s+443.*;" conf = re.sub(rep, '', conf) - rep = "\s+listen\s+\[\:\:\]\:443.*;" + rep = "\\s+listen\\s+\\[\\:\\:\\]\\:443.*;" conf = re.sub(rep, '', conf) mw.writeFile(dst_panel_path, conf) @@ -645,7 +645,7 @@ def setPanelSslApi(self): conf = conf.replace('#error_page 404/404.html;', sslStr) - rep = "listen\s+([0-9]+)\s*[default_server]*;" + rep = "listen\\s+([0-9]+)\\s*[default_server]*;" tmp = re.findall(rep, conf) if not mw.inArray(tmp, '443'): listen = re.search(rep, conf).group() @@ -761,7 +761,7 @@ def checkPanelToken(self): def setStatusCodeApi(self): status_code = request.form.get('status_code', '').strip() - if re.match("^\d+$", status_code): + if re.match("^\\d+$", status_code): status_code = int(status_code) if status_code != 0: if status_code < 100 or status_code > 999: