From 16d14a816d3566c349542ee796459e250c1b377e Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sat, 7 Oct 2023 19:03:18 +0800 Subject: [PATCH 1/6] wip --- configs/default/common.py | 2 +- configs/default/sites.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/default/common.py b/configs/default/common.py index cc1d129ba..133ca184d 100644 --- a/configs/default/common.py +++ b/configs/default/common.py @@ -22,7 +22,7 @@ "apps.openapi", ] -CORS_ALLOW_ALL_ORIGINS = True + MIDDLEWARE = [ "django_prometheus.middleware.PrometheusBeforeMiddleware", diff --git a/configs/default/sites.py b/configs/default/sites.py index de34097bd..93ea5f3b2 100644 --- a/configs/default/sites.py +++ b/configs/default/sites.py @@ -11,6 +11,8 @@ # 网站域名设置(请正确填写,不然订阅功能会失效: HOST = os.getenv("HOST", "http://127.0.0.1:8000") +CORS_ALLOW_ALL_ORIGINS = True +CSRF_TRUSTED_ORIGINS = [HOST] # 网站密钥 SECRET_KEY = os.getenv("SECRET_KEY", "aasdasdas") From 4b2b2ce313ef6058a379bdb9d2e67506ece6836b Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sat, 7 Oct 2023 19:09:43 +0800 Subject: [PATCH 2/6] update ci --- .github/workflows/code.yml | 5 +++++ configs/default/common.py | 1 - configs/development.py | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 24d8cbb37..ab338bdf0 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -4,6 +4,7 @@ on: branches: - master - dev + - debug-* paths: - "apps/**" - "configs/**" @@ -14,16 +15,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master + - name: build code image uses: elgohr/Publish-Docker-Github-Action@master + if: github.ref == 'refs/heads/dev' with: name: ehco1996/django-sspanel username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} tags: "latest,code" dockerfile: deploy/Dockerfile.CODE + - name: build debug code image uses: elgohr/Publish-Docker-Github-Action@master + if: github.ref == 'refs/heads/debug'* with: name: ehco1996/django-sspanel username: ${{ secrets.DOCKER_USERNAME }} diff --git a/configs/default/common.py b/configs/default/common.py index 133ca184d..0408e07e4 100644 --- a/configs/default/common.py +++ b/configs/default/common.py @@ -23,7 +23,6 @@ ] - MIDDLEWARE = [ "django_prometheus.middleware.PrometheusBeforeMiddleware", "corsheaders.middleware.CorsMiddleware", diff --git a/configs/development.py b/configs/development.py index d3ffb75ad..91c955bca 100644 --- a/configs/development.py +++ b/configs/development.py @@ -1,5 +1,3 @@ -import os - from configs.default import * # noqa # NOTE for django debug toolbar From b7b0bf7709e0dea3bfd616d769d4155cb2389137 Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sat, 7 Oct 2023 19:10:53 +0800 Subject: [PATCH 3/6] fix --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index ab338bdf0..052dd1d44 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -28,7 +28,7 @@ jobs: - name: build debug code image uses: elgohr/Publish-Docker-Github-Action@master - if: github.ref == 'refs/heads/debug'* + if: github.ref == 'refs/heads/debug.*' with: name: ehco1996/django-sspanel username: ${{ secrets.DOCKER_USERNAME }} From 35968411198df7570589aaf82c758479eeeb54c2 Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sat, 7 Oct 2023 19:12:36 +0800 Subject: [PATCH 4/6] fix --- .github/workflows/code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 052dd1d44..6d965fdea 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -28,7 +28,7 @@ jobs: - name: build debug code image uses: elgohr/Publish-Docker-Github-Action@master - if: github.ref == 'refs/heads/debug.*' + if: startsWith(github.ref, 'refs/heads/debug-') with: name: ehco1996/django-sspanel username: ${{ secrets.DOCKER_USERNAME }} From 39157685ae6d94759723cffe0199245bc1d507db Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sat, 7 Oct 2023 19:18:23 +0800 Subject: [PATCH 5/6] fix --- .github/workflows/code.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 6d965fdea..dd98bc2ea 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -9,6 +9,15 @@ on: - "apps/**" - "configs/**" - "templates/**" + pull_request: + branches: + - master + - dev + - debug-* + paths: + - "apps/**" + - "configs/**" + - "templates/**" workflow_dispatch: jobs: build-code: @@ -18,7 +27,7 @@ jobs: - name: build code image uses: elgohr/Publish-Docker-Github-Action@master - if: github.ref == 'refs/heads/dev' + if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/heads/debug-') with: name: ehco1996/django-sspanel username: ${{ secrets.DOCKER_USERNAME }} From ebd2b05f40fce10e7b01d69e8a88764d1b276f2a Mon Sep 17 00:00:00 2001 From: Ehco1996 Date: Sat, 7 Oct 2023 19:20:55 +0800 Subject: [PATCH 6/6] fix --- .github/workflows/code.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index dd98bc2ea..ec68b7531 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -27,7 +27,6 @@ jobs: - name: build code image uses: elgohr/Publish-Docker-Github-Action@master - if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/heads/debug-') with: name: ehco1996/django-sspanel username: ${{ secrets.DOCKER_USERNAME }}