Compare commits

...
62 Commits
Author SHA1 Message Date
Vincent Young 80f63f1174 chore: fix docker images 2023-05-30 01:21:20 +08:00
Vincent Young 2ced7ee49b chore: build docker 2023-05-30 01:07:43 +08:00
Vincent Young 684ecb4221 Update README.md 2023-04-27 02:16:12 +08:00
Vincent Young 62027d38fb chore: homebrew using v0.7.7 2023-04-23 13:49:25 +08:00
Vincent Young 491a2e7e5e Merge branch 'main' of https://github.com/OwO-Network/DeepLX 2023-04-23 13:25:52 +08:00
Vincent Young c4e7565703 feat: support for specified ports 2023-04-23 13:25:47 +08:00
Vincent Young bbf535e97b chore: switch to the robot release 2023-04-10 00:30:37 +08:00
Vincent Young f9f378e7eb docs: add python call example 2023-03-21 16:56:08 +08:00
Vincent Young d0310450e5 Create .github/FUNDING.yml 2023-03-18 19:05:31 +08:00
Vincent Young 80aaa94b06 Update README.md 2023-03-17 17:27:19 +08:00
Vincent Young 62befe706c docs: add docker compose v2 command
Update README.md
2023-03-17 17:23:41 +08:00
Davy b429e451dd Update README.md 2023-03-17 02:21:15 -07:00
Vincent Young cbd1507335 docs: modify to the latest response demo 2023-03-16 20:25:44 +08:00
Vincent Young db722920cd feat: return full alternatives 2023-03-16 20:23:21 +08:00
Vincent Young a5b256d7ad docs: not recommended for use on immersive 2023-03-07 04:58:17 +08:00
Vincent Young 6befe9c53d docs: detailed description 2023-03-07 04:40:44 +08:00
Vincent Young 1ecf4480d6 docs: fix guide 2023-03-07 04:10:38 +08:00
Vincent Young 6d4f38c051 chore: add docker-compose 2023-03-07 03:12:31 +08:00
Vincent Young b35c1d6622 docs: add dockerhub support 2023-03-07 03:05:22 +08:00
Vincent Young 70e64ad3b1 chore: fix dockerhub bug 2023-03-07 02:57:58 +08:00
Vincent Young 5be234ffd1 chore: add dockerhub 2023-03-07 02:53:59 +08:00
Vincent Young 7af10b4528 Merge pull request #28 from K024/feat/cors
feat: Add CORS middleware
2023-03-07 00:28:58 +08:00
K024 ca78976607 feat: Add CORS middleware 2023-03-07 00:19:27 +08:00
Vincent Young 865067066f Update README.md 2023-03-06 20:48:46 +08:00
Vincent Young 1dc48e6d3c docs: support docker 2023-03-06 20:48:26 +08:00
Vincent Young 1ac235fb41 docs: switch to own deeplx plugin 2023-03-05 22:10:58 +08:00
Vincent Young 0f97ccc90f Merge pull request #26 from MartialBE/main
add Docker Image Build
2023-03-05 22:10:09 +08:00
MartialBE 73b67e8681 在 GitHub Actions 中添加 Docker 镜像构建和缓存功能
- 添加 Docker 构建和发布的 Github Action
- 为 `dev` 分支和 带有`v*`的 tag 构建和发布 Docker 镜像
- 使用 `ghcr.io` 作为 Docker 注册表,并通过 Github 凭据进行身份验证
- 使用 `docker/metadata-action` 为 Docker 镜像设置标签和标记
- 使用 Github Actions 缓存模式缓存 Docker 镜像。
2023-03-05 20:48:54 +08:00
Vincent Young 553e2816f9 docs: add blank line 2023-03-04 16:57:28 +08:00
Vincent Young 9f92a11da1 docs: brew view the currently installed version 2023-03-03 02:31:10 +08:00
Vincent Young 1daf41b262 docs: fix grammatical errors 2023-03-03 02:27:30 +08:00
Vincent Young 155579355b Merge branch 'main' of https://github.com/OwO-Network/DeepLX 2023-03-03 02:26:53 +08:00
Vincent Young 2bfa97d18c docs: add the command of brew update 2023-03-03 02:26:49 +08:00
Vincent Young 4e64391645 Update build.yml 2023-03-03 00:55:09 +08:00
Vincent Young f9d5c48f86 Merge pull request #21 from OwO-Network/dependabot/go_modules/golang.org/x/crypto-0.1.0
chore(deps): bump golang.org/x/crypto from 0.0.0-20210711020723-a769d52b0f97 to 0.1.0
2023-03-03 00:52:13 +08:00
dependabot[bot] 9345c927eb chore(deps): bump golang.org/x/crypto
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210711020723-a769d52b0f97 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 16:51:56 +00:00
Vincent Young 3442c2f4db Merge pull request #20 from OwO-Network/dependabot/go_modules/golang.org/x/net-0.7.0
chore(deps): bump golang.org/x/net from 0.0.0-20210226172049-e18ecbb05110 to 0.7.0
2023-03-03 00:50:52 +08:00
dependabot[bot] 5bef2bc630 chore(deps): bump golang.org/x/net
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20210226172049-e18ecbb05110 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/commits/v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 16:49:36 +00:00
Vincent Young bc49e4029f Update README.md 2023-03-02 23:22:26 +08:00
Vincent Young 956bcbd287 Update README.md 2023-03-02 16:50:24 +08:00
Vincent Young 401fdb9d0b Merge pull request #18 from cijiugechu/feat/detect-lang 2023-03-02 14:41:27 +08:00
cijiugechu 4a79f9ffad feat: Automatically detect the source lang 2023-03-02 14:36:41 +08:00
Vincent Young c870ce0dc7 Update README.md 2023-03-02 12:10:10 +08:00
Vincent Young bde89980e5 Update README.md 2023-03-02 11:51:56 +08:00
Vincent Young 5a67c9c225 docs: add immersive-translate usage. 2023-02-28 18:15:54 +08:00
Vincent Young 01f30e033e Merge pull request #9 from sbilly/patch-1
Create Dockerfile
2023-02-28 16:22:56 +08:00
sbilly 890a211a92 Create Dockerfile
build docker image for DeepLX
2023-02-27 00:03:11 +08:00
Vincent Young 8579f68985 docs: correct author information 2023-02-25 22:27:15 +08:00
Vincent Young ffdba23b03 style: return a uniform variable name 2023-02-25 22:17:13 +08:00
Vincent Young a3778c05fb refactor: rebuild the code format without logic
Merge pull request #7 from Kabochar/main
2023-02-25 22:10:59 +08:00
kabocha 81c94afb55 style(main.go): make it like golang code format 2023-02-25 22:03:51 +08:00
Vincent Young 48151fec8f docs: add a note 2023-02-24 21:37:01 +08:00
Vincent Young 154fb27895 Merge pull request #3 from wuyudi/add-aur
add aur
2023-02-24 15:14:47 +08:00
Vincent Young 08fd328e9d Update README.md 2023-02-20 16:46:48 +08:00
Vincent Young d8fbb7e07e Update README.md 2023-02-18 21:29:55 +08:00
Vincent Young d16d74b3e9 Update README.md 2023-02-18 21:01:05 +08:00
Vincent Young 8b0953e9f7 Update install.sh 2023-02-18 20:57:58 +08:00
Vincent Young 43565812b5 Update deeplx.service 2023-02-18 20:55:20 +08:00
Vincent Young f8a41debe6 Merge branch 'main' of https://github.com/OwO-Network/DeepLX 2023-02-18 20:46:26 +08:00
Vincent Young e593bceb97 fix: disable cgo 2023-02-18 20:46:16 +08:00
Vincent Young 9e558516ef Update README.md 2023-02-18 20:28:10 +08:00
AsukaMinato 7aa936e888 add aur 2023-02-16 21:38:33 +09:00
12 changed files with 359 additions and 121 deletions
+5 -11
View File
@@ -3,7 +3,7 @@
# @Author: Vincent Young # @Author: Vincent Young
# @Date: 2022-10-20 02:19:06 # @Date: 2022-10-20 02:19:06
# @LastEditors: Vincent Young # @LastEditors: Vincent Young
# @LastEditTime: 2022-10-20 09:51:57 # @LastEditTime: 2023-02-18 20:45:52
# @FilePath: /DeepLX/.cross_compile.sh # @FilePath: /DeepLX/.cross_compile.sh
# @Telegram: https://t.me/missuo # @Telegram: https://t.me/missuo
# #
@@ -29,16 +29,10 @@ for pl in ${PLATFORMS}; do
echo "build => ${TARGET}" echo "build => ${TARGET}"
if [ "${DEBUG_MODE}" == "debug" ]; then if [ "${DEBUG_MODE}" == "debug" ]; then
go build -trimpath -gcflags "all=-N -l" -o ${TARGET} \ CGO_ENABLED=0 go build -trimpath -gcflags "all=-N -l" -o ${TARGET} \
-ldflags "-X 'main.version=${BUILD_VERSION}' \ -ldflags "-w -s" main.go
-X 'main.buildDate=${BUILD_DATE}' \
-X 'main.commitID=${COMMIT_SHA1}'\
-w -s"
else else
go build -trimpath -o ${TARGET} \ CGO_ENABLED=0 go build -trimpath -o ${TARGET} \
-ldflags "-X 'main.version=${BUILD_VERSION}' \ -ldflags "-w -s" main.go
-X 'main.buildDate=${BUILD_DATE}' \
-X 'main.commitID=${COMMIT_SHA1}'\
-w -s"
fi fi
done done
+1
View File
@@ -0,0 +1 @@
custom: https://paypal.me/missuo
+4 -16
View File
@@ -1,5 +1,7 @@
on: on:
push: push:
tags:
- 'v*'
pull_request: pull_request:
name: Build Release name: Build Release
@@ -13,7 +15,7 @@ jobs:
- uses: actions/setup-go@v2 - uses: actions/setup-go@v2
with: with:
go-version: "1.18" go-version: "1.19"
- run: bash .cross_compile.sh - run: bash .cross_compile.sh
@@ -22,18 +24,4 @@ jobs:
with: with:
draft: false draft: false
files: | files: |
dist/deeplx_darwin_amd64 dist/*
dist/deeplx_darwin_arm64
dist/deeplx_linux_386
dist/deeplx_linux_amd64
dist/deeplx_linux_arm64
dist/deeplx_linux_armv7
dist/deeplx_linux_mips
dist/deeplx_openbsd_amd64
dist/deeplx_openbsd_arm64
dist/deeplx_freebsd_amd64
dist/deeplx_freebsd_arm64
dist/deeplx_windows_amd64.exe
dist/deeplx_windows_386.exe
env:
GITHUB_TOKEN: ${{ secrets.GT_Token }}
+77
View File
@@ -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
View File
@@ -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"]
+116 -18
View File
@@ -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,19 +27,74 @@ 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 `/Users/YOUR_USERNAME/Library/LaunchAgents`. 2. Download the `me.missuo.deeplx.plist` to `~/Library/LaunchAgents`.
```bash ```bash
wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/me.missuo.deeplx.plist -O ~/Library/LaunchAgents/me.missuo.deeplx.plist wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/me.missuo.deeplx.plist -O ~/Library/LaunchAgents/me.missuo.deeplx.plist
``` ```
@@ -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.
![9a75c26ad6e8bd9b7582c](https://telegraph.eowo.us/file/9a75c26ad6e8bd9b7582c.png)
## 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)
![c5c19dd89df6fae1a256d](https://missuo.ru/file/c5c19dd89df6fae1a256d.png)
## 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)
![6a48ba28621f2465028f0](https://missuo.ru/file/6a48ba28621f2465028f0.png)
## 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>
+3 -5
View File
@@ -1,14 +1,12 @@
[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
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
+8
View File
@@ -0,0 +1,8 @@
version: '3'
services:
deeplx:
image: ghcr.io/owo-network/deeplx:latest
restart: always
ports:
- "1188:1188"
+12 -7
View File
@@ -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
) )
+28 -4
View File
@@ -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=
+2 -1
View File
@@ -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
+89 -59
View File
@@ -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))
} }