diff options
-rw-r--r-- | .babelrc | 25 | ||||
-rw-r--r-- | src/config.js | 2 | ||||
-rw-r--r-- | src/electron/ipc-api/autoUpdate.js | 1 | ||||
-rw-r--r-- | src/features/serviceProxy/index.js | 14 | ||||
-rw-r--r-- | src/index.js | 2 | ||||
-rw-r--r-- | src/webview/contextMenu.js | 59 |
6 files changed, 83 insertions, 20 deletions
@@ -1,14 +1,31 @@ | |||
1 | { | 1 | { |
2 | "presets": [ | 2 | "presets": [ |
3 | "@babel/env", | 3 | [ |
4 | "@babel/preset-env", | ||
5 | { | ||
6 | "targets": { | ||
7 | "electron": 2 | ||
8 | } | ||
9 | } | ||
10 | ], | ||
4 | "@babel/react" | 11 | "@babel/react" |
5 | ], | 12 | ], |
6 | "plugins": [ | 13 | "plugins": [ |
7 | ["@babel/plugin-proposal-decorators", { "legacy": true }], | 14 | [ |
15 | "@babel/plugin-proposal-decorators", | ||
16 | { | ||
17 | "legacy": true | ||
18 | } | ||
19 | ], | ||
8 | "@babel/proposal-export-default-from", | 20 | "@babel/proposal-export-default-from", |
9 | ["@babel/proposal-class-properties", { "loose": true }], | 21 | [ |
22 | "@babel/proposal-class-properties", | ||
23 | { | ||
24 | "loose": true | ||
25 | } | ||
26 | ], | ||
10 | "@babel/proposal-throw-expressions", | 27 | "@babel/proposal-throw-expressions", |
11 | "@babel/syntax-dynamic-import" | 28 | "@babel/syntax-dynamic-import" |
12 | ], | 29 | ], |
13 | "sourceMaps": "inline" | 30 | "sourceMaps": "inline" |
14 | } | 31 | } \ No newline at end of file |
diff --git a/src/config.js b/src/config.js index c612d1e2b..ba3af14b9 100644 --- a/src/config.js +++ b/src/config.js | |||
@@ -39,7 +39,7 @@ export const DEFAULT_FEATURES_CONFIG = { | |||
39 | isServiceProxyPremiumFeature: true, | 39 | isServiceProxyPremiumFeature: true, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | export const FRANZ_SERVICE_REQUEST = 'hhttp://bit.ly/franz-plugin-docs'; | 42 | export const FRANZ_SERVICE_REQUEST = 'https://bit.ly/franz-plugin-docs'; |
43 | export const FRANZ_TRANSLATION = 'https://bit.ly/franz-translate'; | 43 | export const FRANZ_TRANSLATION = 'https://bit.ly/franz-translate'; |
44 | 44 | ||
45 | export const FILE_SYSTEM_SETTINGS_TYPES = [ | 45 | export const FILE_SYSTEM_SETTINGS_TYPES = [ |
diff --git a/src/electron/ipc-api/autoUpdate.js b/src/electron/ipc-api/autoUpdate.js index 9ccc89ea2..83dd83712 100644 --- a/src/electron/ipc-api/autoUpdate.js +++ b/src/electron/ipc-api/autoUpdate.js | |||
@@ -7,6 +7,7 @@ export default (params) => { | |||
7 | if (process.platform === 'darwin' || process.platform === 'win32') { | 7 | if (process.platform === 'darwin' || process.platform === 'win32') { |
8 | ipcMain.on('autoUpdate', (event, args) => { | 8 | ipcMain.on('autoUpdate', (event, args) => { |
9 | try { | 9 | try { |
10 | autoUpdater.autoInstallOnAppQuit = false; | ||
10 | autoUpdater.allowPrerelease = Boolean(params.settings.app.get('beta')); | 11 | autoUpdater.allowPrerelease = Boolean(params.settings.app.get('beta')); |
11 | if (args.action === 'check') { | 12 | if (args.action === 'check') { |
12 | autoUpdater.checkForUpdates(); | 13 | autoUpdater.checkForUpdates(); |
diff --git a/src/features/serviceProxy/index.js b/src/features/serviceProxy/index.js index cad9844fd..ee0b4e79c 100644 --- a/src/features/serviceProxy/index.js +++ b/src/features/serviceProxy/index.js | |||
@@ -21,24 +21,24 @@ export default function init(stores) { | |||
21 | config.isEnabled = isServiceProxyEnabled !== undefined ? isServiceProxyEnabled : DEFAULT_FEATURES_CONFIG.isServiceProxyEnabled; | 21 | config.isEnabled = isServiceProxyEnabled !== undefined ? isServiceProxyEnabled : DEFAULT_FEATURES_CONFIG.isServiceProxyEnabled; |
22 | config.isPremium = isServiceProxyPremiumFeature !== undefined ? isServiceProxyPremiumFeature : DEFAULT_FEATURES_CONFIG.isServiceProxyPremiumFeature; | 22 | config.isPremium = isServiceProxyPremiumFeature !== undefined ? isServiceProxyPremiumFeature : DEFAULT_FEATURES_CONFIG.isServiceProxyPremiumFeature; |
23 | 23 | ||
24 | const services = stores.services.all; | 24 | const services = stores.services.enabled; |
25 | const isPremiumUser = stores.user.data.isPremium; | 25 | const isPremiumUser = stores.user.data.isPremium; |
26 | 26 | ||
27 | services.forEach((service) => { | 27 | services.forEach((service) => { |
28 | const s = session.fromPartition(`persist:service-${service.id}`); | 28 | const s = session.fromPartition(`persist:service-${service.id}`); |
29 | let proxyHost = 'direct://'; | ||
30 | 29 | ||
31 | if (config.isEnabled && (isPremiumUser || !config.isPremium)) { | 30 | if (config.isEnabled && (isPremiumUser || !config.isPremium)) { |
32 | const serviceProxyConfig = stores.settings.proxy[service.id]; | 31 | const serviceProxyConfig = stores.settings.proxy[service.id]; |
33 | 32 | ||
34 | if (serviceProxyConfig && serviceProxyConfig.isEnabled && serviceProxyConfig.host) { | 33 | if (serviceProxyConfig && serviceProxyConfig.isEnabled && serviceProxyConfig.host) { |
35 | proxyHost = serviceProxyConfig.host; | 34 | const proxyHost = serviceProxyConfig.host; |
35 | debug(`Setting proxy config from service settings for "${service.name}" (${service.id}) to`, proxyHost); | ||
36 | |||
37 | s.setProxy({ proxyRules: proxyHost }, () => { | ||
38 | debug(`Using proxy "${proxyHost}" for "${service.name}" (${service.id})`); | ||
39 | }); | ||
36 | } | 40 | } |
37 | } | 41 | } |
38 | |||
39 | s.setProxy({ proxyRules: proxyHost }, (e) => { | ||
40 | debug(`Using proxy "${proxyHost}" for "${service.name}" (${service.id})`, e); | ||
41 | }); | ||
42 | }); | 42 | }); |
43 | }); | 43 | }); |
44 | } | 44 | } |
diff --git a/src/index.js b/src/index.js index 663f81cc9..37c553840 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -115,7 +115,7 @@ const createWindow = () => { | |||
115 | mainWindow.loadURL(`file://${__dirname}/index.html`); | 115 | mainWindow.loadURL(`file://${__dirname}/index.html`); |
116 | 116 | ||
117 | // Open the DevTools. | 117 | // Open the DevTools. |
118 | if (isDevMode) { | 118 | if (isDevMode || process.argv.includes('--devtools')) { |
119 | mainWindow.webContents.openDevTools(); | 119 | mainWindow.webContents.openDevTools(); |
120 | } | 120 | } |
121 | 121 | ||
diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js index 195306fda..ad156128c 100644 --- a/src/webview/contextMenu.js +++ b/src/webview/contextMenu.js | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | import { clipboard, remote, ipcRenderer, shell } from 'electron'; | 4 | import { clipboard, remote, ipcRenderer, shell } from 'electron'; |
5 | 5 | ||
6 | import { isDevMode } from '../environment'; | 6 | import { isDevMode, isMac } from '../environment'; |
7 | 7 | ||
8 | const debug = require('debug')('Franz:contextMenu'); | 8 | const debug = require('debug')('Franz:contextMenu'); |
9 | 9 | ||
@@ -23,19 +23,31 @@ function delUnusedElements(menuTpl) { | |||
23 | 23 | ||
24 | const buildMenuTpl = (props, suggestions) => { | 24 | const buildMenuTpl = (props, suggestions) => { |
25 | const { editFlags } = props; | 25 | const { editFlags } = props; |
26 | const hasText = props.selectionText.trim().length > 0; | 26 | const textSelection = props.selectionText.trim(); |
27 | const hasText = textSelection.length > 0; | ||
27 | const can = type => editFlags[`can${type}`] && hasText; | 28 | const can = type => editFlags[`can${type}`] && hasText; |
28 | 29 | ||
29 | console.log(props); | 30 | const canGoBack = webContents.canGoBack(); |
31 | const canGoForward = webContents.canGoForward(); | ||
30 | 32 | ||
31 | let menuTpl = [ | 33 | let menuTpl = [ |
32 | { | 34 | { |
33 | type: 'separator', | 35 | type: 'separator', |
34 | }, { | 36 | }, { |
37 | id: 'lookup', | ||
38 | label: `Look Up "${textSelection.length > 15 ? `${textSelection.slice(0, 15)}...` : textSelection}"`, | ||
39 | visible: isMac && props.mediaType === 'none' && hasText, | ||
40 | click() { | ||
41 | debug('Show definition for selection', textSelection); | ||
42 | webContents.showDefinitionForSelection(); | ||
43 | }, | ||
44 | }, { | ||
45 | type: 'separator', | ||
46 | }, { | ||
35 | id: 'cut', | 47 | id: 'cut', |
36 | role: can('Cut') ? 'cut' : '', | 48 | role: can('Cut') ? 'cut' : '', |
37 | enabled: can('Cut'), | 49 | enabled: can('Cut'), |
38 | visible: !!props.selectionText.trim(), | 50 | visible: hasText && props.isEditable, |
39 | }, { | 51 | }, { |
40 | id: 'copy', | 52 | id: 'copy', |
41 | label: 'Copy', | 53 | label: 'Copy', |
@@ -50,6 +62,18 @@ const buildMenuTpl = (props, suggestions) => { | |||
50 | visible: props.isEditable, | 62 | visible: props.isEditable, |
51 | }, { | 63 | }, { |
52 | type: 'separator', | 64 | type: 'separator', |
65 | visible: props.isEditable && hasText, | ||
66 | }, { | ||
67 | id: 'searchTextSelection', | ||
68 | label: `Search Google for "${textSelection.length > 15 ? `${textSelection.slice(0, 15)}...` : textSelection}"`, | ||
69 | visible: hasText, | ||
70 | click() { | ||
71 | const url = `https://www.google.com/search?q=${textSelection}`; | ||
72 | debug('Search on Google', url); | ||
73 | shell.openExternal(url); | ||
74 | }, | ||
75 | }, { | ||
76 | type: 'separator', | ||
53 | }, | 77 | }, |
54 | ]; | 78 | ]; |
55 | 79 | ||
@@ -60,6 +84,7 @@ const buildMenuTpl = (props, suggestions) => { | |||
60 | id: 'openLink', | 84 | id: 'openLink', |
61 | label: 'Open Link in Browser', | 85 | label: 'Open Link in Browser', |
62 | click() { | 86 | click() { |
87 | debug('Open link in Browser', props.linkURL); | ||
63 | shell.openExternal(props.linkURL); | 88 | shell.openExternal(props.linkURL); |
64 | }, | 89 | }, |
65 | }, { | 90 | }, { |
@@ -83,6 +108,7 @@ const buildMenuTpl = (props, suggestions) => { | |||
83 | id: 'openImage', | 108 | id: 'openImage', |
84 | label: 'Open Image in Browser', | 109 | label: 'Open Image in Browser', |
85 | click() { | 110 | click() { |
111 | debug('Open image in Browser', props.srcURL); | ||
86 | shell.openExternal(props.srcURL); | 112 | shell.openExternal(props.srcURL); |
87 | }, | 113 | }, |
88 | }, { | 114 | }, { |
@@ -132,7 +158,6 @@ const buildMenuTpl = (props, suggestions) => { | |||
132 | }); | 158 | }); |
133 | } | 159 | } |
134 | 160 | ||
135 | console.log('suggestions', suggestions.length, suggestions); | ||
136 | if (suggestions.length > 0) { | 161 | if (suggestions.length > 0) { |
137 | suggestions.reverse().map(suggestion => menuTpl.unshift({ | 162 | suggestions.reverse().map(suggestion => menuTpl.unshift({ |
138 | id: `suggestion-${suggestion}`, | 163 | id: `suggestion-${suggestion}`, |
@@ -143,6 +168,28 @@ const buildMenuTpl = (props, suggestions) => { | |||
143 | })); | 168 | })); |
144 | } | 169 | } |
145 | 170 | ||
171 | if (canGoBack || canGoForward) { | ||
172 | menuTpl.push({ | ||
173 | type: 'separator', | ||
174 | }, { | ||
175 | id: 'goBack', | ||
176 | label: 'Go Back', | ||
177 | enabled: canGoBack, | ||
178 | click() { | ||
179 | webContents.goBack(); | ||
180 | }, | ||
181 | }, { | ||
182 | id: 'goForward', | ||
183 | label: 'Go Forward', | ||
184 | enabled: canGoForward, | ||
185 | click() { | ||
186 | webContents.goForward(); | ||
187 | }, | ||
188 | }, { | ||
189 | type: 'separator', | ||
190 | }); | ||
191 | } | ||
192 | |||
146 | if (isDevMode) { | 193 | if (isDevMode) { |
147 | menuTpl.push({ | 194 | menuTpl.push({ |
148 | type: 'separator', | 195 | type: 'separator', |
@@ -152,8 +199,6 @@ const buildMenuTpl = (props, suggestions) => { | |||
152 | click() { | 199 | click() { |
153 | webContents.inspectElement(props.x, props.y); | 200 | webContents.inspectElement(props.x, props.y); |
154 | }, | 201 | }, |
155 | }, { | ||
156 | type: 'separator', | ||
157 | }); | 202 | }); |
158 | } | 203 | } |
159 | 204 | ||