From 2a423a8cb3b6dd69636b0dc136e4079a0f0c03ce Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 7 Mar 2016 15:47:23 -0800 Subject: [PATCH] Use config.APP_NAME throughout --- config.js | 6 ++++++ main/config.js | 6 ------ main/menu.js | 3 ++- main/windows.js | 4 ++-- renderer/index.js | 3 ++- renderer/state.js | 4 +++- 6 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 config.js delete mode 100644 main/config.js diff --git a/config.js b/config.js new file mode 100644 index 00000000..d8e90215 --- /dev/null +++ b/config.js @@ -0,0 +1,6 @@ +var path = require('path') + +module.exports = { + APP_NAME: 'WebTorrent', + INDEX: 'file://' + path.resolve(__dirname, 'renderer', 'index.html') +} diff --git a/main/config.js b/main/config.js deleted file mode 100644 index 0f435f5f..00000000 --- a/main/config.js +++ /dev/null @@ -1,6 +0,0 @@ -var path = require('path') - -module.exports = { - APP_NAME: 'WebTorrent', - INDEX: 'file://' + path.resolve(__dirname, '..', 'renderer', 'index.html') -} diff --git a/main/menu.js b/main/menu.js index 617ba158..b7ec6743 100644 --- a/main/menu.js +++ b/main/menu.js @@ -1,3 +1,4 @@ +var config = require('../config') var debug = require('debug')('webtorrent-app:menu') var electron = require('electron') var windows = require('./windows') @@ -205,7 +206,7 @@ function getMenuTemplate () { role: 'help', submenu: [ { - label: 'Learn more about WebTorrent', + label: 'Learn more about ' + config.APP_NAME, click: function () { electron.shell.openExternal('https://webtorrent.io') } }, { diff --git a/main/windows.js b/main/windows.js index e8c0d3d9..4b7c08b9 100644 --- a/main/windows.js +++ b/main/windows.js @@ -1,6 +1,6 @@ -var electron = require('electron') +var config = require('../config') var debug = require('debug')('webtorrent-app:windows') -var config = require('./config') +var electron = require('electron') var app = electron.app diff --git a/renderer/index.js b/renderer/index.js index 4a015fff..306fc4f9 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -4,6 +4,7 @@ console.time('init') var airplay = require('airplay-js') var cfg = require('application-config')('WebTorrent') var chromecasts = require('chromecasts')() +var config = require('../config') var createTorrent = require('create-torrent') var dragDrop = require('drag-drop') var electron = require('electron') @@ -410,7 +411,7 @@ function deleteTorrent (torrent) { function openChromecast (torrent) { startServer(torrent, function () { state.devices.chromecast.play(state.server.networkURL, { - title: 'WebTorrent — ' + torrent.name + title: config.APP_NAME + ' — ' + torrent.name }) state.devices.chromecast.on('error', function (err) { err.message = 'Chromecast: ' + err.message diff --git a/renderer/state.js b/renderer/state.js index 0c8e6b3e..e5830e4b 100644 --- a/renderer/state.js +++ b/renderer/state.js @@ -1,3 +1,5 @@ +var config = require('../config') + module.exports = { /* Temporary state disappears once the program exits. * It can contain complex objects like open connections, etc. @@ -19,7 +21,7 @@ module.exports = { isFocused: true, isFullScreen: false, mainWindowBounds: null, /* x y width height */ - title: 'WebTorrent', /* current window title */ + title: config.APP_NAME, /* current window title */ video: { isPaused: false, currentTime: 0, /* seconds */