diff --git a/app/aboutDialog.js b/app/aboutDialog.js deleted file mode 100644 index 49899b683f5..00000000000 --- a/app/aboutDialog.js +++ /dev/null @@ -1,55 +0,0 @@ -const electron = require('electron') -const app = require('electron').app -const dialog = electron.dialog -const Channel = require('./channel') -const path = require('path') -const locale = require('./locale') - -module.exports.showAbout = function () { - // The timeout is in case there's a call just after the modal to hide the menu. - // showMessageBox is a modal and blocks everything otherwise, so menu would remain open - // while the dialog is displayed. - setTimeout(() => { - dialog.showMessageBox({ - title: 'Brave', - message: `Brave: ${app.getVersion()} -Electron: ${process.versions['atom-shell']} -libchromiumcontent: ${process.versions['chrome']} -V8: ${process.versions.v8} -Node.js: ${process.versions.node} -${locale.translation('updateChannel')}: ${Channel.channel()} - -${locale.translation('licenseText')}`, - icon: path.join(__dirname, '..', 'app', 'extensions', 'brave', 'img', 'braveAbout.png'), - buttons: [locale.translation('licenseTextOk')] - }) - }, 50) -} - -module.exports.showImportWarning = function () { - // The timeout is in case there's a call just after the modal to hide the menu. - // showMessageBox is a modal and blocks everything otherwise, so menu would remain open - // while the dialog is displayed. - setTimeout(() => { - dialog.showMessageBox({ - title: 'Brave', - message: `${locale.translation('closeFirefoxWarning')}`, - icon: path.join(__dirname, '..', 'app', 'extensions', 'brave', 'img', 'braveAbout.png'), - buttons: [locale.translation('closeFirefoxWarningOk')] - }) - }, 50) -} - -module.exports.showImportSuccess = function () { - // The timeout is in case there's a call just after the modal to hide the menu. - // showMessageBox is a modal and blocks everything otherwise, so menu would remain open - // while the dialog is displayed. - setTimeout(() => { - dialog.showMessageBox({ - title: 'Brave', - message: `${locale.translation('importSuccess')}`, - icon: path.join(__dirname, '..', 'app', 'extensions', 'brave', 'img', 'braveAbout.png'), - buttons: [locale.translation('importSuccessOk')] - }) - }, 50) -} diff --git a/app/common/commonMenu.js b/app/common/commonMenu.js index 2b745345d89..686216e2cf4 100644 --- a/app/common/commonMenu.js +++ b/app/common/commonMenu.js @@ -301,11 +301,7 @@ module.exports.aboutBraveMenuItem = () => { return { label: locale.translation('aboutApp'), click: (item, focusedWindow) => { - if (process.type === 'browser') { - process.emit(messages.SHOW_ABOUT) - } else { - electron.ipcRenderer.send(messages.SHOW_ABOUT) - } + module.exports.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_NEW_FRAME, 'about:brave', { singleFrame: true }]) } } } diff --git a/app/extensions/brave/about-brave.html b/app/extensions/brave/about-brave.html new file mode 100644 index 00000000000..e119160607e --- /dev/null +++ b/app/extensions/brave/about-brave.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + +
+ + diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index abbd70bbaa9..f86c4900f07 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -14,6 +14,8 @@ cancel=Cancel submit=Submit settings=Settings aboutPages=About pages +aboutBrave=About Brave +versionInformation=Version Information listOfAboutPages=List of about pages history=History settingName=Setting name diff --git a/app/importer.js b/app/importer.js index 73cda669e53..ad937d1c90b 100644 --- a/app/importer.js +++ b/app/importer.js @@ -10,7 +10,6 @@ const dialog = electron.dialog const BrowserWindow = electron.BrowserWindow const session = electron.session const Immutable = require('immutable') -const {showImportWarning, showImportSuccess} = require('./aboutDialog') const siteUtil = require('../js/state/siteUtil') const AppStore = require('../js/stores/appStore') const siteTags = require('../js/constants/siteTags') @@ -18,6 +17,8 @@ const appActions = require('../js/actions/appActions') const messages = require('../js/constants/messages') const settings = require('../js/constants/settings') const getSetting = require('../js/settings').getSetting +const path = require('path') +const locale = require('./locale') var isMergeFavorites = false var isImportingBookmarks = false @@ -225,6 +226,34 @@ importer.on('add-cookies', (e, cookies) => { } }) +const showImportWarning = function () { + // The timeout is in case there's a call just after the modal to hide the menu. + // showMessageBox is a modal and blocks everything otherwise, so menu would remain open + // while the dialog is displayed. + setTimeout(() => { + dialog.showMessageBox({ + title: 'Brave', + message: `${locale.translation('closeFirefoxWarning')}`, + icon: path.join(__dirname, '..', 'app', 'extensions', 'brave', 'img', 'braveAbout.png'), + buttons: [locale.translation('closeFirefoxWarningOk')] + }) + }, 50) +} + +const showImportSuccess = function () { + // The timeout is in case there's a call just after the modal to hide the menu. + // showMessageBox is a modal and blocks everything otherwise, so menu would remain open + // while the dialog is displayed. + setTimeout(() => { + dialog.showMessageBox({ + title: 'Brave', + message: `${locale.translation('importSuccess')}`, + icon: path.join(__dirname, '..', 'app', 'extensions', 'brave', 'img', 'braveAbout.png'), + buttons: [locale.translation('importSuccessOk')] + }) + }, 50) +} + importer.on('show-warning-dialog', (e) => { showImportWarning() }) diff --git a/app/index.js b/app/index.js index 919b3a7c4fe..73b75fe5b7f 100644 --- a/app/index.js +++ b/app/index.js @@ -68,7 +68,6 @@ const HttpsEverywhere = require('./httpsEverywhere') const SiteHacks = require('./siteHacks') const CmdLine = require('./cmdLine') const UpdateStatus = require('../js/constants/updateStatus') -const showAbout = require('./aboutDialog').showAbout const urlParse = require('url').parse const CryptoUtil = require('../js/lib/cryptoUtil') const keytar = require('keytar') @@ -755,9 +754,6 @@ app.on('ready', () => { process.on(messages.CHECK_FOR_UPDATE, () => Updater.checkForUpdate(true)) ipcMain.on(messages.CHECK_FOR_UPDATE, () => Updater.checkForUpdate(true)) - process.on(messages.SHOW_ABOUT, showAbout) - ipcMain.on(messages.SHOW_ABOUT, showAbout) - // This is fired from a auto-update metadata call process.on(messages.UPDATE_META_DATA_RETRIEVED, (metadata) => { console.log(metadata) diff --git a/app/sessionStore.js b/app/sessionStore.js index d236a242ea8..2e22a116b17 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -27,6 +27,7 @@ const filtering = require('./filtering') const autofill = require('./autofill') const {navigatableTypes} = require('../js/lib/appUrlUtil') // const tabState = require('./common/state/tabState') +const Channel = require('./channel') const getSetting = require('../js/settings').getSetting const promisify = require('../js/lib/promisify') @@ -323,6 +324,8 @@ module.exports.cleanAppData = (data, isShutdown) => { delete data.extensions[extensionId].tabs }) } + + delete data.versionInformation } /** @@ -426,6 +429,22 @@ module.exports.loadAppState = () => { return } } + + // version information (shown on about:brave) + const os = require('os') + const versionInformation = [ + {name: 'brave', version: app.getVersion()}, + {name: 'muon', version: process.versions['atom-shell']}, + {name: 'libchromiumcontent', version: process.versions['chrome']}, + {name: 'V8', version: process.versions.v8}, + {name: 'Node.js', version: process.versions.node}, + {name: 'channel', version: Channel.channel()}, + {name: 'os.platform', version: os.platform()}, + {name: 'os.release', version: os.release()}, + {name: 'os.arch', version: os.arch()} + // TODO(bsclifton): read the latest commit hash from a file, etc. + ] + data.versionInformation = versionInformation } catch (e) { // TODO: Session state is corrupted, maybe we should backup this // corrupted value for people to report into support. diff --git a/js/about/about.js b/js/about/about.js index acaef90fa3a..e69c23ec73c 100644 --- a/js/about/about.js +++ b/js/about/about.js @@ -6,20 +6,29 @@ const React = require('react') const ImmutableComponent = require('../components/immutableComponent') const {aboutUrls, isNavigatableAboutPage} = require('../lib/appUrlUtil') +require('../../less/about/history.less') +require('../../node_modules/font-awesome/css/font-awesome.css') + class AboutAbout extends ImmutableComponent { render () { - return
-

-
    - { - aboutUrls.keySeq().sort().filter((aboutSourceUrl) => isNavigatableAboutPage(aboutSourceUrl)).map((aboutSourceUrl) => -
  • - - {aboutSourceUrl} - -
  • ) - } -
+ return
+
+
+
+ +
+
+
    + { + aboutUrls.keySeq().sort().filter((aboutSourceUrl) => isNavigatableAboutPage(aboutSourceUrl)).map((aboutSourceUrl) => +
  • + + {aboutSourceUrl} + +
  • ) + } +
+
} } diff --git a/js/about/brave.js b/js/about/brave.js new file mode 100644 index 00000000000..08965cfbd69 --- /dev/null +++ b/js/about/brave.js @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const React = require('react') +const Immutable = require('immutable') +const messages = require('../constants/messages') +const SortableTable = require('../components/sortableTable') + +const ipc = window.chrome.ipc + +require('../../less/about/history.less') +require('../../node_modules/font-awesome/css/font-awesome.css') + +class AboutBrave extends React.Component { + constructor () { + super() + this.state = { versionInformation: Immutable.fromJS([]) } + ipc.on(messages.VERSION_INFORMATION_UPDATED, (e, versionInformation) => { + if (this.state.versionInformation.size === 0) { + this.setState({versionInformation: Immutable.fromJS(versionInformation)}) + } + }) + } + + render () { + return
+
+
+
+ +
+
+ [ + { + html: entry.get('name'), + value: entry.get('name') + }, + { + html: entry.get('version'), + value: entry.get('version') + } + ])} + /> +
+
+ } +} + +module.exports = diff --git a/js/about/entry.js b/js/about/entry.js index 3d86d088b7b..a7eb2fe808c 100644 --- a/js/about/entry.js +++ b/js/about/entry.js @@ -6,50 +6,54 @@ const ipc = window.chrome.ipc let element switch (getBaseUrl(getSourceAboutUrl(window.location.href))) { - case 'about:newtab': - element = require('./newtab') - break case 'about:about': element = require('./about') break - case 'about:preferences': - element = require('./preferences') - break - case 'about:bookmarks': - element = require('./bookmarks') - break - case 'about:extensions': - element = require('./extensions') - break case 'about:adblock': element = require('./adblock') break - case 'about:downloads': - element = require('./downloads') + case 'about:autofill': + element = require('./autofill') + break + case 'about:brave': + element = require('./brave') + break + case 'about:bookmarks': + element = require('./bookmarks') break case 'about:certerror': element = require('./certerror') break - case 'about:passwords': - element = require('./passwords') - break - case 'about:safebrowsing': - element = require('./safebrowsing') + case 'about:downloads': + element = require('./downloads') break case 'about:error': element = require('./errorPage') break + case 'about:extensions': + element = require('./extensions') + break case 'about:flash': element = require('./flashPlaceholder') break case 'about:history': element = require('./history') break + case 'about:newtab': + element = require('./newtab') + break + case 'about:passwords': + element = require('./passwords') + break + case 'about:preferences': + element = require('./preferences') + break + case 'about:safebrowsing': + element = require('./safebrowsing') + break case 'about:styles': element = require('./styles') break - case 'about:autofill': - element = require('./autofill') } if (element) { diff --git a/js/components/frame.js b/js/components/frame.js index d5c9bbdad30..a0289daeea0 100644 --- a/js/components/frame.js +++ b/js/components/frame.js @@ -170,6 +170,11 @@ class Frame extends ImmutableComponent { }) this.webview.send(messages.AUTOFILL_CREDIT_CARDS_UPDATED, list) } + } else if (location === 'about:brave') { + const versionInformation = appStoreRenderer.state.get('versionInformation') + if (versionInformation && versionInformation.toJS) { + this.webview.send(messages.VERSION_INFORMATION_UPDATED, versionInformation.toJS()) + } } // send state to about pages diff --git a/js/constants/messages.js b/js/constants/messages.js index 87dcb1af63e..ee9a6d70d75 100644 --- a/js/constants/messages.js +++ b/js/constants/messages.js @@ -57,7 +57,6 @@ const messages = { UPDATE_AVAILABLE: _, UPDATE_NOT_AVAILABLE: _, CHECK_FOR_UPDATE: _, - SHOW_ABOUT: _, UPDATE_META_DATA_RETRIEVED: _, // App state APP_INITIALIZED: _, @@ -113,6 +112,7 @@ const messages = { DOWNLOADS_UPDATED: _, FLASH_UPDATED: _, NEWTAB_DATA_UPDATED: _, + VERSION_INFORMATION_UPDATED: _, // About pages from contentScript OPEN_DOWNLOAD_PATH: _, RELOAD_URL: _, diff --git a/js/lib/appUrlUtil.js b/js/lib/appUrlUtil.js index 69d3d33db89..23f6c98a32d 100644 --- a/js/lib/appUrlUtil.js +++ b/js/lib/appUrlUtil.js @@ -52,21 +52,22 @@ module.exports.getManifestUrl = function () { // Map of source about: URLs mapped to target URLs module.exports.aboutUrls = new Immutable.Map({ 'about:about': module.exports.getAppUrl('about-about.html'), + 'about:adblock': module.exports.getAppUrl('about-adblock.html'), + 'about:autofill': module.exports.getAppUrl('about-autofill.html'), 'about:blank': module.exports.getAppUrl('about-blank.html'), - 'about:history': module.exports.getAppUrl('about-history.html'), 'about:bookmarks': module.exports.getAppUrl('about-bookmarks.html'), + 'about:brave': module.exports.getAppUrl('about-brave.html'), + 'about:certerror': module.exports.getAppUrl('about-certerror.html'), + 'about:config': module.exports.getAppUrl('about-config.html'), 'about:downloads': module.exports.getAppUrl('about-downloads.html'), + 'about:error': module.exports.getAppUrl('about-error.html'), 'about:extensions': module.exports.getAppUrl('about-extensions.html'), - 'about:adblock': module.exports.getAppUrl('about-adblock.html'), + 'about:flash': module.exports.getAppUrl('about-flash.html'), + 'about:history': module.exports.getAppUrl('about-history.html'), 'about:newtab': module.exports.getAppUrl('about-newtab.html'), + 'about:passwords': module.exports.getAppUrl('about-passwords.html'), 'about:preferences': module.exports.getAppUrl('about-preferences.html'), - 'about:config': module.exports.getAppUrl('about-config.html'), - 'about:certerror': module.exports.getAppUrl('about-certerror.html'), 'about:safebrowsing': module.exports.getAppUrl('about-safebrowsing.html'), - 'about:passwords': module.exports.getAppUrl('about-passwords.html'), - 'about:flash': module.exports.getAppUrl('about-flash.html'), - 'about:error': module.exports.getAppUrl('about-error.html'), - 'about:autofill': module.exports.getAppUrl('about-autofill.html'), 'about:styles': module.exports.getAppUrl('about-styles.html') }) diff --git a/less/about/history.less b/less/about/history.less index cac2796c8e9..68b729151a7 100644 --- a/less/about/history.less +++ b/less/about/history.less @@ -4,6 +4,20 @@ min-width: 704px; .siteDetailsPageContent { + &.aboutAbout { + .sortableTable { + -webkit-user-select: text; + margin-left: @aboutPageSectionPadding; + width: 400px; + td { + cursor: auto; + padding-left: 8px; + } + } + ul { + margin-left: @aboutPageSectionPadding + @aboutPageSectionPadding; + } + } .sortableTable { -webkit-user-select: none; // Time visited