2021-01-17 20:09:57 +00:00
|
|
|
# gtranslate
|
2021-05-10 15:09:47 +00:00
|
|
|
Better front-end for Google Translate that is lightweight, doesn't track
|
|
|
|
you and works without JavaScript.
|
2021-01-17 20:49:27 +00:00
|
|
|
|
|
|
|
# Installation
|
|
|
|
```sh
|
|
|
|
git clone https://git.sr.ht/~yerinalexey/gtranslate
|
|
|
|
cd gtranslate
|
|
|
|
|
|
|
|
go build
|
|
|
|
```
|
|
|
|
|
|
|
|
Then run the server with
|
|
|
|
|
|
|
|
```sh
|
|
|
|
./gtranslate
|
|
|
|
```
|
|
|
|
|
|
|
|
If you want to use a different port:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
./gtranslate -b :3000 # will run on port 3000
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: if you're running it outside of development environment, you
|
2021-01-22 21:16:07 +00:00
|
|
|
should pass `--templates-dir` and `--static-dir` arguments pointing to
|
2021-01-17 20:49:27 +00:00
|
|
|
templates and static directories:
|
|
|
|
|
|
|
|
```sh
|
2021-01-18 17:05:13 +00:00
|
|
|
./gtranslate \
|
2021-05-01 11:38:06 +00:00
|
|
|
--templates-dir path/to/gtranslate/templates \
|
|
|
|
--static-dir path/to/gtranslate/static
|
2021-01-17 20:49:27 +00:00
|
|
|
```
|
2021-01-18 19:36:30 +00:00
|
|
|
|
2021-01-22 09:23:09 +00:00
|
|
|
Other settings (available with `./gtranslate --help`):
|
|
|
|
|
2021-01-18 20:34:21 +00:00
|
|
|
```
|
2021-01-22 09:23:09 +00:00
|
|
|
Usage of ./gtranslate:
|
2021-01-22 21:16:07 +00:00
|
|
|
-b, --bind string Address to bind the server to, [addr]:port (default ":5000")
|
|
|
|
--proxy string Proxy URL, with no scheme http is assumed
|
|
|
|
--static-dir string Static files directory (default "./static")
|
|
|
|
--templates-dir string Templates directory (default "./templates")
|
|
|
|
--user-agent string User-Agent header to use
|
2021-01-18 20:34:21 +00:00
|
|
|
```
|
|
|
|
|
2021-01-22 10:08:24 +00:00
|
|
|
# Using Tor
|
|
|
|
Routing requests through Tor has its benefits:
|
|
|
|
- Google will have a hard time tracking `gtranslate` servers as they act like normal Tor users
|
|
|
|
- You probably won't get banned as requests are made from different IPs
|
|
|
|
|
|
|
|
Despite that, it has some drawbacks:
|
|
|
|
- Much slower response time
|
|
|
|
- Might get capcha or some other junk that will block requests
|
|
|
|
- If doing the wrong thing, you might get your server compromised (in terms of anonymity)
|
|
|
|
- This feature is not tested in development
|
|
|
|
|
|
|
|
First of, you need to set up Tor daemon on the server. Here's a guide on
|
2021-03-15 16:50:45 +00:00
|
|
|
ArchWiki: [Tor].
|
|
|
|
|
|
|
|
[Tor]: https://wiki.archlinux.org/index.php/tor
|
2021-01-22 10:08:24 +00:00
|
|
|
|
|
|
|
With default settings, it should start a SOCKS5 proxy on localhost, port
|
|
|
|
9050.
|
|
|
|
|
|
|
|
Also, to minimize fingerprint, you need to use a very common user agent
|
|
|
|
on Tor network. And, you guessed it, get it straight from Tor Browser.
|
2021-01-22 21:13:19 +00:00
|
|
|
If you have one, you can just open https://httpbin.org/headers and copy
|
|
|
|
it from there. If not, the latest available is provided here:
|
2021-03-15 16:50:45 +00:00
|
|
|
[Tor Browser's User-Agent][tor-browser-user-agent].
|
|
|
|
|
|
|
|
[tor-browser-user-agent]: https://tor.stackexchange.com/questions/4890/tor-browser-user-agent-strings/21524#21524
|
2021-01-22 10:08:24 +00:00
|
|
|
|
|
|
|
Full setup:
|
2021-01-22 09:23:09 +00:00
|
|
|
|
|
|
|
```sh
|
2021-01-22 09:20:27 +00:00
|
|
|
./gtranslate \
|
|
|
|
--user-agent "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0" \
|
2021-01-22 10:08:24 +00:00
|
|
|
--proxy "socks5://localhost:9050" \
|
2021-01-22 09:20:27 +00:00
|
|
|
...
|
|
|
|
```
|
|
|
|
|
2021-01-22 10:08:24 +00:00
|
|
|
If you have managed to set it up or experienced issues with this guide,
|
2021-03-15 16:50:45 +00:00
|
|
|
feel free to shoot an email to my [public inbox].
|
2021-01-22 09:20:27 +00:00
|
|
|
|
2021-03-15 16:50:45 +00:00
|
|
|
[public inbox]: https://lists.sr.ht/~yerinalexey/public-inbox
|