diff --git a/app/browser/tabs.js b/app/browser/tabs.js index 67dae81c479..cb69841b742 100644 --- a/app/browser/tabs.js +++ b/app/browser/tabs.js @@ -371,6 +371,10 @@ const updateAboutDetails = (tabId) => { adblockCount, httpsUpgradedCount, torEnabled, + versionInformation: { + browserLaptop: app.getVersion().toString(), + initState: appState.getIn(['about', 'init']).toJS() + }, newTabDetail: newTabDetail.toJS() }) } else if (location === 'about:autofill') { diff --git a/app/darwinInit.js b/app/darwinInit.js new file mode 100644 index 00000000000..9bc93f16fb8 --- /dev/null +++ b/app/darwinInit.js @@ -0,0 +1,147 @@ +/* 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/. */ + +if (process.platform === 'darwin') { + const electron = require('electron') + const path = require('path') + const childProcess = require('child_process') + const execSync = childProcess.execSync + const app = electron.app + const fs = require('fs') + const os = require('os') + const appName = 'Brave Browser.app' + const homedir = os.homedir() + + const getBraveBinPath = () => { + const appPath = app.getPath('exe') + const appIndex = appPath.indexOf('.app') + '.app'.length + if (appPath && appIndex > 4) { + // Remove the `Contents`/`MacOS`/`Brave` parts from path + const runningAppPath = appPath.substring(0, appIndex) + return runningAppPath + } + return false + } + + const braveCoreUpgradeFile = path.join(app.getPath('userData'), 'brave-core-upgrade') + + const shouldAttemptInstall = () => { + return !fs.existsSync(braveCoreUpgradeFile) + } + + const getBraveCoreInstallerPath = () => { + const appDir = getBraveBinPath() + if (!appDir) { + return false + } + return path.join(getBraveBinPath(), 'Contents', 'Resources', 'Brave-Browser.pkg') + } + + const getBraveCoreInstallPath = () => { + const braveCoreInstallLocations = [ + `${homedir}/Applications/${appName}/`, + `/Applications/${appName}/` + ] + + // check for existing installations + for (var i = 0; i < braveCoreInstallLocations.length; i++) { + if (fs.existsSync(braveCoreInstallLocations[i])) { + console.log(`brave-core already installed at "${braveCoreInstallLocations[i]}"`) + return braveCoreInstallLocations[i] + } + } + + return false + } + + const installBraveCore = () => { + // get path to the bundled brave-core binary + const installerPath = getBraveCoreInstallerPath() + if (!installerPath) { + console.log('brave-core installer not found') + return false + } + + // brave-core is not installed; go ahead with silent install + const tempDir = path.join(os.tmpdir(), 'brave-upgrade') + try { + console.log(`Extracting brave-core binaries from "${installerPath}" into temp directory "${tempDir}"`) + execSync(`pkgutil --expand-full "${installerPath}" "${tempDir}"`) + + let installedPath = '/Applications' + try { + console.log(`Attempting to move extracted brave-core binaries into "${installedPath}/."`) + execSync(`mv "${tempDir}/Payload/${appName}/" "${installedPath}/."`) + } catch (globalPathException) { + installedPath = `${homedir}/Applications` + console.log(`Attempting to move extracted brave-core binaries into "${installedPath}/."`) + execSync(`mv "${tempDir}/Payload/${appName}/" "${installedPath}/."`) + } + + // match expected permissions + // logic borrowed from ./build/pkg-scripts/postinstall + [ + `chmod -R 775 "${installedPath}/${appName}"`, + `chown -R $USER "${installedPath}/${appName}"`, + `chgrp -R admin "${installedPath}/${appName}"` + ].forEach((cmd) => { + try { + execSync(cmd) + } catch (e) { + console.log(`Failed adjusting permissions with "${cmd}"\nerror: "${e.toString()}"`) + } + }) + + // store details to disk; no further install attempts will be made + try { + fs.writeFileSync(braveCoreUpgradeFile, `installed: ${new Date().getTime()}`) + } catch (e) { + } + + // launch into freshly installed brave-core and append argument expected in: + // https://github.com/brave/brave-browser/issues/1545 + let openCmd = `open -a "${installedPath}/${appName}/" --args --upgrade-from-muon` + console.log('Launching brave-core') + execSync(openCmd) + } catch (e) { + return false + } finally { + console.log(`Removing temp directory "${tempDir}"`) + try { + execSync(`rm -rf ${tempDir}`) + } catch (e) {} + } + + return true + } + + module.exports = function () { + // If brave-core is installed, find the path and version + const braveCoreInstallPath = getBraveCoreInstallPath() + if (braveCoreInstallPath) { + const getVersionCmd = `defaults read "${braveCoreInstallPath}/Contents/Info" CFBundleShortVersionString` + let braveCoreVersion + try { + // format will be like `71.0.57.4` + braveCoreVersion = execSync(getVersionCmd).toString().trim() + // remove the Chromium version from the string + const versionAsArray = braveCoreVersion.split('.') + if (versionAsArray.length === 4) { + braveCoreVersion = versionAsArray.slice(1).join('.') + } + } catch (e) {} + + return {braveCoreInstalled: true, braveCoreInstallPath, braveCoreVersion} + } + + // If brave-core is NOT installed, attempt to install it + if (shouldAttemptInstall()) { + if (installBraveCore()) { + app.exit() + } + } + + return {braveCoreInstalled: false} + } +} diff --git a/app/extensions/brave/img/favicons/startpage.png b/app/extensions/brave/img/favicons/startpage.png index df5c9cc4bc1..52cb68a6f68 100644 Binary files a/app/extensions/brave/img/favicons/startpage.png and b/app/extensions/brave/img/favicons/startpage.png differ diff --git a/app/extensions/brave/locales/en-US/preferences.properties b/app/extensions/brave/locales/en-US/preferences.properties index 736c33b8d83..14ef508e2c5 100644 --- a/app/extensions/brave/locales/en-US/preferences.properties +++ b/app/extensions/brave/locales/en-US/preferences.properties @@ -379,7 +379,7 @@ syncShowQR=Show secret QR code. (Do not share!) syncSiteSettings=Saved site settings syncStart=I am new to Sync syncTitle=Brave Sync -syncTitleMessage=Sync encrypted browser data between your devices securely and privately using Brave Sync. +syncTitleMessage=This version of Sync is deprecated. You can clear any existing data you have. tabCloseAction=When closing an active tab: tabCloseActionLastActive=Select the last viewed tab tabCloseActionNext=Select the next tab diff --git a/app/index.js b/app/index.js index 5b93a99eec7..b39be648c29 100644 --- a/app/index.js +++ b/app/index.js @@ -49,12 +49,14 @@ process.on('unhandledRejection', function (reason, promise) { process.on('warning', warning => console.warn(warning.stack)) -if (process.platform === 'win32') { - require('./windowsInit') -} +let initState -if (process.platform === 'linux') { +if (process.platform === 'win32') { + initState = require('./windowsInit')() +} else if (process.platform === 'linux') { require('./linuxInit') +} else if (process.platform === 'darwin') { + initState = require('./darwinInit')() } const electron = require('electron') @@ -185,6 +187,9 @@ app.on('ready', () => { }) loadAppStatePromise.then((initialImmutableState) => { + // merge state which was set during optional platform-specific init + initialImmutableState = initialImmutableState.setIn(['about', 'init'], Immutable.fromJS(initState || {})) + // Do this after loading the state // For tests we always want to load default app state const loadedPerWindowImmutableState = initialImmutableState.get('perWindowState') diff --git a/app/renderer/components/preferences/syncTab.js b/app/renderer/components/preferences/syncTab.js index 713771b0f6b..3ef43f05556 100644 --- a/app/renderer/components/preferences/syncTab.js +++ b/app/renderer/components/preferences/syncTab.js @@ -112,6 +112,7 @@ class SyncTab extends ImmutableComponent { l10nId='syncStart' testId='syncStartButton' onClick={this.showSyncStart.bind(this)} + disabled />
@@ -143,6 +145,7 @@ class SyncTab extends ImmutableComponent { l10nId='syncNewDevice' testId='syncNewDeviceButton' onClick={this.showSyncNewDevice.bind(this)} + disabled /> } @@ -468,15 +471,6 @@ class SyncTab extends ImmutableComponent { : null } { - !this.isSetup && this.props.syncStartOverlayVisible - ? - : null - } - { !this.isSetup && this.props.syncAddOverlayVisible ? - - -
+ settingsListTitle: true + })}> + Please download the new version of Brave for desktop. +
{ this.setupError ? this.errorContent @@ -530,19 +522,19 @@ class SyncTab extends ImmutableComponent { dataL10nId='syncBookmarks' prefKey={settings.SYNC_TYPE_BOOKMARK} settings={this.props.settings} - onChangeSetting={this.props.onChangeSetting} + disabled /> diff --git a/app/sessionStore.js b/app/sessionStore.js index 0ced30fa2a3..a1fd83bef28 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -48,6 +48,7 @@ const {isImmutable, makeImmutable, deleteImmutablePaths} = require('./common/sta const {getSetting} = require('../js/settings') const platformUtil = require('./common/lib/platformUtil') const historyUtil = require('./common/lib/historyUtil') +const {newTabMode} = require('./common/constants/settingsEnums') const sessionStorageVersion = 1 const sessionStorageName = `session-store-${sessionStorageVersion}` @@ -692,6 +693,10 @@ module.exports.runPreMigrations = (data) => { data.settings[settings.PAYMENTS_NOTIFICATION_TRY_PAYMENTS_DISMISSED] = data.settings['payments.notificationTryPaymentsDismissed'] delete data.settings['payments.notificationTryPaymentsDismissed'] } + + // force NEWTAB_MODE to be dashboard so folks can see deprecation notice + // preference is also disabled (see js/about/preferences.js) + data.settings[settings.NEWTAB_MODE] = newTabMode.NEW_TAB_PAGE } if (data.sites) { diff --git a/app/updater.js b/app/updater.js index faa0cf170ca..1c36b873576 100644 --- a/app/updater.js +++ b/app/updater.js @@ -29,6 +29,7 @@ const UpdateStatus = require('../js/constants/updateStatus') // Utils const request = require('../js/lib/request').request const ledgerUtil = require('./common/lib/ledgerUtil') +const {isLinux} = require('./common/lib/platformUtil') const dates = require('./dates') const Channel = require('./channel') @@ -85,6 +86,21 @@ var scheduleUpdates = () => { }, appConfig.updates.appUpdateCheckFrequency) } + // Linux doesn't have an auto-update mechanism. + // Instead, show a persistent nag linking to instructions + if (isLinux()) { + appActions.showNotification({ + buttons: [], + options: { + persist: false, + advancedText: 'See instructions to upgrade to the latest version', + advancedLink: 'https://brave-browser.readthedocs.io/en/latest/installing-brave.html#linux' + }, + position: 'global', + message: 'This version of Brave is no longer supported and will not be updated.' + }) + } + // Startup check if (appConfig.updates.runtimeUpdateCheckDelay) { setTimeout(() => { diff --git a/app/windowsInit.js b/app/windowsInit.js index 183b53d2318..de02a788ed9 100644 --- a/app/windowsInit.js +++ b/app/windowsInit.js @@ -2,109 +2,246 @@ * 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 electron = require('electron') -const path = require('path') -const childProcess = require('child_process') -const spawn = childProcess.spawn -const spawnSync = childProcess.spawnSync -const execSync = childProcess.execSync -const app = electron.app -const Channel = require('./channel') -const cmdLine = require('./cmdLine') -const promoCodeFirstRunStorage = require('./promoCodeFirstRunStorage') - -let appUserModelId = 'com.squirrel.brave.Brave' -switch (Channel.channel()) { - case 'nightly': - appUserModelId = 'com.squirrel.BraveNightly.BraveNightly' - break - case 'developer': - appUserModelId = 'com.squirrel.BraveDeveloper.BraveDeveloper' - break - case 'beta': - appUserModelId = 'com.squirrel.BraveBeta.BraveBeta' - break - case 'dev': - appUserModelId = 'com.squirrel.brave.Brave' - break - default: - appUserModelId = 'com.squirrel.brave.Brave' - break -} +if (process.platform === 'win32') { + const electron = require('electron') + const path = require('path') + const childProcess = require('child_process') + const spawn = childProcess.spawn + const spawnSync = childProcess.spawnSync + const execSync = childProcess.execSync + const app = electron.app + const fs = require('fs') + const os = require('os') + const Channel = require('./channel') + const cmdLine = require('./cmdLine') + const promoCodeFirstRunStorage = require('./promoCodeFirstRunStorage') -const getBraveBinPath = () => { - const appPath = app.getPath('exe') - return path.dirname(appPath) -} + let appUserModelId = 'com.squirrel.brave.Brave' + switch (Channel.channel()) { + case 'nightly': + appUserModelId = 'com.squirrel.BraveNightly.BraveNightly' + break + case 'developer': + appUserModelId = 'com.squirrel.BraveDeveloper.BraveDeveloper' + break + case 'beta': + appUserModelId = 'com.squirrel.BraveBeta.BraveBeta' + break + case 'dev': + appUserModelId = 'com.squirrel.brave.Brave' + break + default: + appUserModelId = 'com.squirrel.brave.Brave' + break + } -const getBraveDefaultsBinPath = () => { - const appDir = getBraveBinPath() - return path.join(appDir, 'resources', 'braveDefaults.exe') -} + const getBraveBinPath = () => { + const appPath = app.getPath('exe') + return path.dirname(appPath) + } -const getVisualElementsManifestPath = () => { - const appDir = getBraveBinPath() - return path.join(appDir, 'resources', 'Update.VisualElementsManifest.xml') -} + const getBraveDefaultsBinPath = () => { + const appDir = getBraveBinPath() + return path.join(appDir, 'resources', 'braveDefaults.exe') + } -function CopyManifestFile () { - const versionedRoot = getBraveBinPath() - let updateRoot = versionedRoot.split('\\') - updateRoot.pop() - updateRoot = updateRoot.join('\\') - const cmd = 'copy "' + getVisualElementsManifestPath() + '" "' + updateRoot + '"' - execSync(cmd) -} + const getVisualElementsManifestPath = () => { + const appDir = getBraveBinPath() + return path.join(appDir, 'resources', 'Update.VisualElementsManifest.xml') + } -// windows installation events etc... -if (process.platform === 'win32') { - const shouldQuit = require('electron-squirrel-startup') - const channel = Channel.channel() - const isSquirrelInstall = process.argv.includes('--squirrel-install') - const isSquirrelUpdate = process.argv.includes('--squirrel-updated') - const isSquirrelUninstall = process.argv.includes('--squirrel-uninstall') - const isSquirrelFirstRun = process.argv.includes('--squirrel-firstrun') - // handle running as part of install process - if (isSquirrelInstall) { - // determine if promo code was provided by setup.exe - const promoCode = cmdLine.getFirstRunPromoCode() - if (promoCode) { - // write promo code so state can access it - promoCodeFirstRunStorage.writeFirstRunPromoCodeSync(promoCode) + const copyManifestFile = () => { + const versionedRoot = getBraveBinPath() + let updateRoot = versionedRoot.split('\\') + updateRoot.pop() + updateRoot = updateRoot.join('\\') + const cmd = 'copy "' + getVisualElementsManifestPath() + '" "' + updateRoot + '"' + execSync(cmd) + } + + const braveCoreUpgradeFile = path.join(app.getPath('userData'), 'brave-core-upgrade') + + var debugLog = function (contents) { + const logPath = braveCoreUpgradeFile + '-debug.log' + const logLine = new Date().toISOString() + ' - ' + contents + os.EOL + try { + fs.appendFileSync(logPath, logLine) + console.log(logLine) + } catch (e) { + console.error(e) } } - // first-run after install / update - if (isSquirrelInstall || isSquirrelUpdate) { - // The manifest file is used to customize the look of the Start menu tile. - // This function copies it from the versioned folder to the parent folder - // (where the auto-update executable lives) - CopyManifestFile() - // Launch defaults helper to add defaults on install - spawn(getBraveDefaultsBinPath(), [], { detached: true }) - } else if (isSquirrelUninstall) { - // Launch defaults helper to remove defaults on uninstall - // Sync to avoid file path in use on uninstall - spawnSync(getBraveDefaultsBinPath(), ['-uninstall']) + + const shouldAttemptInstall = () => { + return !fs.existsSync(braveCoreUpgradeFile) } - if (shouldQuit(channel)) { - process.exit(0) + const getBraveCoreInstallerPath = () => { + const appDir = getBraveBinPath() + if (!appDir) { + return false + } + return path.join(appDir, 'resources', + os.arch() === 'x32' ? 'BraveBrowserSetup32.exe' : 'BraveBrowserSetup64.exe') } - const userDataDirSwitch = '--user-data-dir-name=brave-' + channel - if (channel !== 'dev' && !process.argv.includes(userDataDirSwitch) && - !process.argv.includes('--relaunch') && - !process.argv.includes('--user-data-dir-name=brave-development')) { - delete process.env.CHROME_USER_DATA_DIR - if (isSquirrelFirstRun) { - app.relaunch({args: [userDataDirSwitch, '--relaunch']}) - } else { - app.relaunch({args: process.argv.slice(1).concat([userDataDirSwitch, '--relaunch'])}) + const getBraveCoreInstallPath = () => { + const braveCoreInstallLocations = [ + '%USERPROFILE%\\AppData\\Local\\BraveSoftware\\Brave-Browser\\Application', + '%ProgramFiles(x86)%\\BraveSoftware\\Brave-Browser\\Application', + '%ProgramFiles%\\BraveSoftware\\Brave-Browser\\Application' + ] + + // check for existing installations + for (let i = 0; i < braveCoreInstallLocations.length; i++) { + const path = braveCoreInstallLocations[i] + const resolvedPath = path.replace(/%([^%]+)%/g, function (_, variableToResolve) { + return process.env[variableToResolve] + }) + if (fs.existsSync(resolvedPath)) { + debugLog(`brave-core already installed at "${resolvedPath}"`) + return resolvedPath + } } - app.exit() + + return false } -} -app.on('will-finish-launching', () => { - app.setAppUserModelId(appUserModelId) -}) + const installBraveCore = () => { + // get path to the bundled brave-core binary + const installerPath = getBraveCoreInstallerPath() + if (!installerPath) { + debugLog('brave-core installer not found') + return false + } + + // forcefully create the legacy shortcut + const updateExe = path.join(getBraveBinPath(), '..', 'Update.exe') + const shortcutTarget = path.basename(process.execPath) + const shortcutCmd = `${updateExe} --createShortcut=${shortcutTarget} --shortcut-locations=DuplicateDesktop --process-start-args=--launch-muon` + try { + debugLog('Creating "Brave (old)" shortcut on desktop') + execSync(shortcutCmd) + } catch (e) { + debugLog('Error thrown when creating Muon shortcut: ' + e.toString()) + } + + // brave-core is not installed; go ahead with silent install + const installCmd = `${installerPath} /silent /install` + try { + debugLog(`Attempting silent install using "${installerPath}"`) + execSync(installCmd) + } catch (e) { + debugLog('Error thrown when installing brave-core: ' + e.toString()) + return false + } + + // store details to disk; no further install attempts will be made + try { + fs.writeFileSync(braveCoreUpgradeFile, `installed: ${new Date().getTime()}`) + } catch (e) { + } + + // relaunch and append argument expected in: + // https://github.com/brave/brave-browser/issues/1545 + try { + const installedPath = getBraveCoreInstallPath() + debugLog(`Launching brave-core at "${installedPath}/brave.exe" with "--upgrade-from-muon" flag`) + execSync(`"${installedPath}/brave.exe" --upgrade-from-muon`) + } catch (e) { + return false + } + + return true + } + + module.exports = function () { + const shouldQuit = require('electron-squirrel-startup') + const channel = Channel.channel() + const isSquirrelInstall = process.argv.includes('--squirrel-install') + const isSquirrelUpdate = process.argv.includes('--squirrel-updated') + const isSquirrelUninstall = process.argv.includes('--squirrel-uninstall') + const isSquirrelFirstRun = process.argv.includes('--squirrel-firstrun') + + // Events like `--squirrel-install` and `--squirrel-updated` + // are fired by Update.exe DURING the install/upgrade. Since + // we don't intend to actually launch the executable, we need + // to exit after performing housekeeping tasks. + if (isSquirrelInstall || isSquirrelUpdate) { + // Detect promoCode (via CLI) and write to disk for later use + const promoCode = isSquirrelInstall && cmdLine.getFirstRunPromoCode() + if (promoCode) { + promoCodeFirstRunStorage.writeFirstRunPromoCodeSync(promoCode) + } + // The manifest file is used to customize the look of the Start menu tile. + // This function copies it from the versioned folder to the parent folder + // (where the auto-update executable lives) + copyManifestFile() + // Launch defaults helper to add defaults on install + spawn(getBraveDefaultsBinPath(), [], { detached: true }) + } else if (isSquirrelUninstall) { + // Launch defaults helper to remove defaults on uninstall + // Sync to avoid file path in use on uninstall + spawnSync(getBraveDefaultsBinPath(), ['-uninstall']) + } + + // Quit if this is only an install or update event. + // This logic also creates the shortcuts (desktop, etc) + if (shouldQuit(channel)) { + process.exit(0) + } + + // If executable is on BETA/DEVELOPER/NIGHTLY channels, there + // is a different `user-data-dir-name`. This logic will + // relaunch using the proper profile if it was omitted for + // some reason. + const userDataDirSwitch = '--user-data-dir-name=brave-' + channel + if (channel !== 'dev' && !process.argv.includes(userDataDirSwitch) && + !process.argv.includes('--relaunch') && + !process.argv.includes('--user-data-dir-name=brave-development')) { + delete process.env.CHROME_USER_DATA_DIR + if (isSquirrelFirstRun) { + app.relaunch({args: [userDataDirSwitch, '--relaunch']}) + } else { + app.relaunch({args: process.argv.slice(1).concat([userDataDirSwitch, '--relaunch'])}) + } + app.exit() + return + } + + app.on('will-finish-launching', () => { + app.setAppUserModelId(appUserModelId) + }) + + // If brave-core is installed, find the path and version + const braveCoreInstallPath = getBraveCoreInstallPath() + if (braveCoreInstallPath) { + const getVersionCmd = `wmic datafile where name='${braveCoreInstallPath.replace(/\\/g, '\\\\')}\\\\brave.exe' get Version /value` + let braveCoreVersion + try { + // format will be like `Version=70.0.56.8` + braveCoreVersion = execSync(getVersionCmd).toString().trim() + const keyValue = braveCoreVersion.split('=') + if (keyValue.length === 2) { + // remove the Chromium version from the string + const versionAsArray = keyValue[1].split('.') + if (versionAsArray.length === 4) { + braveCoreVersion = versionAsArray.slice(1).join('.') + } + } + } catch (e) {} + + return {braveCoreInstalled: true, braveCoreInstallPath, braveCoreVersion} + } + + // If brave-core is NOT installed, attempt to install it + if (shouldAttemptInstall()) { + if (installBraveCore()) { + app.exit() + return + } + } + + return {braveCoreInstalled: false} + } +} diff --git a/js/about/aboutActions.js b/js/about/aboutActions.js index 0511923a12f..42327bb07ab 100644 --- a/js/about/aboutActions.js +++ b/js/about/aboutActions.js @@ -369,6 +369,15 @@ const aboutActions = { actionType: appConstants.APP_RENDER_TO_PDF, savePath: savePath }) + }, + + /** + * Launch into Brave Core using path discovered during init + */ + launchBraveCore: function () { + aboutActions.dispatchAction({ + actionType: appConstants.APP_LAUNCH_BRAVE_CORE + }) } } module.exports = aboutActions diff --git a/js/about/newtab.js b/js/about/newtab.js index c2693032513..960cccff747 100644 --- a/js/about/newtab.js +++ b/js/about/newtab.js @@ -15,6 +15,7 @@ const Block = require('./newTabComponents/block') const SiteRemovalNotification = require('./newTabComponents/siteRemovalNotification') const FooterInfo = require('./newTabComponents/footerInfo') const NewPrivateTab = require('./newprivatetab') +const BrowserButton = require('../../app/renderer/components/common/browserButton') // Constants const messages = require('../constants/messages') @@ -31,6 +32,7 @@ const backgrounds = require('../data/backgrounds') const urlutils = require('../lib/urlutil') const random = require('../../app/common/lib/randomUtil') const cx = require('../lib/classSet') +const {isLinux} = require('../../app/common/lib/platformUtil') const ipc = window.chrome.ipcRenderer // Styles @@ -65,6 +67,7 @@ class NewTabPage extends React.Component { const showEmptyPage = !!data.get('showEmptyPage') const showImages = !!data.get('showImages') && !showEmptyPage + const versionInformation = data.get('versionInformation') this.setState({ newTabData: data, updatedStamp, @@ -73,7 +76,8 @@ class NewTabPage extends React.Component { showImages: !!data.get('showImages') && !showEmptyPage, backgroundImage: showImages ? this.state.backgroundImage || this.randomBackgroundImage - : undefined + : undefined, + versionInformation }) }) } @@ -257,6 +261,79 @@ class NewTabPage extends React.Component { return name.charAt(0).toUpperCase() } + launchBraveCore () { + const braveCoreInstallPath = this.state.versionInformation && this.state.versionInformation.getIn(['initState', 'braveCoreInstallPath']) + if (braveCoreInstallPath) { + aboutActions.launchBraveCore() + } + } + + openHelp () { + window.location = 'https://support.brave.com/hc/en-us/articles/360018538092' + } + + getDeprecatedText () { + const muonVersion = this.state.versionInformation && this.state.versionInformation.get('browserLaptop') + const formattedMuonVersion = muonVersion + ? ('(' + muonVersion + ')') + : '' + const braveCoreInstalled = (this.state.versionInformation && this.state.versionInformation.getIn(['initState', 'braveCoreInstalled'])) || false + const braveCoreVersion = braveCoreInstalled && this.state.versionInformation && this.state.versionInformation.getIn(['initState', 'braveCoreVersion']) + const formattedBraveCoreVersion = braveCoreVersion + ? ('(' + braveCoreVersion + ')') + : '' + let braveCoreFriendlyVersion = (braveCoreVersion && braveCoreVersion.split('.').length === 3) + ? braveCoreVersion.split('.').slice(0, 2).join('.') + : undefined + const launchButtonText = braveCoreFriendlyVersion + ? `Launch Brave ${braveCoreFriendlyVersion}` + : 'Launch Brave' + + if (braveCoreInstalled) { + return
+
+ Note:  + A newer version of Brave {formattedBraveCoreVersion} has already been installed. + This version of Brave {formattedMuonVersion} is no longer supported and will not be updated. +
+
+ To avoid potential security risks, please move over to the latest version of the Brave Browser. +
+
+ + Learn moreā€¦ + + +
+
+ } + + return
+
+ Hello! This version of Brave {formattedMuonVersion} is no longer supported and will not be updated. + { + isLinux() + ?  To avoid potential security risks, please follow these instructions to upgrade to the latest version of the Brave Browser. + :  To avoid potential security risks, please download the latest version of the Brave Browser. + } +
+
+ + +
+
+ } + render () { // don't render if user prefers an empty page if (this.state.showEmptyPage && !this.props.isIncognito) { @@ -330,6 +407,10 @@ class NewTabPage extends React.Component { }) } + +
+ {this.getDeprecatedText()} +
{ diff --git a/js/about/preferences.js b/js/about/preferences.js index 8978a98ade7..cd06579e588 100644 --- a/js/about/preferences.js +++ b/js/about/preferences.js @@ -139,6 +139,7 @@ class GeneralTab extends ImmutableComponent {