Fix Onlines
This commit is contained in:
@@ -167,12 +167,20 @@ chmod 755 "$BIN"
|
||||
USER_NAME="admin"
|
||||
PASSWORD="$(rand_hex 10)"
|
||||
TOKEN="$(rand_hex 24)"
|
||||
PANEL_URL=""
|
||||
PANEL_SERVER_ID="0"
|
||||
PANEL_SERVER_IP=""
|
||||
PANEL_PUSH_INTERVAL="60"
|
||||
|
||||
if [ -f "$CONFIG_DIR/config.json" ]; then
|
||||
echo "Existing config found: $CONFIG_DIR/config.json"
|
||||
USER_NAME="$(grep -o '"username"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG_DIR/config.json" | head -1 | cut -d '"' -f4 || echo admin)"
|
||||
PASSWORD="$(grep -o '"password"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG_DIR/config.json" | head -1 | cut -d '"' -f4 || rand_hex 10)"
|
||||
TOKEN="$(grep -o '"token"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG_DIR/config.json" | head -1 | cut -d '"' -f4 || rand_hex 24)"
|
||||
PANEL_URL="$(grep -o '"panel_url"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG_DIR/config.json" | head -1 | cut -d '"' -f4 || echo '')"
|
||||
PANEL_SERVER_ID="$(grep -o '"panel_server_id"[[:space:]]*:[[:space:]]*[0-9]*' "$CONFIG_DIR/config.json" | head -1 | grep -o '[0-9]*$' || echo 0)"
|
||||
PANEL_SERVER_IP="$(grep -o '"panel_server_ip"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG_DIR/config.json" | head -1 | cut -d '"' -f4 || echo '')"
|
||||
PANEL_PUSH_INTERVAL="$(grep -o '"panel_push_interval_seconds"[[:space:]]*:[[:space:]]*[0-9]*' "$CONFIG_DIR/config.json" | head -1 | grep -o '[0-9]*$' || echo 60)"
|
||||
EXISTING_PORT="$(extract_listen_port "$CONFIG_DIR/config.json" || true)"
|
||||
if [ "$PORT_SET" = "0" ] && [ -n "$EXISTING_PORT" ]; then
|
||||
PORT="$EXISTING_PORT"
|
||||
@@ -191,7 +199,11 @@ cat > "$CONFIG_DIR/config.json" <<EOF
|
||||
"username": "$USER_NAME",
|
||||
"password": "$PASSWORD",
|
||||
"token": "$TOKEN",
|
||||
"data_dir": "$CONFIG_DIR"
|
||||
"data_dir": "$CONFIG_DIR",
|
||||
"panel_url": "$PANEL_URL",
|
||||
"panel_server_id": $PANEL_SERVER_ID,
|
||||
"panel_server_ip": "$PANEL_SERVER_IP",
|
||||
"panel_push_interval_seconds": $PANEL_PUSH_INTERVAL
|
||||
}
|
||||
EOF
|
||||
chmod 600 "$CONFIG_DIR/config.json"
|
||||
|
||||
Reference in New Issue
Block a user