fca8d6da97
* fix: update subscription_crypto_link when syncing user from panel (#2867) * fix: update subscription_crypto_link when syncing user from panel * fix: update subscription_crypto_link when syncing user from panel * fix: use PROXY_URL for Telegram OIDC JWKS requests (#2866) * feat: add TELEGRAM_API_URL for custom Telegram Bot API server Support custom Telegram Bot API server URL via TELEGRAM_API_URL env var. Enables bot operation in regions where api.telegram.org is blocked (Cloudflare Worker, self-hosted telegram-bot-api, nginx reverse proxy). Uses native aiogram TelegramAPIServer.from_base(), works with PROXY_URL. * fix(ci): read Docker image version from release-please manifest instead of hardcoding (#2859) The x-release-please-version markers in workflow files were stuck at v3.7.0 since commit5070bb34removed them from extra-files (GitHub Actions returns 403 when release-please tries to modify .github/workflows/ via GITHUB_TOKEN). Instead of hardcoding the version, read it from .release-please-manifest.json at build time. This file is always kept in sync by release-please and does not require workflow file write permissions. --- Маркеры x-release-please-version в workflow-файлах застряли на v3.7.0 после коммита5070bb34, который удалил их из extra-files (GitHub Actions возвращает 403 при попытке release-please изменить .github/workflows/ через GITHUB_TOKEN). Вместо хардкода версии теперь читаем её из .release-please-manifest.json во время сборки. Этот файл всегда синхронизируется release-please и не требует прав на запись в workflow-файлы. * fix: format telegram_auth.py to use single quotes (ruff) * fix: remove daily tariff fallback to smallest period discount Daily tariffs (period_days=1) incorrectly inherited the discount of the smallest configured period (e.g. 90 days -> 5%). This caused daily prices to show discounts that were never intended for them. Now daily tariffs only get a discount if explicitly configured for period_days=1 in the promo group's period_discounts. * fix: use CABINET_URL for campaign web links instead of MINIAPP_CUSTOM_URL Campaign web links were generated from MINIAPP_CUSTOM_URL which is often empty, causing get_campaign_web_link() to return None. Admins and partners could only share bot links for campaigns, not cabinet links. Now prefers CABINET_URL (where the auth flow captures ?campaign= param), falling back to MINIAPP_CUSTOM_URL for backwards compatibility. This is consistent with how referral web links already use CABINET_URL. * feat: add DISPLAY_NAME_RESTRICTION_ENABLED toggle Allows disabling the display name restriction middleware via .env. Users with special characters in their Telegram name (e.g. "@") were blocked from using the bot entirely. Default: true (enabled). Set DISPLAY_NAME_RESTRICTION_ENABLED=false to disable. * fix: allow clearing all period discounts from promo groups Empty period_discounts dict was normalized to None by the schema, making it indistinguishable from "field absent" (don't update). Now empty dict passes through to CRUD which correctly sets period_discounts=None in DB, clearing all discounts. * fix: create panel user instead of update for new subscriptions in multi-tariff mode In multi-tariff mode, new subscriptions have remnawave_uuid=None. The old logic fell back to user.remnawave_uuid (from a previous subscription) and called update_remnawave_user(), which refused to work because the NEW subscription had no UUID. Now correctly: in multi-tariff mode, always CREATE if subscription has no remnawave_uuid. In single-tariff mode, use user-level UUID. Fixes: "subscription has no remnawave_uuid, cannot update panel" * fix: apply same create-vs-update fix to renewal and purchase flows Same bug as the tariff purchase fix: in multi-tariff mode, new subscriptions without remnawave_uuid incorrectly fell back to user.remnawave_uuid and called update instead of create. Fixed in subscription_renewal_service.py and purchase.py to use the same _should_create pattern based on mode. * fix: apply create-vs-update fix to all remaining tariff_purchase flows Fixed 6 more locations in tariff_purchase.py that had the same broken pattern (custom purchase, daily purchase, trial conversion, tariff switch, daily switch, instant switch). All now use _should_create based on multi-tariff mode instead of falling back to user UUID. * fix: apply create-vs-update fix to cabinet traffic/devices and monitoring Same multi-tariff create-vs-update bug in 5 more locations: - cabinet/subscription_modules/traffic.py (2 instances) - cabinet/subscription_modules/devices.py (2 instances) - services/monitoring_service.py (1 instance) All now use _should_create pattern based on subscription.remnawave_uuid in multi-tariff mode instead of falling back to user.remnawave_uuid. * fix: ruff format traffic.py and monitoring_service.py --------- Co-authored-by: Dmitry V. Lunin <49199230+BlackRaincoat@users.noreply.github.com> Co-authored-by: Gary Jarrel <gary@jarrel.com.au>
114 lines
4.8 KiB
YAML
114 lines
4.8 KiB
YAML
name: BedolagaBot
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Get version info
|
|
id: version
|
|
run: |
|
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
|
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
|
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
|
|
|
|
# Read base version from release-please manifest (single source of truth)
|
|
BASE_VERSION=$(jq -r '."."' .release-please-manifest.json)
|
|
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
TAGS="fr1ngg/remnawave-bedolaga-telegram-bot:latest,fr1ngg/remnawave-bedolaga-telegram-bot:${VERSION}"
|
|
echo "🏷️ Собираем релизную версию: $VERSION"
|
|
elif [[ $GITHUB_REF == refs/heads/main ]]; then
|
|
VERSION="v${BASE_VERSION}-${SHORT_SHA}"
|
|
TAGS="fr1ngg/remnawave-bedolaga-telegram-bot:latest,fr1ngg/remnawave-bedolaga-telegram-bot:${VERSION}"
|
|
echo "🚀 Собираем версию из main: $VERSION"
|
|
elif [[ $GITHUB_REF == refs/heads/dev ]]; then
|
|
VERSION="v${BASE_VERSION}-dev-${SHORT_SHA}"
|
|
TAGS="fr1ngg/remnawave-bedolaga-telegram-bot:dev,fr1ngg/remnawave-bedolaga-telegram-bot:${VERSION}"
|
|
echo "🧪 Собираем dev версию: $VERSION"
|
|
else
|
|
VERSION="v${BASE_VERSION}-pr-${SHORT_SHA}"
|
|
TAGS="fr1ngg/remnawave-bedolaga-telegram-bot:pr-${SHORT_SHA}"
|
|
echo "🔀 Собираем PR версию: $VERSION"
|
|
fi
|
|
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "tags=$TAGS" >> $GITHUB_OUTPUT
|
|
echo "should_push=${{ github.event_name != 'pull_request' }}" >> $GITHUB_OUTPUT
|
|
|
|
echo "=== Информация о сборке ==="
|
|
echo "Версия: $VERSION"
|
|
echo "Коммит: $SHORT_SHA"
|
|
echo "Теги: $TAGS"
|
|
echo "Push: ${{ github.event_name != 'pull_request' }}"
|
|
echo "==========================="
|
|
|
|
- name: Login to Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ steps.version.outputs.should_push }}
|
|
tags: ${{ steps.version.outputs.tags }}
|
|
build-args: |
|
|
VERSION=${{ steps.version.outputs.version }}
|
|
BUILD_DATE=${{ steps.version.outputs.build_date }}
|
|
VCS_REF=${{ steps.version.outputs.short_sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
labels: |
|
|
org.opencontainers.image.version=${{ steps.version.outputs.version }}
|
|
org.opencontainers.image.created=${{ steps.version.outputs.build_date }}
|
|
org.opencontainers.image.revision=${{ steps.version.outputs.short_sha }}
|
|
org.opencontainers.image.title=Bedolaga RemnaWave Bot
|
|
org.opencontainers.image.description=Telegram bot for RemnaWave VPN service
|
|
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
|
|
|
- name: Build Summary
|
|
if: github.event_name != 'pull_request'
|
|
run: |
|
|
echo "## 🚀 Docker Hub Build Summary" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Параметр | Значение |" >> $GITHUB_STEP_SUMMARY
|
|
echo "|----------|----------|" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Версия** | \`${{ steps.version.outputs.version }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Коммит** | \`${{ steps.version.outputs.short_sha }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Дата сборки** | \`${{ steps.version.outputs.build_date }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Registry** | Docker Hub |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Ветка** | \`${{ github.ref_name }}\` |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| **Статус** | ✅ Опубликован |" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "### 📋 Опубликованные теги:" >> $GITHUB_STEP_SUMMARY
|
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "${{ steps.version.outputs.tags }}" | tr ',' '\n' >> $GITHUB_STEP_SUMMARY
|
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "### 🔗 Ссылки:" >> $GITHUB_STEP_SUMMARY
|
|
echo "- [Docker Hub Repository](https://hub.docker.com/r/fr1ngg/remnawave-bedolaga-telegram-bot)" >> $GITHUB_STEP_SUMMARY
|