Skip to content

Commit 304b9a2

Browse files
Merge branch 'OwO-Network:main' into main
2 parents 0b5a7fb + 1f1c088 commit 304b9a2

4 files changed

Lines changed: 74 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/bytedance/sonic v1.11.2 // indirect
1818
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
1919
github.com/chenzhuoyu/iasm v0.9.1 // indirect
20-
github.com/cloudflare/circl v1.5.0 // indirect
20+
github.com/cloudflare/circl v1.6.1 // indirect
2121
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
2222
github.com/gin-contrib/sse v0.1.0 // indirect
2323
github.com/go-playground/locales v0.14.1 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpV
1313
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
1414
github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0=
1515
github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
16-
github.com/cloudflare/circl v1.5.0 h1:hxIWksrX6XN5a1L2TI/h53AGPhNHoUBo+TD1ms9+pys=
17-
github.com/cloudflare/circl v1.5.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
16+
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
17+
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
1818
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1919
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2020
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

translate/translate.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,18 @@ func makeRequestWithBody(postStr string, proxyURL string, dlSession string) (gjs
3636
// Create a new req client
3737
client := req.C().SetTLSFingerprintRandomized()
3838

39-
// Set minimal headers like TypeScript version
39+
// Set headers to simulate browser request
4040
headers := http.Header{
41-
"Content-Type": []string{"application/json"},
41+
"Content-Type": []string{"application/json"},
42+
"Accept": []string{"*/*"},
43+
"Accept-Language": []string{"en-US,en;q=0.9"},
44+
"Accept-Encoding": []string{"gzip, deflate, br, zstd"},
45+
"Origin": []string{"https://www.deepl.com"},
46+
"Referer": []string{"https://www.deepl.com/"},
47+
"Sec-Fetch-Dest": []string{"empty"},
48+
"Sec-Fetch-Mode": []string{"cors"},
49+
"Sec-Fetch-Site": []string{"same-site"},
50+
"User-Agent": []string{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"},
4251
}
4352

4453
if dlSession != "" {
@@ -70,6 +79,11 @@ func makeRequestWithBody(postStr string, proxyURL string, dlSession string) (gjs
7079
return gjson.Result{}, fmt.Errorf("too many requests, your IP has been blocked by DeepL temporarily, please don't request it frequently in a short time")
7180
}
7281

82+
// Check for other error status codes
83+
if resp.StatusCode != 200 {
84+
return gjson.Result{}, fmt.Errorf("request failed with status code: %d", resp.StatusCode)
85+
}
86+
7387
var bodyReader io.Reader
7488
contentEncoding := resp.Header.Get("Content-Encoding")
7589
switch contentEncoding {

uninstall.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# Colors
4+
red='\033[0;31m'
5+
green='\033[0;32m'
6+
yellow='\033[0;33m'
7+
plain='\033[0m'
8+
9+
# Check for root privileges
10+
if [[ $EUID -ne 0 ]]; then
11+
echo -e "${red}This script must be run as root.${plain}"
12+
exit 1
13+
fi
14+
15+
uninstall_deeplx() {
16+
echo -e "${green}Starting DeepLX uninstallation...${plain}"
17+
18+
# 1. Stop and disable the DeepLX service
19+
if systemctl is-active --quiet deeplx; then
20+
echo -e "${yellow}Stopping DeepLX service...${plain}"
21+
systemctl stop deeplx
22+
else
23+
echo -e "${yellow}DeepLX service is not running or not found.${plain}"
24+
fi
25+
26+
if systemctl is-enabled --quiet deeplx; then
27+
echo -e "${yellow}Disabling DeepLX service from starting on boot...${plain}"
28+
systemctl disable deeplx
29+
else
30+
echo -e "${yellow}DeepLX service is not enabled.${plain}"
31+
fi
32+
33+
# 2. Remove the systemd service file
34+
if [ -f /etc/systemd/system/deeplx.service ]; then
35+
echo -e "${yellow}Removing DeepLX systemd service file (/etc/systemd/system/deeplx.service)...${plain}"
36+
rm -f /etc/systemd/system/deeplx.service
37+
systemctl daemon-reload
38+
echo -e "${green}Systemd daemon reloaded.${plain}"
39+
else
40+
echo -e "${yellow}DeepLX systemd service file not found, skipping removal.${plain}"
41+
fi
42+
43+
# 3. Remove the DeepLX executable
44+
if [ -f /usr/bin/deeplx ]; then
45+
echo -e "${yellow}Removing DeepLX executable (/usr/bin/deeplx)...${plain}"
46+
rm -f /usr/bin/deeplx
47+
else
48+
echo -e "${yellow}DeepLX executable not found, skipping removal.${plain}"
49+
fi
50+
51+
echo -e "${green}DeepLX uninstallation complete.${plain}"
52+
echo -e "${green}If you wish to reinstall, please run the install script again.${plain}"
53+
}
54+
55+
uninstall_deeplx

0 commit comments

Comments
 (0)