diff --git a/.dockerignore b/.dockerignore index 2eff99b..a9d7db9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -64,5 +64,6 @@ API-Trace/* .env player-parsers +api-prox docs .git \ No newline at end of file diff --git a/.env.sample b/.env.sample index dcb7e8b..e9357c1 100644 --- a/.env.sample +++ b/.env.sample @@ -1,5 +1,4 @@ # пример заполнения: https://example.com, http://0.0.0.0:80 -NEXT_PUBLIC_KODIK_PARSER_URL= # Домен парсера кодика, требуется для просмотра с данного источника -NEXT_PUBLIC_ANILIBRIA_PARSER_URL= # Домен парсера анилибрии, если не заполнено, используется официальное апи -NEXT_PUBLIC_SIBNET_PARSER_URL= # Домен парсера сибнет, требуется для просмотра с данного источника +NEXT_PUBLIC_PLAYER_PARSER_URL= # Домен сервиса player-parsers, требуется для работы встроенного плеера +NEXT_PUBLIC_API_URL= # Домен сервиса api-prox, для использования своего сервера API вместо встроенного middleware # --- \ No newline at end of file diff --git a/.github/workflows/docker-anix-api-prox.yml b/.github/workflows/docker-anix-api-prox.yml new file mode 100644 index 0000000..55da244 --- /dev/null +++ b/.github/workflows/docker-anix-api-prox.yml @@ -0,0 +1,31 @@ +name: Build and Publish 'anix-api-prox' to Docker Hub + +on: + push: + branches: + - V3 + paths: + - "api-prox/*.ts" + - "!api-prox/hooks/*" + - "!api-prox/episode/*" + - "api-prox/Dockerfile" + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Dynamically set 'tag' environment variable + run: echo "tag=$(date +'%d-%m-%Y')" >> $GITHUB_ENV + - name: Build Image + run: | + cd ./api-prox + docker build . -t radiquum/anix-api-prox:latest + docker tag radiquum/anix-api-prox:latest radiquum/anix-api-prox:${{ env.tag }} + - name: Publish Image + run: | + docker login -u radiquum -p ${{ secrets.DOCKERHUB_TOKEN }} + docker push radiquum/anix-api-prox:latest + docker push radiquum/anix-api-prox:${{ env.tag }} diff --git a/.github/workflows/docker-anix-player-parsers.yml b/.github/workflows/docker-anix-player-parsers.yml new file mode 100644 index 0000000..cec8746 --- /dev/null +++ b/.github/workflows/docker-anix-player-parsers.yml @@ -0,0 +1,29 @@ +name: Build and Publish 'anix-player-parsers' to Docker Hub + +on: + push: + branches: + - V3 + paths: + - "player-parser/*.ts" + - "player-parser/Dockerfile" + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Dynamically set 'tag' environment variable + run: echo "tag=$(date +'%d-%m-%Y')" >> $GITHUB_ENV + - name: Build Image + run: | + cd ./player-parser + docker build . -t radiquum/anix-player-parser:latest + docker tag radiquum/anix-player-parser:latest radiquum/anix-player-parser:${{ env.tag }} + - name: Publish Image + run: | + docker login -u radiquum -p ${{ secrets.DOCKERHUB_TOKEN }} + docker push radiquum/anix-player-parser:latest + docker push radiquum/anix-player-parser:${{ env.tag }} diff --git a/.github/workflows/docker-anix.yml b/.github/workflows/docker-anix.yml new file mode 100644 index 0000000..0c3b980 --- /dev/null +++ b/.github/workflows/docker-anix.yml @@ -0,0 +1,30 @@ +name: Build and Publish 'anix' to Docker Hub + +on: + push: + branches: + - V3 + paths: + - 'app/**' + - 'Dockerfile' + - 'middleware.ts' + - 'next.config.js' + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Dynamically set 'tag' environment variable + run: echo "tag=$(date +'%d-%m-%Y')" >> $GITHUB_ENV + - name: Build Image + run: | + docker build . -t radiquum/anix:latest + docker tag radiquum/anix:latest radiquum/anix:${{ env.tag }} + - name: Publish Image + run: | + docker login -u radiquum -p ${{ secrets.DOCKERHUB_TOKEN }} + docker push radiquum/anix:latest + docker push radiquum/anix:${{ env.tag }} diff --git a/DEPLOYMENT.RU.md b/DEPLOYMENT.RU.md index 78f43a3..0682f16 100644 --- a/DEPLOYMENT.RU.md +++ b/DEPLOYMENT.RU.md @@ -26,13 +26,12 @@ ![vercel import button](./docs/deploy/vercel_import.png) -5. (опционально) добавьте переменные для использования своего плеера: +5. (опционально) добавьте переменные для использования своего плеера и\или API прокси: - - NEXT_PUBLIC_KODIK_PARSER_URL - - NEXT_PUBLIC_ANILIBRIA_PARSER_URL - - NEXT_PUBLIC_SIBNET_PARSER_URL + - NEXT_PUBLIC_PLAYER_PARSER_URL + - NEXT_PUBLIC_API_URL - на те которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) + на те которые вы получили, если развёртывали [anix-player-parser](./player-parser/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md) ![vercel project settings](./docs/deploy/vercel_project.png) @@ -75,13 +74,12 @@ ![netlify project name](./docs/deploy/netlify_project_name.png) -7. (опционально) добавьте переменные для использования своего плеера: +7. (опционально) добавьте переменную для использования своего плеера и\или API прокси:: - - NEXT_PUBLIC_KODIK_PARSER_URL - - NEXT_PUBLIC_ANILIBRIA_PARSER_URL - - NEXT_PUBLIC_SIBNET_PARSER_URL + - NEXT_PUBLIC_PLAYER_PARSER_URL + - NEXT_PUBLIC_API_URL - на те которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md) + на те которые вы получили, если развёртывали [anix-player-parser](./player-parser/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md) 1. ![alt text](./docs/deploy/netlify_env_1.png) @@ -124,7 +122,7 @@ - -p - порт контейнера который будет доступен извне. ПОРТ:3000 > [!NOTE] -> для переменных которые вы получили, если развёртывали [anix-player-parsers](./player-parsers/README.RU.md), необходимо использовать `-e ПЕРЕМЕННАЯ=ЗНАЧЕНИЕ` до слова anix +> для переменных которые вы получили, если развёртывали [anix-player-parser](./player-parser/README.RU.md) и/или [anix-api-prox](./api-prox/README.RU.md), необходимо использовать `-e ПЕРЕМЕННАЯ=ЗНАЧЕНИЕ` до последнего слова anix [команда docker run](https://docs.docker.com/reference/cli/docker/container/run/) @@ -154,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-parser](./player-parser/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 f7ae21b..3d247de 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -26,13 +26,12 @@ Requirements: ![vercel import button](./docs/deploy/vercel_import.png) -5. (optional) Add variables to use your own player: +5. (optional) Add variable to use your own player and/or api-proxy: - - NEXT_PUBLIC_KODIK_PARSER_URL - - NEXT_PUBLIC_ANILIBRIA_PARSER_URL - - NEXT_PUBLIC_SIBNET_PARSER_URL + - 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-parser](./player-parser/README.md) and/or [anix-api-prox](./api-prox/README.md) ![vercel project settings](./docs/deploy/vercel_project.png) @@ -75,13 +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_KODIK_PARSER_URL - - NEXT_PUBLIC_ANILIBRIA_PARSER_URL - - NEXT_PUBLIC_SIBNET_PARSER_URL + - 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-parser](./player-parser/README.md) and/or [anix-api-prox](./api-prox/README.md) 1. ![alt text](./docs/deploy/netlify_env_1.png) @@ -124,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 word anix +> For variables you received if you deployed [anix-player-parser](./player-parser/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/) @@ -154,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-parser](./player-parser/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/api-prox/.dockerignore b/api-prox/.dockerignore new file mode 100644 index 0000000..5e7b2f7 --- /dev/null +++ b/api-prox/.dockerignore @@ -0,0 +1,5 @@ +episode +hooks +node_modules +README.md +README.RU.md \ No newline at end of file diff --git a/api-prox/Dockerfile b/api-prox/Dockerfile new file mode 100644 index 0000000..de0c3a1 --- /dev/null +++ b/api-prox/Dockerfile @@ -0,0 +1,17 @@ +FROM node:23-alpine + +LABEL org.opencontainers.image.source=https://github.com/radiquum/anix + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY *.ts ./ +COPY tsconfig.json ./ + +RUN mkdir -p /app/hooks + +EXPOSE 7001 + +CMD ["npm", "run", "serve"] \ No newline at end of file diff --git a/api-prox/README.RU.md b/api-prox/README.RU.md new file mode 100644 index 0000000..079c711 --- /dev/null +++ b/api-prox/README.RU.md @@ -0,0 +1,111 @@ +# AniX - Api Proxy + +Данный под-проект позволяет проксировать запросы к API Anixart и изменять их ответы с помощью хуков + +Он может использоваться как для основного проекта AniX, так и как отдельный сервис для андроид приложения с изменённой ссылкой на API. + +Лицензия: [MIT](../LICENSE) + +## Доступные хуки + +- release.ts: добавляет рейтинг с shikimori в строку доп. информации +- profile.example.ts: меняет ник официального аккаунта anixart (пример работы с хуком) +- profile.sponsor.ts: включает спонсорку (отключает рекламу) после входа в аккаунт в android приложении +- toggles.ts: заменяет ответ конфигурации, если присутствует переменная окружения `HOST_URL` заменяет ссылку веб плеера, на встроенную, при совместном использовании с переменной окружения `PLAYER_PARSER_URL`, включает собственный веб-плеер, как в веб клиенте AniX +- episode.disabled.ts: позволяет изменять/добавлять озвучки, источники и эпизоды с помощью файла json, в папке `episode`. + +## Использование + +В строке веб-браузера необходимо ввести: + +`://<:port>/[?]` + +Ответ: + +- 500: произошла ошибка, подробнее в строке `reason` в теле ответа +- 200: запрос прошёл успешно (если произошла ошибка на стороне API Anixart, смотри строку `code`) + +## Развёртывание + +### Docker + +Требования: + +- [docker](https://docs.docker.com/engine/install/) + +### Пре-билд + +1. выполните команду: + +`docker run -d --name anix-api -p 7001:7001 radiquum/anix-api-prox:latest` + +для использования хуков необходимо создать папку `hooks` и добавить флаг `-v ./hooks:/app/hooks` перед флагом `-p`. +(так-же и для папки `episode`, если требуется) + +### Ручной билд + +Доп. Требования: + +- [git](https://git-scm.com/) + +1. Клонируйте репозиторий `git clone https://github.com/Radiquum/AniX` +2. Переместитесь в директорию репозитория `cd AniX` +3. Переместитесь в директорию сервиса `cd api-prox` +4. Выполните команду `docker build -t anix-api-prox .` +5. После окончания, выполните команду: `docker run -d --restart always --name anix-player -p 7001:7001 anix-api-prox` + +для использования хуков необходимо добавить флаг `-v ./hooks:/app/hooks` перед флагом `-p`. +(так-же и для папки `episode`, если требуется) + +### docker/Обозначения + +- -d - запустить контейнер в фоне +- --restart always - всегда запускать после перезагрузки сервера +- --name - название контейнера +- -p - порт контейнера который будет доступен извне. ПОРТ:7000 +- -v - добавить папку с хоста в контейнер + +### docker/После развёртывания + +Сервис будет доступен по адресу: `http://<ВАШ IP><:ВАШ ПОРТ>/` + +### docker/Примечание + +Для использования своего домена и поддержки протокола HTTPS, вы можете использовать Traefik или другой reverse-proxy, с сертификатом SSL. + +Полезные ссылки: + +- [Конвертер из команды docker run в синтакс для docker compose](https://it-tools.tech/docker-run-to-docker-compose-converter) +- [Как настроить Traefik + свой домен + SSL](https://letmegooglethat.com/?q=how+to+setup+traefik+with+custom+domain+and+ssl+certificate+from+lets+encrypt%3F) + +### pm2 + +Требования: + +- [git](https://git-scm.com/) +- [nodejs 23+ с npm](http://nodejs.org/) +- [pm2](https://pm2.keymetrics.io/) + +Инструкция: + +1. Клонируйте репозиторий `git clone https://github.com/Radiquum/AniX` +2. Переместитесь в директорию репозитория `cd AniX` +3. Переместитесь в директорию сервиса `cd api-prox` +4. Выполните команду `npm install` +5. После окончания и выполните команду `pm2 start index.ts -n anix-api-prox` + +### pm2/Обозначения + +- -n - название сервиса в pm2 + +### pm2/После развёртывания + +Сервис будет доступен по адресу: `http://<ВАШ IP>:7001/` + +### pm2/Примечание + +Для автоматического запуска приложения, рекомендуется настроить pm2 на автозапуск, с помощью команды: `pm2 startup` + +Полезные ссылки: + +- [PM2: подходим к вопросу процесс-менеджмента с умом @ Habr](https://habr.com/ru/articles/480670/) diff --git a/api-prox/README.md b/api-prox/README.md new file mode 100644 index 0000000..20ae469 --- /dev/null +++ b/api-prox/README.md @@ -0,0 +1,112 @@ + +# AniX - Api Proxy + +This sub-project allows proxying requests to the Anixart API and modifying their responses using hooks. + +It can be used both for the main AniX project and as a standalone service for the Android app with a modified API link. + +License: [MIT](../LICENSE) + +## Available Hooks + +- release.ts: adds a rating from Shikimori to the additional info line +- profile.example.ts: changes the nickname of the official Anixart account (an example of using a hook) +- profile.sponsor.ts: enables sponsorship (disables ads) after logging into the account in the Android app +- toggles.ts: replaces the configuration response; if the `HOST_URL` environment variable is present, it replaces the web player link with an embedded one; when used together with the `PLAYER_PARSER_URL` variable, enables the custom web player, as in the AniX web client +- episode.disabled.ts: allows modifying/adding voiceovers, sources, and episodes using a JSON file in the `episode` folder. + +## Usage + +In the web browser address bar, enter: + +`://<:port>/[?]` + +Response: + +- 500: an error occurred, see the `reason` field in the response body for more details +- 200: request was successful (if there was an error on the Anixart API side, see the `code` field) + +## Deployment + +### Docker + +Requirements: + +- [docker](https://docs.docker.com/engine/install/) + +### Pre-built + +1. Run the command: + +`docker run -d --name anix-api -p 7001:7001 radiquum/anix-api-prox:latest` + +To use hooks, create a `hooks` folder and add the flag `-v ./hooks:/app/hooks` before the `-p` flag. +(The same applies to the `episode` folder if needed) + +### Manual Build + +Additional Requirements: + +- [git](https://git-scm.com/) + +1. Clone the repository: `git clone https://github.com/Radiquum/AniX` +2. Navigate to the repository directory: `cd AniX` +3. Navigate to the service directory: `cd api-prox` +4. Run the command: `docker build -t anix-api-prox .` +5. After completion, run: `docker run -d --restart always --name anix-player -p 7001:7001 anix-api-prox` + +To use hooks, add the flag `-v ./hooks:/app/hooks` before the `-p` flag. +(The same applies to the `episode` folder if needed) + +### docker/Flags + +- -d - run the container in background +- --restart always - always start after server reboot +- --name - container name +- -p - container port that will be accessible from outside. PORT:7000 +- -v - mount a folder from host into the container + +### docker/After Deployment + +The service will be available at: `http://<:YOUR PORT>/` + +### docker/Note + +To use your own domain and support HTTPS, you can use Traefik or another reverse proxy with an SSL certificate. + +Useful links: + +- [Converter from docker run command to docker compose syntax](https://it-tools.tech/docker-run-to-docker-compose-converter) +- [How to setup Traefik + custom domain + SSL](https://letmegooglethat.com/?q=how+to+setup+traefik+with+custom+domain+and+ssl+certificate+from+lets+encrypt%3F) + +### pm2 + +Requirements: + +- [git](https://git-scm.com/) +- [nodejs 23+ with npm](http://nodejs.org/) +- [pm2](https://pm2.keymetrics.io/) + +Instructions: + +1. Clone the repository: `git clone https://github.com/Radiquum/AniX` +2. Navigate to the repository directory: `cd AniX` +3. Navigate to the service directory: `cd api-prox` +4. Run: `npm install` +5. After completion, run: `pm2 start index.ts -n anix-api-prox` + +### pm2/Flags + +- -n - service name in pm2 + +### pm2/After Deployment + +The service will be available at: `http://:7001/` + +### pm2/Note + +For automatic app startup, it is recommended to set up pm2 autostart using the command: `pm2 startup` + +Useful links: + +- [PM2: a smart approach to process management @ Habr](https://habr.com/ru/articles/480670/) diff --git a/api-prox/episode/841.example.json b/api-prox/episode/841.example.json new file mode 100644 index 0000000..ac3e51b --- /dev/null +++ b/api-prox/episode/841.example.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://gist.githubusercontent.com/Radiquum/7f33c09be293233b831c841b69f24608/raw/anix-api-prox-custom-episode-schema.json", + "comment": [ + "пример для добавления и изменения озвучек, источников и эпизодов", + "для аниме Initial D - First Stage, ID: 841", + "кстати раздел 'comment' совсем не нужен, так что это буквально коммент" + ], + "types": [ + { + "id": 1, + "name": "NyaniDUB (Заменено с AniDub)", + "sources": [ + { + "id": 1, + "name": "Sibnet", + "episodes": [ + { + "position": 0, + "name": "Первая серия" + } + ] + } + ] + }, + { + "id": 999, + "name": "By Blender Foundation", + "icon": "https://download.blender.org/branding/community/blender_community_badge_white.png", + "episodes_count": 2, + "sources": [ + { + "id": 998, + "name": "Public Test Videos", + "episodes_count": 2, + "episodes": [ + { + "position": 1, + "name": "Big Buck Bunny", + "url": "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", + "is_filler": true + }, + { + "position": 2, + "name": "Elephant Dream", + "url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", + "is_filler": true + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/api-prox/hooks/episode.disabled.ts b/api-prox/hooks/episode.disabled.ts new file mode 100644 index 0000000..b483741 --- /dev/null +++ b/api-prox/hooks/episode.disabled.ts @@ -0,0 +1,297 @@ +// хук добавляет ссылки на кастомные источники +// а так-же позволяет добавлять собственные озвучки +// с помощью json (/episode/.json) +// пример находится в файле 841.example.json в папке episode +// +// сами видео файлы эпизодов необходимо хостить отдельно (например с помощью nginx), +// хуку требуется переменная среды HOST_URL, которая ведёт на сервис api-prox + +import { logger } from "../shared"; +import fs from "fs/promises"; + +let HOSTNAME: null | string = null; +if (process.env.HOST_URL) { + HOSTNAME = process.env.HOST_URL; +} + +export function match(path: string): boolean { + // если не установлен хост, не запускаем хук + if (!HOSTNAME) return false; + // используем только страницы с путём /episode/* + const pathRe = /^\/episode\/\d+/; + if (pathRe.test(path)) return true; + return false; +} + +export interface VoiceoverInfo { + "@id": number; + id: number; + name: string; + icon: null | string; + workers: null | string; + is_sub: boolean; + episodes_count: number; + view_count: number; + pinned: boolean; +} + +export interface SourceInfo { + "@id": number; + id: number; + type: number | VoiceoverInfo; + name: string; + episodes_count: number; +} + +export interface EpisodeInfo { + "@id": number; + position: number; + release: number | any; + source: number | SourceInfo; + name: null | string; + url: string; + iframe: boolean; + addedDate: number; + is_filler: boolean; + is_watched: boolean; +} + +export async function get(data: any, url: URL) { + const base = "./episode"; + + let releaseId = null; + let voiceOverId = null; + let sourceId = null; + let info: any = null; + + const path = url.pathname.split("/").filter((item) => { + return !["", "episode"].includes(item); + }); + + logger.consoleHook("debug", `Received request for:`, url.pathname); + logger.consoleHook("debug", `Decoded pathname:`, path); + + releaseId = Number(path[0]); + voiceOverId = Number(path[1]); + sourceId = Number(path[2]); + logger.consoleHook("debug", `Release ID:`, releaseId); + logger.consoleHook("debug", `Voiceover ID:`, voiceOverId); + logger.consoleHook("debug", `Source ID:`, sourceId); + + try { + info = JSON.parse( + await fs.readFile(`${base}/${releaseId}.json`, { + encoding: "utf8", + }) + ); + } catch { + return data; + } + + if (path.length == 1) { + if (!info || !data.hasOwnProperty("types")) { + return data; + } + + for (let i = 0; i < info.types.length; i++) { + const type: VoiceoverInfo = info.types[i]; + const existingType: VoiceoverInfo = data.types.find( + (item: VoiceoverInfo) => item.id == type.id + ); + + if (existingType) { + type.name ? (existingType.name = type.name) : null; + type.icon ? (existingType.icon = type.icon) : null; + type.workers ? (existingType.workers = type.workers) : ""; + type.is_sub ? (existingType.is_sub = type.is_sub) : null; + type.episodes_count ? + (existingType.episodes_count = type.episodes_count) + : null; + } else { + data.types = [ + ...data.types, + { + "@id": data.types.length + 1, + id: type.id, + name: type.name || "Неизвестная Озвучка", + icon: type.icon || "", + workers: type.workers || "", + is_sub: type.is_sub || false, + episodes_count: type.episodes_count || 0, + view_count: 0, + pinned: false, + }, + ]; + } + } + } + + if (path.length == 2) { + if (!info || !data.hasOwnProperty("sources")) { + return data; + } + + const apiResponse = await fetch(`${HOSTNAME}/episode/${releaseId}`); + if (!apiResponse.ok) { + return data; + } + const types = await apiResponse.json(); + const type: VoiceoverInfo = types.types.find( + (item: VoiceoverInfo) => item.id == voiceOverId + ); + type["@id"] = 2; + type.episodes_count = 0; + type.view_count = 0; + + if (data.sources.length > 0) { + data.sources[0].type = type; + } + + const sources = info.types.find( + (item: VoiceoverInfo) => item.id == type.id + ); + if (!sources || !sources.sources || sources.sources.length == 0) { + return data; + } + + for (let i = 0; i < sources.sources.length; i++) { + const source: SourceInfo = sources.sources[i]; + const existingSource: SourceInfo = data.sources.find( + (item: SourceInfo) => item.id == source.id + ); + + if (existingSource) { + source.name ? (existingSource.name = source.name) : null; + source.episodes_count ? + (existingSource.episodes_count = source.episodes_count) + : null; + } else { + data.sources = [ + ...data.sources, + { + "@id": data.sources.length == 0 ? 1 : 2 + data.sources.length, + id: source.id, + type: data.sources.length > 0 ? 2 : type, + name: source.name || "Неизвестный Источник", + episodes_count: source.episodes_count || 0, + }, + ]; + } + } + } + + if (path.length == 3) { + if (!info || !data.hasOwnProperty("episodes")) { + return data; + } + + const apiSourceResponse = await fetch( + `${HOSTNAME}/episode/${releaseId}/${voiceOverId}` + ); + if (!apiSourceResponse.ok) { + return data; + } + const sources = await apiSourceResponse.json(); + const source = sources.sources.find( + (item: SourceInfo) => item.id == sourceId + ); + + source["@id"] = 3; + if (isNaN(source.type["@id"])) { + source.type = sources.sources[0].type; + } + source.type["@id"] = 4; + + const apiReleaseResponse = await fetch(`${HOSTNAME}/release/${releaseId}`); + if (!apiReleaseResponse.ok) { + return data; + } + const release = await apiReleaseResponse.json(); + release.release["@id"] = 2; + release.release.screenshots = []; + release.release.comments = []; + release.release.screenshot_images = []; + release.release.related_releases = []; + release.release.recommended_releases = []; + release.release.video_banners = []; + release.release.your_vote = 0; + release.release.related_count = 0; + release.release.comment_count = 0; + release.release.comments_count = 0; + release.release.collection_count = 0; + release.release.profile_list_status = 0; + + if (data.episodes.length > 0) { + data.episodes[0].release = release.release; + data.episodes[0].source = source; + data.episodes[0].source.episodes_count = 0; + data.episodes[0].source.type.workers ? + null + : (data.episodes[0].source.type.workers = ""); + } + + const ctypes = info.types; + if (!ctypes || ctypes.length == 0) return data; + const ctype = info.types.find( + (item: VoiceoverInfo) => item.id == voiceOverId + ); + if (!ctype) return data; + const csource = ctype.sources.find( + (item: SourceInfo) => item.id == sourceId + ); + if (!csource || !csource.episodes) return data; + const episodes = csource.episodes; + if (!episodes || episodes.length == 0) return data; + + if ( + data.episodes && + data.episodes.length > 0 && + data.episodes[0].source && + data.episodes[0].source.name == "Sibnet" + ) { + data.episodes.forEach((item: EpisodeInfo, index: number) => { + item.name ? null : ( + (data.episodes[index].name = `${item.position + 1} серия`) + ); + }); + } + + for (let i = 0; i < episodes.length; i++) { + const episode: EpisodeInfo = episodes[i]; + const existingEpisode: EpisodeInfo = data.episodes.find( + (item: EpisodeInfo) => item.position == episode.position + ); + + if (existingEpisode) { + episode.position ? (existingEpisode.position = episode.position) : null; + episode.name ? (existingEpisode.name = episode.name) : null; + episode.url ? (existingEpisode.url = episode.url) : null; + episode.iframe !== undefined ? + (existingEpisode.iframe = episode.iframe) + : null; + episode.is_filler !== undefined ? + (existingEpisode.is_filler = episode.is_filler) + : null; + } else { + data.episodes = [ + ...data.episodes, + { + "@id": data.episodes.length == 0 ? 1 : 4 + data.episodes.length, + position: episode.position || data.episodes.length, + release: data.episodes.length > 0 ? 2 : release.release, + source: data.episodes.length > 0 ? 3 : source, + name: episode.name || "Неизвестная Серия", + url: episode.url || "", + iframe: episode.iframe !== undefined ? episode.iframe : true, + addedDate: 0, + is_filler: + episode.is_filler !== undefined ? episode.is_filler : false, + is_watched: false, + }, + ]; + } + } + } + + return data; +} diff --git a/api-prox/hooks/profile.example.ts b/api-prox/hooks/profile.example.ts new file mode 100644 index 0000000..25aa201 --- /dev/null +++ b/api-prox/hooks/profile.example.ts @@ -0,0 +1,28 @@ +// хук меняет юзернейм 'Anixart' на 'Anixartiki' + +import { logger } from "../shared"; + +export function match(path: string): boolean { + // id профиля 1, это профиль Anixart (разработчиков) + if (path == "/profile/1") return true; + return false; +} + +export async function get(data: any, url: URL) { + const newUname = "Anixartiki"; + + // проверяем что есть поле 'profile' и оно не равно 'null', что значит что мы получили данные с апи и можно двигаться дальше + // иначе возвращаем оригинальные данные + if (!data.hasOwnProperty("profile") || !data.profile) return data; + + // выводим сообщение в лог, если уровень логгера 'debug' + logger.debugHook( + `Changed username of '${data["profile"]["login"]}' (${data["profile"]["id"]}) to ${newUname}` + ); + + // меняем поле на новый юзернейм + data["profile"]["login"] = newUname; + + // возвращаем изменённые данные + return data; +} diff --git a/api-prox/hooks/profile.sponsor.ts b/api-prox/hooks/profile.sponsor.ts new file mode 100644 index 0000000..f87ad0d --- /dev/null +++ b/api-prox/hooks/profile.sponsor.ts @@ -0,0 +1,12 @@ +// хук включает "вечную" спонсорку, отключая рекламу после входа в профиль, в официальном приложении + +export function match(path: string): boolean { + if (path == "/profile/info") return true; + return false; +} + +export async function get(data: any, url: URL) { + data["is_sponsor"] = true; + data["sponsorship_expires"] = 2147483647; + return data; +} diff --git a/api-prox/hooks/release.ts b/api-prox/hooks/release.ts new file mode 100644 index 0000000..a9a8b28 --- /dev/null +++ b/api-prox/hooks/release.ts @@ -0,0 +1,82 @@ +// хук добавляет рейтинг шикимори в поле note релиза + +export function match(path: string): boolean { + // используем только страницы с путём /release/ + const pathRe = /\/release\/\d+/; + if (pathRe.test(path)) return true; + return false; +} + +const timeout = 5000; // таймаут запроса к внешнему апи на 5 секунд + +async function fetchShikiRating(title: string) { + try { + // ищём аниме на шикимори по названию, т.к. ид аниме аниксарт и шикимори разные и нет никакого референса друг на друга + const shikiIdRes = await fetch( + `https://shikimori.one/api/animes?search=${title}`, + { signal: AbortSignal.timeout(timeout) } + ); + if (!shikiIdRes.ok) throw new Error(); // если при поиске произошла ошибка, то возвращаем null + + const shikiIdJson = await shikiIdRes.json(); + if (shikiIdJson.length == 0) throw new Error(); // если нет результатов, то возвращаем null + + // берём ид от первого результата + const shikiId = shikiIdJson[0]["id"]; + + // повторяем процесс, уже с ид от шикимори + const shikiAnimRes = await fetch( + `https://shikimori.one/api/animes/${shikiId}`, + { signal: AbortSignal.timeout(timeout) } + ); + if (!shikiAnimRes.ok) throw new Error(); // если при произошла ошибка, то возвращаем null + const shikiAnimJson = await shikiAnimRes.json(); + + // возвращаем рейтинг + return Number(shikiAnimJson.score); + } catch { + return null; + } +} + +async function fetchMALRating(title: string) { + try { + // ищём аниме на MAL по названию, через API Jikan, т.к. ид аниме аниксарт и шикимори разные и нет никакого референса друг на друга + const malRes = await fetch(`https://api.jikan.moe/v4/anime?q=${title}`, { + signal: AbortSignal.timeout(timeout), + }); + if (!malRes.ok) throw new Error(); // если при поиске произошла ошибка, то возвращаем null + + const malJson = await malRes.json(); + if (malJson.data.length == 0) throw new Error(); // если нет результатов, то возвращаем null + // возвращаем рейтинг от первого результата + return Number(malJson.data[0].score); + } catch { + return null; + } +} + +export async function get(data: any, url: URL) { + // проверяем что есть поле 'release' + // иначе возвращаем оригинальные данные + if (!data.hasOwnProperty("release")) return data; + + const shikimoriRating = await fetchShikiRating( + data["release"]["title_original"] + ); + const malRating = await fetchMALRating(data["release"]["title_original"]); + + // пушим строки в список, что-бы было легче их объединить + const noteBuilder = []; + if (data["release"]["note"]) noteBuilder.push(`${data.release.note}`); // первым добавляем оригинальное значение примечания, если оно есть + data["release"]["note"] && + (shikimoriRating || malRating) && + noteBuilder.push("------"); // добавляем разделитель, если есть рейтинг и оригинальное примечание + shikimoriRating && + noteBuilder.push(`Рейтинг Shikimori: ${shikimoriRating}★`); // добавляем рейтинг от шикимори + malRating && noteBuilder.push(`Рейтинг My Anime List: ${malRating}★`); // добавляем рейтинг от MAL + data["release"]["note"] = noteBuilder.join("
"); // заменяем оригинальное поле нашей строкой + + // возвращаем изменённые данные + return data; +} diff --git a/api-prox/hooks/toggles.ts b/api-prox/hooks/toggles.ts new file mode 100644 index 0000000..175dffd --- /dev/null +++ b/api-prox/hooks/toggles.ts @@ -0,0 +1,76 @@ +// хук изменяет ответ config/toggles + +export interface Toggles { + minVersionCode: number; + lastVersionCode: number; + whatsNew: string; + downloadLink: string; + minGPVersionCode: number; + lastGPVersionCode: number; + gpWhatsNew: string; + gpDownloadLink: string; + overrideGPVersion: boolean; + inAppUpdates: boolean; + inAppUpdatesImmediate: boolean; + inAppUpdatesFlexibleDelay: number; + impMessageEnabled: boolean; + impMessageText: string; + impMessageBackgroundColor: string; + impMessageTextColor: string; + impMessageLink: string; + adBannerBlockId: string; + adBannerSizeType: number; + adInterstitialBlockId: string; + adBannerDelay: number; + adInterstitialDelay: number; + kodikVideoLinksUrl: string; + kodikIframeAd: boolean; + sibnetRandUserAgent: boolean; + sibnetUserAgent: string; + torlookUrl: string; + baseUrl: string; + apiUrl: string; + apiAltUrl: string; + apiAltAvailable: boolean; + iframeEmbedUrl: string; + kodikAdIframeUrl: string; + sponsorshipPromotion: boolean; + sponsorshipText: string; + sponsorshipAvailable: boolean; + pageNoConnectionUrl: string; + snowfall: boolean; + searchBarIconUrl: string; + searchBarIconTint: string; + searchBarIconAction: string; + searchBarIconValue: string; + min_blog_create_rating_score: number; +} + +export function match(path: string): boolean { + if (path == "/config/toggles") return true; + return false; +} + +export async function get(data: Toggles, url: URL) { + data.lastVersionCode = 25062200; + + data.impMessageEnabled = true; + data.impMessageText = "разработчик AniX / Api-Prox-Service"; + data.impMessageLink = "https://wah.su/radiquum"; + data.impMessageBackgroundColor = "ffb3d0"; + data.impMessageTextColor = "ffffff"; + + data.apiAltAvailable = false; + data.apiAltUrl = ""; + + data.sponsorshipAvailable = false; + data.sponsorshipPromotion = false; + data.kodikIframeAd = false; + data.kodikAdIframeUrl = ""; + + if (process.env.HOST_URL) { + data.iframeEmbedUrl = `${process.env.HOST_URL}/player?url=`; + } + + return data; +} diff --git a/api-prox/iframe.ts b/api-prox/iframe.ts new file mode 100644 index 0000000..b8d9d9e --- /dev/null +++ b/api-prox/iframe.ts @@ -0,0 +1,14 @@ +export const Iframe = (url: string) => { + return ` + + + + Веб-плеер + + + + + + + ` +} diff --git a/api-prox/index.ts b/api-prox/index.ts new file mode 100644 index 0000000..2d98944 --- /dev/null +++ b/api-prox/index.ts @@ -0,0 +1,366 @@ +import { + ANIXART_API, + ANIXART_HEADERS, + ANIXART_HEADERST, + asJSON, + GetHook, + logger, + PostHook, +} from "./shared"; +import express from "express"; +import fs from "fs/promises"; +import { MediaChromeTheme } from "./media-chrome"; +import { Iframe } from "./iframe"; + +const app = express(); +app.use(function (req, res, next) { + res.header("Access-Control-Allow-Origin", req.headers.origin || "*"); + res.header( + "Access-Control-Allow-Headers", + "Origin, X-Requested-With, Content-Type, Accept, Sign" + ); + res.header("Access-Control-Allow-Methods", "GET,HEAD,POST,OPTIONS"); + next(); +}); +app.use( + express.raw({ inflate: true, limit: "50mb", type: "multipart/form-data" }) +); +app.use(express.json()); +app.use(express.urlencoded({ extended: true })); + +const HOST = process.env.HOST || "0.0.0.0"; +const PORT = 7001; + +let hooks: string[] = []; + +async function loadHooks() { + let hooksDir: string[] = []; + try { + hooksDir = await fs.readdir("./hooks"); + } catch (err) { + logger.error("'hooks' directory not found"); + } + + for (let i = 0; i < hooksDir.length; i++) { + const name = hooksDir[i]; + if ( + !name.endsWith(".ts") || + name.includes("example") || + name.includes("disabled") + ) + continue; + + require(`./hooks/${name}`); + logger.infoHook(`Loaded "./hooks/${name}"`); + hooks.push(name); + + (async () => { + try { + const watcher = fs.watch(`./hooks/${name}`); + for await (const event of watcher) { + if (event.eventType === "change") { + logger.infoHook(`Updated "./hooks/${event.filename}"`); + delete require.cache[require.resolve(`./hooks/${event.filename}`)]; + require(`./hooks/${event.filename}`); + } + } + } catch (err) { + throw err; + } + })(); + } +} + +app.get("/player", async (req, res) => { + let url = req.query.url || null; + + res.status(200); + res.set({ + "Access-Control-Allow-Origin": req.headers.origin || "*", + "Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS", + "Cache-Control": "no-cache", + "Content-Type": "text/html; charset=utf-8", + }); + if (!url) { + res.send("

No url query found!

"); + return; + } + + let player = ""; + let poster = ""; + + const CUSTOM_PLAYER_DOMAINS = [ + "video.sibnet.ru", + "anixart.libria.fun", + "kodik.info", + "aniqit.com", + "kodik.cc", + "kodik.biz", + ]; + const urlDomain = new URL(url.toString()); + const PLAYER_PARSER_URL = process.env.PLAYER_PARSER_URL || null; + + if (CUSTOM_PLAYER_DOMAINS.includes(urlDomain.hostname)) { + try { + if (!PLAYER_PARSER_URL) throw new Error(); + + if ( + ["kodik.info", "aniqit.com", "kodik.cc", "kodik.biz"].includes( + urlDomain.hostname + ) + ) { + player = "kodik"; + } + if ("anixart.libria.fun" == urlDomain.hostname) { + player = "libria"; + } + if ("video.sibnet.ru" == urlDomain.hostname) { + player = "sibnet"; + } + + const playerParserRes = await fetch( + `${PLAYER_PARSER_URL}?url=${encodeURIComponent(url.toString())}&player=${player}` + ); + + if (!playerParserRes.ok) throw new Error(); + + const playerParserData: { manifest: string; poster: string } = + await playerParserRes.json(); + + poster = playerParserData.poster; + if (playerParserData.manifest.startsWith("#EXTM3U")) { + const playerUrlArray = playerParserData.manifest.split("\n"); + url = playerUrlArray.join("\\n"); + } else { + url = playerParserData.manifest; + } + } catch { + res.send(Iframe(url.toString())); + return; + } + } else if (url.toString().toLowerCase().endsWith("mp4")) { + player = "mp4"; + } else if (url.toString().toLowerCase().endsWith(".m3u8")) { + player = "hls"; + } else { + res.send(Iframe(url.toString())); + return; + } + + res.send(` + + + + Веб-плеер + + + ${["kodik", "libria", "hls"].includes(player) ? '' : ""} + + + + + ${MediaChromeTheme()} + + + ${ + ["kodik", "libria", "hls"].includes(player) ? + `` + : `` + } + + + + `); +}); + +app.get("/*path", async (req, res) => { + if (req.path == "/favicon.ico") return asJSON(req, res, {}, 404); + + const url = new URL(`${ANIXART_API}${req.url}`); + logger.debug( + `[${req.method}] ${url.protocol}//${url.hostname}${url.pathname}` + ); + // logger.debug(` ↳ [QUERY] ${url.searchParams.toString()}`); + + if ( + url.searchParams.get("API-Version") == "v2" || + req.headers["api-version"] == "v2" + ) { + // logger.debug(` ↳ Force API V2`); + ANIXART_HEADERS["Api-Version"] = "v2"; + url.searchParams.delete("API-Version"); + } + + const apiResponse = await fetch(url.toString(), { + method: "GET", + headers: ANIXART_HEADERS, + }); + + if ( + !apiResponse || + !apiResponse.ok || + apiResponse.headers.get("content-type") != "application/json" + ) { + logger.error( + `Failed to fetch: '${url.protocol}//${url.hostname}${url.pathname}', Path probably doesn't exist` + ); + asJSON( + req, + res, + { + code: 99, + returned_value: { + request_status: apiResponse ? apiResponse.status : null, + request_content_type: + apiResponse ? apiResponse.headers.get("content-type") : null, + }, + reason: "Path probably doesn't exist", + }, + 500 + ); + return; + } + + let data = await apiResponse.json(); + for (let i = 0; i < hooks.length; i++) { + const name = hooks[i]; + const hook: GetHook = require(`./hooks/${name}`); + if (!hook.hasOwnProperty("match") || !hook.hasOwnProperty("get")) continue; + if (!hook.match(req.path)) continue; + data = await hook.get(data, url); + } + + asJSON(req, res, data, 200); + return; +}); + +app.post("/*path", async (req, res) => { + const url = new URL(`${ANIXART_API}${req.url}`); + logger.debug( + `[${req.method}] ${url.protocol}//${url.hostname}${url.pathname}` + ); + // logger.debug(` ↳ [QUERY] ${url.searchParams.toString()}`); + + let reqContentType = + req.headers["content-type"] ? + req.headers["content-type"].split(";")[0] + : "x-unknown/unknown"; + + const supportedContentTypes = [ + "application/json", + "application/x-www-form-urlencoded", + "multipart/form-data", + ]; + + const isSupported = supportedContentTypes.includes( + reqContentType.toLowerCase() + ); + + if (!isSupported) { + res.status(500).json({ + code: 99, + error: "Unsupported Media Type", + reason: `Content-Type '${reqContentType}' is not supported.`, + }); + return; + } + + let apiResponse: null | Response = null; + const apiHeaders: ANIXART_HEADERST = { + "User-Agent": ANIXART_HEADERS["User-Agent"], + "Content-Type": req.headers["content-type"] || "application/json" + }; + + if ( + url.searchParams.get("API-Version") == "v2" || + req.headers["api-version"] == "v2" + ) { + // logger.debug(` ↳ Force API V2`); + apiHeaders["Api-Version"] = "v2"; + url.searchParams.delete("API-Version"); + } + + switch (reqContentType) { + case "multipart/form-data": + apiResponse = await fetch(url.toString(), { + method: "POST", + headers: apiHeaders, + body: req.body, + }); + break; + case "application/x-www-form-urlencoded": + apiResponse = await fetch(url.toString(), { + method: "POST", + headers: apiHeaders, + body: new URLSearchParams(req.body), + }); + break; + case "application/json": + apiResponse = await fetch(url.toString(), { + method: "POST", + headers: apiHeaders, + body: JSON.stringify(req.body), + }); + break; + } + + if ( + !apiResponse || + !apiResponse.ok || + apiResponse.headers.get("content-type") != "application/json" + ) { + logger.error( + `Failed to post: '${url.protocol}//${url.hostname}${url.pathname}', Path probably doesn't exist` + ); + asJSON( + req, + res, + { + code: 99, + returned_value: { + request_status: apiResponse ? apiResponse.status : null, + request_content_type: + apiResponse ? apiResponse.headers.get("content-type") : null, + }, + reason: "Path probably doesn't exist", + }, + 500 + ); + return; + } + + let data = await apiResponse.json(); + for (let i = 0; i < hooks.length; i++) { + const name = hooks[i]; + const hook: PostHook = require(`./hooks/${name}`); + if (!hook.hasOwnProperty("match") || !hook.hasOwnProperty("post")) continue; + if (!hook.match(req.path)) continue; + data = await hook.post(data, url); + } + + asJSON(req, res, data, 200); + return; +}); + +app.listen(PORT, HOST, function () { + loadHooks(); + logger.info(`Server listen: http://${HOST}:${PORT}`); +}); diff --git a/api-prox/media-chrome.ts b/api-prox/media-chrome.ts new file mode 100644 index 0000000..a0c1a7f --- /dev/null +++ b/api-prox/media-chrome.ts @@ -0,0 +1,813 @@ +export const MediaChromeTheme = () => { + return ` + + + + + +` +} \ No newline at end of file diff --git a/api-prox/package-lock.json b/api-prox/package-lock.json new file mode 100644 index 0000000..cf52db9 --- /dev/null +++ b/api-prox/package-lock.json @@ -0,0 +1,1453 @@ +{ + "name": "anix-api-proxy", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "anix-api-proxy", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "express": "^5.1.0", + "tsx": "^4.20.3" + }, + "devDependencies": { + "@types/express": "^5.0.3", + "@types/node": "^24.0.4", + "typescript": "^5.8.3" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", + "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.3.tgz", + "integrity": "sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.6.tgz", + "integrity": "sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", + "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.0.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.4.tgz", + "integrity": "sha512-ulyqAkrhnuNq9pB76DRBTkcS6YsmDALy6Ua63V8OhrOBgbcYt6IOdzpw5P1+dyRIyMerzLkeYWBeOXPpA9GMAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.8.0" + } + }, + "node_modules/@types/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "0.17.5", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.5.tgz", + "integrity": "sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.8", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.8.tgz", + "integrity": "sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-tsconfig": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-errors/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", + "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz", + "integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.6.3", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tsx": { + "version": "4.20.3", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.3.tgz", + "integrity": "sha512-qjbnuR9Tr+FJOMBqJCW5ehvIo/buZq7vH7qD7JziU98h6l3qGy0a/yPFjwO+y0/T7GFpNgNAvEcPPVfyT8rrPQ==", + "license": "MIT", + "dependencies": { + "esbuild": "~0.25.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", + "dev": true, + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/api-prox/package.json b/api-prox/package.json new file mode 100644 index 0000000..0696b26 --- /dev/null +++ b/api-prox/package.json @@ -0,0 +1,20 @@ +{ + "name": "anix-api-proxy", + "version": "1.0.0", + "description": "Proxy and Hook requests from anix to anixart api", + "main": "index.ts", + "scripts": { + "serve": "npx tsx ./index.ts" + }, + "author": "Radiquum", + "license": "MIT", + "devDependencies": { + "@types/express": "^5.0.3", + "@types/node": "^24.0.4", + "typescript": "^5.8.3" + }, + "dependencies": { + "express": "^5.1.0", + "tsx": "^4.20.3" + } +} diff --git a/api-prox/shared.ts b/api-prox/shared.ts new file mode 100644 index 0000000..eeebd9a --- /dev/null +++ b/api-prox/shared.ts @@ -0,0 +1,124 @@ +export const corsHeaders = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Sign", + "Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS", + "Cache-Control": "no-cache", +}; + +import { Request, Response } from "express"; +export function asJSON(req: Request,res: Response, object: any, status: number) { + corsHeaders["Access-Control-Allow-Origin"] = req.headers.origin || "*"; + + res.status(status).type("application/json"); + res.set(corsHeaders); + res.send(JSON.stringify(object)); +} + +export const ANIXART_UA = + "AnixartApp/9.0 BETA 5-25062213 (Android 9; SDK 28; arm64-v8a; samsung SM-G975N; en)"; +export const ANIXART_API = "https://api.anixart.app"; + +export type ANIXART_HEADERST = { + "User-Agent": string; + "Content-Type": string; + "Api-Version"?: string; +}; +export const ANIXART_HEADERS: ANIXART_HEADERST = { + "User-Agent": ANIXART_UA, + "Content-Type": "application/json; charset=UTF-8", +}; + +type LogLevel = "debug" | "info" | "warn" | "error" | "disable"; +export class Log { + level: LogLevel; + levelInt = { + debug: 0, + info: 1, + warn: 2, + error: 3, + disable: 4, + }; + + constructor(level: LogLevel = "info") { + this.level = level; + } + + getString(...args: string[]): string { + return args.toString(); + } + + getTime(): string { + const datetime = new Date(); + return `${datetime.getHours().toString().padStart(2, "0")}:${datetime.getMinutes().toString().padStart(2, "0")}:${datetime.getSeconds().toString().padStart(2, "0")}`; + } + + console(logLevel: LogLevel = "info", ...msg: any[]) { + if (this.levelInt[this.level] <= this.levelInt[logLevel]) + console.log(`[${logLevel.toUpperCase()}](${this.getTime()}) -> `, ...msg); + } + debug(...msg: string[]) { + if (this.levelInt[this.level] <= 0) + console.log(`[DEBUG](${this.getTime()}) -> ${this.getString(...msg)}`); + } + info(...msg: string[]) { + if (this.levelInt[this.level] <= 1) + console.log(`[INFO](${this.getTime()}) -> ${this.getString(...msg)}`); + } + warn(...msg: string[]) { + if (this.levelInt[this.level] <= 2) + console.log(`[WARN](${this.getTime()}) -> ${this.getString(...msg)}`); + } + error(...msg: string[]) { + if (this.levelInt[this.level] <= 3) + console.log(`[ERROR](${this.getTime()}) -> ${this.getString(...msg)}`); + } + + consoleHook(logLevel: LogLevel = "info", ...msg: any[]) { + if (this.levelInt[this.level] <= this.levelInt[logLevel]) + console.log( + `[${logLevel.toUpperCase()}|HOOK](${this.getTime()}) -> `, + ...msg + ); + } + debugHook(...msg: string[]) { + if (this.levelInt[this.level] <= 0) + console.log( + `[DEBUG|HOOK](${this.getTime()}) -> ${this.getString(...msg)}` + ); + } + infoHook(...msg: string[]) { + if (this.levelInt[this.level] <= 1) + console.log( + `[INFO|HOOK](${this.getTime()}) -> ${this.getString(...msg)}` + ); + } + warnHook(...msg: string[]) { + if (this.levelInt[this.level] <= 2) + console.log( + `[WARN|HOOK](${this.getTime()}) -> ${this.getString(...msg)}` + ); + } + errorHook(...msg: string[]) { + if (this.levelInt[this.level] <= 3) + console.log( + `[ERROR|HOOK](${this.getTime()}) -> ${this.getString(...msg)}` + ); + } +} + +export const logger = new Log((process.env.LOG_LEVEL as LogLevel) || "info"); + +export interface GetHook { + match: (path: string) => boolean; + get: (data: any, url: URL) => any; +} + +export interface PostHook { + match: (path: string) => boolean; + post: (body: any, url: URL) => any; +} + +export interface LoadedHook { + path: string; + mtime: string; +} diff --git a/api-prox/tsconfig.json b/api-prox/tsconfig.json new file mode 100644 index 0000000..904d43f --- /dev/null +++ b/api-prox/tsconfig.json @@ -0,0 +1,113 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "libReplacement": true, /* Enable lib replacement. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "noUncheckedSideEffectImports": true, /* Check side effect imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ + // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/app/api/config.ts b/app/api/config.ts index ec8fffd..b3e8211 100644 --- a/app/api/config.ts +++ b/app/api/config.ts @@ -1,9 +1,11 @@ export const CURRENT_APP_VERSION = "3.7.0"; +import { env } from "next-runtime-env"; -export const API_URL = "https://api.anixart.tv"; -export const API_PREFIX = "/api/proxy"; +const NEXT_PUBLIC_API_URL = env("NEXT_PUBLIC_API_URL") || null; +export const API_URL = NEXT_PUBLIC_API_URL ||"https://api.anixart.app"; +export const API_PREFIX = NEXT_PUBLIC_API_URL || "/api/proxy"; export const USER_AGENT = - "AnixartApp/8.2.1-23121216 (Android 9; SDK 28; arm64-v8a; samsung SM-G975N; en)"; + "AnixartApp/9.0 BETA 5-25062213 (Android 9; SDK 28; arm64-v8a; samsung SM-G975N; en)"; export const ENDPOINTS = { release: { diff --git a/app/api/utils.ts b/app/api/utils.ts index f1f4b8d..fabc2b7 100644 --- a/app/api/utils.ts +++ b/app/api/utils.ts @@ -323,6 +323,7 @@ export async function _FetchHomePageReleases( const data: Object = fetch(url, { method: "POST", + headers: HEADERS, body: JSON.stringify(body), }) .then((response) => { diff --git a/app/components/Comments/Comments.Add.tsx b/app/components/Comments/Comments.Add.tsx index edec270..f4aba68 100644 --- a/app/components/Comments/Comments.Add.tsx +++ b/app/components/Comments/Comments.Add.tsx @@ -42,6 +42,7 @@ export const CommentsAddModal = (props: { const res = await fetch(url, { method: "POST", + headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); diff --git a/app/components/Comments/Comments.Edit.tsx b/app/components/Comments/Comments.Edit.tsx index 4cc7fd6..cb997d8 100644 --- a/app/components/Comments/Comments.Edit.tsx +++ b/app/components/Comments/Comments.Edit.tsx @@ -32,6 +32,7 @@ export const CommentsEditModal = (props: { } const res = await fetch(url, { method: "POST", + headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); diff --git a/app/components/Profile/Profile.EditModal.tsx b/app/components/Profile/Profile.EditModal.tsx index 7048df5..31ec419 100644 --- a/app/components/Profile/Profile.EditModal.tsx +++ b/app/components/Profile/Profile.EditModal.tsx @@ -1,6 +1,13 @@ "use client"; -import { FileInput, Label, Modal, ModalBody, ModalHeader, useThemeMode } from "flowbite-react"; +import { + FileInput, + Label, + Modal, + ModalBody, + ModalHeader, + useThemeMode, +} from "flowbite-react"; import { Spinner } from "../Spinner/Spinner"; import useSWR from "swr"; import { ENDPOINTS } from "#/api/config"; @@ -143,6 +150,7 @@ export const ProfileEditModal = (props: { const { data, error } = await tryCatchAPI( fetch(`${ENDPOINTS.user.settings.avatar}?token=${props.token}`, { method: "POST", + headers: { "Content-Type": "application/json" }, body: formData, }) ); @@ -188,7 +196,7 @@ export const ProfileEditModal = (props: { if (avatarModalProps.croppedImage) { _uploadAvatar(); } - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [avatarModalProps.croppedImage]); if (!prefData || !loginData || prefError || loginError) { diff --git a/app/components/ReleasePlayer/PlayerParsing.ts b/app/components/ReleasePlayer/PlayerParsing.ts index bd85ff4..9a250a6 100644 --- a/app/components/ReleasePlayer/PlayerParsing.ts +++ b/app/components/ReleasePlayer/PlayerParsing.ts @@ -1,5 +1,5 @@ import { tryCatchPlayer, tryCatchAPI } from "#/api/utils"; -import { env } from 'next-runtime-env'; +import { env } from "next-runtime-env"; export async function _fetchAPI( url: string, @@ -62,147 +62,33 @@ export async function _fetchPlayer( return data; } -function decryptKodikLink(enc: string) { - const decryptedBase64 = enc.replace(/[a-zA-Z]/g, (e: any) => { - return String.fromCharCode( - (e <= "Z" ? 90 : 122) >= (e = e.charCodeAt(0) + 18) ? e : e - 26 - ); - }); - return atob(decryptedBase64); -} - export const _fetchKodikManifest = async ( url: string, setPlayerError: (state) => void ) => { - // Fetch episode links via edge function - const NEXT_PUBLIC_KODIK_PARSER_URL = env("NEXT_PUBLIC_KODIK_PARSER_URL") - if (!NEXT_PUBLIC_KODIK_PARSER_URL) { + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL"); + if (!NEXT_PUBLIC_PLAYER_PARSER_URL) { setPlayerError({ - message: "Источник не настроен", - detail: "переменная 'NEXT_PUBLIC_KODIK_PARSER_URL' не обнаружена", + message: "Плеер не настроен", + detail: "переменная 'NEXT_PUBLIC_PLAYER_PARSER_URL' не обнаружена", }); return { manifest: null, poster: null }; } const data = await _fetchPlayer( - `${NEXT_PUBLIC_KODIK_PARSER_URL}/?url=${url}&player=kodik`, + `${NEXT_PUBLIC_PLAYER_PARSER_URL}/?url=${url}&player=kodik`, setPlayerError ); + if (data) { - let lowQualityLink = data.links["360"][0].src; // we assume that 360p is always present - - if (!lowQualityLink.includes("//")) { - // check if link is encrypted, else do nothing - lowQualityLink = decryptKodikLink(lowQualityLink); - } - - if (lowQualityLink.includes("https://")) { - // strip the https prefix, since we add it manually - lowQualityLink = lowQualityLink.replace("https://", "//"); - } - - let manifest = `https:${lowQualityLink.replace("360.mp4:hls:", "")}`; - let poster = `https:${lowQualityLink.replace("360.mp4:hls:manifest.m3u8", "thumb001.jpg")}`; - - if ( - lowQualityLink.includes("animetvseries") || - lowQualityLink.includes("tvseries") - ) { - // if link includes "animetvseries" or "tvseries" we need to construct manifest ourselves - let blobTxt = "#EXTM3U\n"; - - if (data.links.hasOwnProperty("240")) { - blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=427x240,BANDWIDTH=200000\n"; - let link = data.links["240"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; - } - - if (data.links.hasOwnProperty("360")) { - blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=578x360,BANDWIDTH=400000\n"; - let link = data.links["360"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; - } - - if (data.links.hasOwnProperty("480")) { - blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=854x480,BANDWIDTH=596000\n"; - let link = data.links["480"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; - } - - if (data.links.hasOwnProperty("720")) { - blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=1280x720,BANDWIDTH=1280000\n"; - let link = data.links["720"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; - } - - if (data.links.hasOwnProperty("1080")) { - blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=1920x1080,BANDWIDTH=2560000\n"; - let link = data.links["1080"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; - } - - let file = new File([blobTxt], "manifest.m3u8", { + let manifest: string = data.manifest; + if (!manifest.startsWith("http")) { + let file = new File([manifest], "manifest.m3u8", { type: "application/x-mpegURL", }); manifest = URL.createObjectURL(file); } - return { manifest, poster }; + return { manifest, poster: data.poster }; } return { manifest: null, poster: null }; }; @@ -211,32 +97,26 @@ export const _fetchAnilibriaManifest = async ( url: string, setPlayerError: (state) => void ) => { - const id = url.split("?id=")[1].split("&ep=")[0]; - const epid = url.split("?id=")[1].split("&ep=")[1]; - const _url = `https://api.anilibria.tv/v3/title?id=${id}`; - let data = null; - const NEXT_PUBLIC_ANILIBRIA_PARSER_URL = env("NEXT_PUBLIC_ANILIBRIA_PARSER_URL") - if (NEXT_PUBLIC_ANILIBRIA_PARSER_URL) { - data = await _fetchPlayer( - `${NEXT_PUBLIC_ANILIBRIA_PARSER_URL}/?url=${_url}&player=libria`, - setPlayerError - ); - } else { - data = await _fetchPlayer(_url, setPlayerError); + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL"); + if (!NEXT_PUBLIC_PLAYER_PARSER_URL) { + setPlayerError({ + message: "Плеер не настроен", + detail: "переменная 'NEXT_PUBLIC_PLAYER_PARSER_URL' не обнаружена", + }); + return { manifest: null, poster: null }; } - if (data) { - const host = `https://${data.player.host}`; - const ep = data.player.list[epid]; + const data = await _fetchPlayer( + `${NEXT_PUBLIC_PLAYER_PARSER_URL}/?url=${encodeURIComponent(url)}&player=libria`, + setPlayerError + ); - // we need to manually construct a manifest file for a hls player - const blobTxt = `#EXTM3U\n${ep.hls.sd && `#EXT-X-STREAM-INF:RESOLUTION=854x480,BANDWIDTH=596000\n${host}${ep.hls.sd}\n`}${ep.hls.hd && `#EXT-X-STREAM-INF:RESOLUTION=1280x720,BANDWIDTH=1280000\n${host}${ep.hls.hd}\n`}${ep.hls.fhd && `#EXT-X-STREAM-INF:RESOLUTION=1920x1080,BANDWIDTH=2560000\n${host}${ep.hls.fhd}\n`}`; - let file = new File([blobTxt], "manifest.m3u8", { + if (data) { + let file = new File([data.manifest], "manifest.m3u8", { type: "application/x-mpegURL", }); let manifest = URL.createObjectURL(file); - let poster = `https://anixart.libria.fun${ep.preview}`; - return { manifest, poster }; + return { manifest, poster: data.poster }; } return { manifest: null, poster: null }; }; @@ -245,23 +125,22 @@ export const _fetchSibnetManifest = async ( url: string, setPlayerError: (state) => void ) => { - // Fetch data via cloud endpoint - const NEXT_PUBLIC_SIBNET_PARSER_URL = env("NEXT_PUBLIC_SIBNET_PARSER_URL") - if (!NEXT_PUBLIC_SIBNET_PARSER_URL) { + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL"); + if (!NEXT_PUBLIC_PLAYER_PARSER_URL) { setPlayerError({ - message: "Источник не настроен", - detail: "переменная 'NEXT_PUBLIC_SIBNET_PARSER_URL' не обнаружена", + message: "Плеер не настроен", + detail: "переменная 'NEXT_PUBLIC_PLAYER_PARSER_URL' не обнаружена", }); return { manifest: null, poster: null }; } + const data = await _fetchPlayer( - `${NEXT_PUBLIC_SIBNET_PARSER_URL}/?url=${url}&player=sibnet`, + `${NEXT_PUBLIC_PLAYER_PARSER_URL}/?url=${url}&player=sibnet`, setPlayerError ); + if (data) { - let manifest = data.video; - let poster = data.poster; - return { manifest, poster }; + return { manifest: data.manifest, poster: data.poster }; } return { manifest: null, poster: null }; }; diff --git a/app/components/ReleasePlayer/ReleasePlayerCustom.tsx b/app/components/ReleasePlayer/ReleasePlayerCustom.tsx index d85368a..2ac55a1 100644 --- a/app/components/ReleasePlayer/ReleasePlayerCustom.tsx +++ b/app/components/ReleasePlayer/ReleasePlayerCustom.tsx @@ -125,6 +125,22 @@ export const ReleasePlayerCustom = (props: { } return; } + if (episode.selected.url.toLowerCase().endsWith(".mp4")) { + SetPlayerProps({ + src: episode.selected.url, + poster: null, + type: "mp4", + }); + return; + } + if (episode.selected.url.toLowerCase().endsWith(".m3u8")) { + SetPlayerProps({ + src: episode.selected.url, + poster: null, + type: "hls", + }); + return; + } setPlayerError({ message: `Источник "${source.selected.name}" не поддерживается`, detail: null, diff --git a/app/components/SettingsModal/SettingsModal.tsx b/app/components/SettingsModal/SettingsModal.tsx index 90ee3c3..56d9291 100644 --- a/app/components/SettingsModal/SettingsModal.tsx +++ b/app/components/SettingsModal/SettingsModal.tsx @@ -16,6 +16,8 @@ import { useThemeMode, } from "flowbite-react"; import Link from "next/link"; +import { env } from "next-runtime-env"; +import { useEffect, useState } from "react"; const HomeCategory = { last: "Последние релизы", @@ -51,6 +53,14 @@ export const SettingsModal = (props: { isOpen: boolean; setIsOpen: any }) => { const userStore = useUserStore(); const { computedMode, setMode } = useThemeMode(); + const [isPlayerConfigured, setIsPlayerConfigured] = useState(false); + + useEffect(() => { + const NEXT_PUBLIC_PLAYER_PARSER_URL = env("NEXT_PUBLIC_PLAYER_PARSER_URL") || null; + if (NEXT_PUBLIC_PLAYER_PARSER_URL) { + setIsPlayerConfigured(true); + } + }, []); return ( { }) } checked={preferenceStore.params.experimental.newPlayer} + disabled={!isPlayerConfigured} /> diff --git a/app/pages/CreateCollection.tsx b/app/pages/CreateCollection.tsx index a7b2982..78e36a8 100644 --- a/app/pages/CreateCollection.tsx +++ b/app/pages/CreateCollection.tsx @@ -188,6 +188,7 @@ export const CreateCollectionPage = () => { const { data, error } = await tryCatchAPI( fetch(url, { method: "POST", + headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ...collectionInfo, is_private: isPrivate, diff --git a/player-parser/.dockerignore b/player-parser/.dockerignore new file mode 100644 index 0000000..aab984b --- /dev/null +++ b/player-parser/.dockerignore @@ -0,0 +1,3 @@ +node_modules +README.md +README.RU.md \ No newline at end of file diff --git a/player-parsers/Dockerfile b/player-parser/Dockerfile similarity index 85% rename from player-parsers/Dockerfile rename to player-parser/Dockerfile index 0963569..8cbd672 100644 --- a/player-parsers/Dockerfile +++ b/player-parser/Dockerfile @@ -10,6 +10,5 @@ RUN npm ci COPY *.ts ./ EXPOSE 7000 -ENV PORT=7000 -ENV HOSTNAME="0.0.0.0" + CMD ["npm", "run", "serve"] \ No newline at end of file diff --git a/player-parsers/README.RU.md b/player-parser/README.RU.md similarity index 96% rename from player-parsers/README.RU.md rename to player-parser/README.RU.md index d206410..406611d 100644 --- a/player-parsers/README.RU.md +++ b/player-parser/README.RU.md @@ -22,9 +22,6 @@ - VIDEO_URL - ссылка на видео от источника - PLAYER_SOURCE - источник, один из: kodik, sibnet, libria -> [!NOTE] -> Если используется источник libria, ссылка должна быть ссылкой на API anilibria, а не на плеер - Ответ: - 500|400: произошла ошибка, подробнее в строке `message` в теле ответа diff --git a/player-parsers/README.md b/player-parser/README.md similarity index 97% rename from player-parsers/README.md rename to player-parser/README.md index a0bc338..495870f 100644 --- a/player-parsers/README.md +++ b/player-parser/README.md @@ -22,9 +22,6 @@ where: - VIDEO_URL - the link to the video from the source - PLAYER_SOURCE - the source, one of: kodik, sibnet, libria -> [!NOTE] -> When using libria source, url should be the url to the anilibria api, not player directly - Response: - 500|400: an error occurred, see the `message` field in the response body for details diff --git a/player-parser/index.ts b/player-parser/index.ts new file mode 100644 index 0000000..9f3cf5f --- /dev/null +++ b/player-parser/index.ts @@ -0,0 +1,62 @@ +import { asJSON } from "./shared"; +import { getAnilibriaURL } from "./libria"; +import { getSibnetURL } from "./sibnet"; +import { getKodikURL } from "./kodik"; + +import express from "express"; +const app = express(); +app.use(function (req, res, next) { + res.header("Access-Control-Allow-Origin", req.headers.origin || "*"); + res.header( + "Access-Control-Allow-Headers", + "Origin, X-Requested-With, Content-Type, Accept" + ); + res.header("Access-Control-Allow-Methods", "GET,HEAD,POST,OPTIONS"); + next(); +}); + +const HOST = process.env.HOST || "0.0.0.0"; +const PORT = 7000; +const allowedPlayers = ["kodik", "libria", "sibnet"]; + +app.get("/", (req, res) => { + const urlParams = new URLSearchParams(req.query); + const url = urlParams.get("url"); + const player = urlParams.get("player"); + + if (!url) { + asJSON(req, res, { message: "no 'url' query provided" }, 400); + return; + } + + if (!player) { + asJSON(req, res, { message: "no 'player' query provided" }, 400); + return; + } + + switch (player) { + case "libria": + getAnilibriaURL(req, res, url); + return; + case "sibnet": + getSibnetURL(req, res, url); + return; + case "kodik": + getKodikURL(req, res, url); + return; + default: + asJSON( + req, + res, + { + message: `player '${player}' is not supported. choose one of: ${allowedPlayers.join(", ")}`, + }, + 400 + ); + return; + } +}); + +app.listen(PORT, HOST, function () { + console.log(`Server listens http://${HOST}:${PORT}`); +}); diff --git a/player-parser/kodik.ts b/player-parser/kodik.ts new file mode 100644 index 0000000..a41b0b6 --- /dev/null +++ b/player-parser/kodik.ts @@ -0,0 +1,177 @@ +import { asJSON, randomUA } from "./shared"; +const altDomains = ["kodik.info", "aniqit.com", "kodik.cc", "kodik.biz"]; + +export async function getKodikURL(req, res, url: string) { + const origDomain = url.replace("https://", "").split("/")[0]; + let domain = url.replace("https://", "").split("/")[0]; + + if (!altDomains.includes(domain)) { + asJSON(req, res, { message: "KODIK: Неправильная ссылка на плеер" }, 400); + return; + } + + let user_agent = randomUA(); + + let pageRes = await fetch(url, { + headers: { + "User-Agent": user_agent, + }, + }); + + if (!pageRes.ok) { + for (let i = 0; i < altDomains.length; i++) { + if (url.includes(altDomains[i])) { + continue; + } + + user_agent = randomUA(); + const altDomain = altDomains[i]; + const altUrl = url.replace( + `https://${origDomain}/`, + `https://${altDomain}/` + ); + + domain = altDomain; + pageRes = await fetch(altUrl, { + headers: { + "User-Agent": user_agent, + }, + }); + + if (pageRes.ok) { + break; + } + } + } + + if (!pageRes.ok) { + asJSON(req, res, { message: "KODIK: Не удалось загрузить страницу с плеером" }, 500); + return; + } + + const pageData = await pageRes.text(); + const urlParamsRe = /var urlParams = .*;$/m; + const urlParamsMatch = urlParamsRe.exec(pageData); + + if (!urlParamsMatch || urlParamsMatch.length == 0) { + asJSON(req, res, { message: `KODIK: Не удалось найти данные эпизода` }, 500); + return; + } + + const urlParamsStr = urlParamsMatch[0] + .replace("var urlParams = '", "") + .replace("';", ""); + + const urlStr = url.replace(`https://${origDomain}/`, ""); + const type = urlStr.split("/")[0]; + const id = urlStr.split("/")[1]; + const hash = urlStr.split("/")[2]; + + const urlParams = JSON.parse(urlParamsStr); + urlParams["type"] = type; + urlParams["id"] = id; + urlParams["hash"] = hash; + + const formData = new FormData(); + for (const [key, value] of Object.entries(urlParams)) { + formData.append(key, value as any); + } + + const linksRes = await fetch(`https://${domain}/ftor`, { + method: "POST", + body: formData, + headers: { + "User-Agent": user_agent, + }, + }); + + if (!linksRes.ok) { + asJSON(req, res, { message: `KODIK: Не удалось получить прямую ссылку` }, 500); + return; + } + + let data = stripResponse(await linksRes.json()); + if (isEncrypted(data)) { + for (const [key] of Object.entries(data.links)) { + data.links[key][0].src = decryptSrc(data.links[key][0].src); + } + } + + if (!hasProto(data)) { + for (const [key] of Object.entries(data.links)) { + data.links[key][0].src = addProto(data.links[key][0].src); + } + } + + if (!isAnimeTvSeries(data)) { + data["manifest"] = data.links[data.default][0].src.replace( + `${data.default}.mp4:hls:`, + "" + ); + } else { + data["manifest"] = createManifest(data); + } + + data["poster"] = data.links[data.default][0].src.replace( + `${data.default}.mp4:hls:manifest.m3u8`, + "thumb001.jpg" + ); + + asJSON(req, res, data, 200); + return; +} + +function stripResponse(data) { + return { + default: data.default, + links: data.links, + }; +} + +function isEncrypted(data) { + return !data.links[data.default][0].src.includes("//"); +} + +function decryptSrc(enc: string) { + const decryptedBase64 = enc.replace(/[a-zA-Z]/g, (e: any) => { + return String.fromCharCode( + (e <= "Z" ? 90 : 122) >= (e = e.charCodeAt(0) + 18) ? e : e - 26 + ); + }); + return atob(decryptedBase64); +} + +function hasProto(data) { + return data.links[data.default][0].src.startsWith("http"); +} + +function addProto(string) { + return `https:${string}`; +} + +function isAnimeTvSeries(data) { + return ( + data.links[data.default][0].src.includes("animetvseries") || + data.links[data.default][0].src.includes("tvseries") + ); +} + +function createManifest(data) { + const resolutions = { + 240: "427x240", + 360: "578x360", + 480: "854x480", + 720: "1280x720", + 1080: "1920x1080", + }; + + const stringBuilder: string[] = []; + + stringBuilder.push("#EXTM3U"); + for (const [key] of Object.entries(data.links)) { + stringBuilder.push(`#EXT-X-STREAM-INF:RESOLUTION=${resolutions[key]}`); + stringBuilder.push(data.links[key][0].src); + } + + return stringBuilder.join("\n"); +} diff --git a/player-parser/libria.ts b/player-parser/libria.ts new file mode 100644 index 0000000..8382198 --- /dev/null +++ b/player-parser/libria.ts @@ -0,0 +1,135 @@ +import { asJSON } from "./shared"; + +export interface APIStatusResponse { + request: Request; + is_alive: boolean; + available_api_endpoints: string[]; +} + +export interface Request { + ip: string; + country: string; + iso_code: string; + timezone: string; +} + +async function checkApiStatus(req, res) { + const endpoints = ["https://anilibria.top", "https://anilibria.wtf"]; + let selectedEndpoint: string | null = null; + + for (let i = 0; i < endpoints.length; i++) { + const endpoint = endpoints[i]; + const apiRes = await fetch(`${endpoint}/api/v1/app/status`, { + signal: AbortSignal.timeout(3000), + }); + if (apiRes.ok) { + const data: APIStatusResponse = await apiRes.json(); + if (data.is_alive != true) { + asJSON(req, res, { message: "LIBRIA: API сервер не доступен" }, 500); + return null; + } + selectedEndpoint = endpoint; + break; + } + } + + if (!selectedEndpoint) { + asJSON(req, res, { message: "LIBRIA: Нет доступных эндпоинтов API" }, 500); + return null; + } + + return selectedEndpoint; +} + +export async function getAnilibriaURL(req, res, url: string) { + if (!url.includes("libria")) { + asJSON(req, res, { message: "LIBRIA: Неправильная ссылка на плеер" }, 400); + return; + } + + const apiEndpoint = await checkApiStatus(req, res); + if (!apiEndpoint) { + return; + } + + const decodedUrl = new URL(url); + + const releaseId = decodedUrl.searchParams.get("id") || null; + const releaseEp = decodedUrl.searchParams.get("ep") || null; + + let apiRes = await fetch(`${apiEndpoint}/api/v1/anime/releases/${releaseId}`); + if (!apiRes.ok) { + if (apiRes.status == 404) { + asJSON(req, res, { message: "LIBRIA: Релиз не найден" }, 404); + return; + } + + asJSON( + req, + res, + { message: "LIBRIA: Ошибка получения ответа от API" }, + 500 + ); + return; + } + + let data = stripResponse(req, res, await apiRes.json(), releaseEp); + if (!data) { + return; + } + + if (releaseEp) { + data["manifest"] = createManifest(data); + data["poster"] = getPoster(data); + } + + asJSON(req, res, data, 200); + return; +} + +function stripResponse(req, res, data, releaseEp) { + const resp = {}; + resp["posters"] = data.poster; + resp["episodes"] = data.episodes; + + if (releaseEp) { + const episode = data.episodes.find((item) => item.ordinal == releaseEp); + if (!episode) { + asJSON(req, res, { message: "LIBRIA: Эпизод не найден" }, 404); + return null; + } + resp["episodes"] = [episode]; + } + + return resp; +} + +function createManifest(data) { + const episode = data.episodes[0]; + const resolutions = { + hls_480: "854x480", + hls_720: "1280x720", + hls_1080: "1920x1080", + }; + + const stringBuilder: string[] = []; + + stringBuilder.push("#EXTM3U"); + for (const [key, value] of Object.entries(resolutions)) { + if (!episode[key]) continue; + stringBuilder.push(`#EXT-X-STREAM-INF:RESOLUTION=${value}`); + const url = new URL(episode[key]); + url.search = ""; + stringBuilder.push(url.toString()); + } + + return stringBuilder.join("\n"); +} + +function getPoster(data) { + const episode = data.episodes[0]; + + if (episode.preview && episode.preview.preview) + return `https://anixart.libria.fun${episode.preview.preview}`; + return `https://anilibria.top${data.poster.preview}`; +} diff --git a/player-parsers/package-lock.json b/player-parser/package-lock.json similarity index 100% rename from player-parsers/package-lock.json rename to player-parser/package-lock.json diff --git a/player-parsers/package.json b/player-parser/package.json similarity index 100% rename from player-parsers/package.json rename to player-parser/package.json diff --git a/player-parsers/shared.ts b/player-parser/shared.ts similarity index 93% rename from player-parsers/shared.ts rename to player-parser/shared.ts index fd3a955..b03c5eb 100644 --- a/player-parsers/shared.ts +++ b/player-parser/shared.ts @@ -1,14 +1,10 @@ export const corsHeaders = { "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept", "Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS", "Cache-Control": "no-cache", }; -export const resHeaders = { - ...corsHeaders, - "Content-Type": "application/json", -}; - export const USERAGENTS = [ "Mozilla/5.0 (Linux; Android 12.0; LG G8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.2.7124.71 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.5.1269.13 Safari/537.36", @@ -37,7 +33,9 @@ export const USERAGENTS = [ "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/128.0 Firefox/128.0", ]; -export function asJSON(res, object: any, status: number) { +export function asJSON(req, res, object: any, status: number) { + corsHeaders["Access-Control-Allow-Origin"] = req.headers.origin || "*"; + res.status(status).type("application/json"); res.set(corsHeaders); res.send(JSON.stringify(object)); diff --git a/player-parsers/sibnet.ts b/player-parser/sibnet.ts similarity index 62% rename from player-parsers/sibnet.ts rename to player-parser/sibnet.ts index 5df85b8..235f4b6 100644 --- a/player-parsers/sibnet.ts +++ b/player-parser/sibnet.ts @@ -1,9 +1,9 @@ import { asJSON, randomUA } from "./shared"; -export async function getSibnetURL(res, url: string) { +export async function getSibnetURL(req, res, url: string) { if (!url.includes("sibnet")) { - asJSON(res, { message: "Wrong url provided for player sibnet" }, 400); + asJSON(req, res, { message: "SIBNET: Неправильная ссылка на плеер" }, 400); return } @@ -15,7 +15,7 @@ export async function getSibnetURL(res, url: string) { }, }); if (!pageRes.ok) { - asJSON(res, { message: `SIBNET:${pageRes.status}: failed to load page` }, 500) + asJSON(req, res, { message: `SIBNET: Не удалось загрузить страницу с плеером` }, 500) return } const pageData = await pageRes.text(); @@ -23,7 +23,7 @@ export async function getSibnetURL(res, url: string) { const videoMatch = videoRe.exec(pageData); if (!videoMatch || videoMatch.length == 0) { - asJSON(res, { message: `SIBNET: failed to find data to parse` }, 500) + asJSON(req, res, { message: `SIBNET: Не удалось найти данные эпизода` }, 500) return } @@ -42,11 +42,11 @@ export async function getSibnetURL(res, url: string) { ); if (!actualVideoRes.headers.get("location")) { - asJSON(res, { message: `SIBNET: failed to get video link` }, 500) + asJSON(req, res, { message: `SIBNET: Не удалось получить прямую ссылку` }, 500) return } - const video = actualVideoRes.headers.get("location"); + const video = `https:${actualVideoRes.headers.get("location")}`; const poster = posterMatch ? posterMatch.length > 0 ? @@ -54,6 +54,6 @@ export async function getSibnetURL(res, url: string) { : null : null; - asJSON(res, { video, poster }, 200) + asJSON(req, res, { manifest: video, poster }, 200) return } diff --git a/player-parsers/.dockerignore b/player-parsers/.dockerignore deleted file mode 100644 index 4400aea..0000000 --- a/player-parsers/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -README.md \ No newline at end of file diff --git a/player-parsers/index.ts b/player-parsers/index.ts deleted file mode 100644 index e3b891f..0000000 --- a/player-parsers/index.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { asJSON } from "./shared"; -import { getAnilibriaURL } from "./libria"; -import { getSibnetURL } from "./sibnet"; -import { getKodikURL } from "./kodik"; - -import express from "express"; -const app = express(); - -const host = "0.0.0.0"; -const port = 7000; -const allowedPlayers = ["kodik", "libria", "sibnet"]; - -app.get("/", (req, res) => { - const urlParams = new URLSearchParams(req.query) - const url = urlParams.get("url"); - const player = urlParams.get("player"); - - if (!url) { - asJSON(res, { message: "no 'url' query provided" }, 400) - return - } - - if (!player) { - asJSON(res, { message: "no 'player' query provided" }, 400) - return - } - - switch (player) { - case "libria": - getAnilibriaURL(res, url) - return - case "sibnet": - getSibnetURL(res, url) - return - case "kodik": - getKodikURL(res, url) - return - default: - asJSON(res, { message: `player '${player}' is not supported. choose one of: ${allowedPlayers.join(", ")}` }, 400) - return - } -}); - -app.listen(port, host, function () { - console.log(`Server listens http://${host}:${port}`); -}); diff --git a/player-parsers/kodik.ts b/player-parsers/kodik.ts deleted file mode 100644 index e28444d..0000000 --- a/player-parsers/kodik.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { asJSON, randomUA } from "./shared"; -const altDomains = ["kodik.info", "aniqit.com", "kodik.cc", "kodik.biz"]; - -export async function getKodikURL(res, url: string) { - const origDomain = url.replace("https://", "").split("/")[0]; - let domain = url.replace("https://", "").split("/")[0]; - - if (!altDomains.includes(domain)) { - asJSON(res, { message: "Wrong url provided for player kodik" }, 400); - return; - } - - let user_agent = randomUA(); - - let pageRes = await fetch(url, { - headers: { - "User-Agent": user_agent, - }, - }); - - if (!pageRes.ok) { - for (let i = 0; i < altDomains.length; i++) { - if (url.includes(altDomains[i])) { - continue; - } - - user_agent = randomUA(); - const altDomain = altDomains[i]; - const altUrl = url.replace( - `https://${origDomain}/`, - `https://${altDomain}/` - ); - - domain = altDomain; - pageRes = await fetch(altUrl, { - headers: { - "User-Agent": user_agent, - }, - }); - - if (pageRes.ok) { - break; - } - } - } - - if (!pageRes.ok) { - asJSON(res, { message: "KODIK: failed to load page" }, 500); - return; - } - - const pageData = await pageRes.text(); - const urlParamsRe = /var urlParams = .*;$/m; - const urlParamsMatch = urlParamsRe.exec(pageData); - - if (!urlParamsMatch || urlParamsMatch.length == 0) { - asJSON(res, { message: `KODIK: failed to find data to parse` }, 500); - return; - } - - const urlParamsStr = urlParamsMatch[0] - .replace("var urlParams = '", "") - .replace("';", ""); - - const urlStr = url.replace(`https://${origDomain}/`, ""); - const type = urlStr.split("/")[0]; - const id = urlStr.split("/")[1]; - const hash = urlStr.split("/")[2]; - - const urlParams = JSON.parse(urlParamsStr); - urlParams["type"] = type; - urlParams["id"] = id; - urlParams["hash"] = hash; - - const formData = new FormData(); - for (const [key, value] of Object.entries(urlParams)) { - formData.append(key, value as any); - } - - const linksRes = await fetch(`https://${domain}/ftor`, { - method: "POST", - body: formData, - headers: { - "User-Agent": user_agent, - }, - }); - - if (!linksRes.ok) { - asJSON(res, { message: `KODIK: failed to get links` }, 500); - return; - } - - asJSON(res, await linksRes.json(), 200); - return; -} diff --git a/player-parsers/libria.ts b/player-parsers/libria.ts deleted file mode 100644 index a907074..0000000 --- a/player-parsers/libria.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { asJSON } from "./shared"; - -export async function getAnilibriaURL(res, url: string) { - - if (!url.includes("anilibria")) { - asJSON(res, { message: "Wrong url provided for player libria" }, 400); - return - } - - let apiRes = await fetch(url); - if (!apiRes.ok) { - asJSON(res, { message: "LIBRIA: failed to get api response" }, 500); - return - } - asJSON(res, await apiRes.json(), 200); - return -} diff --git a/tsconfig.json b/tsconfig.json index 8fdb696..b0d0bcc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,5 +33,5 @@ "**/*.tsx", "next.config.js" ], - "exclude": ["node_modules", "player-parsers"] + "exclude": ["node_modules", "player-parser", "api-prox"] }