mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Merge https://github.com/grepwood/lgogdownloader into master
This commit is contained in:
commit
f6d020b807
@ -246,6 +246,7 @@ int Downloader::login()
|
|||||||
{
|
{
|
||||||
std::string email;
|
std::string email;
|
||||||
std::string password;
|
std::string password;
|
||||||
|
bool headless = false;
|
||||||
|
|
||||||
if (!Globals::globalConfig.sEmail.empty() && !Globals::globalConfig.sPassword.empty())
|
if (!Globals::globalConfig.sEmail.empty() && !Globals::globalConfig.sPassword.empty())
|
||||||
{
|
{
|
||||||
@ -255,24 +256,32 @@ int Downloader::login()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!isatty(STDIN_FILENO)) {
|
if (!isatty(STDIN_FILENO)) {
|
||||||
std::cerr << "Unable to read email and password" << std::endl;
|
/* Attempt to read this stuff from elsewhere */
|
||||||
return 0;
|
bool cookie_gone = !(boost::filesystem::exists(Globals::globalConfig.curlConf.sCookiePath));
|
||||||
}
|
bool tokens_gone = !(boost::filesystem::exists(Globals::globalConfig.sConfigDirectory + "/galaxy_tokens.json"));
|
||||||
std::cerr << "Email: ";
|
std::cout << Globals::globalConfig.curlConf.sCookiePath << std::endl;
|
||||||
std::getline(std::cin,email);
|
std::cout << (Globals::globalConfig.sConfigDirectory + "/galaxy_tokens.json") << std::endl;
|
||||||
|
if(cookie_gone || tokens_gone) {
|
||||||
|
std::cerr << "Unable to read email and password" << std::endl;
|
||||||
|
return 0;
|
||||||
|
} else headless = true;
|
||||||
|
} else {
|
||||||
|
std::cerr << "Email: ";
|
||||||
|
std::getline(std::cin,email);
|
||||||
|
|
||||||
std::cerr << "Password: ";
|
std::cerr << "Password: ";
|
||||||
struct termios termios_old, termios_new;
|
struct termios termios_old, termios_new;
|
||||||
tcgetattr(STDIN_FILENO, &termios_old); // Get current terminal attributes
|
tcgetattr(STDIN_FILENO, &termios_old); // Get current terminal attributes
|
||||||
termios_new = termios_old;
|
termios_new = termios_old;
|
||||||
termios_new.c_lflag &= ~ECHO; // Set ECHO off
|
termios_new.c_lflag &= ~ECHO; // Set ECHO off
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &termios_new); // Set terminal attributes
|
tcsetattr(STDIN_FILENO, TCSANOW, &termios_new); // Set terminal attributes
|
||||||
std::getline(std::cin, password);
|
std::getline(std::cin, password);
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &termios_old); // Restore old terminal attributes
|
tcsetattr(STDIN_FILENO, TCSANOW, &termios_old); // Restore old terminal attributes
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (email.empty() || password.empty())
|
if ((email.empty() || password.empty()) && !headless)
|
||||||
{
|
{
|
||||||
std::cerr << "Email and/or password empty" << std::endl;
|
std::cerr << "Email and/or password empty" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user