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