debug: logging referer\nci: add apisync workflow
This commit is contained in:
parent
008f84c180
commit
2dc5c1e7e0
47
.gitea/workflows/apisyncer.yml
Normal file
47
.gitea/workflows/apisyncer.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Sync OpenAPI Spec
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'staging'
|
||||||
|
paths:
|
||||||
|
- 'api/openapi.yaml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-spec:
|
||||||
|
runs-on: [squizstaging]
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: https://gitea.pena/PenaDevops/actions.git/checkout@v1
|
||||||
|
- name: Install SSH tools on Alpine
|
||||||
|
run: |
|
||||||
|
apk update
|
||||||
|
apk add --no-cache openssh-client
|
||||||
|
|
||||||
|
- name: Set Ssh key
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.CENTRAL_REPO_SSH_KEY }}" > ~/.ssh/deploy_key
|
||||||
|
chmod 600 ~/.ssh/deploy_key
|
||||||
|
ssh-keyscan -H gitea.pena >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Push to Central Repo
|
||||||
|
run: |
|
||||||
|
ls ~/.ssh
|
||||||
|
# Для Gitea используем:
|
||||||
|
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
echo "Current branch: $CURRENT_BRANCH"
|
||||||
|
ssh-keygen -l -f ~/.ssh/deploy_key || echo "Key validation failed"
|
||||||
|
export GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes"
|
||||||
|
# Клонируем центральный репозиторий используя SSH
|
||||||
|
git clone --depth 1 --single-branch --branch $BRANCH_NAME git@gitea.pena:PenaSide/docs.git
|
||||||
|
# Копируем файл, даём уникальное имя
|
||||||
|
cp api/openapi.yaml docs/$(echo "${{ gitea.repository }}" | tr '/' '-')-openapi.yaml
|
||||||
|
cd docs
|
||||||
|
git config user.name "Gitea Actions Bot"
|
||||||
|
git config user.email "actions-bot@example.com"
|
||||||
|
git add .
|
||||||
|
git commit -m "chore: update OpenAPI spec from ${{ gitea.repository }}"
|
||||||
|
# Пушим используя SSH
|
||||||
|
git push
|
||||||
@ -11,6 +11,7 @@ import (
|
|||||||
"gitea.pena/PenaSide/common/log_mw"
|
"gitea.pena/PenaSide/common/log_mw"
|
||||||
"time"
|
"time"
|
||||||
"strings"
|
"strings"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Deps struct {
|
type Deps struct {
|
||||||
@ -49,6 +50,7 @@ func (r *RecoveryController) HandleRecoveryRequest(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
referralURL := c.Get("Referer")
|
referralURL := c.Get("Referer")
|
||||||
|
fmt.Println("REFERRER", referralURL)
|
||||||
|
|
||||||
if req.RedirectionURL == "" && referralURL != "" {
|
if req.RedirectionURL == "" && referralURL != "" {
|
||||||
req.RedirectionURL = referralURL
|
req.RedirectionURL = referralURL
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user