From 268d77e7b194dd02ac0523533f2d5eec08aed17d Mon Sep 17 00:00:00 2001 From: okxlin Date: Fri, 17 Nov 2023 00:25:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0deeplx=E5=88=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/deeplx/0.8.3/.env.sample | 3 + apps/deeplx/0.8.3/data.yml | 18 +++ apps/deeplx/0.8.3/docker-compose.yml | 17 +++ apps/deeplx/README.md | 199 ++++++++++++++++++++++++++ apps/deeplx/data.yml | 20 +++ apps/deeplx/latest/.env.sample | 3 + apps/deeplx/latest/data.yml | 18 +++ apps/deeplx/latest/docker-compose.yml | 17 +++ apps/deeplx/logo.png | Bin 0 -> 4768 bytes 9 files changed, 295 insertions(+) create mode 100644 apps/deeplx/0.8.3/.env.sample create mode 100644 apps/deeplx/0.8.3/data.yml create mode 100644 apps/deeplx/0.8.3/docker-compose.yml create mode 100644 apps/deeplx/README.md create mode 100644 apps/deeplx/data.yml create mode 100644 apps/deeplx/latest/.env.sample create mode 100644 apps/deeplx/latest/data.yml create mode 100644 apps/deeplx/latest/docker-compose.yml create mode 100644 apps/deeplx/logo.png diff --git a/apps/deeplx/0.8.3/.env.sample b/apps/deeplx/0.8.3/.env.sample new file mode 100644 index 00000000..916bc865 --- /dev/null +++ b/apps/deeplx/0.8.3/.env.sample @@ -0,0 +1,3 @@ +CONTAINER_NAME="deeplx" +PANEL_APP_PORT_HTTP="40174" +TOKEN_VAULE="token123456" diff --git a/apps/deeplx/0.8.3/data.yml b/apps/deeplx/0.8.3/data.yml new file mode 100644 index 00000000..e0d9d0cd --- /dev/null +++ b/apps/deeplx/0.8.3/data.yml @@ -0,0 +1,18 @@ +additionalProperties: + formFields: + - default: 40174 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelEn: Port + labelZh: 端口 + required: true + rule: paramPort + type: number + - default: deeplx + envKey: TOKEN_VAULE + labelEn: Token + labelZh: 密码 + random: true + required: false + rule: paramComplexity + type: password diff --git a/apps/deeplx/0.8.3/docker-compose.yml b/apps/deeplx/0.8.3/docker-compose.yml new file mode 100644 index 00000000..a0d9f3b1 --- /dev/null +++ b/apps/deeplx/0.8.3/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' +services: + deeplx: + container_name: ${CONTAINER_NAME} + restart: always + networks: + - 1panel-network + ports: + - "${PANEL_APP_PORT_HTTP}:1188" + command: ["/app/deeplx", "-token", "${TOKEN_VAULE}"] + image: missuo/deeplx:v0.8.3 + labels: + createdBy: "Apps" + +networks: + 1panel-network: + external: true diff --git a/apps/deeplx/README.md b/apps/deeplx/README.md new file mode 100644 index 00000000..61203ad1 --- /dev/null +++ b/apps/deeplx/README.md @@ -0,0 +1,199 @@ +# 使用说明 + +使用例子`http://IP:Port/translate` + +# 原始相关 +*** + +[![GitHub Workflow][1]](https://github.com/OwO-Network/DeepLX/actions) +[![Go Version][2]](https://github.com/OwO-Network/DeepLX/blob/main/go.mod) +[![Go Report][3]](https://goreportcard.com/badge/github.com/OwO-Network/DeepLX) +[![Maintainability][4]](https://codeclimate.com/github/OwO-Network/DeepLX/maintainability) +[![GitHub License][5]](https://github.com/OwO-Network/DeepLX/blob/main/LICENSE) +[![Docker Pulls][6]](https://hub.docker.com/r/missuo/deeplx) +[![Releases][7]](https://github.com/OwO-Network/DeepLX/releases) + +[1]: https://img.shields.io/github/actions/workflow/status/OwO-Network/DeepLX/build.yml?logo=github +[2]: https://img.shields.io/github/go-mod/go-version/OwO-Network/DeepLX?logo=go +[3]: https://goreportcard.com/badge/github.com/OwO-Network/DeepLX +[4]: https://api.codeclimate.com/v1/badges/b5b30239174fc6603aca/maintainability +[5]: https://img.shields.io/github/license/OwO-Network/DeepLX +[6]: https://img.shields.io/docker/pulls/missuo/deeplx?logo=docker +[7]: https://img.shields.io/github/v/release/OwO-Network/DeepLX?logo=smartthings + +## **Related Projects** +| Link | Description | Maintainer | +| ------------------------------------------ | -------------------------------------- | ----------------- | +| [OwO-Network/PyDeepLX](https://github.com/OwO-Network/PyDeepLX) | Python Package for DeepLX | OwO-Network | +| [OwO-Network/gdeeplx](https://github.com/OwO-Network/gdeeplx) | Golang Package for DeepLX | OwO-Network | +| [ifyour/deeplx](https://github.com/ifyour/deeplx) | JS Package for DeepLX (JavaScript) | ifyour | + +## Discussion Group +[Telegram Group](https://t.me/+8KDGHKJCxEVkNzll) + +## Description +- `DeepLX` is listening to `0.0.0.0:1188` by default. You can modify the listening port by yourself. +- `DeepLX` is using `DeepL` Free API. +- `DeepLX` is unlimited to the number of requests. + +## Usage +### Request Parameters +- text: string +- source_lang: string +- target_lang: string + +### Response +```json +{ + "alternatives": [ + "no one else", + "there is no other person (idiom); there is no one else", + "there is no other person" + ], + "code": 200, + "data": "there is no one else", + "id": 8352115005, + "source_lang": "ZH", + "target_lang": "EN" +} +``` +### Specify the port (Optional) +**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 +``` +### Set access password (Optional) +**To prevent abuse of your public API, you can use a token to restrict translation requests.** +```bash +./deeplx -token hellodeeplx +``` + +``` +curl -X POST http://localhost:1188/translate \ +-H "Content-Type: application/json" \ +-H "Authorization: Bearer your_access_token" \ +-d '{ + "text": "Hello, world!", + "source_lang": "EN", + "target_lang": "DE" +}' + +``` + +### 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://raw.githubusercontent.com/OwO-Network/DeepLX/main/install.sh) +# or +bash <(curl -Ls https://qwq.mx/deeplx) +``` + +### Run on Mac +#### Homebrew (Recommended) +**Homebrew has been fixed in the latest version and works perfectly.** +```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. +```bash +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`. +```bash +wget https://raw.githubusercontent.com/OwO-Network/DeepLX/main/me.missuo.deeplx.plist -O ~/Library/LaunchAgents/me.missuo.deeplx.plist +``` +3. Run following command. +```bash +launchctl load ~/Library/LaunchAgents/me.missuo.deeplx.plist +launchctl start ~/Library/LaunchAgents/me.missuo.deeplx.plist +``` + +### Install from AUR +```bash +paru -S deeplx-bin +``` + +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.** + +## License +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FOwO-Network%2FDeepLX.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FOwO-Network%2FDeepLX?ref=badge_large) \ No newline at end of file diff --git a/apps/deeplx/data.yml b/apps/deeplx/data.yml new file mode 100644 index 00000000..daeee2d9 --- /dev/null +++ b/apps/deeplx/data.yml @@ -0,0 +1,20 @@ +name: DeepLX +tags: + - 工具 +title: DeepL 免费 API(无需 TOKEN) +type: 工具 +description: DeepL 免费 API(无需 TOKEN) +additionalProperties: + key: deeplx + name: DeepLX + tags: + - Tool + shortDescZh: DeepL 免费 API(无需 TOKEN) + shortDescEn: DeepL Free API (No TOKEN required) + type: tool + crossVersionUpdate: true + limit: 0 + recommend: 0 + website: https://github.com/OwO-Network/DeepLX + github: https://github.com/OwO-Network/DeepLX + document: https://github.com/OwO-Network/DeepLX diff --git a/apps/deeplx/latest/.env.sample b/apps/deeplx/latest/.env.sample new file mode 100644 index 00000000..916bc865 --- /dev/null +++ b/apps/deeplx/latest/.env.sample @@ -0,0 +1,3 @@ +CONTAINER_NAME="deeplx" +PANEL_APP_PORT_HTTP="40174" +TOKEN_VAULE="token123456" diff --git a/apps/deeplx/latest/data.yml b/apps/deeplx/latest/data.yml new file mode 100644 index 00000000..e0d9d0cd --- /dev/null +++ b/apps/deeplx/latest/data.yml @@ -0,0 +1,18 @@ +additionalProperties: + formFields: + - default: 40174 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelEn: Port + labelZh: 端口 + required: true + rule: paramPort + type: number + - default: deeplx + envKey: TOKEN_VAULE + labelEn: Token + labelZh: 密码 + random: true + required: false + rule: paramComplexity + type: password diff --git a/apps/deeplx/latest/docker-compose.yml b/apps/deeplx/latest/docker-compose.yml new file mode 100644 index 00000000..f0de1815 --- /dev/null +++ b/apps/deeplx/latest/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' +services: + deeplx: + container_name: ${CONTAINER_NAME} + restart: always + networks: + - 1panel-network + ports: + - "${PANEL_APP_PORT_HTTP}:1188" + command: ["/app/deeplx", "-token", "${TOKEN_VAULE}"] + image: missuo/deeplx:latest + labels: + createdBy: "Apps" + +networks: + 1panel-network: + external: true diff --git a/apps/deeplx/logo.png b/apps/deeplx/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..9cec3e62d1817bf3fe702d0d21ccdd15beb049a2 GIT binary patch literal 4768 zcmV;R5?}3!P)jbaz0;>2SrtTwn z)H1E<6|nIfMA{#)@DVcPBd_i=ZPq7b*aVQ=DY5Pzci0(h))HveB68OhgW4TK;2AyS zBR=37iQ5q&-xx{y0kHG{i`f8%*aIc!0CLy^Eam`g*8zFh0f5*89p?dM*a14?0yE?Q zUfBUw+5te|0Z!ZiklO)A-Ud4LYx6xd0000XbW%=J06iXX(G4#H{Qi$>R_ar^=A=Y? z`hl*|>X+iP&Xvja=Uoc^!vFvgdPzhopiyCwmZ88QH4lWH^WzlzO}Do-^o zG86ad{=WP0SY^N~LR^j|cbF5!i)YpDKR~n|<@)eG9$JHHC+u z!M(djZt_vB>;D~WjK3;H*7n7F0(&%S-TxJ9>-Z}UIQp6XNJQ%RJ1-r7g6vVfkXn=--}4@RcYp{Upn^i)nATC8hV}rzHarg_a`X!ksrx_IxPlM+F#3gvG&5M>cwqMA;7NGo$09Nxf1&#u zU__37Dk4K8{z@KE^^rdlk@(%p!Q2=I?ERTIBJDYEaNFMRU@fW&ahekhyO0>SIkHl}1BiAzV2ZyQH9xeZ5_zYc% zeandC@mDK~KRA5!n!dKJu;H`6yl0*)dRHEkw~9y{3XAb)Haj83CQZ}n%k_>C-e~v% z&3tkwBJy^9BzIlyT>SaN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