Skip to content

Commit 4007fab

Browse files
committed
Adding Config (multi_client, asynchronous_response)
1 parent 30b5a6a commit 4007fab

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ zig-cache
22
zig-out
33
.direnv
44
.zig-cache
5-
examples/comprehensive/examples
5+
examples/comprehensive/examples
6+
CLAUDE.md
7+
/.claude

src/c.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub extern fn webui_set_file_handler_window(
341341
pub extern fn webui_interface_set_response_file_handler(
342342
window: usize,
343343
response: *const anyopaque,
344-
length: usize,
344+
length: c_int,
345345
) callconv(.c) void;
346346

347347
/// @brief Check if the specified window is still running.
@@ -915,7 +915,7 @@ pub extern fn webui_return_bool(e: *Event, b: bool) callconv(.c) void;
915915
/// @brief Get the last WebUI error code.
916916
///
917917
/// @example int error_num = webui_get_last_error_number();
918-
pub extern fn webui_get_last_error_number() callconv(.c) c_int;
918+
pub extern fn webui_get_last_error_number() callconv(.c) usize;
919919

920920
/// @brief Get the last WebUI error message.
921921
///

src/webui.zig

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub const WebUIError = error{
4949

5050
/// webui error wrapper
5151
pub const WebUIErrorInfo = struct {
52-
num: i32,
52+
num: usize,
5353
msg: [:0]const u8,
5454
};
5555

@@ -311,7 +311,7 @@ pub fn interfaceSetResponseFileHandler(self: webui, response: []u8) void {
311311
c.webui_interface_set_response_file_handler(
312312
self.window_handle,
313313
@ptrCast(response.ptr),
314-
response.len,
314+
@intCast(response.len),
315315
);
316316
}
317317

@@ -976,11 +976,11 @@ pub const WEBUI_VERSION: std.SemanticVersion = .{
976976
.major = 2,
977977
.minor = 5,
978978
.patch = 0,
979-
.pre = "beta.2",
979+
.pre = "beta.4",
980980
};
981981

982982
/// Max windows, servers and threads
983-
pub const WEBUI_MAX_IDS = 256;
983+
pub const WEBUI_MAX_IDS = 65535;
984984

985985
/// Max allowed argument's index
986986
pub const WEBUI_MAX_ARG = 16;
@@ -1065,18 +1065,22 @@ pub const Config = enum(c_int) {
10651065
/// root folder gets changed.
10661066
/// Default: False
10671067
folder_monitor,
1068+
/// Allow multiple clients to connect to the same window,
1069+
/// This is helpful for web apps (non-desktop software),
1070+
/// Please see the documentation for more details.
1071+
/// Default: False
1072+
multi_client,
10681073
/// Allow or prevent WebUI from adding `webui_auth` cookies.
10691074
/// WebUI uses these cookies to identify clients and block
10701075
/// unauthorized access to the window content using a URL.
10711076
/// Please keep this option to `True` if you want only a single
10721077
/// client to access the window content.
10731078
/// Default: True
1074-
multi_client,
1075-
/// Allow multiple clients to connect to the same window,
1076-
/// This is helpful for web apps (non-desktop software),
1077-
/// Please see the documentation for more details.
1078-
/// Default: True
10791079
use_cookies,
1080+
/// If the backend uses asynchronous operations, set this
1081+
/// option to `True`. This will make WebUI wait until the
1082+
/// backend sets a response using `webui_return_x()`.
1083+
asynchronous_response,
10801084
};
10811085

10821086
pub const Event = extern struct {

0 commit comments

Comments
 (0)