From fe07e99eee380d271ae09f36130e18835b651cc0 Mon Sep 17 00:00:00 2001 From: JezerM Date: Wed, 2 Feb 2022 09:22:17 -0600 Subject: [PATCH] Fix electron's handler --- ts/bridge/bridge.ts | 13 +++++++++---- ts/browser.ts | 8 ++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ts/bridge/bridge.ts b/ts/bridge/bridge.ts index 85748aa..597161c 100644 --- a/ts/bridge/bridge.ts +++ b/ts/bridge/bridge.ts @@ -524,7 +524,7 @@ export class Greeter { if (started || this.is_authenticated) reset_screensaver(); return started; } catch (err) { - console.log(err); + logger.error(err); general_error_prompt( browser.primary_window, "LightDM couldn't start session", @@ -738,14 +738,13 @@ function handler( const param = args[0]; args.shift(); if (!hasKey(accesor, param)) return (ev.returnValue = undefined); - const pr = accesor[param]; + const pr: unknown = accesor[param]; const ac = descriptors[param]; - global.lightdm["respond"]; let value = undefined; if (typeof pr === "function") { - const func: (...v: unknown[]) => unknown = Object.bind(pr, accesor); + const func: (...v: unknown[]) => unknown = pr.bind(accesor); value = func(...args); } else { if (args.length > 0 && ac && ac.set) { @@ -754,6 +753,12 @@ function handler( value = pr || undefined; } } + //console.log({ + //accesor: accesor.constructor.name, + //result: value, + //args, + //param, + //}); return (ev.returnValue = value); } diff --git a/ts/browser.ts b/ts/browser.ts index 9049033..49fba13 100644 --- a/ts/browser.ts +++ b/ts/browser.ts @@ -79,7 +79,7 @@ class Browser { const req_url = request.url; const url = new URL(req_url); const res = decodeURI(url.pathname); - //console.log({ url, res }); + //console.error("Protocol:", { url, res }); callback(res); }); } @@ -266,13 +266,17 @@ class Browser { session.defaultSession.webRequest.onBeforeRequest((details, callback) => { const url = new URL(details.url); - //console.log({ origin: details.url, url }); const block = !( url.protocol.includes("web-greeter") || url.protocol.includes("file") || url.protocol.includes("devtools") ) && nody_greeter.config.greeter.secure_mode; + //console.error("BeforeRequest:", { + //origin: details.url, + //url, + //blocked: block, + //}); callback({ cancel: block }); }); }