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
This commit is contained in:
Kyza 2022-12-09 10:16:01 -05:00 committed by GitHub
parent e0d1befb65
commit 4290f54981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 });
};
};