diff --git a/.env.sample b/.env.sample index a775549..e9357c1 100644 --- a/.env.sample +++ b/.env.sample @@ -1,3 +1,4 @@ # пример заполнения: https://example.com, http://0.0.0.0:80 NEXT_PUBLIC_PLAYER_PARSER_URL= # Домен сервиса player-parsers, требуется для работы встроенного плеера +NEXT_PUBLIC_API_URL= # Домен сервиса api-prox, для использования своего сервера API вместо встроенного middleware # --- \ No newline at end of file diff --git a/DEPLOYMENT.RU.md b/DEPLOYMENT.RU.md index 6605fc7..ab8cee2 100644 --- a/DEPLOYMENT.RU.md +++ b/DEPLOYMENT.RU.md @@ -26,11 +26,12 @@ ![vercel import button](./docs/deploy/vercel_import.png) -5. (опционально) добавьте переменную для использования своего плеера: +5. (опционально) добавьте переменные для использования своего плеера и\или API прокси: - NEXT_PUBLIC_PLAYER_PARSER_URL + - NEXT_PUBLIC_API_URL - на те которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) + на те которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md) ![vercel project settings](./docs/deploy/vercel_project.png) @@ -73,11 +74,12 @@ ![netlify project name](./docs/deploy/netlify_project_name.png) -7. (опционально) добавьте переменную для использования своего плеера: +7. (опционально) добавьте переменную для использования своего плеера и\или API прокси:: - NEXT_PUBLIC_PLAYER_PARSER_URL + - NEXT_PUBLIC_API_URL - на те которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) + на те которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md) 1. ![alt text](./docs/deploy/netlify_env_1.png) @@ -120,7 +122,7 @@ - -p - порт контейнера который будет доступен извне. ПОРТ:3000 > [!NOTE] -> для переменных которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md), необходимо использовать `-e ПЕРЕМЕННАЯ=ЗНАЧЕНИЕ` до последнего слова anix +> для переменных которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md), необходимо использовать `-e ПЕРЕМЕННАЯ=ЗНАЧЕНИЕ` до последнего слова anix [команда docker run](https://docs.docker.com/reference/cli/docker/container/run/) @@ -150,7 +152,7 @@ 1. Клонируйте репозиторий `git clone https://github.com/Radiquum/AniX` 2. Переместитесь в директорию репозитория `cd AniX` 3. Выполните команду `npm install` -4. (опционально) скопируйте .env.sample как .env и заполните его переменными которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) +4. (опционально) скопируйте .env.sample как .env и заполните его переменными которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md) 5. Выполните команду `npm run build` 6. создайте новую директорию (далее будем использовать `<имя_новой_директории>` как её имя) 7. переместите в созданную директорию (`<имя_новой_директории>`) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 2b5dce6..7dd6de8 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -26,11 +26,12 @@ Requirements: ![vercel import button](./docs/deploy/vercel_import.png) -5. (optional) Add variable to use your own player: +5. (optional) Add variable to use your own player and/or api-proxy: - NEXT_PUBLIC_PLAYER_PARSER_URL + - NEXT_PUBLIC_API_URL - Use the ones you received if you deployed [anix-player-parsers](./player-parsers/README.md) + Use the ones you received if you deployed [anix-player-parsers](./player-parsers/README.md) and/or [anix-api-prox](./api-prox/README.md) ![vercel project settings](./docs/deploy/vercel_project.png) @@ -73,11 +74,12 @@ Requirements: ![netlify project name](./docs/deploy/netlify_project_name.png) -7. (optional) Add variables to use your own player: +7. (optional) Add variables to use your own player and/or api-proxy: - NEXT_PUBLIC_PLAYER_PARSER_URL + - NEXT_PUBLIC_API_URL - Use the ones you received if you deployed [anix-player-parsers](./player-parsers/README.md) + Use the ones you received if you deployed [anix-player-parsers](./player-parsers/README.md) and/or [anix-api-prox](./api-prox/README.md) 1. ![alt text](./docs/deploy/netlify_env_1.png) @@ -120,7 +122,7 @@ Additional Requirements: - -p - container port to be exposed externally. PORT:3000 > [!NOTE] -> For variables you received if you deployed [anix-player-parsers](./player-parsers/README.md), you need to use `-e VARIABLE=VALUE` before the last word anix +> For variables you received if you deployed [anix-player-parsers](./player-parsers/README.md) and/or [anix-api-prox](./api-prox/README.md), you need to use `-e VARIABLE=VALUE` before the last word anix [docker run command](https://docs.docker.com/reference/cli/docker/container/run/) @@ -150,7 +152,7 @@ Instructions: 1. Clone the repository `git clone https://github.com/Radiquum/AniX` 2. Navigate to the repository directory `cd AniX` 3. Run the command `npm install` -4. (optional) copy `.env.sample` as `.env` and fill it with variables you received if you deployed [anix-player-parsers](./player-parsers/README.md) +4. (optional) copy `.env.sample` as `.env` and fill it with variables you received if you deployed [anix-player-parsers](./player-parsers/README.md) and/or [anix-api-prox](./api-prox/README.md) 5. Run the command `npm run build` 6. Create a new directory (next we will be refer to its name as ``) 7. Move the following files into the new directory (``): diff --git a/app/api/config.ts b/app/api/config.ts index ad32b6f..f797ee0 100644 --- a/app/api/config.ts +++ b/app/api/config.ts @@ -1,7 +1,9 @@ export const CURRENT_APP_VERSION = "3.7.0"; +import { env } from "next-runtime-env"; +const NEXT_PUBLIC_API_URL = env("NEXT_PUBLIC_API_URL") || null; export const API_URL = "https://api.anixart.app"; -export const API_PREFIX = "/api/proxy"; +export const API_PREFIX = NEXT_PUBLIC_API_URL || "/api/proxy"; export const USER_AGENT = "AnixartApp/9.0 BETA 5-25062213 (Android 9; SDK 28; arm64-v8a; samsung SM-G975N; en)";