Add option to disable GUI login

Adds option --disable-login-gui which is used to disable GUI login when reCAPTCHA is encountered on login form.
Useful when downloader is compiled with GUI support but user is using it through SSH without X forwarding.
This commit is contained in:
Sude 2019-03-01 23:12:04 +02:00
parent a8d9d466c9
commit ea0ec2a9bd
3 changed files with 12 additions and 0 deletions

View File

@ -231,6 +231,9 @@ class Config
bool bReport; bool bReport;
bool bRespectUmask; bool bRespectUmask;
bool bPlatformDetection; bool bPlatformDetection;
#ifdef USE_QT_GUI_LOGIN
bool bDisableLoginGUI;
#endif
// Cache // Cache
bool bUseCache; bool bUseCache;

View File

@ -247,6 +247,9 @@ int main(int argc, char *argv[])
("lowspeed-timeout", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted") ("lowspeed-timeout", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted")
("lowspeed-rate", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeoutRate)->default_value(200), "Set average transfer speed in bytes per second that the transfer should be below during time specified with --lowspeed-timeout for it to be considered too slow and aborted") ("lowspeed-rate", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeoutRate)->default_value(200), "Set average transfer speed in bytes per second that the transfer should be below during time specified with --lowspeed-timeout for it to be considered too slow and aborted")
("include-hidden-products", bpo::value<bool>(&Globals::globalConfig.bIncludeHiddenProducts)->zero_tokens()->default_value(false), "Include games that have been set hidden in account page") ("include-hidden-products", bpo::value<bool>(&Globals::globalConfig.bIncludeHiddenProducts)->zero_tokens()->default_value(false), "Include games that have been set hidden in account page")
#ifdef USE_QT_GUI_LOGIN
("disable-login-gui", bpo::value<bool>(&Globals::globalConfig.bDisableLoginGUI)->zero_tokens()->default_value(false), "Disable login GUI when encountering reCAPTCHA on login form.\nUseful when downloader is compiled with GUI support but you are using it through SSH without X forwarding")
#endif
; ;
// Options read from config file // Options read from config file
options_cfg_only.add_options() options_cfg_only.add_options()

View File

@ -316,6 +316,12 @@ int Website::Login(const std::string& email, const std::string& password)
<< "Try to login later or compile LGOGDownloader with -DUSE_QT_GUI=ON" << std::endl; << "Try to login later or compile LGOGDownloader with -DUSE_QT_GUI=ON" << std::endl;
return res = 0; return res = 0;
#else #else
if (Globals::globalConfig.bDisableLoginGUI)
{
std::cout << "Login form contains reCAPTCHA but GUI login is disabled." << std::endl
<< "Enable GUI login or try to login later." << std::endl;
return res = 0;
}
GuiLogin gl; GuiLogin gl;
gl.Login(); gl.Login();