Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/brave/browser-laptop into…
Browse files Browse the repository at this point in the history
… badge-text
  • Loading branch information
jonathansampson committed Feb 14, 2017
2 parents e82bf93 + a11ec89 commit d981e74
Show file tree
Hide file tree
Showing 52 changed files with 821 additions and 275 deletions.
4 changes: 2 additions & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
runtime = electron
target = 2.56.0
target = 2.56.3
target_arch = x64
brave_electron_version = 2.56.0
brave_electron_version = 2.56.3
disturl = http://brave-laptop-binaries.s3.amazonaws.com/atom-shell/dist
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
# Changelog

## [0.13.3](https://github.com/brave/browser-laptop/releases/v0.13.3dev)
- TODO
- Added a way to export bookmarks. ([#1002](https://github.com/brave/browser-laptop/issues/1002))
- Added preference for background image or gradient for new tab. ([#6965](https://github.com/brave/browser-laptop/issues/6965))
- Added a preference setting to "always allow" full screen view. ([#5979](https://github.com/brave/browser-laptop/issues/5979))
- Added Ecosia as search engine. ([#7158](https://github.com/brave/browser-laptop/issues/7158))
- Added translation for bookmarks manager. ([#7130](https://github.com/brave/browser-laptop/issues/7130))
- Added new verified state for disabled publishers. ([#6974](https://github.com/brave/browser-laptop/issues/6974))
- Fixed lookup in dictionary by context menu. ([#7167](https://github.com/brave/browser-laptop/issues/7167))
- Fixed various UI issues. ([#7181](https://github.com/brave/browser-laptop/issues/7181))
- Fixed 'more bookmarks' menu item. ([#7097](https://github.com/brave/browser-laptop/issues/7097))
- Fixed Brave crash when Brave payment is disabled and enabled frequently. ([#7031](https://github.com/brave/browser-laptop/issues/7031))
- Fixed stutter/odd jump when tab switching with unloaded tabs. ([#6895](https://github.com/brave/browser-laptop/issues/6895))
- Fixed disable close button on tabs if tab size is too small. ([#5431](https://github.com/brave/browser-laptop/issues/5431))
- Fixed viewport regaining focus after closing downloads-bar. ([#3219](https://github.com/brave/browser-laptop/issues/3219))
- Fixed click target for Audio indicator on/off button. ([#1776](https://github.com/brave/browser-laptop/issues/1776))
- Fixed three-finger "Look up" tap. ([#1064](https://github.com/brave/browser-laptop/issues/1064))
- Fixed tabs don't resize with window. ([#100](https://github.com/brave/browser-laptop/issues/100))
- Upgraded to node 7.4.0. ([#7061](https://github.com/brave/browser-laptop/issues/7061))
- Upgrade muon to 2.56.3. ([#7173](https://github.com/brave/browser-laptop/issues/7173))
- Upgrade to Chromium v56.0.2924.76. ([#3681](https://github.com/brave/browser-laptop/issues/3681))


## [0.13.2](https://github.com/brave/browser-laptop/releases/v0.13.2dev)
- Added a way to keep tabs the same size when closing instead of resizing. ([#6088](https://github.com/brave/browser-laptop/issues/6088))
Expand Down
2 changes: 1 addition & 1 deletion app/browser/bookmarksExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function createBookmarkArray (sites, parentFolderId, first = true, depth = 1) {

if (first) payload.push(`${indentFirst}<DL><p>`)

filteredBookmarks.forEach((site) => {
filteredBookmarks.toList().sort(siteUtil.siteSort).forEach((site) => {
if (site.get('tags').includes(siteTags.BOOKMARK) && site.get('location')) {
title = site.get('customTitle') || site.get('title') || site.get('location')
payload.push(`${indentNext}<DT><A HREF="${site.get('location')}">${title}</A>`)
Expand Down
23 changes: 15 additions & 8 deletions app/common/lib/menuUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,19 @@ const isItemValid = (currentItem, previousItem) => {
return false
}
}
return currentItem && (typeof currentItem.l10nLabelId === 'string' || typeof currentItem.label === 'string' || currentItem.type === 'separator')

return currentItem && (typeof currentItem.l10nLabelId === 'string' || typeof currentItem.label === 'string' ||
currentItem.type === 'separator' || typeof currentItem.slice === 'function' || typeof currentItem.labelDataBind === 'string')
}

/**
* Remove invalid entries from a menu template:
* - null or falsey entries
* - extra menu separators
* - entries which don't have a label (or l10nLabelId) if their type is not 'separator'
*/
module.exports.sanitizeTemplateItems = (template) => {
const sanitizeTemplateItems = (template) => {
const reduced = template.reduce((result, currentValue, currentIndex, array) => {
const previousItem = result.length > 0
? result[result.length - 1]
: undefined
if (currentValue && currentValue.submenu) {
currentValue.submenu = sanitizeTemplateItems(currentValue.submenu)
}
if (isItemValid(currentValue, previousItem)) {
result.push(currentValue)
}
Expand All @@ -185,3 +184,11 @@ module.exports.sanitizeTemplateItems = (template) => {

return result
}

/**
* Remove invalid entries from a menu template:
* - null or falsey entries
* - extra menu separators
* - entries which don't have a label (or l10nLabelId) if their type is not 'separator'
*/
module.exports.sanitizeTemplateItems = sanitizeTemplateItems
5 changes: 5 additions & 0 deletions app/common/lib/randomUtil.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* 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/. */

module.exports.random = () => Math.random()
12 changes: 11 additions & 1 deletion app/crash-herald.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@
const appConfig = require('../js/constants/appConfig')
const crashReporter = require('electron').crashReporter

// buildConfig.js is built at package time, we need to require it in a try/catch
// block to trap for it not existing yet.
var buildConfig
try {
buildConfig = require('../js/constants/buildConfig')
} catch (e) {
buildConfig = {}
}

exports.init = () => {
const options = {
productName: 'Brave Developers',
companyName: 'Brave.com',
submitURL: appConfig.crashes.crashSubmitUrl,
autoSubmit: true,
extra: {
node_env: process.env.NODE_ENV
node_env: process.env.NODE_ENV,
rev: buildConfig.BROWSER_LAPTOP_REV || 'unknown'
}
}
crashReporter.start(options)
Expand Down
3 changes: 2 additions & 1 deletion app/extensions/brave/content/scripts/blockFlash.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* 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 adobeRegex = new RegExp('//(get\\.adobe\\.com/([a-z_-]+/)*flashplayer|www\\.macromedia\\.com/go/getflash|www\\.adobe\\.com/go/getflash)', 'i')
const adobeRegex =
new RegExp('//(get\\.adobe\\.com/([a-z_-]+/)*flashplayer|www\\.macromedia\\.com/go/getflash|www\\.adobe\\.com/go/getflash|helpx\\.adobe\\.com/flash-player/([a-z_-]+/)*flash-player)', 'i')

function blockFlashDetection () {
const handler = {
Expand Down
2 changes: 1 addition & 1 deletion app/extensions/brave/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- TODO: Don't allow img-src *, needed for favicons -->
<!-- TODO: Refactor away all unsafe-inline content -->
<!-- TODO: Replace suggestqueries.google.com and ac.duckduckgo.com and other search engines with a single config search engine -->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; form-action http://localhost:*; script-src 'self' http://localhost:*; connect-src 'self' https://s3.amazonaws.com/adblock-data/ https://s3.amazonaws.com/safe-browsing-data/ https://s3.amazonaws.com/tracking-protection-data/ https://s3.amazonaws.com/https-everywhere-data/ http://localhost:* ws://localhost:* https://suggestqueries.google.com https://ac.duckduckgo.com https://completion.amazon.com https://search.yahoo.com https://api.bing.com https://www.startpage.com https://infogalactic.com https://api.qwant.com https://brave-download.global.ssl.fastly.net https://brave-laptop-updates.global.ssl.fastly.net https://brave-download.global.ssl.fastly.net https://laptop-updates-pre.brave.com https://brave-laptop-updates-pre.brave.com; style-src 'unsafe-inline'; font-src 'self' http://localhost:*; img-src 'self' * data: file:; object-src 'self'; plugin-types application/browser-plugin">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; form-action http://localhost:*; script-src 'self' http://localhost:*; connect-src 'self' https://s3.amazonaws.com/adblock-data/ https://s3.amazonaws.com/safe-browsing-data/ https://s3.amazonaws.com/tracking-protection-data/ https://s3.amazonaws.com/https-everywhere-data/ http://localhost:* ws://localhost:* https://suggestqueries.google.com https://ac.duckduckgo.com https://completion.amazon.com https://search.yahoo.com https://api.bing.com https://www.startpage.com https://infogalactic.com https://api.qwant.com https://ac.ecosia.org https://brave-download.global.ssl.fastly.net https://brave-laptop-updates.global.ssl.fastly.net https://brave-download.global.ssl.fastly.net https://laptop-updates-pre.brave.com https://brave-laptop-updates-pre.brave.com; style-src 'unsafe-inline'; font-src 'self' http://localhost:*; img-src 'self' * data: file:; object-src 'self'; plugin-types application/browser-plugin">
<meta name="referrer" content="no-referrer">
<title>Brave</title>
<script src="ext/l20n.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion app/extensions/brave/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- TODO: Don't allow img-src *, needed for favicons -->
<!-- TODO: Refactor away all unsafe-inline content -->
<!-- TODO: Replace suggestqueries.google.com and ac.duckduckgo.com and other search engines with a single config search engine -->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; form-action http://localhost:*; script-src 'self'; img-src * data: file:; style-src 'self' 'unsafe-inline'; font-src 'self'; connect-src 'self' https://s3.amazonaws.com/adblock-data/ https://s3.amazonaws.com/safe-browsing-data/ https://s3.amazonaws.com/tracking-protection-data/ https://s3.amazonaws.com/https-everywhere-data/ https://suggestqueries.google.com https://ac.duckduckgo.com https://completion.amazon.com https://search.yahoo.com https://api.bing.com https://www.startpage.com https://infogalactic.com https://api.qwant.com https://brave-download.global.ssl.fastly.net https://brave-laptop-updates.global.ssl.fastly.net https://laptop-updates-pre.brave.com https://brave-laptop-updates-pre.brave.com; object-src 'self'; plugin-types application/browser-plugin"/>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; form-action http://localhost:*; script-src 'self'; img-src * data: file:; style-src 'self' 'unsafe-inline'; font-src 'self'; connect-src 'self' https://s3.amazonaws.com/adblock-data/ https://s3.amazonaws.com/safe-browsing-data/ https://s3.amazonaws.com/tracking-protection-data/ https://s3.amazonaws.com/https-everywhere-data/ https://suggestqueries.google.com https://ac.duckduckgo.com https://completion.amazon.com https://search.yahoo.com https://api.bing.com https://www.startpage.com https://infogalactic.com https://api.qwant.com https://ac.ecosia.org https://brave-download.global.ssl.fastly.net https://brave-laptop-updates.global.ssl.fastly.net https://laptop-updates-pre.brave.com https://brave-laptop-updates-pre.brave.com; object-src 'self'; plugin-types application/browser-plugin"/>
<meta name="referrer" content="no-referrer">
<title>Brave</title>
<script src="ext/l20n.min.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/bookmarks.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ allFolders=All Folders
addBookmarkFolder.title=Add Folder
addBookmark.title=Add Bookmark
exportBookmarks.title=Export bookmarks
title=Title
lastVisited=Last Visited
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,5 @@ notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
dashboardSettingsTitle=Dashboard
dashboardShowImages=Show images
25 changes: 21 additions & 4 deletions app/renderer/components/addEditBookmarkHanger.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const KeyCodes = require('../../common/constants/keyCodes')
const siteTags = require('../../../js/constants/siteTags')
const settings = require('../../../js/constants/settings')
const siteUtil = require('../../../js/state/siteUtil')
const UrlUtil = require('../../../js/lib/urlutil')
const getSetting = require('../../../js/settings').getSetting

class AddEditBookmarkHanger extends ImmutableComponent {
Expand Down Expand Up @@ -53,7 +54,9 @@ class AddEditBookmarkHanger extends ImmutableComponent {
: 'bookmarkAdded'
}
get isFolder () {
return siteUtil.isFolder(this.props.currentDetail)
// Fake a folderId property so that the bookmark is considered a bookmark folder.
// This is ImmutableJS so it doesn't actually set a value, it just returns a new one.
return siteUtil.isFolder(this.props.currentDetail.set('folderId', 0))
}
setDefaultFocus () {
this.bookmarkName.select()
Expand Down Expand Up @@ -95,15 +98,29 @@ class AddEditBookmarkHanger extends ImmutableComponent {
}
onNameChange (e) {
let currentDetail = this.props.currentDetail
if (currentDetail.get('title') === e.target.value && e.target.value) {
let name = e.target.value
if (typeof name === 'string' && UrlUtil.isURL(name)) {
const punycodeUrl = UrlUtil.getPunycodeUrl(name)
if (punycodeUrl.replace(/\/$/, '') !== name) {
name = punycodeUrl
}
}
if (currentDetail.get('title') === name && name) {
currentDetail = currentDetail.delete('customTitle')
} else {
currentDetail = currentDetail.set('customTitle', e.target.value)
currentDetail = currentDetail.set('customTitle', name)
}
windowActions.setBookmarkDetail(currentDetail, this.props.originalDetail, this.props.destinationDetail, this.props.shouldShowLocation, !this.props.isModal)
}
onLocationChange (e) {
const currentDetail = this.props.currentDetail.set('location', e.target.value)
let location = e.target.value
if (typeof location === 'string') {
const punycodeUrl = UrlUtil.getPunycodeUrl(location)
if (punycodeUrl.replace(/\/$/, '') !== location) {
location = punycodeUrl
}
}
const currentDetail = this.props.currentDetail.set('location', location)
windowActions.setBookmarkDetail(currentDetail, this.props.originalDetail, this.props.destinationDetail, this.props.shouldShowLocation, !this.props.isModal)
}
onParentFolderChange (e) {
Expand Down
6 changes: 6 additions & 0 deletions app/renderer/components/bookmarksToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ class BookmarkToolbarButton extends ImmutableComponent {
this.onDragOver = this.onDragOver.bind(this)
this.onContextMenu = this.onContextMenu.bind(this)
}
componentDidMount () {
this.bookmarkNode.addEventListener('auxclick', this.onAuxClick.bind(this))
}
get activeFrame () {
return windowStore.getFrame(this.props.activeFrameKey)
}
onAuxClick (e) {
this.onClick(e)
}
onClick (e) {
if (!this.props.clickBookmarkItem(this.props.bookmark, e) &&
this.props.bookmark.get('tags').includes(siteTags.BOOKMARK_FOLDER)) {
Expand Down
7 changes: 2 additions & 5 deletions app/renderer/components/preferences/paymentsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ const getSetting = require('../../../../js/settings').getSetting
const settings = require('../../../../js/constants/settings')
const ModalOverlay = require('../../../../js/components/modalOverlay')
const coinbaseCountries = require('../../../../js/constants/coinbaseCountries')
const {changeSetting} = require('../../lib/settingsUtil')
const moment = require('moment')
moment.locale(navigator.language)

// Components
const Button = require('../../../../js/components/button')
const {FormTextbox, RecoveryKeyTextbox} = require('../textbox')
const {FormDropdown, SettingDropdown} = require('../dropdown')
const {SettingsList, SettingItem, SettingCheckbox} = require('../settings')

class PaymentsTab extends ImmutableComponent {
constructor () {
Expand Down Expand Up @@ -228,7 +230,6 @@ class PaymentsTab extends ImmutableComponent {
get advancedSettingsContent () {
const minDuration = this.props.ledgerData.getIn(['synopsisOptions', 'minDuration'])
const minPublisherVisits = this.props.ledgerData.getIn(['synopsisOptions', 'minPublisherVisits'])
const {SettingsList, SettingItem, SettingCheckbox, changeSetting} = require('../../../../js/about/preferences')

return <div className='board'>
<div className='panel advancedSettings'>
Expand Down Expand Up @@ -326,8 +327,6 @@ class PaymentsTab extends ImmutableComponent {
}

get ledgerRecoveryContent () {
const {SettingsList, SettingItem} = require('../../../../js/about/preferences')

const l10nDataArgs = {
balance: this.btcToCurrencyString(this.props.ledgerData.get('balance'))
}
Expand Down Expand Up @@ -476,7 +475,6 @@ class PaymentsTab extends ImmutableComponent {
}

get enabledContent () {
const {SettingsList, SettingItem, changeSetting} = require('../../../../js/about/preferences')
// TODO: report when funds are too low
// TODO: support non-USD currency
return <div>
Expand Down Expand Up @@ -541,7 +539,6 @@ class PaymentsTab extends ImmutableComponent {
}

render () {
const {SettingCheckbox} = require('../../../../js/about/preferences')
return <div className='paymentsContainer'>
{
this.enabled && this.props.addFundsOverlayVisible
Expand Down
9 changes: 2 additions & 7 deletions app/renderer/components/publisherToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class PublisherToggle extends ImmutableComponent {

get shouldShowAddPublisherButton () {
if ((!!this.hostSettings || !!this.validPublisherSynopsis) && this.visiblePublisher) {
// Only show publisher icon if autoSuggest option is OFF
return !getSetting(settings.AUTO_SUGGEST_SITES)
// Only show publisher icon if ledger is enabled
return getSetting(settings.PAYMENTS_ENABLED)
}
return false
}
Expand All @@ -89,11 +89,6 @@ class PublisherToggle extends ImmutableComponent {
}

onAuthorizePublisher () {
// if payments disabled, enable it
if (!getSetting(settings.AUTO_SUGGEST_SITES)) {
appActions.changeSetting(settings.PAYMENTS_ENABLED, true)
}

this.authorizedPublisher
? appActions.changeSiteSetting(this.hostPattern, 'ledgerPayments', false)
: appActions.changeSiteSetting(this.hostPattern, 'ledgerPayments', true)
Expand Down
71 changes: 70 additions & 1 deletion app/renderer/components/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

const React = require('react')
const ImmutableComponent = require('../../../js/components/immutableComponent')
const aboutActions = require('../../../js/about/aboutActions')
const getSetting = require('../../../js/settings').getSetting
const {changeSetting} = require('../lib/settingsUtil')
const SwitchControl = require('../../../js/components/switchControl')

class SettingsList extends ImmutableComponent {
render () {
Expand Down Expand Up @@ -33,7 +37,72 @@ class SettingItem extends ImmutableComponent {
}
}

class SettingCheckbox extends ImmutableComponent {
constructor () {
super()
this.onClick = this.onClick.bind(this)
}

onClick (e) {
if (this.props.disabled) {
return
}
return this.props.onChange ? this.props.onChange(e) : changeSetting(this.props.onChangeSetting, this.props.prefKey, e)
}

render () {
const props = {
style: this.props.style,
className: 'settingItem'
}
if (this.props.id) {
props.id = this.props.id
}
return <div {...props}>
<SwitchControl id={this.props.prefKey}
small={this.props.small}
disabled={this.props.disabled}
onClick={this.onClick}
checkedOn={this.props.checked !== undefined ? this.props.checked : getSetting(this.props.prefKey, this.props.settings)} />
<label data-l10n-id={this.props.dataL10nId} htmlFor={this.props.prefKey} />
{this.props.options}
</div>
}
}

class SiteSettingCheckbox extends ImmutableComponent {
constructor () {
super()
this.onClick = this.onClick.bind(this)
}

onClick (e) {
if (this.props.disabled || !this.props.hostPattern) {
return
} else {
const value = !!e.target.value
value === this.props.defaultValue
? aboutActions.removeSiteSetting(this.props.hostPattern,
this.props.prefKey)
: aboutActions.changeSiteSetting(this.props.hostPattern,
this.props.prefKey, value)
}
}

render () {
return <div style={this.props.style} className='settingItem siteSettingItem'>
<SwitchControl
small={this.props.small}
disabled={this.props.disabled}
onClick={this.onClick}
checkedOn={this.props.checked} />
</div>
}
}

module.exports = {
SettingsList,
SettingItem
SettingItem,
SettingCheckbox,
SiteSettingCheckbox
}
Loading

0 comments on commit d981e74

Please sign in to comment.