Rain92 / UltimateMangaReader

A feature-rich online manga reader for Kobo E-Ink devices based on Qt5.
GNU Affero General Public License v3.0
175 stars 25 forks source link

Proxy Support [workaround] #12

Closed mtlive closed 3 years ago

mtlive commented 4 years ago

It might not seem useful, but since manga sites are blocked on some ISPs it might be helpful to add proxy settings to bypass restrictions. Also Qt supports setting a proxy so I think it should make things straightforward.

mtlive commented 4 years ago

Well I tried compiling UMR for Windows. Qt uses system proxy by default and it worked flawlessly on Windows. UltimateMangaReader-win32.zip UMR_windows

On Kobo I tried to set proxy by adding this line to launch script: export http_proxy=socks5h://192.168.1.1:2020 but it either can't connect to Wi-Fi or hangs/doesn't load anything. I also reviewed logs on proxy server (an openssh tunnel with -D switch) and there seems to be no connection from Kobo.

Could it be from the Qt library that you have provided with release (maybe a switch that you used for configuration)? I just used your release and didn't recompile anything for kobo.

mtlive commented 4 years ago

OK, after wasting some hours figuring out how to compile Qt for kobo and library stuffs,... I found out a weird behaviour from Qt on Kobo. Even though Qt detects system proxy and by default is set to use it doesn't use it! The output of:

QTextStream(stdout) << "***Proxy:" << QNetworkProxy::applicationProxy().hostName() << ":" << QNetworkProxy::applicationProxy().port() << " type:" << QNetworkProxy::applicationProxy().type()<< endl;
QTextStream(stdout) << "***Use system proxy:" << QNetworkProxyFactory::usesSystemConfiguration() << endl;
QNetworkProxyFactory::setUseSystemConfiguration(true);
QTextStream(stdout) << "***Proxy:" << QNetworkProxy::applicationProxy().hostName() << ":" << QNetworkProxy::applicationProxy().port() << " type:" << QNetworkProxy::applicationProxy().type()<< endl;

is

***Proxy:localhost:2020 type:1
***Use system proxy:1
***Proxy:localhost:2020 type:1

Even this one didn't work: QNetworkProxy::setApplicationProxy( QNetworkProxy::applicationProxy());

Only this one makes it to use proxy:

QNetworkProxy proxy;
proxy.setType(QNetworkProxy::applicationProxy().type());
proxy.setHostName(QNetworkProxy::applicationProxy().hostName());
proxy.setPort(QNetworkProxy::applicationProxy().port());
QNetworkProxy::setApplicationProxy(proxy);
QTextStream(stdout) << "***Proxy:" << QNetworkProxy::applicationProxy().hostName() << ":" << QNetworkProxy::applicationProxy().port() << " type:" << QNetworkProxy::applicationProxy().type()<< endl;

Output: ***Proxy:localhost:2020 type:1

BTW I can now use proxy and access mangadex!