mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Allow method with sessionId and use it when appropriate (*.enable)
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -121,3 +121,33 @@ pub fn getParams(
|
||||
};
|
||||
return std.json.innerParse(T, alloc, scanner, options);
|
||||
}
|
||||
|
||||
pub fn getSessionID(
|
||||
alloc: std.mem.Allocator,
|
||||
scanner: *std.json.Scanner,
|
||||
) ![]const u8 {
|
||||
var n = (try scanner.next()).string;
|
||||
if (std.mem.eql(u8, n, "params")) {
|
||||
// ignore empty params
|
||||
_ = (try scanner.next()).object_begin;
|
||||
_ = (try scanner.next()).object_end;
|
||||
n = (try scanner.next()).string;
|
||||
}
|
||||
try checkKey("sessionId", n);
|
||||
const options = std.json.ParseOptions{
|
||||
.max_value_len = scanner.input.len,
|
||||
.allocate = .alloc_if_needed,
|
||||
};
|
||||
return std.json.innerParse([]const u8, alloc, scanner, options);
|
||||
}
|
||||
|
||||
// Common
|
||||
// ------
|
||||
|
||||
pub const SessionID = "9559320D92474062597D9875C664CAC0";
|
||||
|
||||
pub const SessionIDResp = struct {
|
||||
id: u64,
|
||||
result: struct {} = .{},
|
||||
sessionId: []const u8,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user