dialect-app / dialect

A translation app for GNOME.
https://dialectapp.org/
GNU General Public License v3.0
609 stars 69 forks source link

[Feature request] Add proxy setting #115

Open Nokia808 opened 3 years ago

Nokia808 commented 3 years ago

Hi.

This may be strange request from title ! But it's usefulness is that: 1) unfortunately, there are certain situation in which even such sites like online translations are blocked ! In such cases this feature will be extremely useful ... 2) to improve privacy of users, like utilizing Google via Tor network to avoid Google anti-privacy hanger....

If this feature accepted to be added as future enhancement, then it should allow SOCKS 5 proxy & should allow user to select UDP or TCP or automatic(UDP/TCP) protocol.

Thank you.

mufeedali commented 3 years ago

Personally, I don't think this is within the scope of the application and any proxy settings should probably be system-wide. What do you think, @rafaelmardojai ?

Nokia808 commented 3 years ago

@fushinari Well, at a time it is more suitable to use system-wide solution. But at other cases it is more suitable to make only certain applications bypass the blockage .......

However, the final decision is up to the developer(s).

mufeedali commented 3 years ago

Actually, I think I agree with you that it's a good addition. But it adds a layer of complexity that I'm not sure I want. Also, to implement it properly, we would need py-googletrans to also support proxy settings, but sadly, it's still marked as a TODO.

Nokia808 commented 3 years ago

@fushinari It is very okay to be in "TODO" list ! Take your time.

Venturub commented 3 years ago

I agree with this. And would also add, as a suggestion, the user IP to be somehow replaced by another IP who would then be the one presenting directly the translation request to Google Translator. This would further justify the Dialect usage over the Google Translator website through the browser. I do not know the feasibility of this but it would be great... thanks!

zefr0x commented 2 years ago

No need for that, we are in Linux :)

For Tor:

You can just use the torsocks tool to wrap dialect to use tor. (It is safer)

For other proxies:

You can use environment variables, for example:

export http_proxy=socks5://127.0.0.1:9050
export https_proxy=$http_proxy

Or to directly start dialect with them:

http_proxy=socks5://127.0.0.1:9050 https_proxy=$http_proxy dialect

The python-requests library supports it, thats why it will work for dialect.

Read this for more info: https://wiki.archlinux.org/title/Proxy_server#Environment_variables

You might be able to also use a sandboxing tool to apply a proxy, but I didn't test it.

rafaelmardojai commented 2 years ago

The python-requests library supports it, thats why it will work for dialect.

Just for the record, Dialect doesn't use python-requests but libsoup. And it should respect the proxy settings from GNOME Settings.

zefr0x commented 2 years ago

Oh

So python-requests is used for Google translate only? gTTS uses it as I saw here. And I saw it here in the flatpak mainfest file.

After some search it should work with libsoup also for other translate services: https://mail.gnome.org/archives/libsoup-list/2009-February/msg00018.html

rafaelmardojai commented 2 years ago

So python-requests is used for Google translate only? gTTS uses it as I saw here. And I saw it here in the flatpak mainfest file.

Only Google text-to-speech (gTTS), Google translation is implemented with libsoup.

After some search it should work with libsoup also for other translate services: https://mail.gnome.org/archives/libsoup-list/2009-February/msg00018.html

Yeah, the env vars you pointed should work with libsoup.