mirror of
https://github.com/webui-dev/webui.git
synced 2024-09-17 17:27:54 +03:00
Adding webui_set_default_root_folder()
* Adding `webui_set_default_root_folder()` * Fix non initialized webui-core in some scenarios
This commit is contained in:
parent
eda58b315e
commit
74830815cd
@ -164,8 +164,10 @@ WEBUI_EXPORT void webui_close(size_t window);
|
|||||||
WEBUI_EXPORT void webui_destroy(size_t window);
|
WEBUI_EXPORT void webui_destroy(size_t window);
|
||||||
// Close all opened windows. webui_wait() will break.
|
// Close all opened windows. webui_wait() will break.
|
||||||
WEBUI_EXPORT void webui_exit(void);
|
WEBUI_EXPORT void webui_exit(void);
|
||||||
// Set the web-server root folder path.
|
// Set the web-server root folder path for a specific window.
|
||||||
WEBUI_EXPORT bool webui_set_root_folder(size_t window, const char* path);
|
WEBUI_EXPORT bool webui_set_root_folder(size_t window, const char* path);
|
||||||
|
// Set the web-server root folder path for all windows.
|
||||||
|
WEBUI_EXPORT bool webui_set_default_root_folder(const char* path);
|
||||||
// Set a custom handler to serve files
|
// Set a custom handler to serve files
|
||||||
WEBUI_EXPORT void webui_set_file_handler(size_t window, const void* (*handler)(const char* filename, int* length));
|
WEBUI_EXPORT void webui_set_file_handler(size_t window, const void* (*handler)(const char* filename, int* length));
|
||||||
|
|
||||||
|
96
src/webui.c
96
src/webui.c
@ -47,6 +47,7 @@ void webui_run(size_t window, const char* script) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ void webui_set_file_handler(size_t window, const void* (*handler)(const char *fi
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -93,11 +95,10 @@ bool webui_script(size_t window, const char* script, size_t timeout_second, char
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return false;
|
if(_webui_core.wins[window] == NULL) return false;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
_webui_init();
|
|
||||||
|
|
||||||
// Initializing response buffer
|
// Initializing response buffer
|
||||||
if(buffer_length > 0)
|
if(buffer_length > 0)
|
||||||
memset(buffer, 0, buffer_length);
|
memset(buffer, 0, buffer_length);
|
||||||
@ -201,7 +202,10 @@ size_t webui_new_window(void) {
|
|||||||
win->browser_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
win->browser_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
||||||
win->profile_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
win->profile_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
||||||
win->server_root_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
win->server_root_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
||||||
sprintf(win->server_root_path, "%s", WEBUI_DEFAULT_PATH);
|
if(_webui_is_empty(_webui_core.default_server_root_path))
|
||||||
|
sprintf(win->server_root_path, "%s", WEBUI_DEFAULT_PATH);
|
||||||
|
else
|
||||||
|
sprintf(win->server_root_path, "%s", _webui_core.default_server_root_path);
|
||||||
|
|
||||||
#ifdef WEBUI_LOG
|
#ifdef WEBUI_LOG
|
||||||
printf("[User] webui_new_window() -> New window #%zu @ 0x%p\n", window_number, win);
|
printf("[User] webui_new_window() -> New window #%zu @ 0x%p\n", window_number, win);
|
||||||
@ -216,6 +220,8 @@ size_t webui_get_new_window_id(void) {
|
|||||||
printf("[User] webui_get_new_window_id()...\n");
|
printf("[User] webui_get_new_window_id()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
for(size_t i = 1; i < WEBUI_MAX_ARRAY; i++) {
|
for(size_t i = 1; i < WEBUI_MAX_ARRAY; i++) {
|
||||||
if(_webui_core.wins[i] == NULL) {
|
if(_webui_core.wins[i] == NULL) {
|
||||||
if(i > _webui_core.last_win_number)
|
if(i > _webui_core.last_win_number)
|
||||||
@ -271,6 +277,7 @@ void webui_set_kiosk(size_t window, bool status) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -284,11 +291,10 @@ void webui_close(size_t window) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
_webui_init();
|
|
||||||
|
|
||||||
if(win->connected) {
|
if(win->connected) {
|
||||||
|
|
||||||
// Prepare packets
|
// Prepare packets
|
||||||
@ -311,11 +317,10 @@ void webui_destroy(size_t window) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
_webui_init();
|
|
||||||
|
|
||||||
if(win->server_running) {
|
if(win->server_running) {
|
||||||
|
|
||||||
// Freindly close
|
// Freindly close
|
||||||
@ -381,6 +386,7 @@ bool webui_is_shown(size_t window) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return false;
|
if(_webui_core.wins[window] == NULL) return false;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -394,6 +400,7 @@ void webui_set_multi_access(size_t window, bool status) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -407,6 +414,7 @@ void webui_set_icon(size_t window, const char* icon, const char* icon_type) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -440,6 +448,7 @@ bool webui_show(size_t window, const char* content) {
|
|||||||
_webui_core.ui = true;
|
_webui_core.ui = true;
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return false;
|
if(_webui_core.wins[window] == NULL) return false;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -459,6 +468,7 @@ bool webui_show_browser(size_t window, const char* content, size_t browser) {
|
|||||||
_webui_core.ui = true;
|
_webui_core.ui = true;
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return false;
|
if(_webui_core.wins[window] == NULL) return false;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -472,11 +482,10 @@ size_t webui_bind(size_t window, const char* element, void (*func)(webui_event_t
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return 0;
|
if(_webui_core.wins[window] == NULL) return 0;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
_webui_init();
|
|
||||||
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
if(_webui_is_empty(element))
|
if(_webui_is_empty(element))
|
||||||
win->has_events = true;
|
win->has_events = true;
|
||||||
@ -545,6 +554,8 @@ const char* webui_get_string(webui_event_t* e) {
|
|||||||
printf("[User] webui_get_string()...\n");
|
printf("[User] webui_get_string()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
if(e->data != NULL) {
|
if(e->data != NULL) {
|
||||||
size_t len = _webui_strlen(e->data);
|
size_t len = _webui_strlen(e->data);
|
||||||
if(len > 0 && len <= WEBUI_MAX_BUF)
|
if(len > 0 && len <= WEBUI_MAX_BUF)
|
||||||
@ -560,6 +571,8 @@ long long int webui_get_int(webui_event_t* e) {
|
|||||||
printf("[User] webui_get_int()...\n");
|
printf("[User] webui_get_int()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
char* endptr;
|
char* endptr;
|
||||||
|
|
||||||
if(e->data != NULL) {
|
if(e->data != NULL) {
|
||||||
@ -577,6 +590,8 @@ bool webui_get_bool(webui_event_t* e) {
|
|||||||
printf("[User] webui_get_bool()...\n");
|
printf("[User] webui_get_bool()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
const char* str = webui_get_string(e);
|
const char* str = webui_get_string(e);
|
||||||
if(str[0] == 't' || str[0] == 'T') // true || True
|
if(str[0] == 't' || str[0] == 'T') // true || True
|
||||||
return true;
|
return true;
|
||||||
@ -591,6 +606,7 @@ void webui_return_int(webui_event_t* e, long long int n) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[e->window] == NULL) return;
|
if(_webui_core.wins[e->window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[e->window];
|
_webui_window_t* win = _webui_core.wins[e->window];
|
||||||
|
|
||||||
@ -622,6 +638,7 @@ void webui_return_string(webui_event_t* e, const char* s) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[e->window] == NULL) return;
|
if(_webui_core.wins[e->window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[e->window];
|
_webui_window_t* win = _webui_core.wins[e->window];
|
||||||
|
|
||||||
@ -650,6 +667,7 @@ void webui_return_bool(webui_event_t* e, bool b) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[e->window] == NULL) return;
|
if(_webui_core.wins[e->window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[e->window];
|
_webui_window_t* win = _webui_core.wins[e->window];
|
||||||
|
|
||||||
@ -678,6 +696,7 @@ void webui_set_hide(size_t window, bool status) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -694,6 +713,7 @@ void webui_send_raw(size_t window, const char* function, const void* raw, size_t
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -747,6 +767,8 @@ char* webui_encode(const char* str) {
|
|||||||
printf("[User] webui_encode()...\n");
|
printf("[User] webui_encode()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
size_t len = strlen(str);
|
size_t len = strlen(str);
|
||||||
if(len < 1)
|
if(len < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -784,6 +806,8 @@ char* webui_decode(const char* str) {
|
|||||||
printf("[User] webui_decode()...\n");
|
printf("[User] webui_decode()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
size_t len = strlen(str);
|
size_t len = strlen(str);
|
||||||
if(len < 1)
|
if(len < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -821,6 +845,8 @@ void webui_free(void* ptr) {
|
|||||||
printf("[User] webui_free([0x%p])...\n", ptr);
|
printf("[User] webui_free([0x%p])...\n", ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
_webui_free_mem(ptr);
|
_webui_free_mem(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,6 +856,8 @@ void* webui_malloc(size_t size) {
|
|||||||
printf("[User] webui_malloc(%zu bytes)...\n", size);
|
printf("[User] webui_malloc(%zu bytes)...\n", size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
return _webui_malloc(size);
|
return _webui_malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,6 +867,8 @@ void webui_exit(void) {
|
|||||||
printf("[User] webui_exit()...\n");
|
printf("[User] webui_exit()...\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
#ifndef WEBUI_LOG
|
#ifndef WEBUI_LOG
|
||||||
// Close all opened windows
|
// Close all opened windows
|
||||||
// by sending `close` command
|
// by sending `close` command
|
||||||
@ -942,11 +972,10 @@ void webui_set_runtime(size_t window, size_t runtime) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
_webui_init();
|
|
||||||
|
|
||||||
if(runtime != Deno && runtime != NodeJS)
|
if(runtime != Deno && runtime != NodeJS)
|
||||||
win->runtime = None;
|
win->runtime = None;
|
||||||
else
|
else
|
||||||
@ -960,6 +989,7 @@ bool webui_set_root_folder(size_t window, const char* path) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return false;
|
if(_webui_core.wins[window] == NULL) return false;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -979,6 +1009,39 @@ bool webui_set_root_folder(size_t window, const char* path) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool webui_set_default_root_folder(const char* path) {
|
||||||
|
|
||||||
|
#ifdef WEBUI_LOG
|
||||||
|
printf("[User] webui_set_default_root_folder([%s])...\n", path);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_webui_init();
|
||||||
|
|
||||||
|
if(_webui_is_empty(path) || (_webui_strlen(path) > WEBUI_MAX_PATH) || !_webui_folder_exist((char*)path)) {
|
||||||
|
|
||||||
|
_webui_core.default_server_root_path[0] = '\0';
|
||||||
|
#ifdef WEBUI_LOG
|
||||||
|
printf("[User] webui_set_default_root_folder() -> Failed.\n");
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WEBUI_LOG
|
||||||
|
printf("[User] webui_set_default_root_folder() -> Success.\n");
|
||||||
|
#endif
|
||||||
|
sprintf(_webui_core.default_server_root_path, "%s", path);
|
||||||
|
|
||||||
|
// Update all windows. This will works only
|
||||||
|
// for non-running windows.
|
||||||
|
for(size_t i = 1; i <= _webui_core.last_win_number; i++) {
|
||||||
|
if(_webui_core.wins[i] != NULL) {
|
||||||
|
sprintf(_webui_core.wins[i]->server_root_path, "%s", _webui_core.default_server_root_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// -- Interface's Functions ----------------
|
// -- Interface's Functions ----------------
|
||||||
static void _webui_interface_bind_handler(webui_event_t* e) {
|
static void _webui_interface_bind_handler(webui_event_t* e) {
|
||||||
|
|
||||||
@ -987,6 +1050,7 @@ static void _webui_interface_bind_handler(webui_event_t* e) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[e->window] == NULL) return;
|
if(_webui_core.wins[e->window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[e->window];
|
_webui_window_t* win = _webui_core.wins[e->window];
|
||||||
|
|
||||||
@ -1044,6 +1108,7 @@ void webui_interface_set_response(size_t window, size_t event_number, const char
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return;
|
if(_webui_core.wins[window] == NULL) return;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -1106,6 +1171,7 @@ size_t webui_interface_get_window_id(size_t window) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return 0;
|
if(_webui_core.wins[window] == NULL) return 0;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -1119,6 +1185,7 @@ size_t webui_interface_get_bind_id(size_t window, const char* element) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dereference
|
// Dereference
|
||||||
|
_webui_init();
|
||||||
if(_webui_core.wins[window] == NULL) return 0;
|
if(_webui_core.wins[window] == NULL) return 0;
|
||||||
_webui_window_t* win = _webui_core.wins[window];
|
_webui_window_t* win = _webui_core.wins[window];
|
||||||
|
|
||||||
@ -3641,8 +3708,6 @@ static bool _webui_show_window(_webui_window_t* win, const char* content, bool i
|
|||||||
printf("[Core]\t\t_webui_show_window(FILE, [%zu])...\n", browser);
|
printf("[Core]\t\t_webui_show_window(FILE, [%zu])...\n", browser);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_webui_init();
|
|
||||||
|
|
||||||
char* url = NULL;
|
char* url = NULL;
|
||||||
size_t port = (win->server_port == 0 ? _webui_get_free_port() : win->server_port);
|
size_t port = (win->server_port == 0 ? _webui_get_free_port() : win->server_port);
|
||||||
size_t ws_port = (win->ws_port == 0 ? _webui_get_free_port() : win->ws_port);
|
size_t ws_port = (win->ws_port == 0 ? _webui_get_free_port() : win->ws_port);
|
||||||
@ -4232,7 +4297,7 @@ static size_t _webui_get_free_port(void) {
|
|||||||
static void _webui_init(void) {
|
static void _webui_init(void) {
|
||||||
|
|
||||||
if(_webui_core.initialized)
|
if(_webui_core.initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef WEBUI_LOG
|
#ifdef WEBUI_LOG
|
||||||
printf("[Core]\t\tWebUI v%s \n", WEBUI_VERSION);
|
printf("[Core]\t\tWebUI v%s \n", WEBUI_VERSION);
|
||||||
@ -4241,9 +4306,10 @@ static void _webui_init(void) {
|
|||||||
|
|
||||||
// Initializing core
|
// Initializing core
|
||||||
memset(&_webui_core, 0, sizeof(_webui_core_t));
|
memset(&_webui_core, 0, sizeof(_webui_core_t));
|
||||||
_webui_core.initialized = true;
|
_webui_core.initialized = true;
|
||||||
_webui_core.startup_timeout = WEBUI_DEF_TIMEOUT;
|
_webui_core.startup_timeout = WEBUI_DEF_TIMEOUT;
|
||||||
_webui_core.executable_path = _webui_get_current_path();
|
_webui_core.executable_path = _webui_get_current_path();
|
||||||
|
_webui_core.default_server_root_path = (char*) _webui_malloc(WEBUI_MAX_PATH);
|
||||||
|
|
||||||
// Initializing server services
|
// Initializing server services
|
||||||
mg_init_library(0);
|
mg_init_library(0);
|
||||||
|
@ -116,6 +116,7 @@ typedef struct _webui_core_t {
|
|||||||
webui_mutex_t mutex_wait;
|
webui_mutex_t mutex_wait;
|
||||||
webui_mutex_t mutex_bridge;
|
webui_mutex_t mutex_bridge;
|
||||||
webui_condition_t condition_wait;
|
webui_condition_t condition_wait;
|
||||||
|
char* default_server_root_path;
|
||||||
bool ui;
|
bool ui;
|
||||||
} _webui_core_t;
|
} _webui_core_t;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user