2022-09-25 02:35:56 +03:00
/*
2023-04-01 07:05:41 +03:00
WebUI Library 2.1 .1
2022-09-25 02:35:56 +03:00
http : //webui.me
https : //github.com/alifcommunity/webui
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
Copyright ( c ) 2020 - 2023 Hassan Draga .
Licensed under GNU General Public License v2 .0 .
All rights reserved .
Canada .
2022-09-25 02:35:56 +03:00
*/
# ifndef _WEBUI_H
# define _WEBUI_H
# if defined(_MSC_VER) || defined(__TINYC__)
# define EXPORT __declspec(dllexport)
# else
# define EXPORT extern
# endif
2023-04-01 07:05:41 +03:00
# define WEBUI_VERSION "2.1.1" // Version
2022-09-25 02:35:56 +03:00
# define WEBUI_HEADER_SIGNATURE 0xFF // All packets should start with this 8bit
# define WEBUI_HEADER_JS 0xFE // Javascript result in frontend
# define WEBUI_HEADER_CLICK 0xFD // Click event
# define WEBUI_HEADER_SWITCH 0xFC // Frontend refresh
# define WEBUI_HEADER_CLOSE 0xFB // Close window
# define WEBUI_HEADER_CALL_FUNC 0xFA // Call a backend function
2022-11-12 01:19:37 +03:00
# define WEBUI_MAX_ARRAY (1024) // Max threads, servers, windows, pointers..
# define WEBUI_MIN_PORT (10000) // Minimum socket port
# define WEBUI_MAX_PORT (65500) // Should be less than 65535
# define WEBUI_MAX_BUF (1024000) // 1024 Kb max dynamic memory allocation
2022-09-25 02:35:56 +03:00
# define WEBUI_DEFAULT_PATH "." // Default root path
2022-12-12 18:13:27 +03:00
# define WEBUI_DEF_TIMEOUT (8) // Default startup timeout in seconds
2022-09-25 02:35:56 +03:00
2023-04-01 07:05:41 +03:00
# define WEBUI_EVENT_CONNECTED (1) // Window connected
# define WEBUI_EVENT_MULTI_CONNECTION (2) // Multi clients connected
# define WEBUI_EVENT_UNWANTED_CONNECTION (3) // Unwanted client connected
# define WEBUI_EVENT_DISCONNECTED (4) // Window disconnected
# define WEBUI_EVENT_MOUSE_CLICK (5) // Mouse Click
# define WEBUI_EVENT_NAVIGATION (6) // The window URL changed
# define WEBUI_EVENT_CALLBACK (7) // Function call
2022-10-20 02:48:47 +03:00
// -- C STD ---------------------------
2022-09-25 02:35:56 +03:00
# include <stdbool.h>
# include <inttypes.h>
# include <assert.h>
# include <stdint.h>
# include <stdlib.h>
# include <string.h>
# include <stdio.h>
# include <ctype.h>
# include <stddef.h>
# include <time.h>
# include <errno.h>
2022-12-12 18:13:27 +03:00
# include <math.h>
2022-09-25 02:35:56 +03:00
# if defined(__GNUC__) || defined(__TINYC__)
# include <dirent.h>
# endif
2022-10-20 02:48:47 +03:00
// -- Windows -------------------------
2022-09-25 02:35:56 +03:00
# ifdef _WIN32
2022-11-08 07:33:03 +03:00
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
2022-09-25 02:35:56 +03:00
// #include <SDKDDKVer.h> // Fix _WIN32_WINNT warning
# include <windows.h>
2022-11-08 07:33:03 +03:00
# include <winsock2.h>
2022-09-25 02:35:56 +03:00
# include <ws2tcpip.h>
2022-11-08 07:33:03 +03:00
// #include <iphlpapi.h>
2022-09-25 02:35:56 +03:00
# include <direct.h>
# include <io.h>
# include <tchar.h>
# define WEBUI_GET_CURRENT_DIR _getcwd
# define WEBUI_FILE_EXIST _access
2022-09-29 02:41:24 +03:00
# define WEBUI_POPEN _popen
# define WEBUI_PCLOSE _pclose
2022-10-24 03:06:15 +03:00
# define WEBUI_MAX_PATH MAX_PATH
2022-09-25 02:35:56 +03:00
# endif
2022-10-20 02:48:47 +03:00
// -- Linux ---------------------------
2022-09-25 02:35:56 +03:00
# ifdef __linux__
# include <pthread.h> // POSIX threading
# include <unistd.h>
2022-10-24 03:06:15 +03:00
# include <limits.h>
# include <dirent.h>
# include <sys/socket.h>
# include <fcntl.h>
# include <poll.h>
2022-09-25 02:35:56 +03:00
# define WEBUI_GET_CURRENT_DIR getcwd
2022-10-24 03:06:15 +03:00
# define WEBUI_FILE_EXIST access
2022-09-29 02:41:24 +03:00
# define WEBUI_POPEN popen
# define WEBUI_PCLOSE pclose
2022-10-24 03:06:15 +03:00
# define WEBUI_MAX_PATH PATH_MAX
2022-09-25 02:35:56 +03:00
# endif
2023-03-28 23:50:10 +03:00
// -- Apple ---------------------------
# ifdef __APPLE__
# include <pthread.h> // POSIX threading
# include <unistd.h>
# include <limits.h>
# include <dirent.h>
# include <sys/socket.h>
# include <fcntl.h>
# include <poll.h>
2023-04-01 07:05:41 +03:00
# include <sys/syslimits.h> // PATH_MAX
2023-03-28 23:50:10 +03:00
# define WEBUI_GET_CURRENT_DIR getcwd
# define WEBUI_FILE_EXIST access
# define WEBUI_POPEN popen
# define WEBUI_PCLOSE pclose
# define WEBUI_MAX_PATH PATH_MAX
# endif
2022-10-19 07:38:54 +03:00
2022-10-30 04:41:20 +03:00
// -- Structs -------------------------
struct webui_event_t ;
2022-10-25 05:35:05 +03:00
typedef struct webui_timer_t {
struct timespec start ;
struct timespec now ;
} webui_timer_t ;
2022-09-25 02:35:56 +03:00
typedef struct webui_window_core_t {
unsigned int window_number ;
bool server_running ;
bool connected ;
bool server_handled ;
bool multi_access ;
bool server_root ;
unsigned int server_port ;
char * url ;
const char * html ;
2022-10-19 07:38:54 +03:00
const char * html_cpy ;
2022-09-25 02:35:56 +03:00
const char * icon ;
const char * icon_type ;
unsigned int CurrentBrowser ;
char * browser_path ;
char * profile_path ;
unsigned int connections ;
2022-09-29 02:41:24 +03:00
unsigned int runtime ;
2022-09-29 11:32:28 +03:00
bool detect_process_close ;
2023-04-01 07:05:41 +03:00
bool has_events ;
2022-09-29 11:32:28 +03:00
# ifdef _WIN32
HANDLE server_thread ;
# else
2022-10-24 03:06:15 +03:00
pthread_t server_thread ;
2022-10-25 05:35:05 +03:00
# endif
2022-09-25 02:35:56 +03:00
} webui_window_core_t ;
typedef struct webui_window_t {
webui_window_core_t core ;
char * path ;
} webui_window_t ;
2022-10-30 04:41:20 +03:00
typedef struct webui_event_t {
unsigned int window_id ;
unsigned int element_id ;
char * element_name ;
webui_window_t * window ;
2022-11-22 02:07:46 +03:00
void * data ;
2022-12-12 18:13:27 +03:00
void * response ;
2023-04-01 07:05:41 +03:00
int type ;
2022-10-30 04:41:20 +03:00
} webui_event_t ;
2022-09-25 02:35:56 +03:00
typedef struct webui_javascript_result_t {
bool error ;
unsigned int length ;
const char * data ;
} webui_javascript_result_t ;
2022-10-30 04:41:20 +03:00
typedef struct webui_script_t {
2022-10-20 02:48:47 +03:00
const char * script ;
2022-09-25 02:35:56 +03:00
unsigned int timeout ;
webui_javascript_result_t result ;
2022-10-30 04:41:20 +03:00
} webui_script_t ;
2022-09-25 02:35:56 +03:00
typedef struct webui_cb_t {
webui_window_t * win ;
2022-11-22 02:07:46 +03:00
char * webui_internal_id ;
2022-09-25 02:35:56 +03:00
char * element_name ;
2022-11-22 02:07:46 +03:00
void * data ;
2023-04-01 07:05:41 +03:00
unsigned int data_len ;
int event_type ;
2022-09-25 02:35:56 +03:00
} webui_cb_t ;
2022-09-29 11:32:28 +03:00
typedef struct webui_cmd_async_t {
webui_window_t * win ;
char * cmd ;
} webui_cmd_async_t ;
2022-09-25 02:35:56 +03:00
typedef struct webui_custom_browser_t {
char * app ;
char * arg ;
bool auto_link ;
} webui_custom_browser_t ;
typedef struct webui_browser_t {
unsigned int any ; // 0
unsigned int chrome ; // 1
unsigned int firefox ; // 2
unsigned int edge ; // 3
unsigned int safari ; // 4
unsigned int chromium ; // 5
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
unsigned int opera ; // 6
unsigned int brave ; // 7
unsigned int vivaldi ; // 8
unsigned int epic ; // 9
unsigned int yandex ; // 10
unsigned int current ; // x
2022-09-25 02:35:56 +03:00
unsigned int custom ; // 99
} webui_browser_t ;
2022-09-29 02:41:24 +03:00
typedef struct webui_runtime_t {
unsigned int none ; // 0
unsigned int deno ; // 1
unsigned int nodejs ; // 2
} webui_runtime_t ;
2022-09-25 02:35:56 +03:00
typedef struct webui_t {
unsigned int servers ;
unsigned int connections ;
2022-11-12 01:19:37 +03:00
unsigned int process ;
2022-09-25 02:35:56 +03:00
webui_custom_browser_t * custom_browser ;
bool wait_for_socket_window ;
char * html_elements [ WEBUI_MAX_ARRAY ] ;
unsigned int used_ports [ WEBUI_MAX_ARRAY ] ;
unsigned int last_window ;
unsigned int startup_timeout ;
bool use_timeout ;
bool timeout_extra ;
bool exit_now ;
2022-10-19 07:38:54 +03:00
const char * run_responses [ WEBUI_MAX_ARRAY ] ;
2022-09-25 02:35:56 +03:00
bool run_done [ WEBUI_MAX_ARRAY ] ;
bool run_error [ WEBUI_MAX_ARRAY ] ;
unsigned int run_last_id ;
struct mg_mgr * mg_mgrs [ WEBUI_MAX_ARRAY ] ;
struct mg_connection * mg_connections [ WEBUI_MAX_ARRAY ] ;
webui_browser_t browser ;
2022-09-29 02:41:24 +03:00
webui_runtime_t runtime ;
2022-09-25 02:35:56 +03:00
bool initialized ;
2022-11-08 07:33:03 +03:00
void ( * cb [ WEBUI_MAX_ARRAY ] ) ( webui_event_t * e ) ;
2022-12-12 18:13:27 +03:00
void ( * cb_interface [ WEBUI_MAX_ARRAY ] ) ( unsigned int , unsigned int , char * , webui_window_t * , char * , char * * ) ;
2022-09-29 02:41:24 +03:00
char * executable_path ;
2022-09-25 02:35:56 +03:00
void * ptr_list [ WEBUI_MAX_ARRAY ] ;
2022-10-21 05:21:52 +03:00
unsigned int ptr_position ;
2022-09-25 02:35:56 +03:00
size_t ptr_size [ WEBUI_MAX_ARRAY ] ;
} webui_t ;
2022-10-20 02:48:47 +03:00
// -- Definitions ---------------------
2022-09-25 02:35:56 +03:00
EXPORT webui_t webui ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
// Create a new window object
2023-04-04 18:28:13 +03:00
EXPORT webui_window_t * webui_new_window ( void ) ;
2023-04-01 07:05:41 +03:00
// Bind a specific html element click event with a function
2022-11-08 07:33:03 +03:00
EXPORT unsigned int webui_bind ( webui_window_t * win , const char * element , void ( * func ) ( webui_event_t * e ) ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
// Show a window using a static HTML script, or a file name in the same working directory. If the window is already opened then it will be refreshed with the new content
EXPORT bool webui_show ( webui_window_t * win , const char * content ) ;
// Wait until all opened windows get closed
2023-04-04 18:28:13 +03:00
EXPORT void webui_wait ( void ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
// Close a specific window
EXPORT void webui_close ( webui_window_t * win ) ;
// Close all opened windows
2023-04-04 18:28:13 +03:00
EXPORT void webui_exit ( void ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
2023-04-01 07:05:41 +03:00
// JavaScript
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT void webui_script ( webui_window_t * win , webui_script_t * script ) ;
2022-11-08 07:33:03 +03:00
EXPORT void webui_script_cleanup ( webui_script_t * script ) ;
2022-10-30 04:41:20 +03:00
EXPORT void webui_script_runtime ( webui_window_t * win , unsigned int runtime ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT long long int webui_get_int ( webui_event_t * e ) ;
2022-11-28 19:04:45 +03:00
EXPORT const char * webui_get_string ( webui_event_t * e ) ;
EXPORT bool webui_get_bool ( webui_event_t * e ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT void webui_return_int ( webui_event_t * e , long long int n ) ;
2022-11-28 19:04:45 +03:00
EXPORT void webui_return_string ( webui_event_t * e , char * s ) ;
EXPORT void webui_return_bool ( webui_event_t * e , bool b ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
2023-04-01 07:05:41 +03:00
// Other
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT const char * webui_new_server ( webui_window_t * win , const char * path ) ;
EXPORT bool webui_open ( webui_window_t * win , const char * url , unsigned int browser ) ;
2023-04-04 18:28:13 +03:00
EXPORT bool webui_is_any_window_running ( void ) ;
EXPORT bool webui_is_app_running ( void ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT bool webui_is_shown ( webui_window_t * win ) ;
EXPORT void webui_set_timeout ( unsigned int second ) ;
EXPORT void webui_set_icon ( webui_window_t * win , const char * icon_s , const char * type_s ) ;
EXPORT void webui_multi_access ( webui_window_t * win , bool status ) ;
WebUI v2.0.7
* Switch from GPL to LGPL
* Deno example is ready
* Adding `void _webui_free_all_mem()` to release all dynamic mem at exit
* Break Change `void webui_script_interface(webui_window_t* win, const char* script, unsigned int timeout, bool* error, unsigned int* length, char* data)` to `void webui_script_interface(webui_window_t* win, const char* script, unsigned int timeout, bool* error, unsigned int* length, char** data)`
* Updating readme
* Moving Zig build file into build folder
More code cleaning and more examples is needed before we release the version 2.0.7.
2023-03-22 01:47:19 +03:00
EXPORT void webui_clean_mem ( void * p ) ;
2022-09-25 02:35:56 +03:00
2022-10-20 02:48:47 +03:00
// -- Interface -----------------------
2022-10-30 04:41:20 +03:00
// Used by other languages to create WebUI wrappers
typedef struct webui_script_interface_t {
2022-10-20 02:48:47 +03:00
char * script ;
unsigned int timeout ;
bool error ;
unsigned int length ;
const char * data ;
2022-10-30 04:41:20 +03:00
} webui_script_interface_t ;
2022-12-12 18:13:27 +03:00
EXPORT unsigned int webui_bind_interface ( webui_window_t * win , const char * element , void ( * func ) ( unsigned int , unsigned int , char * , webui_window_t * , char * , char * * ) ) ;
WebUI v2.0.7
* Switch from GPL to LGPL
* Deno example is ready
* Adding `void _webui_free_all_mem()` to release all dynamic mem at exit
* Break Change `void webui_script_interface(webui_window_t* win, const char* script, unsigned int timeout, bool* error, unsigned int* length, char* data)` to `void webui_script_interface(webui_window_t* win, const char* script, unsigned int timeout, bool* error, unsigned int* length, char** data)`
* Updating readme
* Moving Zig build file into build folder
More code cleaning and more examples is needed before we release the version 2.0.7.
2023-03-22 01:47:19 +03:00
EXPORT void webui_script_interface ( webui_window_t * win , const char * script , unsigned int timeout , bool * error , unsigned int * length , char * * data ) ;
2022-10-30 04:41:20 +03:00
EXPORT void webui_script_interface_struct ( webui_window_t * win , webui_script_interface_t * js_int ) ;
2022-09-25 02:35:56 +03:00
// Core
2023-04-04 18:28:13 +03:00
EXPORT void _webui_init ( void ) ;
2022-11-22 02:07:46 +03:00
EXPORT unsigned int _webui_get_cb_index ( char * webui_internal_id ) ;
EXPORT unsigned int _webui_set_cb_index ( char * webui_internal_id ) ;
2023-04-04 18:28:13 +03:00
EXPORT unsigned int _webui_get_free_port ( void ) ;
EXPORT unsigned int _webui_get_new_window_number ( void ) ;
EXPORT void _webui_wait_for_startup ( void ) ;
2022-09-25 02:35:56 +03:00
EXPORT void _webui_free_port ( unsigned int port ) ;
EXPORT void _webui_set_custom_browser ( webui_custom_browser_t * p ) ;
2023-04-04 18:28:13 +03:00
EXPORT char * _webui_get_current_path ( void ) ;
2022-09-25 02:35:56 +03:00
EXPORT void _webui_window_receive ( webui_window_t * win , const char * packet , size_t len ) ;
EXPORT void _webui_window_send ( webui_window_t * win , char * packet , size_t packets_size ) ;
2023-04-01 07:05:41 +03:00
EXPORT void _webui_window_event ( webui_window_t * win , char * element_id , char * element , void * data , unsigned int data_len , int event_type ) ;
2022-10-19 07:38:54 +03:00
EXPORT unsigned int _webui_window_get_number ( webui_window_t * win ) ;
2022-09-25 02:35:56 +03:00
EXPORT void _webui_window_open ( webui_window_t * win , char * link , unsigned int browser ) ;
2022-10-21 05:21:52 +03:00
EXPORT int _webui_cmd_sync ( char * cmd , bool show ) ;
EXPORT int _webui_cmd_async ( char * cmd , bool show ) ;
2022-09-30 04:03:57 +03:00
EXPORT int _webui_run_browser ( webui_window_t * win , char * cmd ) ;
2023-04-04 18:28:13 +03:00
EXPORT void _webui_clean ( void ) ;
2022-09-25 02:35:56 +03:00
EXPORT bool _webui_browser_exist ( webui_window_t * win , unsigned int browser ) ;
2022-10-19 07:38:54 +03:00
EXPORT const char * _webui_browser_get_temp_path ( unsigned int browser ) ;
2022-09-30 04:03:57 +03:00
EXPORT bool _webui_folder_exist ( char * folder ) ;
2022-09-25 02:35:56 +03:00
EXPORT bool _webui_browser_create_profile_folder ( webui_window_t * win , unsigned int browser ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT bool _webui_browser_start_chrome ( webui_window_t * win , const char * address ) ;
2022-09-29 02:41:24 +03:00
EXPORT bool _webui_browser_start_edge ( webui_window_t * win , const char * address ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT bool _webui_browser_start_epic ( webui_window_t * win , const char * address ) ;
EXPORT bool _webui_browser_start_vivaldi ( webui_window_t * win , const char * address ) ;
EXPORT bool _webui_browser_start_brave ( webui_window_t * win , const char * address ) ;
2022-09-29 02:41:24 +03:00
EXPORT bool _webui_browser_start_firefox ( webui_window_t * win , const char * address ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT bool _webui_browser_start_yandex ( webui_window_t * win , const char * address ) ;
EXPORT bool _webui_browser_start_chromium ( webui_window_t * win , const char * address ) ;
2022-09-29 02:41:24 +03:00
EXPORT bool _webui_browser_start_custom ( webui_window_t * win , const char * address ) ;
EXPORT bool _webui_browser_start ( webui_window_t * win , const char * address , unsigned int browser ) ;
2022-10-25 05:35:05 +03:00
EXPORT long _webui_timer_diff ( struct timespec * start , struct timespec * end ) ;
EXPORT void _webui_timer_start ( webui_timer_t * t ) ;
EXPORT bool _webui_timer_is_end ( webui_timer_t * t , unsigned int ms ) ;
EXPORT void _webui_timer_clock_gettime ( struct timespec * spec ) ;
2022-11-03 04:43:48 +03:00
EXPORT bool _webui_set_root_folder ( webui_window_t * win , const char * path ) ;
EXPORT void _webui_wait_process ( webui_window_t * win , bool status ) ;
2022-11-08 07:33:03 +03:00
EXPORT const char * _webui_generate_js_bridge ( webui_window_t * win ) ;
2022-11-22 02:07:46 +03:00
EXPORT void _webui_print_hex ( const char * data , size_t len ) ;
2022-12-12 18:13:27 +03:00
EXPORT void _webui_free_mem ( void * * p ) ;
2023-03-03 23:49:34 +03:00
EXPORT bool _webui_file_exist_mg ( void * ev_data ) ;
EXPORT bool _webui_file_exist ( char * file ) ;
2023-04-04 18:28:13 +03:00
EXPORT void _webui_free_all_mem ( void ) ;
WebUI v2.1.0
#New Features
* Supporting more web browsers
* Search for web browsers in Windows Reg.
* Using the same show() function for HTML script, files, and refresh content
* Support Chrome on macOS
#Breaking code
* Switching from `webui_show(win, html, browser);` to `webui_show(win, content);`, and it's used for HTML, files, and reload the window
* Removing `webui_show_cpy()`, `webui_refresh()`, `webui_refresh_cpy()`
2023-03-29 06:00:09 +03:00
EXPORT bool _webui_show_window ( webui_window_t * win , const char * html , unsigned int browser ) ;
2023-04-01 07:05:41 +03:00
EXPORT char * _webui_generate_internal_id ( webui_window_t * win , const char * element ) ;
2022-09-25 02:35:56 +03:00
# ifdef _WIN32
EXPORT DWORD WINAPI _webui_cb ( LPVOID _arg ) ;
2022-09-30 04:03:57 +03:00
EXPORT DWORD WINAPI _webui_run_browser_task ( LPVOID _arg ) ;
2022-10-21 05:21:52 +03:00
EXPORT int _webui_system_win32 ( char * cmd , bool show ) ;
2022-09-25 02:35:56 +03:00
# else
2022-10-24 03:06:15 +03:00
EXPORT void * _webui_cb ( void * _arg ) ;
EXPORT void * _webui_run_browser_task ( void * _arg ) ;
2022-09-25 02:35:56 +03:00
# endif
# endif /* _WEBUI_H */