Skip to content

Commit

Permalink
Merge pull request #1 from luzov/develop/241105
Browse files Browse the repository at this point in the history
Develop/241105
  • Loading branch information
luzov authored Nov 5, 2024
2 parents a82ecfd + 5756da2 commit 0340346
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 335 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docker Image CI
on:
push:
branches:
- dev
- develop/*
tags:
- 'v*'

Expand All @@ -21,23 +21,23 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
version: latest

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ env.DOCKER_USERNAME }}
Expand All @@ -52,7 +52,7 @@ jobs:

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -65,7 +65,7 @@ jobs:
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
18 changes: 7 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @Author: Vincent Yang
* @Date: 2023-07-01 21:45:34
* @LastEditors: Vincent Young
* @LastEditTime: 2024-09-16 12:12:35
* @LastEditors: Vincent Yang
* @LastEditTime: 2024-11-01 13:04:50
* @FilePath: /DeepLX/main.go
* @Telegram: https://t.me/missuo
* @GitHub: https://github.com/missuo
Expand Down Expand Up @@ -131,7 +131,7 @@ func main() {
return
}

result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL)
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, "")
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down Expand Up @@ -168,8 +168,6 @@ func main() {

dlSession := cfg.DlSession

// fmt.Printf("ENV DL_SESSION: %s\n", cfg.DlSession)

if tagHandling != "" && tagHandling != "html" && tagHandling != "xml" {
c.JSON(http.StatusBadRequest, gin.H{
"code": http.StatusBadRequest,
Expand All @@ -187,12 +185,10 @@ func main() {
}
}

// log.Printf("dlSession: %s\n", dlSession)

if dlSession == "" {
c.JSON(http.StatusUnauthorized, gin.H{
"code": http.StatusUnauthorized,
"message": "No dl_session Found.",
"message": "No dl_session Found",
})
return
} else if strings.Contains(dlSession, ".") {
Expand All @@ -203,7 +199,7 @@ func main() {
return
}

result, err := translate.TranslateByDeepLXPro(sourceLang, targetLang, translateText, tagHandling, dlSession, proxyURL)
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, dlSession)
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down Expand Up @@ -262,7 +258,7 @@ func main() {
return
}

result, err := translate.TranslateByDeepLXPro(sourceLang, targetLang, translateText, tagHandling, dlSession, proxyURL)
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, dlSession)
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down Expand Up @@ -314,7 +310,7 @@ func main() {
targetLang = jsonData.TargetLang
}

result, err := translate.TranslateByDeepLX("", targetLang, translateText, "", proxyURL)
result, err := translate.TranslateByDeepLX("", targetLang, translateText, "", proxyURL, "")
if err != nil {
log.Fatalf("Translation failed: %s", err)
}
Expand Down
Loading

0 comments on commit 0340346

Please sign in to comment.