diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-04-22 15:04:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 20:04:21 +0000 |
commit | 759d93dc198a3cc8c5265245c0144efa5435682b (patch) | |
tree | 53e963a085d3d12af5a2efa2f1ab6f3e5574edc7 /src/features | |
parent | Added build scripts for linux, macos and windows to help new contributors get... (diff) | |
download | ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.gz ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.zst ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.zip |
Turn off usage of 'debug' npm package using with electron-16 (fixes #17)
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/communityRecipes/store.ts | 7 | ||||
-rw-r--r-- | src/features/serviceProxy/index.ts | 11 | ||||
-rw-r--r-- | src/features/todos/preload.ts | 7 | ||||
-rw-r--r-- | src/features/todos/store.js | 23 | ||||
-rw-r--r-- | src/features/workspaces/api.ts | 19 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 9 |
6 files changed, 41 insertions, 35 deletions
diff --git a/src/features/communityRecipes/store.ts b/src/features/communityRecipes/store.ts index 407a63860..afd7d0f01 100644 --- a/src/features/communityRecipes/store.ts +++ b/src/features/communityRecipes/store.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { computed } from 'mobx'; | 1 | import { computed } from 'mobx'; |
2 | import { FeatureStore } from '../utils/FeatureStore'; | 2 | import { FeatureStore } from '../utils/FeatureStore'; |
3 | 3 | ||
4 | const debug = require('debug')('Ferdium:feature:communityRecipes:store'); | 4 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
5 | // const debug = require('debug')('Ferdium:feature:communityRecipes:store'); | ||
5 | 6 | ||
6 | export class CommunityRecipesStore extends FeatureStore { | 7 | export class CommunityRecipesStore extends FeatureStore { |
7 | stores: any; | 8 | stores: any; |
@@ -9,13 +10,13 @@ export class CommunityRecipesStore extends FeatureStore { | |||
9 | actions: any; | 10 | actions: any; |
10 | 11 | ||
11 | start(stores: any, actions: any) { | 12 | start(stores: any, actions: any) { |
12 | debug('start'); | 13 | console.log('start'); |
13 | this.stores = stores; | 14 | this.stores = stores; |
14 | this.actions = actions; | 15 | this.actions = actions; |
15 | } | 16 | } |
16 | 17 | ||
17 | stop() { | 18 | stop() { |
18 | debug('stop'); | 19 | console.log('stop'); |
19 | super.stop(); | 20 | super.stop(); |
20 | } | 21 | } |
21 | 22 | ||
diff --git a/src/features/serviceProxy/index.ts b/src/features/serviceProxy/index.ts index bdc21e97e..b3705b190 100644 --- a/src/features/serviceProxy/index.ts +++ b/src/features/serviceProxy/index.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { autorun, observable } from 'mobx'; | 1 | import { autorun, observable } from 'mobx'; |
2 | import { session } from '@electron/remote'; | 2 | import { session } from '@electron/remote'; |
3 | 3 | ||
4 | const debug = require('debug')('Ferdium:feature:serviceProxy'); | 4 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
5 | // const debug = require('debug')('Ferdium:feature:serviceProxy'); | ||
5 | 6 | ||
6 | export const config = observable({ | 7 | export const config = observable({ |
7 | isEnabled: true, | 8 | isEnabled: true, |
@@ -11,7 +12,7 @@ export default function init(stores: { | |||
11 | services: { enabled: any }; | 12 | services: { enabled: any }; |
12 | settings: { proxy: any }; | 13 | settings: { proxy: any }; |
13 | }) { | 14 | }) { |
14 | debug('Initializing `serviceProxy` feature'); | 15 | console.log('Initializing `serviceProxy` feature'); |
15 | 16 | ||
16 | autorun(() => { | 17 | autorun(() => { |
17 | config.isEnabled = true; | 18 | config.isEnabled = true; |
@@ -19,7 +20,7 @@ export default function init(stores: { | |||
19 | const services = stores.services.enabled; | 20 | const services = stores.services.enabled; |
20 | const proxySettings = stores.settings.proxy; | 21 | const proxySettings = stores.settings.proxy; |
21 | 22 | ||
22 | debug('Service Proxy autorun'); | 23 | console.log('Service Proxy autorun'); |
23 | 24 | ||
24 | for (const service of services) { | 25 | for (const service of services) { |
25 | const s = session.fromPartition(`persist:service-${service.id}`); | 26 | const s = session.fromPartition(`persist:service-${service.id}`); |
@@ -35,14 +36,14 @@ export default function init(stores: { | |||
35 | const proxyHost = `${serviceProxyConfig.host}${ | 36 | const proxyHost = `${serviceProxyConfig.host}${ |
36 | serviceProxyConfig.port ? `:${serviceProxyConfig.port}` : '' | 37 | serviceProxyConfig.port ? `:${serviceProxyConfig.port}` : '' |
37 | }`; | 38 | }`; |
38 | debug( | 39 | console.log( |
39 | `Setting proxy config from service settings for "${service.name}" (${service.id}) to`, | 40 | `Setting proxy config from service settings for "${service.name}" (${service.id}) to`, |
40 | proxyHost, | 41 | proxyHost, |
41 | ); | 42 | ); |
42 | 43 | ||
43 | s.setProxy({ proxyRules: proxyHost }) | 44 | s.setProxy({ proxyRules: proxyHost }) |
44 | .then(() => { | 45 | .then(() => { |
45 | debug( | 46 | console.log( |
46 | `Using proxy "${proxyHost}" for "${service.name}" (${service.id})`, | 47 | `Using proxy "${proxyHost}" for "${service.name}" (${service.id})`, |
47 | ); | 48 | ); |
48 | }) | 49 | }) |
diff --git a/src/features/todos/preload.ts b/src/features/todos/preload.ts index 896d82bdf..4ccee39a0 100644 --- a/src/features/todos/preload.ts +++ b/src/features/todos/preload.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { IPC } from './constants'; | 2 | import { IPC } from './constants'; |
3 | 3 | ||
4 | const debug = require('debug')('Ferdium:feature:todos:preload'); | 4 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
5 | // const debug = require('debug')('Ferdium:feature:todos:preload'); | ||
5 | 6 | ||
6 | debug('Preloading Todos Webview'); | 7 | console.log('Preloading Todos Webview'); |
7 | 8 | ||
8 | let hostMessageListener = ({ action }) => { | 9 | let hostMessageListener = ({ action }) => { |
9 | switch (action) { | 10 | switch (action) { |
@@ -27,7 +28,7 @@ window['ferdium'] = { | |||
27 | }; | 28 | }; |
28 | 29 | ||
29 | ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => { | 30 | ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => { |
30 | debug('Received host message', event, message); | 31 | console.log('Received host message', event, message); |
31 | hostMessageListener(message); | 32 | hostMessageListener(message); |
32 | }); | 33 | }); |
33 | 34 | ||
diff --git a/src/features/todos/store.js b/src/features/todos/store.js index 90ea47c71..41e632b49 100644 --- a/src/features/todos/store.js +++ b/src/features/todos/store.js | |||
@@ -18,7 +18,8 @@ import { createActionBindings } from '../utils/ActionBinding'; | |||
18 | import { IPC, TODOS_ROUTES } from './constants'; | 18 | import { IPC, TODOS_ROUTES } from './constants'; |
19 | import UserAgent from '../../models/UserAgent'; | 19 | import UserAgent from '../../models/UserAgent'; |
20 | 20 | ||
21 | const debug = require('debug')('Ferdium:feature:todos:store'); | 21 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
22 | // const debug = require('debug')('Ferdium:feature:todos:store'); | ||
22 | 23 | ||
23 | export default class TodoStore extends FeatureStore { | 24 | export default class TodoStore extends FeatureStore { |
24 | @observable stores = null; | 25 | @observable stores = null; |
@@ -96,7 +97,7 @@ export default class TodoStore extends FeatureStore { | |||
96 | // ========== PUBLIC API ========= // | 97 | // ========== PUBLIC API ========= // |
97 | 98 | ||
98 | @action start(stores, actions) { | 99 | @action start(stores, actions) { |
99 | debug('TodoStore::start'); | 100 | console.log('TodoStore::start'); |
100 | this.stores = stores; | 101 | this.stores = stores; |
101 | this.actions = actions; | 102 | this.actions = actions; |
102 | 103 | ||
@@ -133,7 +134,7 @@ export default class TodoStore extends FeatureStore { | |||
133 | 134 | ||
134 | @action stop() { | 135 | @action stop() { |
135 | super.stop(); | 136 | super.stop(); |
136 | debug('TodoStore::stop'); | 137 | console.log('TodoStore::stop'); |
137 | this.reset(); | 138 | this.reset(); |
138 | this.isFeatureActive = false; | 139 | this.isFeatureActive = false; |
139 | } | 140 | } |
@@ -162,7 +163,7 @@ export default class TodoStore extends FeatureStore { | |||
162 | }; | 163 | }; |
163 | 164 | ||
164 | @action _setTodosWebview = ({ webview }) => { | 165 | @action _setTodosWebview = ({ webview }) => { |
165 | debug('_setTodosWebview', webview); | 166 | console.log('_setTodosWebview', webview); |
166 | if (this.webview !== webview) { | 167 | if (this.webview !== webview) { |
167 | this.webview = webview; | 168 | this.webview = webview; |
168 | this.userAgentModel.setWebviewReference(webview); | 169 | this.userAgentModel.setWebviewReference(webview); |
@@ -170,14 +171,14 @@ export default class TodoStore extends FeatureStore { | |||
170 | }; | 171 | }; |
171 | 172 | ||
172 | @action _handleHostMessage = message => { | 173 | @action _handleHostMessage = message => { |
173 | debug('_handleHostMessage', message); | 174 | console.log('_handleHostMessage', message); |
174 | if (message.action === 'todos:create') { | 175 | if (message.action === 'todos:create') { |
175 | this.webview.send(IPC.TODOS_HOST_CHANNEL, message); | 176 | this.webview.send(IPC.TODOS_HOST_CHANNEL, message); |
176 | } | 177 | } |
177 | }; | 178 | }; |
178 | 179 | ||
179 | @action _handleClientMessage = ({ channel, message = {} }) => { | 180 | @action _handleClientMessage = ({ channel, message = {} }) => { |
180 | debug('_handleClientMessage', channel, message); | 181 | console.log('_handleClientMessage', channel, message); |
181 | switch (message.action) { | 182 | switch (message.action) { |
182 | case 'todos:initialized': | 183 | case 'todos:initialized': |
183 | this._onTodosClientInitialized(); | 184 | this._onTodosClientInitialized(); |
@@ -186,7 +187,7 @@ export default class TodoStore extends FeatureStore { | |||
186 | this._goToService(message.data); | 187 | this._goToService(message.data); |
187 | break; | 188 | break; |
188 | default: | 189 | default: |
189 | debug('Other message received', channel, message); | 190 | console.log('Other message received', channel, message); |
190 | if (this.stores.services.isTodosServiceAdded) { | 191 | if (this.stores.services.isTodosServiceAdded) { |
191 | this.actions.service.handleIPCMessage({ | 192 | this.actions.service.handleIPCMessage({ |
192 | serviceId: this.stores.services.isTodosServiceAdded.id, | 193 | serviceId: this.stores.services.isTodosServiceAdded.id, |
@@ -202,7 +203,7 @@ export default class TodoStore extends FeatureStore { | |||
202 | }; | 203 | }; |
203 | 204 | ||
204 | @action _toggleTodosFeatureVisibility = () => { | 205 | @action _toggleTodosFeatureVisibility = () => { |
205 | debug('_toggleTodosFeatureVisibility'); | 206 | console.log('_toggleTodosFeatureVisibility'); |
206 | 207 | ||
207 | this._updateSettings({ | 208 | this._updateSettings({ |
208 | isFeatureEnabledByUser: !this.settings.isFeatureEnabledByUser, | 209 | isFeatureEnabledByUser: !this.settings.isFeatureEnabledByUser, |
@@ -210,14 +211,14 @@ export default class TodoStore extends FeatureStore { | |||
210 | }; | 211 | }; |
211 | 212 | ||
212 | _openDevTools = () => { | 213 | _openDevTools = () => { |
213 | debug('_openDevTools'); | 214 | console.log('_openDevTools'); |
214 | 215 | ||
215 | const webview = document.querySelector('#todos-panel webview'); | 216 | const webview = document.querySelector('#todos-panel webview'); |
216 | if (webview) webview.openDevTools(); | 217 | if (webview) webview.openDevTools(); |
217 | }; | 218 | }; |
218 | 219 | ||
219 | _reload = () => { | 220 | _reload = () => { |
220 | debug('_reload'); | 221 | console.log('_reload'); |
221 | 222 | ||
222 | const webview = document.querySelector('#todos-panel webview'); | 223 | const webview = document.querySelector('#todos-panel webview'); |
223 | if (webview) webview.reload(); | 224 | if (webview) webview.reload(); |
@@ -285,7 +286,7 @@ export default class TodoStore extends FeatureStore { | |||
285 | const { pathname } = this.stores.router.location; | 286 | const { pathname } = this.stores.router.location; |
286 | 287 | ||
287 | if (pathname === TODOS_ROUTES.TARGET) { | 288 | if (pathname === TODOS_ROUTES.TARGET) { |
288 | debug('Router is on todos route, show todos panel'); | 289 | console.log('Router is on todos route, show todos panel'); |
289 | // todosStore.start(stores, actions); | 290 | // todosStore.start(stores, actions); |
290 | this.stores.router.push('/'); | 291 | this.stores.router.push('/'); |
291 | 292 | ||
diff --git a/src/features/workspaces/api.ts b/src/features/workspaces/api.ts index 3c8cbbceb..582433527 100644 --- a/src/features/workspaces/api.ts +++ b/src/features/workspaces/api.ts | |||
@@ -4,14 +4,15 @@ import Request from '../../stores/lib/Request'; | |||
4 | import Workspace from './models/Workspace'; | 4 | import Workspace from './models/Workspace'; |
5 | import apiBase from '../../api/apiBase'; | 5 | import apiBase from '../../api/apiBase'; |
6 | 6 | ||
7 | const debug = require('debug')('Ferdium:feature:workspaces:api'); | 7 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
8 | // const debug = require('debug')('Ferdium:feature:workspaces:api'); | ||
8 | 9 | ||
9 | export const workspaceApi = { | 10 | export const workspaceApi = { |
10 | getUserWorkspaces: async () => { | 11 | getUserWorkspaces: async () => { |
11 | const url = `${apiBase()}/workspace`; | 12 | const url = `${apiBase()}/workspace`; |
12 | debug('getUserWorkspaces GET', url); | 13 | console.log('getUserWorkspaces GET', url); |
13 | const result = await sendAuthRequest(url, { method: 'GET' }); | 14 | const result = await sendAuthRequest(url, { method: 'GET' }); |
14 | debug('getUserWorkspaces RESULT', result); | 15 | console.log('getUserWorkspaces RESULT', result); |
15 | if (!result.ok) { | 16 | if (!result.ok) { |
16 | throw new Error("Couldn't getUserWorkspaces"); | 17 | throw new Error("Couldn't getUserWorkspaces"); |
17 | } | 18 | } |
@@ -25,9 +26,9 @@ export const workspaceApi = { | |||
25 | method: 'POST', | 26 | method: 'POST', |
26 | body: JSON.stringify({ name }), | 27 | body: JSON.stringify({ name }), |
27 | }; | 28 | }; |
28 | debug('createWorkspace POST', url, options); | 29 | console.log('createWorkspace POST', url, options); |
29 | const result = await sendAuthRequest(url, options); | 30 | const result = await sendAuthRequest(url, options); |
30 | debug('createWorkspace RESULT', result); | 31 | console.log('createWorkspace RESULT', result); |
31 | if (!result.ok) { | 32 | if (!result.ok) { |
32 | throw new Error("Couldn't createWorkspace"); | 33 | throw new Error("Couldn't createWorkspace"); |
33 | } | 34 | } |
@@ -36,9 +37,9 @@ export const workspaceApi = { | |||
36 | 37 | ||
37 | deleteWorkspace: async workspace => { | 38 | deleteWorkspace: async workspace => { |
38 | const url = `${apiBase()}/workspace/${workspace.id}`; | 39 | const url = `${apiBase()}/workspace/${workspace.id}`; |
39 | debug('deleteWorkspace DELETE', url); | 40 | console.log('deleteWorkspace DELETE', url); |
40 | const result = await sendAuthRequest(url, { method: 'DELETE' }); | 41 | const result = await sendAuthRequest(url, { method: 'DELETE' }); |
41 | debug('deleteWorkspace RESULT', result); | 42 | console.log('deleteWorkspace RESULT', result); |
42 | if (!result.ok) { | 43 | if (!result.ok) { |
43 | throw new Error("Couldn't deleteWorkspace"); | 44 | throw new Error("Couldn't deleteWorkspace"); |
44 | } | 45 | } |
@@ -51,9 +52,9 @@ export const workspaceApi = { | |||
51 | method: 'PUT', | 52 | method: 'PUT', |
52 | body: JSON.stringify(pick(workspace, ['name', 'services'])), | 53 | body: JSON.stringify(pick(workspace, ['name', 'services'])), |
53 | }; | 54 | }; |
54 | debug('updateWorkspace UPDATE', url, options); | 55 | console.log('updateWorkspace UPDATE', url, options); |
55 | const result = await sendAuthRequest(url, options); | 56 | const result = await sendAuthRequest(url, options); |
56 | debug('updateWorkspace RESULT', result); | 57 | console.log('updateWorkspace RESULT', result); |
57 | if (!result.ok) { | 58 | if (!result.ok) { |
58 | throw new Error("Couldn't updateWorkspace"); | 59 | throw new Error("Couldn't updateWorkspace"); |
59 | } | 60 | } |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 1f3d57c24..d2ccfeccf 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -15,7 +15,8 @@ import { createActionBindings } from '../utils/ActionBinding'; | |||
15 | 15 | ||
16 | import { KEEP_WS_LOADED_USID } from '../../config'; | 16 | import { KEEP_WS_LOADED_USID } from '../../config'; |
17 | 17 | ||
18 | const debug = require('debug')('Ferdium:feature:workspaces:store'); | 18 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
19 | // const debug = require('debug')('Ferdium:feature:workspaces:store'); | ||
19 | 20 | ||
20 | export default class WorkspacesStore extends FeatureStore { | 21 | export default class WorkspacesStore extends FeatureStore { |
21 | @observable isFeatureActive = false; | 22 | @observable isFeatureActive = false; |
@@ -69,7 +70,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
69 | // ========== PUBLIC API ========= // | 70 | // ========== PUBLIC API ========= // |
70 | 71 | ||
71 | @action start(stores, actions) { | 72 | @action start(stores, actions) { |
72 | debug('WorkspacesStore::start'); | 73 | console.log('WorkspacesStore::start'); |
73 | this.stores = stores; | 74 | this.stores = stores; |
74 | this.actions = actions; | 75 | this.actions = actions; |
75 | 76 | ||
@@ -115,7 +116,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
115 | 116 | ||
116 | @action stop() { | 117 | @action stop() { |
117 | super.stop(); | 118 | super.stop(); |
118 | debug('WorkspacesStore::stop'); | 119 | console.log('WorkspacesStore::stop'); |
119 | this.reset(); | 120 | this.reset(); |
120 | this.isFeatureActive = false; | 121 | this.isFeatureActive = false; |
121 | } | 122 | } |
@@ -273,7 +274,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
273 | }; | 274 | }; |
274 | 275 | ||
275 | _activateLastUsedWorkspaceReaction = () => { | 276 | _activateLastUsedWorkspaceReaction = () => { |
276 | debug('_activateLastUsedWorkspaceReaction'); | 277 | console.log('_activateLastUsedWorkspaceReaction'); |
277 | if (!this.activeWorkspace && this.userHasWorkspaces) { | 278 | if (!this.activeWorkspace && this.userHasWorkspaces) { |
278 | const { lastActiveWorkspace } = this.settings; | 279 | const { lastActiveWorkspace } = this.settings; |
279 | if (lastActiveWorkspace) { | 280 | if (lastActiveWorkspace) { |