mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
Add target.setDiscoverTargets
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -8,6 +8,7 @@ const getMsg = cdp.getMsg;
|
|||||||
const stringify = cdp.stringify;
|
const stringify = cdp.stringify;
|
||||||
|
|
||||||
const TargetMethods = enum {
|
const TargetMethods = enum {
|
||||||
|
setDiscoverTargets,
|
||||||
setAutoAttach,
|
setAutoAttach,
|
||||||
getTargetInfo,
|
getTargetInfo,
|
||||||
getBrowserContexts,
|
getBrowserContexts,
|
||||||
@@ -25,6 +26,7 @@ pub fn target(
|
|||||||
const method = std.meta.stringToEnum(TargetMethods, action) orelse
|
const method = std.meta.stringToEnum(TargetMethods, action) orelse
|
||||||
return error.UnknownMethod;
|
return error.UnknownMethod;
|
||||||
return switch (method) {
|
return switch (method) {
|
||||||
|
.setDiscoverTargets => targetSetDiscoverTargets(alloc, id, scanner, ctx),
|
||||||
.setAutoAttach => tagetSetAutoAttach(alloc, id, scanner, ctx),
|
.setAutoAttach => tagetSetAutoAttach(alloc, id, scanner, ctx),
|
||||||
.getTargetInfo => tagetGetTargetInfo(alloc, id, scanner, ctx),
|
.getTargetInfo => tagetGetTargetInfo(alloc, id, scanner, ctx),
|
||||||
.getBrowserContexts => getBrowserContexts(alloc, id, scanner, ctx),
|
.getBrowserContexts => getBrowserContexts(alloc, id, scanner, ctx),
|
||||||
@@ -37,6 +39,17 @@ const PageTargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
|
|||||||
const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c";
|
const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c";
|
||||||
const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9";
|
const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9";
|
||||||
|
|
||||||
|
fn targetSetDiscoverTargets(
|
||||||
|
alloc: std.mem.Allocator,
|
||||||
|
id: ?u16,
|
||||||
|
scanner: *std.json.Scanner,
|
||||||
|
_: *Ctx,
|
||||||
|
) ![]const u8 {
|
||||||
|
const msg = try getMsg(alloc, void, scanner);
|
||||||
|
|
||||||
|
return result(alloc, id orelse msg.id.?, null, null, msg.sessionID);
|
||||||
|
}
|
||||||
|
|
||||||
const AttachToTarget = struct {
|
const AttachToTarget = struct {
|
||||||
sessionId: []const u8,
|
sessionId: []const u8,
|
||||||
targetInfo: struct {
|
targetInfo: struct {
|
||||||
@@ -52,8 +65,8 @@ const AttachToTarget = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const TargetFilter = struct {
|
const TargetFilter = struct {
|
||||||
type: []const u8,
|
type: ?[]const u8 = null,
|
||||||
exclude: bool,
|
exclude: ?bool = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn tagetSetAutoAttach(
|
fn tagetSetAutoAttach(
|
||||||
|
|||||||
Reference in New Issue
Block a user