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

Add sync #6882

Merged
merged 64 commits into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3d0fb35
Revert "Convert background page to event page"
diracdeltas Jan 4, 2017
abb9eea
start integration with brave/sync/feature/syncing
diracdeltas Dec 21, 2016
a38865d
set object ids on bookmarks and history
diracdeltas Jan 4, 2017
0661451
Send site settings and bookmarks when sync starts up
diracdeltas Jan 5, 2017
5778210
auto update to latest sync/staging
diracdeltas Jan 5, 2017
62e1d31
make travis download the sync client bundle
diracdeltas Jan 5, 2017
3f426cb
fix failing siteUtil unit test
diracdeltas Jan 6, 2017
3587172
Save sync init data as Immutable.List instead of Uint8Array
diracdeltas Jan 6, 2017
2405b52
change RECEIVE_SYNC_RECORDS to GET_EXISTING_OBJECTS
diracdeltas Jan 9, 2017
980b1ea
sync site settings, add SYNC_CLEAR HISTORY
diracdeltas Jan 10, 2017
1e12b9b
add pref for sync
diracdeltas Jan 12, 2017
4f16d95
Sync: Update appState with Sync bookmark records
ayumi Jan 10, 2017
3284b51
Add Sync logo
ayumi Jan 12, 2017
f3b1a57
move setObjectId from syncUtil to siteUtil to avoid dependency problems
diracdeltas Jan 12, 2017
08c913a
Fix SYNC_CLEAR_HISTORY
ayumi Jan 12, 2017
6d31ee9
Fix applying Create bookmark folders
ayumi Jan 13, 2017
71f090a
add sync QR code and setup options
diracdeltas Jan 13, 2017
502ea23
Add DELETE_SYNC_SITE_SETTINGS, decrease sync interval
diracdeltas Jan 17, 2017
610ecbd
Fix syncing pinned sites
ayumi Jan 19, 2017
985e9c3
Sync siteSettings with browser data
ayumi Jan 18, 2017
934acb5
allow browser-laptop to join an existing sync profile
diracdeltas Jan 19, 2017
8bfc8fa
On Sync init only send siteSettings without objectId
ayumi Jan 20, 2017
65a8764
Sync: Apply records asynchronously
ayumi Jan 23, 2017
41a997e
Fix Sync objectId generation when disabled
ayumi Jan 30, 2017
81c66d0
siteUtil.getFolder() by folderId
ayumi Jan 24, 2017
bf9f40d
Sync initial bookmarks in order
ayumi Jan 24, 2017
85c8126
Merge pull request #6832 from brave/feature/syncing-bookmarks-order
diracdeltas Jan 30, 2017
52b1dc8
Mock sync to be enabled in siteUtilTest
diracdeltas Jan 30, 2017
7c6cc79
Merge remote-tracking branch 'origin/master' into feature/syncing
diracdeltas Jan 31, 2017
6ce74fd
fix failing unittests
diracdeltas Jan 31, 2017
507564c
Change syncUtil to use site Map instead of List
diracdeltas Jan 31, 2017
620cffc
Sync initial bookmarks in order
ayumi Feb 1, 2017
a0045fe
Merge pull request #6964 from brave/feature/syncing-bookmarks-order-2
diracdeltas Feb 1, 2017
69e449f
Merge remote-tracking branch 'origin/master' into feature/syncing
diracdeltas Feb 1, 2017
4a6c304
Merge remote-tracking branch 'origin/master' into feature/syncing
ayumi Feb 3, 2017
1380d48
Merge remote-tracking branch 'origin/master' into feature/syncing
ayumi Feb 3, 2017
8eb2d4a
Fix syncing bookmarks, folders and history
ayumi Feb 4, 2017
bad3f11
implement restartless sync
diracdeltas Jan 26, 2017
4074874
Merge pull request #7086 from brave/feature/restartless-sync
diracdeltas Feb 7, 2017
f980210
Test bookmark Sync
ayumi Feb 6, 2017
6b555ce
Merge pull request #7118 from brave/feature/syncing-test-bookmarks
ayumi Feb 8, 2017
fe4b7ee
Test syncing history and site settings
ayumi Feb 8, 2017
eea6318
Test syncing bookmark folders; fix removing folder childs
ayumi Feb 8, 2017
3d20e69
Merge pull request #7136 from brave/feature/syncing-test-history-site…
ayumi Feb 9, 2017
ed176a6
Add the sweet sync logo to the extension
ayumi Feb 9, 2017
4dc48df
Fix restartless sync on first device setup
diracdeltas Feb 9, 2017
f392fad
Test syncing can be turned off; private history does not sync
ayumi Feb 9, 2017
375ba5d
friendlier device name input UI
diracdeltas Feb 10, 2017
7dad719
Syncing styling
ayumi Feb 10, 2017
2d43d47
Merge pull request #7145 from brave/feature/syncing-tests-3
ayumi Feb 10, 2017
04af333
Merge pull request #7152 from brave/feature/syncing-styling
diracdeltas Feb 10, 2017
7f1e79f
disable sync restore button until code words are entered
diracdeltas Feb 11, 2017
4cd74b0
Merge remote-tracking branch 'origin/master' into feature/syncing
diracdeltas Feb 11, 2017
a66f921
fix issues related to merge and sync default naming
diracdeltas Feb 11, 2017
a80b05b
Adjust width of sync toggle pref / device name
ayumi Feb 13, 2017
7c59a85
Merge remote-tracking branch 'origin/master' into feature/syncing
ayumi Feb 14, 2017
8c39e18
guard against same objectId set on bookmark and history site
ayumi Feb 14, 2017
1a69b53
Sync bookmarks in order during initial sync
ayumi Feb 13, 2017
0239612
Merge pull request #7236 from brave/feature/syncing-bookmarks-existing
diracdeltas Feb 14, 2017
4984218
Merge remote-tracking branch 'origin/master' into feature/syncing
ayumi Feb 14, 2017
2618188
Remove Sync test pauses
ayumi Feb 14, 2017
d132bdf
Remove deprecated sync record field Bookmark.index
ayumi Feb 14, 2017
7c4aeb8
Prepare Sync for packaging
ayumi Feb 15, 2017
7809a0a
Merge pull request #7247 from brave/feature/syncing-auto-dl-lib
diracdeltas Feb 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ httpse.leveldb

# webstrom
.idea

# sync bundle file should be built and copied from the brave/sync repo for now
app/extensions/brave/content/scripts/sync.js
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- npm run download-sync-client
- npm run lint && npm test
notifications:
slack:
Expand Down
58 changes: 55 additions & 3 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ let generateBraveManifest = () => {
// allow access to webpack dev server resources
let devServer = 'localhost:' + process.env.npm_package_config_port
cspDirectives['default-src'] = '\'self\' http://' + devServer
cspDirectives['connect-src'] = '\'self\' http://' + devServer + ' ws://' + devServer
cspDirectives['connect-src'] = ['\'self\'',
'http://' + devServer,
'ws://' + devServer].join(' ')
cspDirectives['style-src'] = '\'self\' \'unsafe-inline\' http://' + devServer
}

Expand Down Expand Up @@ -211,6 +213,43 @@ let generateTorrentManifest = () => {
}
}

let generateSyncManifest = () => {
let cspDirectives = {
'default-src': '\'self\'',
'form-action': '\'none\'',
'style-src': '\'self\' \'unsafe-inline\''
}
cspDirectives['connect-src'] = ['\'self\'',
appConfig.sync.serverUrl,
appConfig.sync.s3Url].join(' ')

if (process.env.NODE_ENV === 'development') {
// allow access to webpack dev server resources
let devServer = 'localhost:' + process.env.npm_package_config_port
cspDirectives['default-src'] += 'http://' + devServer
cspDirectives['connect-src'] += ' http://' + devServer + ' ws://' + devServer
cspDirectives['style-src'] += 'http://' + devServer
}

return {
name: 'Brave Sync',
manifest_version: 2,
version: '1.0',
content_security_policy: concatCSP(cspDirectives),
content_scripts: [],
background: {
scripts: [ 'content/scripts/sync.js' ]
},
icons: {
128: 'img/sync-128.png',
48: 'img/sync-48.png',
16: 'img/sync-16.png'
},
incognito: 'spanning',
key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxOmBmOVzntEY6zrcrGSAyrhzL2FJt4FaP12nb899+SrV0LgpOgyqDjytuXT5IlHS74j7ZK2zTOTQy5/E9hqo6ioi1GA3PQU8E71DTaN6kW+XzP+VyZmgPoQHIxPg8jkYk/H4erfP9kMhkVOtu/XqDTqluNhOT0BvVlBpWd4unTQFWdgpCYlPrI6PsYya4FSuIDe6rCKtJABfuKFEr7U9d9MNAOJEnRS8vdBHWCuhWHqsfAaAPyKHQhnwFSFZ4eB+JznBQf7cQtB3EpOoBElyR9QvmbWFrYu87eGL5XxsojKHCrxlQ4X5ANsALa1Mdd2DHDMVqLMIiEEU42DVB0ZDewIDAQAB'
}
}

const extensionInfo = {
isEnabled: function (extensionId) {
return this.extensionState[extensionId] === extensionStates.ENABLED
Expand Down Expand Up @@ -290,13 +329,24 @@ module.exports.init = () => {
}
})

process.on('reload-sync-extension', () => {
console.log('reloading sync')
disableExtension(config.syncExtensionId)
})

process.on('extension-load-error', (error) => {
console.error(error)
})

process.on('extension-unloaded', (extensionId) => {
extensionInfo.setState(extensionId, extensionStates.DISABLED)
extensionActions.extensionDisabled(extensionId)
if (extensionId === config.syncExtensionId) {
// Reload sync extension to restart the background script
setImmediate(() => {
enableExtension(config.syncExtensionId)
})
}
})

process.on('extension-ready', (installInfo) => {
Expand All @@ -311,7 +361,7 @@ module.exports.init = () => {
let loadExtension = (extensionId, extensionPath, manifest = {}, manifestLocation = 'unpacked') => {
if (!extensionInfo.isLoaded(extensionId) && !extensionInfo.isLoading(extensionId)) {
extensionInfo.setState(extensionId, extensionStates.LOADING)
if (extensionId === config.braveExtensionId || extensionId === config.torrentExtensionId) {
if (extensionId === config.braveExtensionId || extensionId === config.torrentExtensionId || extensionId === config.syncExtensionId) {
session.defaultSession.extensions.load(extensionPath, manifest, manifestLocation)
return
}
Expand Down Expand Up @@ -357,6 +407,8 @@ module.exports.init = () => {
// Manually install the braveExtension and torrentExtension
extensionInfo.setState(config.braveExtensionId, extensionStates.REGISTERED)
loadExtension(config.braveExtensionId, getExtensionsPath('brave'), generateBraveManifest(), 'component')
extensionInfo.setState(config.syncExtensionId, extensionStates.REGISTERED)
loadExtension(config.syncExtensionId, getExtensionsPath('brave'), generateSyncManifest(), 'unpacked')
if (getSetting(settings.TORRENT_VIEWER_ENABLED)) {
extensionInfo.setState(config.torrentExtensionId, extensionStates.REGISTERED)
loadExtension(config.torrentExtensionId, getExtensionsPath('torrent'), generateTorrentManifest(), 'component')
Expand All @@ -365,7 +417,7 @@ module.exports.init = () => {
extensionActions.extensionDisabled(config.torrentExtensionId)
}

let registerComponents = () => {
let registerComponents = (diff) => {
if (getSetting(settings.PDFJS_ENABLED)) {
registerComponent(config.PDFJSExtensionId)
} else {
Expand Down
Binary file added app/extensions/brave/img/sync-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/brave/img/sync-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/brave/img/sync-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 23 additions & 1 deletion app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ paymentsSidebarText1=Our Partners
paymentsSidebarText2=All transaction IP addresses are anonymized with technology from:
paymentsSidebarText3=Brave Bitcoin Wallets are provided through a partnership with:
paymentsSidebarText4=Your contributions in the form of credit cards and bank cards are handled by:
syncTitle=Brave Sync
syncTitleMessage=Sync encrypted browser data between your devices securely and privately using Brave Sync.
syncEnable=Sync this device
syncData=Sync Data
syncDataMessage=Sync the following data from this device:
syncDeviceName=Device name
syncBookmarks=Bookmarks
syncHistory=Browsing history
syncSiteSettings=Saved site settings
syncNewDevice=Sync a new device...
syncStart=I am new to sync
syncAdd=I have an existing sync code
syncNewDevice1=Open Brave on your new device and go to Preferences > Sync > 'I have an existing synced device'.
syncNewDevice2=If it asks you to scan a QR code, click the button below and point your camera at the QR code.
syncShowQR=Show secret QR code. (Do not share!)
syncHideQR=Hide QR code
syncNewDevice3=If asks you to enter code words, type in the words below.
syncShowPassphrase=Show secret code words. (Do not share!)
syncHidePassphrase=Hide code words
syncDeviceNameInput=Enter an optional name for this device:
syncCreate=Set up sync
syncEnterPassphrase=Enter your sync code words:
accountBalance=account balance
accountBalanceConnectionError=Please check your Internet connection.
accountBalanceLoading=loading…
Expand All @@ -44,7 +66,6 @@ insufficientFundsStatus=Your account balance is under your budget for this month
defaultWalletStatus=Thanks for helping support your favorite websites!
tableEmptyText=No table data.
notificationEmptyText=Top publisher visits
syncEmptyText=Sync settings coming soon.
bitcoin=Bitcoin
bitcoinAdd=Use your existing Bitcoin wallet/account
bitcoinAddDescription=Use any BTC wallet that can transfer Bitcoin to your Brave wallet.
Expand Down Expand Up @@ -249,6 +270,7 @@ engineGoKey=Engine Go Key (type first)
braveSoftware=Brave Software
emailAddress=Email address
viewLog=View Log
comingSoon=Coming soon!
setDefaultButton=Set as default…
setDefaultLabel=Brave is not your default browser:
setDefaultAlwaysSwitch=Always check on startup
Expand Down
2 changes: 2 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const contentSettings = require('../js/state/contentSettings')
const privacy = require('../js/state/privacy')
const async = require('async')
const settings = require('../js/constants/settings')
const sync = require('./sync')
const BookmarksExporter = require('./browser/bookmarksExporter')

app.commandLine.appendSwitch('enable-features', 'BlockSmallPluginContent,PreferHtmlOverPlugins')
Expand Down Expand Up @@ -414,6 +415,7 @@ app.on('ready', () => {
delete initialState.perWindowState
appActions.setState(Immutable.fromJS(initialState))
Menu.init(initialState, null)
sync.init(initialState.sync || {})
return loadedPerWindowState
}).then((loadedPerWindowState) => {
contentSettings.init()
Expand Down
Loading