2022-09-25 02:35:56 +03:00
|
|
|
/*
|
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
|
|
|
WebUI Library 2.0.7
|
2022-09-25 02:35:56 +03:00
|
|
|
|
|
|
|
http://webui.me
|
|
|
|
https://github.com/alifcommunity/webui
|
|
|
|
|
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
|
|
|
Licensed under GNU Lesser General Public License v2.1.
|
|
|
|
Copyright (C)2023 Hassan DRAGA <https://github.com/hassandraga> - 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
|
|
|
|
|
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
|
|
|
#define WEBUI_VERSION "2.0.7" // 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
|
|
|
|
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>
|
|
|
|
#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;
|
|
|
|
bool is_bind_all;
|
|
|
|
char* url;
|
2022-11-08 07:33:03 +03:00
|
|
|
void (*cb_all[1])(struct webui_event_t* e);
|
2022-09-25 02:35:56 +03:00
|
|
|
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;
|
|
|
|
#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;
|
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;
|
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
|
|
|
|
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**);
|
|
|
|
void (*cb_interface_all[1])(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;
|
2022-10-30 04:41:20 +03:00
|
|
|
EXPORT void webui_wait();
|
2022-09-25 02:35:56 +03:00
|
|
|
EXPORT void webui_exit();
|
2022-10-30 04:41:20 +03:00
|
|
|
EXPORT bool webui_is_any_window_running();
|
|
|
|
EXPORT bool webui_is_app_running();
|
2022-09-25 02:35:56 +03:00
|
|
|
EXPORT void webui_set_timeout(unsigned int second);
|
|
|
|
EXPORT webui_window_t* webui_new_window();
|
|
|
|
EXPORT bool webui_show(webui_window_t* win, const char* html, unsigned int browser);
|
2022-10-30 04:41:20 +03:00
|
|
|
EXPORT bool webui_show_cpy(webui_window_t* win, const char* html, unsigned int browser);
|
2022-11-08 07:33:03 +03:00
|
|
|
EXPORT bool webui_refresh(webui_window_t* win, const char* html);
|
|
|
|
EXPORT bool webui_refresh_cpy(webui_window_t* win, const char* html);
|
2022-09-25 02:35:56 +03:00
|
|
|
EXPORT void webui_set_icon(webui_window_t* win, const char* icon_s, const char* type_s);
|
2022-11-03 04:43:48 +03:00
|
|
|
EXPORT void webui_multi_access(webui_window_t* win, bool status);
|
|
|
|
EXPORT const char* webui_new_server(webui_window_t* win, const char* path);
|
2022-09-25 02:35:56 +03:00
|
|
|
EXPORT void webui_close(webui_window_t* win);
|
2022-11-03 04:43:48 +03:00
|
|
|
EXPORT bool webui_is_shown(webui_window_t* win);
|
2022-10-30 04:41:20 +03:00
|
|
|
EXPORT void webui_script(webui_window_t* win, webui_script_t* script);
|
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));
|
|
|
|
EXPORT void webui_bind_all(webui_window_t* win, void (*func)(webui_event_t* e));
|
2022-09-29 02:41:24 +03:00
|
|
|
EXPORT bool webui_open(webui_window_t* win, const char* url, unsigned int browser);
|
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);
|
2022-11-28 19:04:45 +03:00
|
|
|
EXPORT int webui_get_int(webui_event_t* e);
|
|
|
|
EXPORT const char* webui_get_string(webui_event_t* e);
|
|
|
|
EXPORT bool webui_get_bool(webui_event_t* e);
|
|
|
|
EXPORT void webui_return_int(webui_event_t* e, int n);
|
|
|
|
EXPORT void webui_return_string(webui_event_t* e, char* s);
|
|
|
|
EXPORT void webui_return_bool(webui_event_t* e, bool b);
|
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
|
2022-11-08 07:33:03 +03:00
|
|
|
EXPORT void _webui_init();
|
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);
|
2022-09-25 02:35:56 +03:00
|
|
|
EXPORT unsigned int _webui_get_free_port();
|
|
|
|
EXPORT unsigned int _webui_get_new_window_number();
|
|
|
|
EXPORT void _webui_wait_for_startup();
|
|
|
|
EXPORT void _webui_free_port(unsigned int port);
|
|
|
|
EXPORT void _webui_set_custom_browser(webui_custom_browser_t* p);
|
|
|
|
EXPORT char* _webui_get_current_path();
|
|
|
|
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);
|
2022-11-22 02:07:46 +03:00
|
|
|
EXPORT void _webui_window_event(webui_window_t* win, char* element_id, char* element, void* data, unsigned int data_len);
|
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);
|
2022-11-12 01:19:37 +03:00
|
|
|
EXPORT void _webui_clean();
|
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);
|
2022-09-29 02:41:24 +03:00
|
|
|
EXPORT bool _webui_browser_start_edge(webui_window_t* win, const char* address);
|
|
|
|
EXPORT bool _webui_browser_start_firefox(webui_window_t* win, const char* address);
|
|
|
|
EXPORT bool _webui_browser_start_custom(webui_window_t* win, const char* address);
|
|
|
|
EXPORT bool _webui_browser_start_chrome(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);
|
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_free_all_mem();
|
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 */
|