From 55153531fb4899d0f3e699b70231d32290800ee2 Mon Sep 17 00:00:00 2001 From: Nikita Kiselev Date: Thu, 10 Jul 2025 19:13:39 +0300 Subject: [PATCH] fix: add CORS headers, make ci builds as preleases --- .github/workflows/main.yaml | 10 +++++++--- .../catalog/controller/extension/tgshop/handle.php | 5 ----- .../oc_telegram_shop/framework/Http/JsonResponse.php | 4 ++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 24d895f..371a118 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -2,7 +2,8 @@ name: Telegram Mini App Shop Builder on: push: - tags: ['v*'] + branches: + - master permissions: contents: write @@ -39,10 +40,12 @@ jobs: with: fetch-depth: 0 # to fetch tags - - name: Extract tag and set filename + - name: Extract latest tag and set filename id: meta run: | - TAG=${GITHUB_REF#refs/tags/} + LAST_TAG=$(git describe --tags --abbrev=0) + SHORT_SHA=$(git rev-parse --short=7 HEAD) + TAG="${LAST_TAG}+${SHORT_SHA}" echo "tag=$TAG" >> $GITHUB_OUTPUT echo "filename=oc_telegram_shop_${TAG}.ocmod.zip" >> $GITHUB_OUTPUT @@ -58,6 +61,7 @@ jobs: - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: + prerelease: true tag_name: ${{ steps.meta.outputs.tag }} files: ./build/${{ steps.meta.outputs.filename }} generate_release_notes: true diff --git a/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php b/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php index ad9a1f0..85b420c 100755 --- a/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php +++ b/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php @@ -64,9 +64,4 @@ class Controllertgshophandle extends Controller $app->bootAndHandleRequest(); } - - public function spa() - { - - } } diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/framework/Http/JsonResponse.php b/module/oc_telegram_shop/upload/oc_telegram_shop/framework/Http/JsonResponse.php index 60a379f..2740b67 100755 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/framework/Http/JsonResponse.php +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/framework/Http/JsonResponse.php @@ -43,5 +43,9 @@ class JsonResponse extends Response { http_response_code($this->getCode()); header('Content-Type: application/json'); + header('Access-Control-Allow-Origin: *'); + header('Access-Control-Allow-Methods: GET, POST'); + header('Access-Control-Allow-Headers: Content-Type, Authorization'); + header('Access-Control-Allow-Credentials: true'); } }