Skip to content

Commit

Permalink
GSvar: update IGV access token after updating user token
Browse files Browse the repository at this point in the history
  • Loading branch information
ubuntolog committed Nov 15, 2023
1 parent ec41a7a commit a8a763c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
25 changes: 20 additions & 5 deletions src/GSvar/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ MainWindow::MainWindow(QWidget *parent)
{
// renew existing session, if it is about to expire
// a new token will be requested slightly in advance
QTimer *login_timer = new QTimer(this);
connect(login_timer, &QTimer::timeout, this, &LoginManager::renewLogin);
login_timer->start(20 * 60 * 1000); // every 20 minutes
QTimer *login_timer = new QTimer(this);
connect(login_timer, SIGNAL(timeout()), this, SLOT(updateSecureToken()));
login_timer->start(20 * 60 * 1000); // every 20 minutes

//check if the server is running
QTimer *server_ping_timer = new QTimer(this);
Expand Down Expand Up @@ -6564,8 +6564,23 @@ void MainWindow::uploadToClinvar(int variant_index1, int variant_index2)
}
catch(Exception& e)
{
GUIHelper::showException(this, e, "ClinVar submission error");
}
GUIHelper::showException(this, e, "ClinVar submission error");
}
}

void MainWindow::updateSecureToken()
{
if (ClientHelper::isClientServerMode())
{
LoginManager::renewLogin();
for(int i = 0; i < IgvSessionManager::count(); i++)
{
if (IgvSessionManager::get(i).isIgvRunning())
{
IgvSessionManager::get(i).execute(QStringList() << "SetAccessToken " + LoginManager::userToken() + " *" + Settings::string("server_host") + "*", false);
}
}
}
}

void MainWindow::dragEnterEvent(QDragEnterEvent* e)
Expand Down
4 changes: 3 additions & 1 deletion src/GSvar/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class MainWindow

public slots:
///Upload variant to Clinvar
void uploadToClinvar(int variant_index1, int variant_index2=-1);
void uploadToClinvar(int variant_index1, int variant_index2=-1);
/// Updates (only in clinet-server mode) the secure token
void updateSecureToken();
/// Checks (only in clinet-server mode) if the server is currently running
void checkServerAvailability();
/// Checks (only in clinet-server mode) if there is some new information needed to be displayed to the user (e.g. downtimes, maintenance, reboots, updates)
Expand Down

0 comments on commit a8a763c

Please sign in to comment.