aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2022-06-30 14:35:45 +0100
committerLibravatar GitHub <noreply@github.com>2022-06-30 13:35:45 +0000
commit13c51fdf5b9fd42a244bc1620e7e96c80a080f66 (patch)
tree739b9f24cad3f12183c974947f25a9a37c099285 /src
parentfix: don't break when when service is undefined on adding a new service (#400) (diff)
downloadferdium-app-13c51fdf5b9fd42a244bc1620e7e96c80a080f66.tar.gz
ferdium-app-13c51fdf5b9fd42a244bc1620e7e96c80a080f66.tar.zst
ferdium-app-13c51fdf5b9fd42a244bc1620e7e96c80a080f66.zip
Feature: Copy Ferdium info from the 'About' dialog into the clipboard (#402)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/environment-remote.ts26
-rw-r--r--src/i18n/locales/en-US.json1
-rw-r--r--src/index.ts6
-rw-r--r--src/lib/Menu.js57
4 files changed, 47 insertions, 43 deletions
diff --git a/src/environment-remote.ts b/src/environment-remote.ts
index 0cd5d2ce4..bb14448a3 100644
--- a/src/environment-remote.ts
+++ b/src/environment-remote.ts
@@ -1,5 +1,4 @@
1import { join } from 'path'; 1import { join } from 'path';
2import osName from 'os-name';
3import { api as electronApi } from './electron-util'; 2import { api as electronApi } from './electron-util';
4import { 3import {
5 LIVE_FERDIUM_API, 4 LIVE_FERDIUM_API,
@@ -14,16 +13,7 @@ import {
14 LOCAL_TODOS_FRONTEND_URL, 13 LOCAL_TODOS_FRONTEND_URL,
15 PRODUCTION_TODOS_FRONTEND_URL, 14 PRODUCTION_TODOS_FRONTEND_URL,
16} from './config'; 15} from './config';
17import { 16import { isWindows } from './environment';
18 chromeVersion,
19 electronVersion,
20 isWindows,
21 nodeVersion,
22 osArch,
23} from './environment';
24
25// @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations.
26import * as buildInfo from './buildInfo.json';
27 17
28export const { app } = electronApi; 18export const { app } = electronApi;
29export const ferdiumVersion: string = app.getVersion(); 19export const ferdiumVersion: string = app.getVersion();
@@ -89,17 +79,3 @@ export const API_VERSION: string = 'v1';
89export const WS_API: string = wsApi; 79export const WS_API: string = wsApi;
90export const WEBSITE: string = web; 80export const WEBSITE: string = web;
91export const TODOS_FRONTEND: string = todos; 81export const TODOS_FRONTEND: string = todos;
92
93export function aboutAppDetails(): string {
94 return [
95 `Version: ${ferdiumVersion}`,
96 `Electron: ${electronVersion}`,
97 `Chrome: ${chromeVersion}`,
98 `Node.js: ${nodeVersion}`,
99 `Platform: ${osName()}`,
100 `Arch: ${osArch}`,
101 `Build date: ${new Date(Number(buildInfo.timestamp))}`,
102 `Git SHA: ${buildInfo.gitHashShort}`,
103 `Git branch: ${buildInfo.gitBranch}`,
104 ].join('\n');
105}
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index f4871f207..1690a6067 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -115,6 +115,7 @@
115 "menu.services": "Services", 115 "menu.services": "Services",
116 "menu.services.activatePreviousService": "Activate previous service", 116 "menu.services.activatePreviousService": "Activate previous service",
117 "menu.services.addNewService": "Add New Service...", 117 "menu.services.addNewService": "Add New Service...",
118 "menu.services.copyToClipboard": "Copy to clipboard",
118 "menu.services.goHome": "Home", 119 "menu.services.goHome": "Home",
119 "menu.services.setNextServiceActive": "Activate next service", 120 "menu.services.setNextServiceActive": "Activate next service",
120 "menu.todos": "Todos", 121 "menu.todos": "Todos",
diff --git a/src/index.ts b/src/index.ts
index 0fccac6e9..786b95a69 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -26,7 +26,6 @@ import { DEFAULT_APP_SETTINGS, DEFAULT_WINDOW_OPTIONS } from './config';
26import { isMac, isWindows, isLinux, altKey } from './environment'; 26import { isMac, isWindows, isLinux, altKey } from './environment';
27import { 27import {
28 isDevMode, 28 isDevMode,
29 aboutAppDetails,
30 userDataRecipesPath, 29 userDataRecipesPath,
31 userDataPath, 30 userDataPath,
32} from './environment-remote'; 31} from './environment-remote';
@@ -166,11 +165,6 @@ if (!retrieveSettingValue('enableGPUAcceleration', false)) {
166 app.disableHardwareAcceleration(); 165 app.disableHardwareAcceleration();
167} 166}
168 167
169app.setAboutPanelOptions({
170 applicationVersion: aboutAppDetails(),
171 version: '',
172});
173
174const createWindow = () => { 168const createWindow = () => {
175 // Remember window size 169 // Remember window size
176 const mainWindowState = windowStateKeeper({ 170 const mainWindowState = windowStateKeeper({
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index d3a3163b9..7b048d3fa 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -9,6 +9,7 @@ import {
9} from '@electron/remote'; 9} from '@electron/remote';
10import { autorun, observable } from 'mobx'; 10import { autorun, observable } from 'mobx';
11import { defineMessages } from 'react-intl'; 11import { defineMessages } from 'react-intl';
12import osName from 'os-name';
12import { 13import {
13 CUSTOM_WEBSITE_RECIPE_ID, 14 CUSTOM_WEBSITE_RECIPE_ID,
14 GITHUB_FERDIUM_URL, 15 GITHUB_FERDIUM_URL,
@@ -27,8 +28,12 @@ import {
27 addNewServiceShortcutKey, 28 addNewServiceShortcutKey,
28 splitModeToggleShortcutKey, 29 splitModeToggleShortcutKey,
29 muteFerdiumShortcutKey, 30 muteFerdiumShortcutKey,
31 electronVersion,
32 chromeVersion,
33 nodeVersion,
34 osArch,
30} from '../environment'; 35} from '../environment';
31import { aboutAppDetails, ferdiumVersion } from '../environment-remote'; 36import { ferdiumVersion } from '../environment-remote';
32import { todoActions } from '../features/todos/actions'; 37import { todoActions } from '../features/todos/actions';
33import { workspaceActions } from '../features/workspaces/actions'; 38import { workspaceActions } from '../features/workspaces/actions';
34import { workspaceStore } from '../features/workspaces/index'; 39import { workspaceStore } from '../features/workspaces/index';
@@ -36,6 +41,9 @@ import apiBase, { serverBase } from '../api/apiBase';
36import { openExternalUrl } from '../helpers/url-helpers'; 41import { openExternalUrl } from '../helpers/url-helpers';
37import globalMessages from '../i18n/globalMessages'; 42import globalMessages from '../i18n/globalMessages';
38 43
44// @ts-expect-error Cannot find module '../buildInfo.json' or its corresponding type declarations.
45import * as buildInfo from '../buildInfo.json';
46
39const menuItems = defineMessages({ 47const menuItems = defineMessages({
40 edit: { 48 edit: {
41 id: 'menu.edit', 49 id: 'menu.edit',
@@ -325,6 +333,14 @@ const menuItems = defineMessages({
325 id: 'menu.services.goHome', 333 id: 'menu.services.goHome',
326 defaultMessage: 'Home', 334 defaultMessage: 'Home',
327 }, 335 },
336 ok: {
337 id: 'global.ok',
338 defaultMessage: 'Ok',
339 },
340 copyToClipboard: {
341 id: 'menu.services.copyToClipboard',
342 defaultMessage: 'Copy to clipboard',
343 },
328}); 344});
329 345
330function getActiveService() { 346function getActiveService() {
@@ -797,10 +813,6 @@ class FranzMenu {
797 accelerator: `${altKey()}+F`, 813 accelerator: `${altKey()}+F`,
798 submenu: [ 814 submenu: [
799 { 815 {
800 label: intl.formatMessage(menuItems.about),
801 role: 'about',
802 },
803 {
804 type: 'separator', 816 type: 'separator',
805 }, 817 },
806 { 818 {
@@ -856,15 +868,36 @@ class FranzMenu {
856 ], 868 ],
857 }); 869 });
858 870
871 const aboutAppDetails = [
872 `Version: ${ferdiumVersion}`,
873 `Electron: ${electronVersion}`,
874 `Chrome: ${chromeVersion}`,
875 `Node.js: ${nodeVersion}`,
876 `Platform: ${osName()}`,
877 `Arch: ${osArch}`,
878 `Build date: ${new Date(Number(buildInfo.timestamp))}`,
879 `Git SHA: ${buildInfo.gitHashShort}`,
880 `Git branch: ${buildInfo.gitBranch}`,
881 ].join('\n');
882
859 const about = { 883 const about = {
860 label: intl.formatMessage(menuItems.about), 884 label: intl.formatMessage(menuItems.about),
861 click: () => { 885 click: () => {
862 dialog.showMessageBox({ 886 dialog
863 type: 'info', 887 .showMessageBox({
864 title: 'Ferdium', 888 type: 'info',
865 message: 'Ferdium', 889 title: 'Ferdium',
866 detail: aboutAppDetails(), 890 message: 'Ferdium',
867 }); 891 detail: aboutAppDetails,
892 buttons: [intl.formatMessage(menuItems.copyToClipboard), intl.formatMessage(menuItems.ok)],
893 })
894 .then(result => {
895 if (result.response === 0) {
896 clipboard.write({
897 text: aboutAppDetails,
898 });
899 }
900 });
868 }, 901 },
869 }; 902 };
870 903
@@ -889,7 +922,7 @@ class FranzMenu {
889 }, 922 },
890 ); 923 );
891 924
892 tpl[5].submenu.unshift(about, { 925 tpl[0].submenu.unshift(about, {
893 type: 'separator', 926 type: 'separator',
894 }); 927 });
895 } else { 928 } else {