From 404a38d990ef6c640bfb16ec35ada2ad3d176a3a Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 1 Dec 2024 20:42:21 +0800 Subject: [PATCH] update --- panel_tools.py | 10 ++++++++++ scripts/init.d/mw.tpl | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/panel_tools.py b/panel_tools.py index e4ad47398..f8bd22402 100755 --- a/panel_tools.py +++ b/panel_tools.py @@ -277,6 +277,14 @@ def getServerIp(): print(ip[0]) +def getPanelSslType(): + scheme = 'http' + panel_ssl = thisdb.getOptionByJson('panel_ssl', default={'open':False}) + if panel_ssl['open']: + scheme = 'https' + return scheme + + def main(): if len(sys.argv) == 1: print('ERROR: Parameter error!') @@ -297,6 +305,8 @@ def main(): show_panel_adminpath() elif method == 'getServerIp': getServerIp() + elif method == 'panel_ssl_type': + print(getPanelSslType()) elif method == "cli": clinum = 0 try: diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index 8461a0df0..c6868db1c 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -521,11 +521,7 @@ mw_clean_lib(){ mw_default(){ cd ${PANEL_DIR} port=7200 - scheme=http - - if [ -f ${PANEL_DIR}/ssl/choose.pl ];then - scheme=https - fi + scheme=$(python3 ${PANEL_DIR}/panel_tools.py panel_ssl_type) if [ -f ${PANEL_DIR}/data/port.pl ];then port=$(cat ${PANEL_DIR}/data/port.pl)