diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/api/apiBase.js | 3 | ||||
-rw-r--r-- | src/config.js | 1 | ||||
-rw-r--r-- | src/electron/ipc-api/localServer.js | 3 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/ServiceController.js | 10 | ||||
-rw-r--r-- | src/internal-server/config/session.js | 2 |
5 files changed, 13 insertions, 6 deletions
diff --git a/src/api/apiBase.js b/src/api/apiBase.js index 3278dc454..db974c96f 100644 --- a/src/api/apiBase.js +++ b/src/api/apiBase.js | |||
@@ -7,6 +7,7 @@ import { | |||
7 | import { | 7 | import { |
8 | DEV_API_FRANZ_WEBSITE, | 8 | DEV_API_FRANZ_WEBSITE, |
9 | LIVE_FRANZ_API, | 9 | LIVE_FRANZ_API, |
10 | LOCAL_HOSTNAME, | ||
10 | LOCAL_SERVER, | 11 | LOCAL_SERVER, |
11 | SERVER_NOT_LOADED, | 12 | SERVER_NOT_LOADED, |
12 | } from '../config'; | 13 | } from '../config'; |
@@ -23,7 +24,7 @@ const apiBase = (withVersion = true) => { | |||
23 | } | 24 | } |
24 | if (window.ferdi.stores.settings.all.app.server === LOCAL_SERVER) { | 25 | if (window.ferdi.stores.settings.all.app.server === LOCAL_SERVER) { |
25 | // Use URL for local server | 26 | // Use URL for local server |
26 | url = `http://127.0.0.1:${window.ferdi.stores.requests.localServerPort}`; | 27 | url = `http://${LOCAL_HOSTNAME}:${window.ferdi.stores.requests.localServerPort}`; |
27 | } else { | 28 | } else { |
28 | // Load URL from store | 29 | // Load URL from store |
29 | url = window.ferdi.stores.settings.all.app.server; | 30 | url = window.ferdi.stores.settings.all.app.server; |
diff --git a/src/config.js b/src/config.js index ef3e4f962..3598fa5d5 100644 --- a/src/config.js +++ b/src/config.js | |||
@@ -4,6 +4,7 @@ import ms from 'ms'; | |||
4 | 4 | ||
5 | export const CHECK_INTERVAL = ms('1h'); // How often should we perform checks | 5 | export const CHECK_INTERVAL = ms('1h'); // How often should we perform checks |
6 | 6 | ||
7 | export const LOCAL_HOSTNAME = 'localhost'; | ||
7 | export const LOCAL_API = 'http://localhost:3000'; | 8 | export const LOCAL_API = 'http://localhost:3000'; |
8 | export const DEV_FRANZ_API = 'https://dev.franzinfra.com'; | 9 | export const DEV_FRANZ_API = 'https://dev.franzinfra.com'; |
9 | 10 | ||
diff --git a/src/electron/ipc-api/localServer.js b/src/electron/ipc-api/localServer.js index 9b800fdf6..493253e17 100644 --- a/src/electron/ipc-api/localServer.js +++ b/src/electron/ipc-api/localServer.js | |||
@@ -1,5 +1,6 @@ | |||
1 | import { ipcMain, app } from 'electron'; | 1 | import { ipcMain, app } from 'electron'; |
2 | import net from 'net'; | 2 | import net from 'net'; |
3 | import { LOCAL_HOSTNAME } from '../../config'; | ||
3 | import startServer from '../../internal-server/start'; | 4 | import startServer from '../../internal-server/start'; |
4 | 5 | ||
5 | const DEFAULT_PORT = 45569; | 6 | const DEFAULT_PORT = 45569; |
@@ -11,7 +12,7 @@ const portInUse = function (port) { | |||
11 | socket.pipe(socket); | 12 | socket.pipe(socket); |
12 | }); | 13 | }); |
13 | 14 | ||
14 | server.listen(port, '127.0.0.1'); | 15 | server.listen(port, LOCAL_HOSTNAME); |
15 | server.on('error', () => { | 16 | server.on('error', () => { |
16 | resolve(true); | 17 | resolve(true); |
17 | }); | 18 | }); |
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js index c30e9e040..e4a7f0295 100644 --- a/src/internal-server/app/Controllers/Http/ServiceController.js +++ b/src/internal-server/app/Controllers/Http/ServiceController.js | |||
@@ -5,6 +5,10 @@ const Env = use('Env'); | |||
5 | const uuid = require('uuid/v4'); | 5 | const uuid = require('uuid/v4'); |
6 | const path = require('path'); | 6 | const path = require('path'); |
7 | const fs = require('fs-extra'); | 7 | const fs = require('fs-extra'); |
8 | const { LOCAL_HOSTNAME } = require('../../../../config'); | ||
9 | |||
10 | const hostname = LOCAL_HOSTNAME; | ||
11 | const port = Env.get('PORT'); | ||
8 | 12 | ||
9 | class ServiceController { | 13 | class ServiceController { |
10 | // Create a new service for user | 14 | // Create a new service for user |
@@ -84,7 +88,7 @@ class ServiceController { | |||
84 | workspaces: [], | 88 | workspaces: [], |
85 | ...JSON.parse(service.settings), | 89 | ...JSON.parse(service.settings), |
86 | iconUrl: settings.iconId | 90 | iconUrl: settings.iconId |
87 | ? `http://127.0.0.1:${Env.get('PORT')}/v1/icon/${settings.iconId}` | 91 | ? `http://${hostname}:${port}/v1/icon/${settings.iconId}` |
88 | : null, | 92 | : null, |
89 | id: service.serviceId, | 93 | id: service.serviceId, |
90 | name: service.name, | 94 | name: service.name, |
@@ -152,7 +156,7 @@ class ServiceController { | |||
152 | id, | 156 | id, |
153 | name: service.name, | 157 | name: service.name, |
154 | ...newSettings, | 158 | ...newSettings, |
155 | iconUrl: `http://127.0.0.1:${Env.get('PORT')}/v1/icon/${ | 159 | iconUrl: `http://${hostname}:${port}/v1/icon/${ |
156 | newSettings.iconId | 160 | newSettings.iconId |
157 | }`, | 161 | }`, |
158 | userId: 1, | 162 | userId: 1, |
@@ -258,7 +262,7 @@ class ServiceController { | |||
258 | workspaces: [], | 262 | workspaces: [], |
259 | ...JSON.parse(service.settings), | 263 | ...JSON.parse(service.settings), |
260 | iconUrl: settings.iconId | 264 | iconUrl: settings.iconId |
261 | ? `http://127.0.0.1:${Env.get('PORT')}/v1/icon/${settings.iconId}` | 265 | ? `http://${hostname}:${port}/v1/icon/${settings.iconId}` |
262 | : null, | 266 | : null, |
263 | id: service.serviceId, | 267 | id: service.serviceId, |
264 | name: service.name, | 268 | name: service.name, |
diff --git a/src/internal-server/config/session.js b/src/internal-server/config/session.js index 62c4f9cc8..3ce3cc4da 100644 --- a/src/internal-server/config/session.js +++ b/src/internal-server/config/session.js | |||
@@ -88,7 +88,7 @@ module.exports = { | |||
88 | | | 88 | | |
89 | */ | 89 | */ |
90 | redis: { | 90 | redis: { |
91 | host: '127.0.0.1', | 91 | host: 'localhost', |
92 | port: 6379, | 92 | port: 6379, |
93 | password: null, | 93 | password: null, |
94 | db: 0, | 94 | db: 0, |