Skip to content

Commit

Permalink
Merge pull request #759 from subutai-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Erkin Matkaziev authored Mar 27, 2018
2 parents b9dffb5 + 2cadcfc commit 02de65c
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ matrix:
before_install:
- openssl aes-256-cbc -k "$decrypt_key" -in /Users/travis/build/subutai-io/control-center/travis.gpg.enc -out /Users/travis/build/subutai-io/control-center/travis.gpg -d
- gpg --allow-secret-key-import --import /Users/travis/build/subutai-io/control-center/travis.gpg && rm -f /Users/travis/build/subutai-io/control-center/travis.gpg
- brew update
- brew install libssh2
script:
- sudo mkdir /Users/dev/ && sudo chmod 777 /Users/dev/
- wget -nv -O /Users/dev/Qt5.9.2.tar.gz https://cdn.subutai.io:8338/kurjun/rest/raw/download?name=Qt5.9.2.tar.gz && tar -xf /Users/dev/Qt5.9.2.tar.gz -C /Users/dev
Expand Down
3 changes: 2 additions & 1 deletion SubutaiControlCenter.pro
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ macx: {
LIBS += -ldl -lpthread
ICON = $$PWD/resources/cc_icon_mac.icns
QMAKE_INFO_PLIST = $$PWD/Info.plist
LIBS += -L/tmp/tray-static -L/usr/local/lib/ -lssh2
LIBS += -L$$PWD/libssh2/lib -lssh2
# LIBS += -L/tmp/tray-static -L/usr/local/lib/ -lssh2
# USE WITH CROSS COMPILATION
# LIBS += -L$$PWD/libssh2/lib -lssh2
# QMAKE_CXXFLAGS += -fshort-wchar -stdlib=libc++ -std=c++11
Expand Down
2 changes: 2 additions & 0 deletions build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ git pull
git checkout $BRANCH
git pull origin $BRANCH

mkdir -p /usr/local/opt/libssh2/lib/
cp /Users/travis/build/subutai-io/control-center/libssh2/lib/mac/libssh2.1.dylib /usr/local/opt/libssh2/lib/libssh2.1.dylib
build="subutai_control_center_bin"

if [ -d "$build" ]; then
Expand Down
2 changes: 1 addition & 1 deletion deb-packages/deb-packages-internal/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Package: subutai-control-center
Architecture: all
Depends: gksu,
libssh2-1,
libssl1.0.2 | libssl1.0.1 | libssl1.0.0 | libssl1.0 | libssl1.0-dev,
libssl1.0.2 | libssl1.0.1 | libssl1.0.0 | libssl1.0 | libssl1.0-dev | libssl1.0-dev (<< 1.1),
libxcb-icccm4,
libxcb-image0,
libxcb-keysyms1,
Expand Down
3 changes: 3 additions & 0 deletions hub/include/HubController.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class CHubController : public QObject {
QString m_current_user;
QString m_current_pass;
QString m_user_id;
QString m_user_email;
SynchroPrimitives::CriticalSection m_refresh_cs;
QTimer m_refresh_timer;
QTimer m_report_timer;
Expand Down Expand Up @@ -135,6 +136,7 @@ private slots:
void set_current_user(const QString& cu) {m_current_user = cu;}
void set_current_pass(const QString& cp) {m_current_pass = cp;}
void set_current_user_id(const QString& user_id){ m_user_id = user_id; }
void set_current_email(const QString& cp) {m_user_email = cp;}

const std::vector<CEnvironment>& lst_environments() const {return m_lst_environments;}
const std::vector<CEnvironment>& lst_healthy_environments() const {return m_lst_healthy_environments;}
Expand All @@ -145,6 +147,7 @@ private slots:
const QString& current_user() const {return m_current_user;}

const QString& current_user_id() const {return m_user_id;}
const QString& current_email() const {return m_user_email;}
const QString& current_pass() const {return m_current_pass;}

void launch_balance_page();
Expand Down
2 changes: 2 additions & 0 deletions hub/include/RestWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ private slots:

bool get_user_id(QString& user_id_str);

bool get_user_email(QString& user_email_str);

void update_my_peers();
void update_p2p_status();

Expand Down
4 changes: 4 additions & 0 deletions hub/src/DlgLogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ DlgLogin::login() {
network_err);

QString id = "";
QString email = "";
switch (err_code) {
case RE_SUCCESS:
if (CRestWorker::Instance()->get_user_id(id))
CHubController::Instance().set_current_user_id(id);

if (CRestWorker::Instance()->get_user_email(email))
CHubController::Instance().set_current_email(email);

ui->lbl_status->setText("");
ui->lbl_status->setVisible(false);
if (CSettingsManager::Instance().remember_me())
Expand Down
25 changes: 25 additions & 0 deletions hub/src/RestWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@ bool CRestWorker::get_user_id(QString& user_id_str) {
}
////////////////////////////////////////////////////////////////////////////

bool CRestWorker::get_user_email(QString& user_email_str) {
int http_code, err_code, network_error;
user_email_str = "";
static const QString str_url(hub_get_url().arg("user-info"));
QUrl url_login(str_url);
QNetworkRequest request(url_login);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QByteArray arr = send_request(m_network_manager, request, true, http_code,
err_code, network_error, QByteArray(), true);

QJsonDocument doc = QJsonDocument::fromJson(arr);
qDebug()
<< "Json file: " << doc;
if (doc.isNull() || doc.isEmpty() || !doc.isObject()) {
qCritical("Get user id failed. URL : %s",
str_url.toStdString().c_str());
return false;
}

QJsonObject obj = doc.object();
if (obj.find("email") != obj.end())
user_email_str = QString("%1").arg(obj["email"].toString());
return true;
}
////////////////////////////////////////////////////////////////////////////
void CRestWorker::update_my_peers() {
QUrl url_env(hub_get_url().arg("my-peers"));
QNetworkRequest req(url_env);
Expand Down
4 changes: 3 additions & 1 deletion hub/src/TrayWebSocketServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ CTrayServer::handle_current_user(const QString &msg,
QWebSocket *pClient) {
UNUSED_ARG(msg);
qInfo("*** handle_current_user ***");
pClient->sendTextMessage(CHubController::Instance().current_user());
qInfo()
<<"sending email to e2e:"<<CHubController::Instance().current_email();
pClient->sendTextMessage(CHubController::Instance().current_email());
}
////////////////////////////////////////////////////////////////////////////

Expand Down
Binary file added libssh2/lib/mac/libssh2.1.dylib
Binary file not shown.
3 changes: 1 addition & 2 deletions upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,4 @@ echo $PKGNAME
echo $BINNAME
echo $OS
echo $BRANCH
echo "---------"
echo "Successfull"
echo "---------"

0 comments on commit 02de65c

Please sign in to comment.