Build server connection testing working.
This commit is contained in:
parent
b7ec93dc3c
commit
7d116c6706
9 changed files with 457 additions and 119 deletions
|
@ -51,6 +51,7 @@ set(SOURCE_FILES
|
||||||
src/palette.c
|
src/palette.c
|
||||||
src/project.c
|
src/project.c
|
||||||
src/ssh.c
|
src/ssh.c
|
||||||
|
src/http.c
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(include/config.h.in config.h)
|
configure_file(include/config.h.in config.h)
|
||||||
|
@ -110,9 +111,9 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||||
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libssh2.a
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libssh2.a
|
||||||
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgcrypt.a
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgcrypt.a
|
||||||
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgpg-error.a
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgpg-error.a
|
||||||
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libcurl.a
|
||||||
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libz.a
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libz.a
|
||||||
${GTK3_LIBRARIES}
|
${GTK3_LIBRARIES}
|
||||||
# -lssl
|
|
||||||
-ldl
|
-ldl
|
||||||
-pthread
|
-pthread
|
||||||
-lm
|
-lm
|
||||||
|
|
173
src/http.c
Normal file
173
src/http.c
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
/*
|
||||||
|
* JoeyDev
|
||||||
|
* Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
|
||||||
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
* misrepresented as being the original software.
|
||||||
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "http.h"
|
||||||
|
|
||||||
|
|
||||||
|
static CURLM *_curlMulti = NULL;
|
||||||
|
static HTTPT **_activeHTTPs = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
gboolean httpUpdate(gpointer userData); // Not static
|
||||||
|
|
||||||
|
static size_t httpWrite(char *data, size_t num, size_t length, void *userp);
|
||||||
|
|
||||||
|
|
||||||
|
HTTPT *httpDownload(HTTPCallback callback, char *filename, char *url) {
|
||||||
|
HTTPT *download = NULL;
|
||||||
|
CURL *eh = NULL;
|
||||||
|
|
||||||
|
download = NEW(HTTPT);
|
||||||
|
if (download) {
|
||||||
|
download->file = fopen(filename, "wb");
|
||||||
|
if (download->file) {
|
||||||
|
download->filename = strdup(filename);
|
||||||
|
download->length = 0;
|
||||||
|
download->progress = 0;
|
||||||
|
download->finished = FALSE;
|
||||||
|
download->success = FALSE;
|
||||||
|
download->callback = callback;
|
||||||
|
eh = curl_easy_init();
|
||||||
|
#ifdef DEBUG_MODE
|
||||||
|
//curl_easy_setopt(eh, CURLOPT_VERBOSE, 1L);
|
||||||
|
curl_easy_setopt(eh, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||||
|
curl_easy_setopt(eh, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||||
|
#endif
|
||||||
|
curl_easy_setopt(eh, CURLOPT_BUFFERSIZE, CURL_MAX_READ_SIZE);
|
||||||
|
curl_easy_setopt(eh, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
|
curl_easy_setopt(eh, CURLOPT_WRITEFUNCTION, httpWrite);
|
||||||
|
curl_easy_setopt(eh, CURLOPT_WRITEDATA, download);
|
||||||
|
curl_easy_setopt(eh, CURLOPT_URL, url);
|
||||||
|
curl_multi_add_handle(_curlMulti, eh);
|
||||||
|
arrput(_activeHTTPs, download);
|
||||||
|
} else {
|
||||||
|
DEL(download);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return download;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void httpShutdown(void) {
|
||||||
|
//***TODO*** Any active sessions?
|
||||||
|
|
||||||
|
g_idle_remove_by_data(httpUpdate);
|
||||||
|
|
||||||
|
curl_multi_cleanup(_curlMulti);
|
||||||
|
curl_global_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void httpStartup(void) {
|
||||||
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
_curlMulti = curl_multi_init();
|
||||||
|
g_idle_add(httpUpdate, httpUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gboolean httpUpdate(gpointer userData) {
|
||||||
|
CURLcode code;
|
||||||
|
CURL *eh = NULL;
|
||||||
|
CURLMsg *msg = NULL;
|
||||||
|
HTTPT *dl = NULL;
|
||||||
|
int msgsLeft = -1;
|
||||||
|
int stillAlive = 1;
|
||||||
|
long httpCode = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
(void)userData;
|
||||||
|
|
||||||
|
for (i=0; i<arrlen(_activeHTTPs); i++) {
|
||||||
|
dl = _activeHTTPs[i];
|
||||||
|
curl_multi_perform(_curlMulti, &stillAlive);
|
||||||
|
while ((msg = curl_multi_info_read(_curlMulti, &msgsLeft))) {
|
||||||
|
code = msg->data.result;
|
||||||
|
eh = msg->easy_handle;
|
||||||
|
// Try to get remote file size.
|
||||||
|
if (dl->length == 0) {
|
||||||
|
curl_easy_getinfo(eh, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &dl->length);
|
||||||
|
#ifdef DEBUG_MODE
|
||||||
|
debug("CURL Length %" CURL_FORMAT_CURL_OFF_T "\n", dl->length);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (msg->msg == CURLMSG_DONE) {
|
||||||
|
// HTTP Error?
|
||||||
|
curl_easy_getinfo (eh, CURLINFO_RESPONSE_CODE, &httpCode);
|
||||||
|
// Finished. Tell CURL.
|
||||||
|
curl_multi_remove_handle(_curlMulti, eh);
|
||||||
|
curl_easy_cleanup(eh);
|
||||||
|
// Close local file.
|
||||||
|
fclose(dl->file);
|
||||||
|
// Transfer okay?
|
||||||
|
dl->success = (code == CURLE_OK && httpCode == 200);
|
||||||
|
dl->finished = TRUE;
|
||||||
|
// Nuke anything we may have written if transfer was bad.
|
||||||
|
if (dl->success == FALSE) {
|
||||||
|
unlink(dl->filename);
|
||||||
|
}
|
||||||
|
// Callback whoever issued this download.
|
||||||
|
if (dl->callback) {
|
||||||
|
dl->callback(dl);
|
||||||
|
}
|
||||||
|
// Remove from download list.
|
||||||
|
arrdel(_activeHTTPs, i);
|
||||||
|
// Free resources.
|
||||||
|
DEL(dl->filename);
|
||||||
|
DEL(dl);
|
||||||
|
break;
|
||||||
|
#ifdef DEBUG_MODE
|
||||||
|
} else {
|
||||||
|
debug("CURL: %d\n", code);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stillAlive) {
|
||||||
|
curl_multi_wait(_curlMulti, NULL, 0, 100, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static size_t httpWrite(char *data, size_t num, size_t length, void *userp) {
|
||||||
|
HTTPT *download = (HTTPT *)userp;
|
||||||
|
|
||||||
|
// Write it to disk.
|
||||||
|
fwrite(data, num, length, download->file);
|
||||||
|
|
||||||
|
// Update UI.
|
||||||
|
download->progress += num * length;
|
||||||
|
#ifdef DEBUG_MODE
|
||||||
|
debug("CURL Progress %" CURL_FORMAT_CURL_OFF_T " Length %" CURL_FORMAT_CURL_OFF_T "\n", download->progress, download->length);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Did the user request to cancel the transfer?
|
||||||
|
/*
|
||||||
|
if (download->finished) {
|
||||||
|
return CURL_READFUNC_ABORT;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
return num * length;
|
||||||
|
}
|
56
src/http.h
Normal file
56
src/http.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* JoeyDev
|
||||||
|
* Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
|
||||||
|
*
|
||||||
|
* This software is provided 'as-is', without any express or implied
|
||||||
|
* warranty. In no event will the authors be held liable for any damages
|
||||||
|
* arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
|
* including commercial applications, and to alter it and redistribute it
|
||||||
|
* freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
* claim that you wrote the original software. If you use this software
|
||||||
|
* in a product, an acknowledgment in the product documentation would be
|
||||||
|
* appreciated but is not required.
|
||||||
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
* misrepresented as being the original software.
|
||||||
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HTTP_H
|
||||||
|
#define HTTP_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "curl/curl.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct HTTPS;
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*HTTPCallback)(struct HTTPS*);
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct HTTPS {
|
||||||
|
CURLM *cm;
|
||||||
|
FILE *file;
|
||||||
|
char *filename;
|
||||||
|
gboolean finished;
|
||||||
|
gboolean success;
|
||||||
|
curl_off_t length;
|
||||||
|
curl_off_t progress;
|
||||||
|
HTTPCallback callback;
|
||||||
|
GtkWidget *status;
|
||||||
|
} HTTPT;
|
||||||
|
|
||||||
|
|
||||||
|
HTTPT *httpDownload(HTTPCallback callback, char *filename, char *url);
|
||||||
|
void httpShutdown(void);
|
||||||
|
void httpStartup(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HTTP_H
|
|
@ -24,12 +24,14 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "scintillaHeaders.h"
|
#include "scintillaHeaders.h"
|
||||||
#include "joeydev.h"
|
#include "joeydev.h"
|
||||||
|
#include "http.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
httpStartup();
|
||||||
sshStartup();
|
sshStartup();
|
||||||
|
|
||||||
winJoeyDevCreate();
|
winJoeyDevCreate();
|
||||||
|
@ -37,6 +39,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
scintilla_release_resources();
|
scintilla_release_resources();
|
||||||
sshShutdown();
|
sshShutdown();
|
||||||
|
httpShutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
118
src/project.c
118
src/project.c
|
@ -22,11 +22,13 @@
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma ide diagnostic ignored "cppcoreguidelines-narrowing-conversions"
|
#pragma ide diagnostic ignored "cppcoreguidelines-narrowing-conversions"
|
||||||
|
#pragma ide diagnostic ignored "EndlessLoop"
|
||||||
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "http.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +58,8 @@ typedef struct ProjectDataS {
|
||||||
GtkWidget *treeProject;
|
GtkWidget *treeProject;
|
||||||
char *configName;
|
char *configName;
|
||||||
char *buildHost;
|
char *buildHost;
|
||||||
int buildPort;
|
int buildHTTPPort;
|
||||||
|
int buildSSHPort;
|
||||||
char *buildUser;
|
char *buildUser;
|
||||||
char *buildPassword;
|
char *buildPassword;
|
||||||
} ProjectDataT;
|
} ProjectDataT;
|
||||||
|
@ -81,10 +84,15 @@ static SectionDataT _sectionData[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean _httpTestComplete = FALSE;
|
||||||
|
static gboolean _httpTestSuccess = FALSE;
|
||||||
|
|
||||||
|
|
||||||
#define BUILD_SETTINGS_RESPONSE_TEST 1
|
#define BUILD_SETTINGS_RESPONSE_TEST 1
|
||||||
|
|
||||||
|
|
||||||
static void addToTree(ProjectDataT *self, char *filename);
|
static void addToTree(ProjectDataT *self, char *filename);
|
||||||
|
static void httpTest(HTTPT *download);
|
||||||
static void loadConfig(ProjectDataT *self);
|
static void loadConfig(ProjectDataT *self);
|
||||||
static void loadProject(ProjectDataT *self);
|
static void loadProject(ProjectDataT *self);
|
||||||
EVENT void menuProjectFileNew(GtkWidget *object, gpointer userData);
|
EVENT void menuProjectFileNew(GtkWidget *object, gpointer userData);
|
||||||
|
@ -134,6 +142,12 @@ static void addToTree(ProjectDataT *self, char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void httpTest(HTTPT *download) {
|
||||||
|
_httpTestComplete = TRUE;
|
||||||
|
_httpTestSuccess = download->success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void loadConfig(ProjectDataT *self) {
|
static void loadConfig(ProjectDataT *self) {
|
||||||
FILE *in = NULL;
|
FILE *in = NULL;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
|
@ -156,16 +170,20 @@ static void loadConfig(ProjectDataT *self) {
|
||||||
self->buildHost = strdup(line);
|
self->buildHost = strdup(line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Port
|
case 3: // HTTP Port
|
||||||
self->buildPort = atoi(line);
|
self->buildHTTPPort = atoi(line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // User
|
case 4: // SSH Port
|
||||||
|
self->buildSSHPort = atoi(line);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // User
|
||||||
DEL(self->buildUser);
|
DEL(self->buildUser);
|
||||||
self->buildUser = strdup(line);
|
self->buildUser = strdup(line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // Password
|
case 6: // Password
|
||||||
DEL(self->buildPassword);
|
DEL(self->buildPassword);
|
||||||
self->buildPassword = strdup(line);
|
self->buildPassword = strdup(line);
|
||||||
break;
|
break;
|
||||||
|
@ -187,7 +205,8 @@ static void loadConfig(ProjectDataT *self) {
|
||||||
DEL(self->buildPassword);
|
DEL(self->buildPassword);
|
||||||
|
|
||||||
self->buildHost = strdup("build.joeylib.com");
|
self->buildHost = strdup("build.joeylib.com");
|
||||||
self->buildPort = 816;
|
self->buildHTTPPort = 6502;
|
||||||
|
self->buildSSHPort = 816;
|
||||||
self->buildUser = strdup(g_get_user_name());
|
self->buildUser = strdup(g_get_user_name());
|
||||||
self->buildPassword = strdup("SuperSecret");
|
self->buildPassword = strdup("SuperSecret");
|
||||||
|
|
||||||
|
@ -396,39 +415,53 @@ EVENT void menuProjectProjectProperties(GtkWidget *object, gpointer userData) {
|
||||||
|
|
||||||
EVENT void menuProjectBuildSettings(GtkWidget *object, gpointer userData) {
|
EVENT void menuProjectBuildSettings(GtkWidget *object, gpointer userData) {
|
||||||
ProjectDataT *self = (ProjectDataT *)userData;
|
ProjectDataT *self = (ProjectDataT *)userData;
|
||||||
|
GtkWidget *dialog;
|
||||||
GtkWidget *dialogServerSettings;
|
GtkWidget *dialogServerSettings;
|
||||||
GtkWidget *txtHost;
|
GtkWidget *txtHost;
|
||||||
GtkWidget *txtPort;
|
GtkWidget *txtHTTPPort;
|
||||||
|
GtkWidget *txtSSHPort;
|
||||||
GtkWidget *txtUser;
|
GtkWidget *txtUser;
|
||||||
GtkWidget *txtPassword;
|
GtkWidget *txtPassword;
|
||||||
|
GtkWidget *btnTest;
|
||||||
|
GtkWidget *btnOkay;
|
||||||
char *widgetNames[] = {
|
char *widgetNames[] = {
|
||||||
"dialogServerSettings",
|
"dialogServerSettings",
|
||||||
"txtHost",
|
"txtHost",
|
||||||
"txtPort",
|
"txtHTTPPort",
|
||||||
|
"txtSSHPort",
|
||||||
"txtUser",
|
"txtUser",
|
||||||
"txtPassword",
|
"txtPassword",
|
||||||
|
"btnTest",
|
||||||
|
"btnOkay",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
GtkWidget **widgets[] = {
|
GtkWidget **widgets[] = {
|
||||||
&dialogServerSettings,
|
&dialogServerSettings,
|
||||||
&txtHost,
|
&txtHost,
|
||||||
&txtPort,
|
&txtHTTPPort,
|
||||||
|
&txtSSHPort,
|
||||||
&txtUser,
|
&txtUser,
|
||||||
&txtPassword
|
&txtPassword,
|
||||||
|
&btnTest,
|
||||||
|
&btnOkay
|
||||||
};
|
};
|
||||||
char temp[6];
|
char temp[6];
|
||||||
|
char *name = NULL;
|
||||||
|
char *url = NULL;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
SSHT *ssh = NULL;
|
SSHT *ssh = NULL;
|
||||||
char *output = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
(void)object;
|
(void)object;
|
||||||
|
|
||||||
utilGetWidgetsFromMemory("/com/kangaroopunch/joeydev/BuildServer.glade", widgetNames, widgets, self);
|
utilGetWidgetsFromMemory("/com/kangaroopunch/joeydev/BuildServer.glade", widgetNames, widgets, self);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
snprintf(temp, 6, "%d", self->buildPort);
|
|
||||||
gtk_entry_set_text(GTK_ENTRY(txtHost), self->buildHost);
|
gtk_entry_set_text(GTK_ENTRY(txtHost), self->buildHost);
|
||||||
gtk_entry_set_text(GTK_ENTRY(txtPort), temp);
|
snprintf(temp, 6, "%d", self->buildHTTPPort);
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(txtHTTPPort), temp);
|
||||||
|
snprintf(temp, 6, "%d", self->buildSSHPort);
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(txtSSHPort), temp);
|
||||||
gtk_entry_set_text(GTK_ENTRY(txtUser), self->buildUser);
|
gtk_entry_set_text(GTK_ENTRY(txtUser), self->buildUser);
|
||||||
gtk_entry_set_text(GTK_ENTRY(txtPassword), self->buildPassword);
|
gtk_entry_set_text(GTK_ENTRY(txtPassword), self->buildPassword);
|
||||||
result = gtk_dialog_run(GTK_DIALOG(dialogServerSettings));
|
result = gtk_dialog_run(GTK_DIALOG(dialogServerSettings));
|
||||||
|
@ -438,28 +471,56 @@ EVENT void menuProjectBuildSettings(GtkWidget *object, gpointer userData) {
|
||||||
DEL(self->buildUser);
|
DEL(self->buildUser);
|
||||||
DEL(self->buildPassword);
|
DEL(self->buildPassword);
|
||||||
self->buildHost = strdup(gtk_entry_get_text(GTK_ENTRY(txtHost)));
|
self->buildHost = strdup(gtk_entry_get_text(GTK_ENTRY(txtHost)));
|
||||||
self->buildPort = atoi(gtk_entry_get_text(GTK_ENTRY(txtPort)));
|
self->buildHTTPPort = atoi(gtk_entry_get_text(GTK_ENTRY(txtHTTPPort)));
|
||||||
|
self->buildSSHPort = atoi(gtk_entry_get_text(GTK_ENTRY(txtSSHPort)));
|
||||||
self->buildUser = strdup(gtk_entry_get_text(GTK_ENTRY(txtUser)));
|
self->buildUser = strdup(gtk_entry_get_text(GTK_ENTRY(txtUser)));
|
||||||
self->buildPassword = strdup(gtk_entry_get_text(GTK_ENTRY(txtPassword)));
|
self->buildPassword = strdup(gtk_entry_get_text(GTK_ENTRY(txtPassword)));
|
||||||
saveConfig(self);
|
saveConfig(self);
|
||||||
|
|
||||||
if (result == BUILD_SETTINGS_RESPONSE_TEST) {
|
if (result == BUILD_SETTINGS_RESPONSE_TEST) {
|
||||||
// Run server connection test.
|
gtk_widget_set_sensitive(btnTest, FALSE);
|
||||||
ssh = sshConnect(self->buildHost, self->buildPort, self->buildUser, self->buildPassword);
|
gtk_widget_set_sensitive(btnOkay, FALSE);
|
||||||
|
// Run server connection tests - HTTP.
|
||||||
|
name = utilCreateString("%s%cjoeydev%cjoeydev.info", g_get_user_config_dir(), UTIL_PATH_CHAR, UTIL_PATH_CHAR);
|
||||||
|
url = utilCreateString("http://%s:%d/joeydev.info", self->buildHost, self->buildHTTPPort);
|
||||||
|
_httpTestComplete = FALSE;
|
||||||
|
httpDownload(httpTest, name, url);
|
||||||
|
// This loop seriously breaks CLion's syntax highlighting.
|
||||||
|
while (_httpTestComplete == FALSE) {
|
||||||
|
gtk_main_iteration();
|
||||||
|
}
|
||||||
|
if (_httpTestSuccess == FALSE) {
|
||||||
|
error = utilCreateString("Unable to connect to HTTP port.");
|
||||||
|
}
|
||||||
|
DEL(url);
|
||||||
|
DEL(name);
|
||||||
|
// Run server connection tests - SSH.
|
||||||
|
ssh = sshConnect(self->buildHost, self->buildSSHPort, self->buildUser, self->buildPassword);
|
||||||
if (ssh) {
|
if (ssh) {
|
||||||
debug("Connected!\n");
|
|
||||||
// echo ${JOEYLIB_SDKS}
|
|
||||||
result = sshExecute(ssh, "ls -la", &output);
|
|
||||||
debug("----------\n");
|
|
||||||
if ((result == 0) && (strlen(output) > 0)) {
|
|
||||||
debug("%s", output);
|
|
||||||
} else {
|
|
||||||
debug("No output!\n");
|
|
||||||
}
|
|
||||||
debug("----------\n");
|
|
||||||
DEL(output);
|
|
||||||
sshDisconnect(&ssh);
|
sshDisconnect(&ssh);
|
||||||
|
} else {
|
||||||
|
DEL(error);
|
||||||
|
error = utilCreateString("Unable to connect to SSH port.");
|
||||||
}
|
}
|
||||||
|
// Did the tests pass?
|
||||||
|
if (error == NULL) {
|
||||||
|
dialog = gtk_message_dialog_new(GTK_WINDOW(dialogServerSettings),
|
||||||
|
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
|
||||||
|
GTK_MESSAGE_INFO,
|
||||||
|
GTK_BUTTONS_CLOSE,
|
||||||
|
"Successful connection to build server!");
|
||||||
|
} else {
|
||||||
|
dialog = gtk_message_dialog_new(GTK_WINDOW(dialogServerSettings),
|
||||||
|
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
|
||||||
|
GTK_MESSAGE_ERROR,
|
||||||
|
GTK_BUTTONS_CLOSE,
|
||||||
|
"%s", error);
|
||||||
|
}
|
||||||
|
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
|
gtk_widget_destroy(dialog);
|
||||||
|
DEL(error);
|
||||||
|
gtk_widget_set_sensitive(btnTest, TRUE);
|
||||||
|
gtk_widget_set_sensitive(btnOkay, TRUE);
|
||||||
} else {
|
} else {
|
||||||
// Close dialog on OKAY but not TEST.
|
// Close dialog on OKAY but not TEST.
|
||||||
break;
|
break;
|
||||||
|
@ -500,7 +561,8 @@ static void saveConfig(ProjectDataT *self) {
|
||||||
fprintf(out, "%s\n", BUILD_SETTINGS_VERSION);
|
fprintf(out, "%s\n", BUILD_SETTINGS_VERSION);
|
||||||
fprintf(out, "------------------------------------------------------------------------------\n");
|
fprintf(out, "------------------------------------------------------------------------------\n");
|
||||||
fprintf(out, "%s\n", self->buildHost);
|
fprintf(out, "%s\n", self->buildHost);
|
||||||
fprintf(out, "%d\n", self->buildPort);
|
fprintf(out, "%d\n", self->buildHTTPPort);
|
||||||
|
fprintf(out, "%d\n", self->buildSSHPort);
|
||||||
fprintf(out, "%s\n", self->buildUser);
|
fprintf(out, "%s\n", self->buildUser);
|
||||||
fprintf(out, "%s\n", self->buildPassword); //***TODO*** This is hardly secure.
|
fprintf(out, "%s\n", self->buildPassword); //***TODO*** This is hardly secure.
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
|
@ -210,8 +210,7 @@ SSHT *sshExecuteVerbose(SSHT *sshData, char *title, char *command, SSHCallback c
|
||||||
|
|
||||||
|
|
||||||
void sshShutdown(void) {
|
void sshShutdown(void) {
|
||||||
//curl_multi_cleanup(_curlMulti);
|
//***TODO*** Any active sessions?
|
||||||
//curl_global_cleanup();
|
|
||||||
|
|
||||||
g_idle_remove_by_data(sshUpdate);
|
g_idle_remove_by_data(sshUpdate);
|
||||||
|
|
||||||
|
@ -225,9 +224,6 @@ void sshShutdown(void) {
|
||||||
void sshStartup(void) {
|
void sshStartup(void) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
//curl_global_init(CURL_GLOBAL_ALL);
|
|
||||||
//_curlMulti = curl_multi_init();
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
err = WSAStartup(MAKEWORD(2, 0), &_wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &_wsadata);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
|
BIN
thirdparty/curl-7.87.0.tar.bz2
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/curl-7.87.0.tar.bz2
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
|
@ -108,6 +108,24 @@ pushd "${ROOT}" || exit &> /dev/null
|
||||||
popd || true &> /dev/null
|
popd || true &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f ${INSTALLED}/lib/libcurl.a ]]; then
|
||||||
|
echo Building Dependency: libcurl...
|
||||||
|
tar xjf ${THIRDPARTY}/curl-7.87.0.tar.bz2
|
||||||
|
pushd curl-7.87.0 || exit &> /dev/null
|
||||||
|
./configure \
|
||||||
|
--enable-static \
|
||||||
|
--disable-shared \
|
||||||
|
--without-ssl \
|
||||||
|
--without-libidn2 \
|
||||||
|
--without-libpsl \
|
||||||
|
--without-brotli \
|
||||||
|
--without-zstd \
|
||||||
|
--prefix=${INSTALLED}
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
popd || true &> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -f ${INSTALLED}/lib/scintilla.a ]]; then
|
if [[ ! -f ${INSTALLED}/lib/scintilla.a ]]; then
|
||||||
echo Building Dependency: Scintilla...
|
echo Building Dependency: Scintilla...
|
||||||
tar xzf ${THIRDPARTY}/scintilla531.tgz
|
tar xzf ${THIRDPARTY}/scintilla531.tgz
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=2 n-rows=4 -->
|
<!-- n-columns=2 n-rows=5 -->
|
||||||
<object class="GtkGrid">
|
<object class="GtkGrid">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
@ -70,45 +70,6 @@
|
||||||
<property name="top-attach">0</property>
|
<property name="top-attach">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="label" translatable="yes">Port:</property>
|
|
||||||
<property name="justify">right</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="label" translatable="yes">User:</property>
|
|
||||||
<property name="justify">right</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="label" translatable="yes">Password:</property>
|
|
||||||
<property name="justify">right</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="txtHost">
|
<object class="GtkEntry" id="txtHost">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -122,15 +83,55 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="txtPort">
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">Password:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="txtPassword">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="input-purpose">digits</property>
|
<property name="visibility">False</property>
|
||||||
|
<property name="input-purpose">password</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">1</property>
|
<property name="top-attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">User:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">SSH Port:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -140,21 +141,46 @@
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="input-purpose">name</property>
|
<property name="input-purpose">name</property>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="txtSSHPort">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="input-purpose">digits</property>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">2</property>
|
<property name="top-attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="txtPassword">
|
<object class="GtkEntry" id="txtHTTPPort">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="input-purpose">password</property>
|
<property name="input-purpose">digits</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
<property name="top-attach">3</property>
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">HTTP Port:</property>
|
||||||
|
<property name="justify">right</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Add table
Reference in a new issue