Use http:// links when dev mode
This commit is contained in:
@@ -18,7 +18,8 @@ const appLauncher = new AutoLaunch({
|
|||||||
|
|
||||||
function backToIndex(index) {
|
function backToIndex(index) {
|
||||||
const target = typeof index === 'undefined' ? 0 : index;
|
const target = typeof index === 'undefined' ? 0 : index;
|
||||||
remote.getCurrentWindow().loadURL(`file://${__dirname}/index.html?index=${target}`);
|
const indexURL = remote.getGlobal('isDev') ? 'http://localhost:8080/browser/index.html' : `file://${__dirname}/index.html`;
|
||||||
|
remote.getCurrentWindow().loadURL(`${indexURL}?index=${target}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SettingsPage = React.createClass({
|
const SettingsPage = React.createClass({
|
||||||
|
13
src/main.js
13
src/main.js
@@ -86,6 +86,8 @@ if (argv['data-dir']) {
|
|||||||
app.setPath('userData', path.resolve(argv['data-dir']));
|
app.setPath('userData', path.resolve(argv['data-dir']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global.isDev = isDev && !argv.testMode;
|
||||||
|
|
||||||
var config = {};
|
var config = {};
|
||||||
try {
|
try {
|
||||||
const configFile = app.getPath('userData') + '/config.json';
|
const configFile = app.getPath('userData') + '/config.json';
|
||||||
@@ -481,20 +483,17 @@ app.on('ready', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
if (isDev && !argv.testMode) {
|
const indexURL = global.isDev ? 'http://localhost:8080/browser/index.html' : 'file://' + __dirname + '/browser/index.html';
|
||||||
mainWindow.loadURL('http://localhost:8080/browser/index.html');
|
mainWindow.loadURL(indexURL);
|
||||||
} else {
|
|
||||||
mainWindow.loadURL('file://' + __dirname + '/browser/index.html');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set application menu
|
// Set application menu
|
||||||
ipcMain.on('update-menu', (event, configData) => {
|
ipcMain.on('update-menu', (event, configData) => {
|
||||||
var aMenu = appMenu.createMenu(mainWindow, configData);
|
var aMenu = appMenu.createMenu(mainWindow, configData, global.isDev);
|
||||||
Menu.setApplicationMenu(aMenu);
|
Menu.setApplicationMenu(aMenu);
|
||||||
|
|
||||||
// set up context menu for tray icon
|
// set up context menu for tray icon
|
||||||
if (shouldShowTrayIcon()) {
|
if (shouldShowTrayIcon()) {
|
||||||
const tMenu = trayMenu.createMenu(mainWindow, configData);
|
const tMenu = trayMenu.createMenu(mainWindow, configData, global.isDev);
|
||||||
trayIcon.setContextMenu(tMenu);
|
trayIcon.setContextMenu(tMenu);
|
||||||
if (process.platform === 'darwin' || process.platform === 'linux') {
|
if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||||
// store the information, if the tray was initialized, for checking in the settings, if the application
|
// store the information, if the tray was initialized, for checking in the settings, if the application
|
||||||
|
@@ -3,7 +3,9 @@
|
|||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const Menu = electron.Menu;
|
const Menu = electron.Menu;
|
||||||
|
|
||||||
function createTemplate(mainWindow, config) {
|
function createTemplate(mainWindow, config, isDev) {
|
||||||
|
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : 'file://' + __dirname + '/browser/settings.html';
|
||||||
|
|
||||||
const separatorItem = {
|
const separatorItem = {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
};
|
};
|
||||||
@@ -25,7 +27,7 @@ function createTemplate(mainWindow, config) {
|
|||||||
label: 'Preferences...',
|
label: 'Preferences...',
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
click() {
|
click() {
|
||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL(settingsURL);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Sign in to Another Server',
|
label: 'Sign in to Another Server',
|
||||||
@@ -44,7 +46,7 @@ function createTemplate(mainWindow, config) {
|
|||||||
label: 'Settings...',
|
label: 'Settings...',
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
click() {
|
click() {
|
||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL(settingsURL);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Sign in to Another Server',
|
label: 'Sign in to Another Server',
|
||||||
@@ -217,8 +219,8 @@ function createTemplate(mainWindow, config) {
|
|||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMenu(mainWindow, config) {
|
function createMenu(mainWindow, config, isDev) {
|
||||||
return Menu.buildFromTemplate(createTemplate(mainWindow, config));
|
return Menu.buildFromTemplate(createTemplate(mainWindow, config, isDev));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@@ -5,7 +5,8 @@ const {
|
|||||||
Menu
|
Menu
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
|
|
||||||
function createTemplate(mainWindow, config) {
|
function createTemplate(mainWindow, config, isDev) {
|
||||||
|
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${__dirname}/browser/settings.html`;
|
||||||
var template = [
|
var template = [
|
||||||
...config.teams.slice(0, 9).map((team, i) => {
|
...config.teams.slice(0, 9).map((team, i) => {
|
||||||
return {
|
return {
|
||||||
@@ -25,7 +26,7 @@ function createTemplate(mainWindow, config) {
|
|||||||
}, {
|
}, {
|
||||||
label: process.platform === 'darwin' ? 'Preferences...' : 'Settings',
|
label: process.platform === 'darwin' ? 'Preferences...' : 'Settings',
|
||||||
click: () => {
|
click: () => {
|
||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL(settingsURL);
|
||||||
showOrRestore(mainWindow);
|
showOrRestore(mainWindow);
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
@@ -42,8 +43,8 @@ function createTemplate(mainWindow, config) {
|
|||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMenu(mainWindow, config) {
|
function createMenu(mainWindow, config, isDev) {
|
||||||
return Menu.buildFromTemplate(createTemplate(mainWindow, config));
|
return Menu.buildFromTemplate(createTemplate(mainWindow, config, isDev));
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOrRestore(window) {
|
function showOrRestore(window) {
|
||||||
|
Reference in New Issue
Block a user