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