mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2026-12-01 14:57:52 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80f63f1174 | ||
|
|
2ced7ee49b | ||
|
|
684ecb4221 | ||
|
|
62027d38fb | ||
|
|
491a2e7e5e | ||
|
|
c4e7565703 | ||
|
|
bbf535e97b | ||
|
|
f9f378e7eb | ||
|
|
d0310450e5 | ||
|
|
80aaa94b06 | ||
|
|
62befe706c | ||
|
|
b429e451dd | ||
|
|
cbd1507335 | ||
|
|
db722920cd | ||
|
|
a5b256d7ad | ||
|
|
6befe9c53d | ||
|
|
1ecf4480d6 | ||
|
|
6d4f38c051 | ||
|
|
b35c1d6622 | ||
|
|
70e64ad3b1 | ||
|
|
5be234ffd1 | ||
|
|
7af10b4528 | ||
|
|
ca78976607 | ||
|
|
865067066f | ||
|
|
1dc48e6d3c | ||
|
|
1ac235fb41 | ||
|
|
0f97ccc90f | ||
|
|
73b67e8681 | ||
|
|
553e2816f9 | ||
|
|
9f92a11da1 | ||
|
|
1daf41b262 | ||
|
|
155579355b | ||
|
|
2bfa97d18c | ||
|
|
4e64391645 | ||
|
|
f9d5c48f86 | ||
|
|
9345c927eb | ||
|
|
3442c2f4db | ||
|
|
5bef2bc630 | ||
|
|
bc49e4029f | ||
|
|
956bcbd287 | ||
|
|
401fdb9d0b | ||
|
|
4a79f9ffad | ||
|
|
c870ce0dc7 | ||
|
|
bde89980e5 | ||
|
|
5a67c9c225 | ||
|
|
01f30e033e | ||
|
|
890a211a92 | ||
|
|
8579f68985 | ||
|
|
ffdba23b03 | ||
|
|
a3778c05fb | ||
|
|
81c94afb55 | ||
|
|
48151fec8f | ||
|
|
154fb27895 | ||
|
|
08fd328e9d | ||
|
|
d8fbb7e07e | ||
|
|
d16d74b3e9 | ||
|
|
8b0953e9f7 | ||
|
|
43565812b5 | ||
|
|
7aa936e888 |
@@ -0,0 +1 @@
|
|||||||
|
custom: https://paypal.me/missuo
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
name: Build Release
|
name: Build Release
|
||||||
@@ -23,5 +25,3 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
files: |
|
files: |
|
||||||
dist/*
|
dist/*
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GT_Token }}
|
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
name: Docker Image CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# github.repository as <account>/<repo>
|
||||||
|
DOCKER_IMAGE_NAME: missuo/deeplx
|
||||||
|
GHCR_IMAGE_NAME: ${{ github.repository }}
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
GHCR_TOKEN: ${{ secrets.GT_Token }}
|
||||||
|
GHCR_USERNAME: ${{ github.repository_owner }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: Set up docker buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: docker.io
|
||||||
|
username: ${{ env.DOCKER_USERNAME }}
|
||||||
|
password: ${{ env.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ env.GHCR_USERNAME }}
|
||||||
|
password: ${{ env.GHCR_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
docker.io/${{ env.DOCKER_IMAGE_NAME }}
|
||||||
|
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM golang:1.19 AS builder
|
||||||
|
WORKDIR /go/src/github.com/OwO-Network/DeepLX
|
||||||
|
COPY main.go ./
|
||||||
|
COPY go.mod ./
|
||||||
|
COPY go.sum ./
|
||||||
|
RUN go get -d -v ./
|
||||||
|
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"]
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: Vincent Young
|
* @Author: Vincent Young
|
||||||
* @Date: 2022-10-18 07:32:29
|
* @Date: 2022-10-18 07:32:29
|
||||||
* @LastEditors: Vincent Young
|
* @LastEditors: Vincent Young
|
||||||
* @LastEditTime: 2023-02-18 19:46:10
|
* @LastEditTime: 2023-04-23 13:49:08
|
||||||
* @FilePath: /DeepLX/README.md
|
* @FilePath: /DeepLX/README.md
|
||||||
* @Telegram: https://t.me/missuo
|
* @Telegram: https://t.me/missuo
|
||||||
*
|
*
|
||||||
@@ -11,11 +11,12 @@
|
|||||||
# DeepL X
|
# DeepL X
|
||||||
Permanently free DeepL API written in Golang
|
Permanently free DeepL API written in Golang
|
||||||
|
|
||||||
|
**Added Python Package: [OwO-Network/PyDeepLX](https://github.com/OwO-Network/PyDeepLX)**
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
- `deeplx` in only run in port `1188`, later versions will do the specified port.
|
- `DeepLX` is listening to `0.0.0.0:1188` by default. You can modify the listening port by yourself.
|
||||||
- `deeplx` is listening to `0.0.0.0:1188` by default.
|
- `DeepLX` is using `DeepL` Free API.
|
||||||
- `deeplx` is using `DeepL` Free API.
|
- `DeepLX` is unlimited to the number of requests.
|
||||||
- `deeplx` is unlimited to the number of requests.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### Request Parameters
|
### Request Parameters
|
||||||
@@ -26,16 +27,71 @@ Permanently free DeepL API written in Golang
|
|||||||
### Response
|
### Response
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"alternatives": [
|
||||||
|
"Undisputed",
|
||||||
|
"Unquestionable",
|
||||||
|
"Unquestionably"
|
||||||
|
],
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"data": "Hello world",
|
"data": "Undoubtedly",
|
||||||
"id": 8305092005
|
"id": 8300079001
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
### Specify the port
|
||||||
|
**Thanks to [cijiugechu](https://github.com/cijiugechu) for [his contribution](https://github.com/OwO-Network/DeepLX/commit/4a0920579ea868b0f05ccdff6bceae316bfd5dc8) to make this feature possible for this project!**
|
||||||
|
```bash
|
||||||
|
./deeplx -p 3333
|
||||||
|
# or
|
||||||
|
./deeplx -port 3333
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run with Docker
|
||||||
|
```bash
|
||||||
|
# ghcr.io
|
||||||
|
docker run -itd -p 1188:1188 ghcr.io/owo-network/deeplx:latest
|
||||||
|
|
||||||
|
# dockerhub
|
||||||
|
docker run -itd -p 1188:1188 missuo/deeplx:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run with Docker Compose
|
||||||
|
```bash
|
||||||
|
mkdir deeplx
|
||||||
|
cd deeplx
|
||||||
|
wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/docker-compose.yaml
|
||||||
|
# docker compose v1
|
||||||
|
docker-compose up -d
|
||||||
|
# or docker compose v2
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run on Linux Server
|
||||||
|
```bash
|
||||||
|
bash <(curl -Ls https://cpp.li/deeplx)
|
||||||
|
```
|
||||||
|
|
||||||
### Run on Mac
|
### Run on Mac
|
||||||
|
#### Homebrew (Recommended)
|
||||||
|
**For unknown reasons v0.7.8 does not work properly with Homebrew, so we are still using v0.7.7 for our version of Homebrew, it has no bugs and it is almost perfect.**
|
||||||
|
```bash
|
||||||
|
brew tap owo-network/brew
|
||||||
|
brew install deeplx
|
||||||
|
brew services start owo-network/brew/deeplx
|
||||||
|
|
||||||
|
# Update to the latest version
|
||||||
|
brew update
|
||||||
|
brew upgrade deeplx
|
||||||
|
brew services restart owo-network/brew/deeplx
|
||||||
|
|
||||||
|
# View the currently installed version
|
||||||
|
brew list --versions deeplx
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Manual
|
||||||
1. Download the latest release of DeepL X.
|
1. Download the latest release of DeepL X.
|
||||||
```bash
|
```bash
|
||||||
sudo mv deeplx_darwin_amd64 /usr/local/bin/deeplx
|
sudo mv deeplx_darwin_amd64 /usr/local/bin/deeplx
|
||||||
|
sudo chmod +x /usr/local/bin/deeplx
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Download the `me.missuo.deeplx.plist` to `~/Library/LaunchAgents`.
|
2. Download the `me.missuo.deeplx.plist` to `~/Library/LaunchAgents`.
|
||||||
@@ -48,15 +104,57 @@ launchctl load ~/Library/LaunchAgents/me.missuo.deeplx.plist
|
|||||||
launchctl start ~/Library/LaunchAgents/me.missuo.deeplx.plist
|
launchctl start ~/Library/LaunchAgents/me.missuo.deeplx.plist
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup on [Bob App](https://bobtranslate.com/)
|
### Install from AUR
|
||||||
1. Install [bob-plugin-deeplx](https://github.com/clubxdev/bob-plugin-deeplx) on Bob.
|
```bash
|
||||||
|
paru -S deeplx-bin
|
||||||
2. Setup the API.
|
|
||||||

|
|
||||||
|
|
||||||
## Docker Backup for zu1k
|
|
||||||
```shell
|
|
||||||
docker run -itd -p 7373:80 missuo/deeplx-bk
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
After installation, start the daemon with the following command.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable deeplx
|
||||||
|
|
||||||
|
```
|
||||||
|
## Setup on [Bob App](https://bobtranslate.com/)
|
||||||
|
1. Install [bob-plugin-deeplx](https://github.com/missuo/bob-plugin-deeplx) on Bob.
|
||||||
|
|
||||||
|
2. Setup the API. (If you use Brew to install locally you can skip this step)
|
||||||
|

|
||||||
|
|
||||||
|
## Setup on [immersive-translate](https://github.com/immersive-translate/immersive-translate)
|
||||||
|
**It is not recommended, because the `immersive-translate` will send many requests in a short time, which will cause the `DeepL API` to block your IP.**
|
||||||
|
|
||||||
|
1. Install Latest [immersive-translate ](https://github.com/immersive-translate/immersive-translate/releases) on your browser.
|
||||||
|
|
||||||
|
2. Click on **Developer Settings** in the bottom left corner. **Enable Beta experimental features**.
|
||||||
|
|
||||||
|
3. Set the URL. (If you are not deploying locally, you need to change 127.0.0.1 to the IP of your server)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Use in Python
|
||||||
|
```python
|
||||||
|
import httpx, json
|
||||||
|
|
||||||
|
deeplx_api = "http://127.0.0.1:1188/translate"
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"text": "Hello World",
|
||||||
|
"source_lang": "EN",
|
||||||
|
"target_lang": "ZH"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_data = json.dumps(data)
|
||||||
|
r = httpx.post(url = deeplx_api, data = post_data).text
|
||||||
|
print(r)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Backup the Docker Image of zu1k
|
||||||
|
```shell
|
||||||
|
docker run -itd -p 1188:80 missuo/deeplx-bk
|
||||||
|
```
|
||||||
|
**This docker image is not related to this project, as the original author deleted the image, it is only for backup.**
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
**DeepL X** © [Vincent Young](https://github.com/missuo) & [Leo Shen](https://github.com/sjlleo), Released under the [MIT](./LICENSE) License.<br>
|
**DeepL X** © [DeepL X Contributors](https://github.com/OwO-Network/DeepLX/graphs/contributors), Released under the [MIT](./LICENSE) License.<br>
|
||||||
|
|||||||
+2
-4
@@ -1,12 +1,10 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=DeepLX Service
|
Description=DeepLX Service
|
||||||
After=network.target nss-lookup.target
|
After=network.target
|
||||||
Wants=network.target
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=root
|
|
||||||
Group=root
|
|
||||||
Type=simple
|
Type=simple
|
||||||
|
Restart=always
|
||||||
WorkingDirectory=/usr/bin/
|
WorkingDirectory=/usr/bin/
|
||||||
ExecStart=/usr/bin/deeplx
|
ExecStart=/usr/bin/deeplx
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
deeplx:
|
||||||
|
image: ghcr.io/owo-network/deeplx:latest
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "1188:1188"
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
module github.com/OwO-Network/deepl-api
|
module github.com/OwO-Network/DeepLX
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require github.com/tidwall/gjson v1.14.3
|
require (
|
||||||
|
github.com/abadojack/whatlanggo v1.0.1
|
||||||
|
github.com/gin-contrib/cors v1.4.0
|
||||||
|
github.com/gin-gonic/gin v1.8.1
|
||||||
|
github.com/tidwall/gjson v1.14.3
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/Jeffail/gabs/v2 v2.7.0 // indirect
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
github.com/gin-gonic/gin v1.8.1 // indirect
|
|
||||||
github.com/go-playground/locales v0.14.0 // indirect
|
github.com/go-playground/locales v0.14.0 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.10.0 // indirect
|
github.com/go-playground/validator/v10 v10.10.0 // indirect
|
||||||
@@ -20,10 +25,10 @@ require (
|
|||||||
github.com/tidwall/match v1.1.1 // indirect
|
github.com/tidwall/match v1.1.1 // indirect
|
||||||
github.com/tidwall/pretty v1.2.0 // indirect
|
github.com/tidwall/pretty v1.2.0 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.7 // indirect
|
github.com/ugorji/go/codec v1.2.7 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
|
golang.org/x/crypto v0.1.0 // indirect
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
|
golang.org/x/net v0.7.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect
|
golang.org/x/sys v0.5.0 // indirect
|
||||||
golang.org/x/text v0.3.6 // indirect
|
golang.org/x/text v0.7.0 // indirect
|
||||||
google.golang.org/protobuf v1.28.0 // indirect
|
google.golang.org/protobuf v1.28.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
|
github.com/Jeffail/gabs/v2 v2.7.0 h1:Y2edYaTcE8ZpRsR2AtmPu5xQdFDIthFG0jYhu5PY8kg=
|
||||||
|
github.com/Jeffail/gabs/v2 v2.7.0/go.mod h1:dp5ocw1FvBBQYssgHsG7I1WYsiLRtkUaB1FEtSwvNUw=
|
||||||
|
github.com/abadojack/whatlanggo v1.0.1 h1:19N6YogDnf71CTHm3Mp2qhYfkRdyvbgwWdd2EPxJRG4=
|
||||||
|
github.com/abadojack/whatlanggo v1.0.1/go.mod h1:66WiQbSbJBIlOZMsvbKe5m6pzQovxCH9B/K8tQB2uoc=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
|
||||||
|
github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
|
||||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
|
github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
|
||||||
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
|
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
|
||||||
|
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
|
||||||
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||||
@@ -15,15 +23,18 @@ github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXS
|
|||||||
github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM=
|
github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM=
|
||||||
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
||||||
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||||
@@ -36,14 +47,19 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
|
|||||||
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
|
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
|
||||||
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
|
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
|
||||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||||
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/tidwall/gjson v1.14.3 h1:9jvXn7olKEHU1S9vwoMGliaT8jq1vJ7IH/n9zD9Dnlw=
|
github.com/tidwall/gjson v1.14.3 h1:9jvXn7olKEHU1S9vwoMGliaT8jq1vJ7IH/n9zD9Dnlw=
|
||||||
github.com/tidwall/gjson v1.14.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
github.com/tidwall/gjson v1.14.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||||
@@ -53,29 +69,37 @@ github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso
|
|||||||
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
|
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
|
||||||
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
|
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
|
||||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
|
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
|
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
|
||||||
|
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||||
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU=
|
|
||||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||||
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ install_deeplx(){
|
|||||||
wget -q -N --no-check-certificate -O /etc/systemd/system/deeplx.service https://raw.githubusercontent.com/OwO-Network/DeepLX/main/deeplx.service
|
wget -q -N --no-check-certificate -O /etc/systemd/system/deeplx.service https://raw.githubusercontent.com/OwO-Network/DeepLX/main/deeplx.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable deeplx
|
systemctl enable deeplx
|
||||||
|
systemctl start deeplx
|
||||||
echo -e "Installed successfully, listening at 0.0.0.0:1188"
|
echo -e "Installed successfully, listening at 0.0.0.0:1188"
|
||||||
}
|
}
|
||||||
install_deeplx
|
install_deeplx
|
||||||
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@@ -11,10 +12,26 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/abadojack/whatlanggo"
|
||||||
|
"github.com/gin-contrib/cors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var port int
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
const (
|
||||||
|
defaultPort = 1188
|
||||||
|
usage = "set up the port to listen on"
|
||||||
|
)
|
||||||
|
|
||||||
|
flag.IntVar(&port, "port", defaultPort, usage)
|
||||||
|
flag.IntVar(&port, "p", defaultPort, usage)
|
||||||
|
|
||||||
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||||
|
}
|
||||||
|
|
||||||
type Lang struct {
|
type Lang struct {
|
||||||
SourceLangUserSelected string `json:"source_lang_user_selected"`
|
SourceLangUserSelected string `json:"source_lang_user_selected"`
|
||||||
TargetLang string `json:"target_lang"`
|
TargetLang string `json:"target_lang"`
|
||||||
@@ -46,15 +63,15 @@ type PostData struct {
|
|||||||
Params Params `json:"params"`
|
Params Params `json:"params"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func init_data(source_lang string, target_lang string) *PostData {
|
func initData(sourceLang string, targetLang string) *PostData {
|
||||||
return &PostData{
|
return &PostData{
|
||||||
Jsonrpc: "2.0",
|
Jsonrpc: "2.0",
|
||||||
Method: "LMT_handle_texts",
|
Method: "LMT_handle_texts",
|
||||||
Params: Params{
|
Params: Params{
|
||||||
Splitting: "newlines",
|
Splitting: "newlines",
|
||||||
Lang: Lang{
|
Lang: Lang{
|
||||||
SourceLangUserSelected: source_lang,
|
SourceLangUserSelected: sourceLang,
|
||||||
TargetLang: target_lang,
|
TargetLang: targetLang,
|
||||||
},
|
},
|
||||||
CommonJobParams: CommonJobParams{
|
CommonJobParams: CommonJobParams{
|
||||||
WasSpoken: false,
|
WasSpoken: false,
|
||||||
@@ -65,8 +82,8 @@ func init_data(source_lang string, target_lang string) *PostData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func get_i_count(translate_text string) int64 {
|
func getICount(translateText string) int64 {
|
||||||
return int64(strings.Count(translate_text, "i"))
|
return int64(strings.Count(translateText, "i"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRandomNumber() int64 {
|
func getRandomNumber() int64 {
|
||||||
@@ -75,26 +92,28 @@ func getRandomNumber() int64 {
|
|||||||
return num * 1000
|
return num * 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTimeStamp(i_count int64) int64 {
|
func getTimeStamp(iCount int64) int64 {
|
||||||
ts := time.Now().UnixMilli()
|
ts := time.Now().UnixMilli()
|
||||||
if i_count != 0 {
|
if iCount != 0 {
|
||||||
i_count = i_count + 1
|
iCount = iCount + 1
|
||||||
return ts - ts%i_count + i_count
|
return ts - ts%iCount + iCount
|
||||||
} else {
|
} else {
|
||||||
return ts
|
return ts
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResData struct {
|
type ResData struct {
|
||||||
Trans_Text string `json:"text"`
|
TransText string `json:"text"`
|
||||||
Source_Lang string `json:"source_lang"`
|
SourceLang string `json:"source_lang"`
|
||||||
Target_Lang string `json:"target_lang"`
|
TargetLang string `json:"target_lang"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// parse flags
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
// display information
|
// display information
|
||||||
fmt.Println("DeepL X has been successfully launched! Listening on 0.0.0.0:1188")
|
fmt.Printf("DeepL X has been successfully launched! Listening on 0.0.0.0:%v\n", port)
|
||||||
fmt.Println("Made by sjlleo and missuo.")
|
fmt.Println("Made by sjlleo and missuo.")
|
||||||
|
|
||||||
// create a random id
|
// create a random id
|
||||||
@@ -103,11 +122,12 @@ func main() {
|
|||||||
// set release mode
|
// set release mode
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
r.Use(cors.Default())
|
||||||
|
|
||||||
r.GET("/", func(c *gin.Context) {
|
r.GET("/", func(c *gin.Context) {
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"msg": "DeepL API, Made by sjlleo and missuo. Go to /translate with POST.",
|
"message": "DeepL Free API, Made by sjlleo and missuo. Go to /translate with POST. http://github.com/OwO-Network/DeepLX",
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -115,41 +135,48 @@ func main() {
|
|||||||
r.POST("/translate", func(c *gin.Context) {
|
r.POST("/translate", func(c *gin.Context) {
|
||||||
reqj := ResData{}
|
reqj := ResData{}
|
||||||
c.BindJSON(&reqj)
|
c.BindJSON(&reqj)
|
||||||
source_lang := reqj.Source_Lang
|
|
||||||
target_lang := reqj.Target_Lang
|
sourceLang := reqj.SourceLang
|
||||||
if source_lang == "" {
|
targetLang := reqj.TargetLang
|
||||||
source_lang = "ZH"
|
translateText := reqj.TransText
|
||||||
|
if sourceLang == "" {
|
||||||
|
lang := whatlanggo.DetectLang(translateText)
|
||||||
|
deepLLang := strings.ToUpper(lang.Iso6391())
|
||||||
|
sourceLang = deepLLang
|
||||||
}
|
}
|
||||||
if target_lang == "" {
|
if targetLang == "" {
|
||||||
target_lang = "EN"
|
targetLang = "EN"
|
||||||
}
|
}
|
||||||
translate_text := reqj.Trans_Text
|
if translateText == "" {
|
||||||
// fmt.Printf("%v", translate_text)
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
if translate_text != "" {
|
"code": http.StatusNotFound,
|
||||||
|
"message": "No Translate Text Found",
|
||||||
|
})
|
||||||
|
} else {
|
||||||
url := "https://www2.deepl.com/jsonrpc"
|
url := "https://www2.deepl.com/jsonrpc"
|
||||||
id = id + 1
|
id = id + 1
|
||||||
post_data := init_data(source_lang, target_lang)
|
postData := initData(sourceLang, targetLang)
|
||||||
text := Text{
|
text := Text{
|
||||||
Text: translate_text,
|
Text: translateText,
|
||||||
RequestAlternatives: 3,
|
RequestAlternatives: 3,
|
||||||
}
|
}
|
||||||
// set id
|
// set id
|
||||||
post_data.ID = id
|
postData.ID = id
|
||||||
// set text
|
// set text
|
||||||
post_data.Params.Texts = append(post_data.Params.Texts, text)
|
postData.Params.Texts = append(postData.Params.Texts, text)
|
||||||
// set timestamp
|
// set timestamp
|
||||||
post_data.Params.Timestamp = getTimeStamp(get_i_count(translate_text))
|
postData.Params.Timestamp = getTimeStamp(getICount(translateText))
|
||||||
post_byte, _ := json.Marshal(post_data)
|
post_byte, _ := json.Marshal(postData)
|
||||||
post_str := string(post_byte)
|
postStr := string(post_byte)
|
||||||
|
|
||||||
// add space if necessary
|
// add space if necessary
|
||||||
if (id+5)%29 == 0 || (id+3)%13 == 0 {
|
if (id+5)%29 == 0 || (id+3)%13 == 0 {
|
||||||
post_str = strings.Replace(post_str, "\"method\":\"", "\"method\" : \"", -1)
|
postStr = strings.Replace(postStr, "\"method\":\"", "\"method\" : \"", -1)
|
||||||
} else {
|
} else {
|
||||||
post_str = strings.Replace(post_str, "\"method\":\"", "\"method\": \"", -1)
|
postStr = strings.Replace(postStr, "\"method\":\"", "\"method\": \"", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
post_byte = []byte(post_str)
|
post_byte = []byte(postStr)
|
||||||
reader := bytes.NewReader(post_byte)
|
reader := bytes.NewReader(post_byte)
|
||||||
request, err := http.NewRequest("POST", url, reader)
|
request, err := http.NewRequest("POST", url, reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -177,38 +204,41 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
res := gjson.ParseBytes(body)
|
res := gjson.ParseBytes(body)
|
||||||
|
|
||||||
// display response
|
// display response
|
||||||
fmt.Println(res)
|
// fmt.Println(res)
|
||||||
if res.Get("error.code").String() == "-32600" {
|
if res.Get("error.code").String() == "-32600" {
|
||||||
log.Println(res.Get("error").String())
|
log.Println(res.Get("error").String())
|
||||||
c.JSON(406, gin.H{
|
c.JSON(http.StatusNotAcceptable, gin.H{
|
||||||
"code": 406,
|
"code": http.StatusNotAcceptable,
|
||||||
"msg": "Invalid target_lang",
|
"message": "Invalid targetLang",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
if resp.StatusCode == 429 {
|
|
||||||
c.JSON(429, gin.H{
|
|
||||||
"code": 429,
|
|
||||||
"message": "Too Many Requests",
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
c.JSON(200, gin.H{
|
|
||||||
"code": 200,
|
|
||||||
"id": id,
|
|
||||||
"data": res.Get("result.texts.0.text").String(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
c.JSON(404, gin.H{
|
if resp.StatusCode == http.StatusTooManyRequests {
|
||||||
"code": 404,
|
c.JSON(http.StatusTooManyRequests, gin.H{
|
||||||
"message": "No Text Found",
|
"code": http.StatusTooManyRequests,
|
||||||
})
|
"message": "Too Many Requests",
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
var alternatives []string
|
||||||
|
res.Get("result.texts.0.alternatives").ForEach(func(key, value gjson.Result) bool {
|
||||||
|
alternatives = append(alternatives, value.Get("text").String())
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": http.StatusOK,
|
||||||
|
"id": id,
|
||||||
|
"data": res.Get("result.texts.0.text").String(),
|
||||||
|
"alternatives": alternatives,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
r.Run(":1188") // listen and serve on 0.0.0.0:1188
|
// by default, listen and serve on 0.0.0.0:1188
|
||||||
|
r.Run(fmt.Sprintf(":%v", port))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user