mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2026-12-01 14:57:52 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f099d187c | ||
|
|
1b88e428ae | ||
|
|
432c0a223c |
+5
-2
@@ -6,5 +6,8 @@ RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o deeplx .
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=builder /go/src/github.com/OwO-Network/DeepLX/deeplx /app/deeplx
|
||||
CMD ["/app/deeplx"]
|
||||
RUN addgroup -S deeplx && adduser -h /app -G deeplx -SH deeplx
|
||||
USER deeplx:deeplx
|
||||
COPY --from=builder --chown=deeplx:deeplx /go/src/github.com/OwO-Network/DeepLX/deeplx /app/deeplx
|
||||
EXPOSE 1188
|
||||
ENTRYPOINT ["/app/deeplx"]
|
||||
|
||||
+15
-3
@@ -127,7 +127,11 @@ func Router(cfg *Config) *gin.Engine {
|
||||
|
||||
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, "")
|
||||
if err != nil {
|
||||
log.Fatalf("Translation failed: %s", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"code": http.StatusInternalServerError,
|
||||
"message": "Translation failed: " + err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if result.Code == http.StatusOK {
|
||||
@@ -191,7 +195,11 @@ func Router(cfg *Config) *gin.Engine {
|
||||
|
||||
result, err := translate.TranslateByDeepLX(sourceLang, targetLang, translateText, tagHandling, proxyURL, dlSession)
|
||||
if err != nil {
|
||||
log.Fatalf("Translation failed: %s", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"code": http.StatusInternalServerError,
|
||||
"message": "Translation failed: " + err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if result.Code == http.StatusOK {
|
||||
@@ -243,7 +251,11 @@ func Router(cfg *Config) *gin.Engine {
|
||||
|
||||
result, err := translate.TranslateByDeepLX("", targetLang, translateText, "", proxyURL, "")
|
||||
if err != nil {
|
||||
log.Fatalf("Translation failed: %s", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"code": http.StatusInternalServerError,
|
||||
"message": "Translation failed: " + err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if result.Code == http.StatusOK {
|
||||
|
||||
Reference in New Issue
Block a user