From 2a192b1befde325b86e8612b29ae71a2c031656c Mon Sep 17 00:00:00 2001 From: lolcat Date: Sun, 25 Oct 2026 00:26:48 -0400 Subject: [PATCH] add cookie extraction function --- ext/bg.js | 7 +++++++ server/lib/fplay.js | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ext/bg.js b/ext/bg.js index 5b305a3..29491dc 100644 --- a/ext/bg.js +++ b/ext/bg.js @@ -512,6 +512,13 @@ function attach_ws_events(ws){ send(ws, seqid, {status: false}); break; + case "get_cookies": + + var cookies = await browser.cookies.getAll(msg.filters); + + send(ws, seqid, {"cookies": cookies}); + break; + default: console.log(`ws: unhandled message "${msg.action}"`, msg); break; diff --git a/server/lib/fplay.js b/server/lib/fplay.js index d4bd5ff..3b2e2ff 100644 --- a/server/lib/fplay.js +++ b/server/lib/fplay.js @@ -442,6 +442,23 @@ fplay.container_detach_proxy = async function(ws, id){ return false; } +fplay.get_cookies = async function(ws, filters = {}){ + + if(typeof filters != "object"){ + + filters = {}; + } + + var cookies = await fplay.send(ws, "get_cookies", {filters: filters}); + + if(typeof cookies.cookies == "object"){ + + return cookies.cookies; + } + + return false; +} + // // Unsolicited event handlers