|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -SCRIPT_VERSION="2.3.0" |
| 3 | +SCRIPT_VERSION="2.3.1" |
4 | 4 | UPDATE_AVAILABLE=false |
5 | 5 | DIR_REMNAWAVE="/usr/local/remnawave_reverse/" |
6 | 6 | LANG_FILE="${DIR_REMNAWAVE}selected_language" |
@@ -2874,32 +2874,18 @@ install_packages() { |
2874 | 2874 | fi |
2875 | 2875 | fi |
2876 | 2876 |
|
2877 | | - if grep -q "Ubuntu" /etc/os-release; then |
2878 | | - install -m 0755 -d /etc/apt/keyrings |
2879 | | - if ! curl -fsSL https://download.docker.com/linux/ubuntu/gpg | tee /etc/apt/keyrings/docker.asc > /dev/null; then |
| 2877 | + if ! command -v docker >/dev/null 2>&1 || ! docker info >/dev/null 2>&1; then |
| 2878 | + echo -e "${COLOR_YELLOW}Installing Docker via get.docker.com...${COLOR_RESET}" |
| 2879 | + |
| 2880 | + if ! curl -fsSL https://get.docker.com -o /tmp/get-docker.sh; then |
2880 | 2881 | echo -e "${COLOR_RED}${LANG[ERROR_DOWNLOAD_DOCKER_KEY]}${COLOR_RESET}" >&2 |
2881 | 2882 | return 1 |
2882 | 2883 | fi |
2883 | | - chmod a+r /etc/apt/keyrings/docker.asc |
2884 | | - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null |
2885 | | - elif grep -q "Debian" /etc/os-release; then |
2886 | | - install -m 0755 -d /etc/apt/keyrings |
2887 | | - if ! curl -fsSL https://download.docker.com/linux/debian/gpg | tee /etc/apt/keyrings/docker.asc > /dev/null; then |
2888 | | - echo -e "${COLOR_RED}${LANG[ERROR_DOWNLOAD_DOCKER_KEY]}${COLOR_RESET}" >&2 |
| 2884 | + |
| 2885 | + if ! sh /tmp/get-docker.sh; then |
| 2886 | + echo -e "${COLOR_RED}${LANG[ERROR_INSTALL_DOCKER]}${COLOR_RESET}" >&2 |
2889 | 2887 | return 1 |
2890 | 2888 | fi |
2891 | | - chmod a+r /etc/apt/keyrings/docker.asc |
2892 | | - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null |
2893 | | - fi |
2894 | | - |
2895 | | - if ! apt-get update; then |
2896 | | - echo -e "${COLOR_RED}${LANG[ERROR_UPDATE_DOCKER_LIST]}${COLOR_RESET}" >&2 |
2897 | | - return 1 |
2898 | | - fi |
2899 | | - |
2900 | | - if ! apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; then |
2901 | | - echo -e "${COLOR_RED}${LANG[ERROR_INSTALL_DOCKER]}${COLOR_RESET}" >&2 |
2902 | | - return 1 |
2903 | 2889 | fi |
2904 | 2890 |
|
2905 | 2891 | if ! command -v docker >/dev/null 2>&1; then |
@@ -4041,26 +4027,33 @@ update_squad() { |
4041 | 4027 | create_api_token() { |
4042 | 4028 | local domain_url=$1 |
4043 | 4029 | local token=$2 |
4044 | | - local token_name="${3:-subscription-page-token}" |
| 4030 | + local target_dir=$3 |
| 4031 | + local token_name="${4:-subscription-page}" |
4045 | 4032 |
|
4046 | 4033 | local token_data='{"tokenName":"'"$token_name"'"}' |
4047 | | - local api_response=$(make_api_request "POST" "http://$domain_url/api/tokens" "$token" "$token_data") |
| 4034 | + local api_response |
| 4035 | + api_response=$(make_api_request "POST" "http://$domain_url/api/tokens" "$token" "$token_data") |
4048 | 4036 |
|
4049 | 4037 | if [ -z "$api_response" ]; then |
4050 | 4038 | echo -e "${COLOR_RED}${LANG[ERROR_CREATE_API_TOKEN]}${COLOR_RESET}" >&2 |
4051 | 4039 | return 1 |
4052 | 4040 | fi |
4053 | 4041 |
|
4054 | | - if echo "$api_response" | jq -e '.response.token' > /dev/null 2>&1; then |
4055 | | - local api_token=$(echo "$api_response" | jq -r '.response.token') |
4056 | | - echo "$api_token" |
4057 | | - return 0 |
4058 | | - else |
4059 | | - echo -e "${COLOR_RED}${LANG[ERROR_CREATE_API_TOKEN]}: $(echo "$api_response" | jq -r '.message // "Unknown error"') ${COLOR_RESET}" >&2 |
| 4042 | + local api_token |
| 4043 | + api_token=$(echo "$api_response" | jq -r '.response.token') |
| 4044 | + |
| 4045 | + if [ -z "$api_token" ] || [ "$api_token" = "null" ]; then |
| 4046 | + echo -e "${COLOR_RED}${LANG[ERROR_CREATE_API_TOKEN]}: $(echo "$api_response" | jq -r '.message // "Unknown error"')" >&2 |
4060 | 4047 | return 1 |
4061 | 4048 | fi |
| 4049 | + |
| 4050 | + # сразу правим docker-compose.yml как в get_public_key |
| 4051 | + sed -i "s|REMNAWAVE_API_TOKEN=.*|REMNAWAVE_API_TOKEN=$api_token|" "$target_dir/docker-compose.yml" |
| 4052 | + |
| 4053 | + echo -e "${COLOR_GREEN}${LANG[API_TOKEN_ADDED]}${COLOR_RESET}" |
4062 | 4054 | } |
4063 | 4055 |
|
| 4056 | + |
4064 | 4057 | ### API Functions ### |
4065 | 4058 |
|
4066 | 4059 | handle_certificates() { |
@@ -4519,7 +4512,10 @@ installation() { |
4519 | 4512 | condition: service_healthy |
4520 | 4513 | environment: |
4521 | 4514 | - REMNAWAVE_PANEL_URL=http://remnawave:3000 |
| 4515 | + - SUBSCRIPTION_UI_DISPLAY_RAW_KEYS=true |
4522 | 4516 | - APP_PORT=3010 |
| 4517 | + - META_TITLE="Remnawave Subscription" |
| 4518 | + - META_DESCRIPTION="page" |
4523 | 4519 | - REMNAWAVE_API_TOKEN=\$api_token |
4524 | 4520 | ports: |
4525 | 4521 | - '127.0.0.1:3010:3010' |
@@ -4773,16 +4769,7 @@ EOL |
4773 | 4769 |
|
4774 | 4770 | # Create API token for subscription page |
4775 | 4771 | echo -e "${COLOR_YELLOW}${LANG[CREATING_API_TOKEN]}${COLOR_RESET}" |
4776 | | - local api_token |
4777 | | - api_token=$(create_api_token "$domain_url" "$token" "subscription-page") |
4778 | | - |
4779 | | - if [ -n "$api_token" ]; then |
4780 | | - |
4781 | | - sed -i "s|REMNAWAVE_API_TOKEN=.*|REMNAWAVE_API_TOKEN=$api_token|" /opt/remnawave/docker-compose.yml |
4782 | | - |
4783 | | - echo -e "${COLOR_GREEN}${LANG[API_TOKEN_ADDED]}${COLOR_RESET}" |
4784 | | - |
4785 | | - fi |
| 4772 | + create_api_token "$domain_url" "$token" "$target_dir" |
4786 | 4773 |
|
4787 | 4774 | # Stop and start Remnawave |
4788 | 4775 | echo -e "${COLOR_YELLOW}${LANG[STOPPING_REMNAWAVE]}${COLOR_RESET}" |
@@ -5096,7 +5083,10 @@ installation_panel() { |
5096 | 5083 | condition: service_healthy |
5097 | 5084 | environment: |
5098 | 5085 | - REMNAWAVE_PANEL_URL=http://remnawave:3000 |
| 5086 | + - SUBSCRIPTION_UI_DISPLAY_RAW_KEYS=true |
5099 | 5087 | - APP_PORT=3010 |
| 5088 | + - META_TITLE="Remnawave Subscription" |
| 5089 | + - META_DESCRIPTION="page" |
5100 | 5090 | - REMNAWAVE_API_TOKEN=\$api_token |
5101 | 5091 | ports: |
5102 | 5092 | - '127.0.0.1:3010:3010' |
|
0 commit comments