From 4290f549815ee80a824e16ba7f785a758b5158f1 Mon Sep 17 00:00:00 2001 From: Kyza Date: Fri, 9 Dec 2022 10:16:01 -0500 Subject: [PATCH] gluon: pass env variables as variables instead of replacing them in the string (#1) * Pass env variables as variables instead of replacing them in the string * Declare as variables instead of passing --- gluon/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gluon/index.js b/gluon/index.js index e4b0b18..4ed229a 100644 --- a/gluon/index.js +++ b/gluon/index.js @@ -85,14 +85,14 @@ export const open = async (url, onLoad = () => {}) => { const toRun = `(() => { if (window.self !== window.top) return; // inside frame - (${onLoad.toString() - .replaceAll('GLUON_VERSION', process.versions.gluon) - .replaceAll('CHROMIUM_VERSION', '${navigator.userAgentData.brands.find(x => x.brand === \'Chromium\').version}') - .replaceAll('NODE_VERSION', process.versions.node)})(); + const GLUON_VERSION = ${process.versions.gluon}; + const CHROMIUM_VERSION = navigator.userAgentData.brands.find(x => x.brand === "Chromium").version; + const NODE_VERSION = ${process.versions.node}; + (${onLoad.toString()})(); })()`; run(toRun); await Page.enable(); await Page.addScriptToEvaluateOnNewDocument({ source: toRun }); -}; \ No newline at end of file +};