From 4666e85de5c40e4cd7fa952a1d1c873a43dc60fb Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Tue, 30 Jul 2019 15:33:29 +0200 Subject: feat(App): Add option to copy debug information via the help menu --- src/stores/AppStore.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/stores') diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index bca20a581..2ac306a2a 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js @@ -8,6 +8,9 @@ import AutoLaunch from 'auto-launch'; import prettyBytes from 'pretty-bytes'; import ms from 'ms'; import { URL } from 'url'; +import os from 'os'; +import path from 'path'; +import { readJsonSync } from 'fs-extra'; import Store from './lib/Store'; import Request from './lib/Request'; @@ -23,7 +26,7 @@ import { isValidExternalURL } from '../helpers/url-helpers'; const debug = require('debug')('Franz:AppStore'); -const { app, systemPreferences } = remote; +const { app, systemPreferences, screen } = remote; const mainWindow = remote.getCurrentWindow(); @@ -182,6 +185,26 @@ export default class AppStore extends Store { return prettyBytes(this.getAppCacheSizeRequest.execute().result || 0); } + @computed get debugInfo() { + return { + host: { + platform: process.platform, + release: os.release(), + screens: screen.getAllDisplays(), + }, + franz: { + version: app.getVersion(), + electron: process.versions.electron, + installedRecipes: this.stores.recipes.all.map(recipe => ({ id: recipe.id, version: recipe.version })), + devRecipes: this.stores.recipePreviews.dev.map(recipe => ({ id: recipe.id, version: recipe.version })), + services: this.stores.services.all.map(service => ({ id: service.id, recipe: service.recipe.id })), + workspaces: this.stores.workspaces.workspaces.map(workspace => ({ id: workspace.id, services: workspace.services })), + windowSettings: readJsonSync(path.join(app.getPath('userData'), 'window-state.json')), + user: this.stores.user.data.id, + }, + }; + } + // Actions @action _notify({ title, options, notificationId, serviceId = null, -- cgit v1.2.3-54-g00ecf