From d8cf813f0d04d13f426242c4890e9198a1119340 Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Wed, 12 Apr 2023 00:40:10 +0100 Subject: [PATCH] menus/about: initial add --- src/index.js | 4 +- src/menus/about.js | 131 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 src/menus/about.js diff --git a/src/index.js b/src/index.js index d9ba056..b4887ff 100644 --- a/src/index.js +++ b/src/index.js @@ -104,4 +104,6 @@ export const open = async (url, opts = {}) => { export const extensions = { add: ExtensionsAPI.add, remove: ExtensionsAPI.remove -}; \ No newline at end of file +}; + +export { default as openAbout } from "./menus/about.js"; \ No newline at end of file diff --git a/src/menus/about.js b/src/menus/about.js new file mode 100644 index 0000000..10fb5ce --- /dev/null +++ b/src/menus/about.js @@ -0,0 +1,131 @@ +import { open } from '../index.js'; + +export default async ({ name, icon = '', version = '', description = '', links = [], gluonVersions } = {}) => { + const html = ` +${name} + +
+ +
+ ${name} + ${version} +
+
+${description} +${gluonVersions ? `
+ Powered by +
+
+ + ${process.versions.gluon.split('-')[0]} +
+
+ + ${process.versions.node} +
+
+ + ${gluonVersions.product.version.split('.')[0]} +
+
+
` : ''} + +`; + + const url = 'data:text/html;base64,' + Buffer.from(html).toString('base64'); + open(url, { + windowSize: [ 420 + (name.length * 8), 340 + (36 * links.length) ], + incognito: true + }); +}; \ No newline at end of file