|
@@ -80,16 +80,15 @@ init_var() {
|
|
|
TROJAN_PANEL_DATA="/tpdata/trojan-panel/"
|
|
|
TROJAN_PANEL_WEBFILE="${TROJAN_PANEL_DATA}webfile/"
|
|
|
TROJAN_PANEL_LOGS="${TROJAN_PANEL_DATA}logs/"
|
|
|
- TROJAN_PANEL_EXPORT="${TROJAN_PANEL_DATA}config/export/"
|
|
|
- TROJAN_PANEL_TEMPLATE="${TROJAN_PANEL_DATA}config/template/"
|
|
|
- TROJAN_PANEL_CONFIG="${TROJAN_PANEL_DATA}config/config.ini"
|
|
|
+ TROJAN_PANEL_CONFIG="${TROJAN_PANEL_DATA}config/"
|
|
|
+ trojan_panel_config_path="${TROJAN_PANEL_DATA}config/config.ini"
|
|
|
trojan_panel_port=8081
|
|
|
|
|
|
# Trojan Panel Core
|
|
|
TROJAN_PANEL_CORE_DATA="/tpdata/trojan-panel-core/"
|
|
|
TROJAN_PANEL_CORE_LOGS="${TROJAN_PANEL_CORE_DATA}logs/"
|
|
|
- TROJAN_PANEL_CORE_SQLITE="${TROJAN_PANEL_CORE_DATA}config/sqlite/"
|
|
|
- TROJAN_PANEL_CORE_CONFIG="${TROJAN_PANEL_CORE_DATA}config/config.ini"
|
|
|
+ TROJAN_PANEL_CORE_CONFIG="${TROJAN_PANEL_CORE_DATA}config/"
|
|
|
+ trojan_panel_core_config_path="${TROJAN_PANEL_CORE_DATA}config/config.ini"
|
|
|
database="trojan_panel_db"
|
|
|
account_table="account"
|
|
|
grpc_port=8100
|
|
@@ -177,7 +176,6 @@ mkdir_tools() {
|
|
|
# Trojan Panel Core
|
|
|
mkdir -p ${TROJAN_PANEL_CORE_DATA}
|
|
|
mkdir -p ${TROJAN_PANEL_CORE_LOGS}
|
|
|
- mkdir -p ${TROJAN_PANEL_CORE_SQLITE}
|
|
|
}
|
|
|
|
|
|
can_connect() {
|
|
@@ -961,13 +959,13 @@ install_trojan_panel_ui() {
|
|
|
if [[ -z $(docker ps -a -q -f "name=^trojan-panel-ui$") ]]; then
|
|
|
echo_content green "---> 安装Trojan Panel前端"
|
|
|
|
|
|
- read -r -p "请输入Trojan Panel前端端口(默认:8888): " trojan_panel_ui_port
|
|
|
- [[ -z "${trojan_panel_ui_port}" ]] && trojan_panel_ui_port="8888"
|
|
|
read -r -p "请输入Trojan Panel后端的IP地址(默认:本机后端): " trojan_panel_ip
|
|
|
[[ -z "${trojan_panel_ip}" ]] && trojan_panel_ip="127.0.0.1"
|
|
|
read -r -p "请输入Trojan Panel后端的服务端口(默认:8081): " trojan_panel_server_port
|
|
|
[[ -z "${trojan_panel_server_port}" ]] && trojan_panel_server_port=8081
|
|
|
|
|
|
+ read -r -p "请输入Trojan Panel前端端口(默认:8888): " trojan_panel_ui_port
|
|
|
+ [[ -z "${trojan_panel_ui_port}" ]] && trojan_panel_ui_port="8888"
|
|
|
while read -r -p "请选择Trojan Panel前端是否开启https?(0/关闭 1/开启 默认:1/开启): " ui_https; do
|
|
|
if [[ -z ${ui_https} || ${ui_https} == 1 ]]; then
|
|
|
install_cert
|
|
@@ -1115,9 +1113,7 @@ install_trojan_panel() {
|
|
|
--network=host \
|
|
|
-v ${WEB_PATH}:${TROJAN_PANEL_WEBFILE} \
|
|
|
-v ${TROJAN_PANEL_LOGS}:${TROJAN_PANEL_LOGS} \
|
|
|
- -v ${TROJAN_PANEL_EXPORT}:${TROJAN_PANEL_EXPORT} \
|
|
|
- -v ${TROJAN_PANEL_TEMPLATE}:${TROJAN_PANEL_TEMPLATE} \
|
|
|
- -v ${TROJAN_PANEL_CORE_CONFIG}:${TROJAN_PANEL_CORE_CONFIG} \
|
|
|
+ -v ${TROJAN_PANEL_CONFIG}:${TROJAN_PANEL_CONFIG} \
|
|
|
-v /etc/localtime:/etc/localtime \
|
|
|
-e GIN_MODE=release \
|
|
|
-e "mariadb_ip=${mariadb_ip}" \
|
|
@@ -1199,7 +1195,6 @@ install_trojan_panel_core() {
|
|
|
-v ${TROJAN_PANEL_CORE_DATA}bin/hysteria/config:${TROJAN_PANEL_CORE_DATA}bin/hysteria/config \
|
|
|
-v ${TROJAN_PANEL_CORE_DATA}bin/naiveproxy/config:${TROJAN_PANEL_CORE_DATA}bin/naiveproxy/config \
|
|
|
-v ${TROJAN_PANEL_CORE_LOGS}:${TROJAN_PANEL_CORE_LOGS} \
|
|
|
- -v ${TROJAN_PANEL_CORE_SQLITE}:${TROJAN_PANEL_CORE_SQLITE} \
|
|
|
-v ${TROJAN_PANEL_CORE_CONFIG}:${TROJAN_PANEL_CORE_CONFIG} \
|
|
|
-v ${CERT_PATH}:${CERT_PATH} \
|
|
|
-v ${WEB_PATH}:${WEB_PATH} \
|
|
@@ -1275,11 +1270,11 @@ update__trojan_panel_database() {
|
|
|
fi
|
|
|
version_212_214=("v2.1.2" "v2.1.3")
|
|
|
if [[ "${version_212_214[*]}" =~ "${trojan_panel_current_version}" ]]; then
|
|
|
- docker cp trojan-panel:${TROJAN_PANEL_CONFIG} ${TROJAN_PANEL_CONFIG} &&
|
|
|
+ docker cp trojan-panel:${trojan_panel_config_path} ${trojan_panel_config_path} &&
|
|
|
trojan_panel_current_version="v2.1.4"
|
|
|
sed '$ a\
|
|
|
[server]\
|
|
|
- port=8081' ${TROJAN_PANEL_CONFIG}
|
|
|
+ port=8081' ${trojan_panel_config_path}
|
|
|
fi
|
|
|
|
|
|
echo_content skyBlue "---> Trojan Panel数据结构更新完成"
|
|
@@ -1305,11 +1300,11 @@ update__trojan_panel_core_database() {
|
|
|
fi
|
|
|
version_210_211=("v2.1.0")
|
|
|
if [[ "${version_210_211[*]}" =~ "${trojan_panel_core_current_version}" ]]; then
|
|
|
- docker cp trojan-panel-core:${TROJAN_PANEL_CORE_CONFIG} ${TROJAN_PANEL_CORE_CONFIG} &&
|
|
|
+ docker cp trojan-panel-core:${trojan_panel_core_config_path} ${trojan_panel_core_config_path} &&
|
|
|
trojan_panel_core_current_version="v2.1.1"
|
|
|
sed '$ a\
|
|
|
[server]\
|
|
|
- port=8082' ${TROJAN_PANEL_CORE_CONFIG}
|
|
|
+ port=8082' ${trojan_panel_core_config_path}
|
|
|
fi
|
|
|
|
|
|
echo_content skyBlue "---> Trojan Panel Core数据结构更新完成"
|
|
@@ -1398,8 +1393,7 @@ update_trojan_panel() {
|
|
|
--network=host \
|
|
|
-v ${WEB_PATH}:${TROJAN_PANEL_WEBFILE} \
|
|
|
-v ${TROJAN_PANEL_LOGS}:${TROJAN_PANEL_LOGS} \
|
|
|
- -v ${TROJAN_PANEL_EXPORT}:${TROJAN_PANEL_EXPORT} \
|
|
|
- -v ${TROJAN_PANEL_TEMPLATE}:${TROJAN_PANEL_TEMPLATE} \
|
|
|
+ -v ${TROJAN_PANEL_CONFIG}:${TROJAN_PANEL_CONFIG} \
|
|
|
-v /etc/localtime:/etc/localtime \
|
|
|
-e GIN_MODE=release \
|
|
|
-e "mariadb_ip=${mariadb_ip}" \
|
|
@@ -1468,7 +1462,7 @@ update_trojan_panel_core() {
|
|
|
-v ${TROJAN_PANEL_CORE_DATA}bin/hysteria/config:${TROJAN_PANEL_CORE_DATA}bin/hysteria/config \
|
|
|
-v ${TROJAN_PANEL_CORE_DATA}bin/naiveproxy/config:${TROJAN_PANEL_CORE_DATA}bin/naiveproxy/config \
|
|
|
-v ${TROJAN_PANEL_CORE_LOGS}:${TROJAN_PANEL_CORE_LOGS} \
|
|
|
- -v ${TROJAN_PANEL_CORE_SQLITE}:${TROJAN_PANEL_CORE_SQLITE} \
|
|
|
+ -v ${TROJAN_PANEL_CORE_CONFIG}:${TROJAN_PANEL_CORE_CONFIG} \
|
|
|
-v ${CERT_PATH}:${CERT_PATH} \
|
|
|
-v ${WEB_PATH}:${WEB_PATH} \
|
|
|
-v /etc/localtime:/etc/localtime \
|