Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelklehr committed Apr 6, 2018
2 parents 23dbbaf + d9a5d84 commit 294dbb1
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v2.0.6
- FIX: Correctly escape paths in tags
- FIX: Wait a certain time before starting sync when detecting changes
- FIX: first run routine was called on every startup

## v2.0.5
- FIX: Display sync folder path

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ You can [install it via the Chrome Web store](https://chrome.google.com/webstore
Alternatively, you can still install it by [downloading the Chrome package from the latest release](https://github.com/marcelklehr/floccus/releases/) and dropping it into Chrome's extension page.



#### Updating from 1.x to v2.0
It is recommended to remove all of your bookmarks from your accounts before updating floccus, deleting them and after updating to reconnect them again, in order to prevent unforeseen problems!

Expand Down Expand Up @@ -75,7 +76,7 @@ Nonetheless, I've chosen to utilize the WebExtensions API for implementing this
4. The incomplete data format (\#3) is an open problem, but doesn't impact the synchronization of the remaining accessible data.
5. The inability to exclude folders from sync in 3rd-party extensions (\#4) is a problem, but manageable when users are able to manually choose folders to ignore. (Currently not implemented)
6. The lack of safe write operations (\#5) can be dealt with similarly to the missing transaction support: Changes made during sync could lead to an unintended but consistent state, which can be resolved manually. Additionally, precautions are taken to prevent this.
7. In order to avoid syncing prematurely (\#6) floccus can employ a timeout to wait until all pending bookmarks operations are done. (Currently not implemented.)
7. In order to avoid syncing prematurely (\#6) floccus employs a timeout to wait until all pending bookmarks operations are done.

## What's with the name?
[Cirrus floccus](https://en.wikipedia.org/wiki/Cirrus_floccus) is a type of cloud, that <del>can sync your browser data</del> looks very nice.
Expand Down
41 changes: 39 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@ var gulp = require('gulp')
var browserify = require('browserify')
var babelify = require('babelify')
var tap = require('gulp-tap')
var zip = require('gulp-zip')

const VERSION = require('./package.json').version
const paths = {
zip: [
'dist/*'
, 'icons/*'
, 'views/*'
, 'CHANGELOG.md'
, 'README.md'
, 'manifest.json'
, 'package.json'
, 'LICENSE.txt'
]
, views: './views/*.html'
, entries: 'src/entries/*.js'
, js: 'src/*'
}

gulp.task('default', ['html', 'js', '3rd-party'])

gulp.task('js', function () {
return gulp.src('src/entries/*.js', {read: false}) // no need of reading file because browserify does.
return gulp.src(paths.entries, {read: false}) // no need of reading file because browserify does.
// transform file objects using gulp-tap plugin
.pipe(tap(function (file) {
// replace file contents with browserify's bundle stream
Expand All @@ -28,7 +46,7 @@ gulp.task('js', function () {
})

gulp.task('html', function () {
return gulp.src('./views/*.html').pipe(gulp.dest('./dist/html/'))
return gulp.src(paths.views).pipe(gulp.dest('./dist/html/'))
})

gulp.task('3rd-party', ['polyfill', 'mocha'])
Expand All @@ -45,3 +63,22 @@ gulp.task('mochajs', function () {
gulp.task('mochacss', function () {
return gulp.src('./node_modules/mocha/mocha.css').pipe(gulp.dest('./dist/css/'))
})

gulp.task('release', ['zip', 'xpi'])

gulp.task('zip', ['default'], function () {
gulp.src(paths.zip)
.pipe(zip(`floccus-build-v${VERSION}.zip`))
.pipe(gulp.dest('../'))
})

gulp.task('xpi', ['default'], function () {
gulp.src(paths.zip)
.pipe(zip(`floccus-build-v${VERSION}.xpi`))
.pipe(gulp.dest('../'))
})

gulp.task('watch', function () {
gulp.watch(paths.js, ['js'])
gulp.watch(paths.views, ['html'])
})
Binary file modified icons/logo_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 img/promotional-tile-maqruee.xcf
Binary file not shown.
Binary file added img/promotional-tile-marquee.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 img/promotional-tile-medium.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 img/promotional-tile-medium.xcf
Binary file not shown.
Binary file added img/promotional-tile-small.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 img/promotional-tile-small.xcf
Binary file not shown.
Binary file added img/screen_chrome_account.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 img/screen_chrome_folderpicker.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 img/screen_chrome_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"manifest_version": 2,
"name": "Floccus (nextcloud Sync)",
"short_name": "Floccus",
"version": "2.0.5",
"description": "Sync your browser with nextcloud (currently only bookmarks; more to come)",
"name": "floccus",
"short_name": "floccus",
"version": "2.0.6",
"description": "Sync your bookmarks with nextcloud",
"icons": {
"48": "icons/logo.png"
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "floccus",
"version": "2.0.5",
"description": "The goal of this project is to build a browser extension that syncs your browser data with [OwnCloud](http://owncloud.org).",
"version": "2.0.6",
"description": "Sync your bookmarks with nextcloud",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -28,6 +28,7 @@
"chai-as-promised": "^7.1.1",
"gulp": "^3.9.1",
"gulp-tap": "^1.0.1",
"gulp-zip": "^4.1.0",
"mocha": "^5.0.4",
"through2": "^2.0.3"
},
Expand Down
26 changes: 14 additions & 12 deletions src/entries/background-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import packageJson from '../../package.json'
const STATUS_ERROR = Symbol('error')
const STATUS_SYNCING = Symbol('syncing')
const STATUS_ALLGOOD = Symbol('allgood')
const INACTIVITY_TIMEOUT = 1000 * 60

class AlarmManger {
constructor (ctl) {
Expand All @@ -26,6 +27,7 @@ class AlarmManger {
class Controller {
constructor () {
this.syncing = {}
this.schedule = {}

this.alarms = new AlarmManger(this)

Expand All @@ -45,31 +47,24 @@ class Controller {
window.syncAccount = (accountId) => this.syncAccount(accountId)
this.setEnabled(true)

browser.storage.local.get('notFirstRun')
.then((d) => d.notFirstRun || this.firstRun())
.catch(() => this.firstRun())

browser.storage.local.get('currentVersion')
.then(async currentVersion => {
if (packageJson.version === currentVersion) return
.then(async d => {
if (packageJson.version === d.currentVersion) return
const accounts = await Account.getAllAccounts()
await Promise.all(
accounts.map(account => account.init())
)
await browser.storage.local.set({
currentVersion: packageJson.version
})
browser.runtime.openOptionsPage()
})
}

setEnabled (enabled) {
this.enabled = enabled
}

firstRun () {
browser.runtime.openOptionsPage()
}

async onchange (localId, details) {
if (!this.enabled) {
return
Expand All @@ -92,7 +87,7 @@ class Controller {

// We should now sync all accounts that are involved in this change (2 at max)
accountsToSync.forEach((account) => {
this.syncAccount(account.id)
this.scheduleSyncAccount(account.id)
})

var ancestors
Expand All @@ -106,8 +101,15 @@ class Controller {
if (containingAccount &&
!this.syncing[containingAccount.id] &&
!accountsToSync.some(acc => acc.id === containingAccount.id)) {
this.syncAccount(containingAccount.id)
this.scheduleSyncAccount(containingAccount.id)
}
}

scheduleSyncAccount (accountId) {
if (this.schedule[accountId]) {
clearTimeout(this.schedule[accountId])
}
this.schedule[accountId] = setTimeout(() => this.syncAccount(accountId), INACTIVITY_TIMEOUT)
}

syncAccount (accountId) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class Tree {
if (!node.children) {
return
}
const descendantPath = parentPath + '/' + node.title.replace('/', '\\/')
const descendantPath = parentPath + '/' + node.title.replace(/[/]/g, '\\/')

await Promise.all(
node.children
Expand Down
4 changes: 4 additions & 0 deletions src/lib/adapters/Nextcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ export default class NextcloudAdapter {
.reverse()
.map(str => reverseStr(str).replace(/>/g, '\\>'))
.join('>')
.replace(/%2C/g, '%252C')
.replace(/,/g, '%2C') // encodeURIComponent(',') == '%2C'
}

static convertTagToPath (tag) {
Expand All @@ -353,6 +355,8 @@ export default class NextcloudAdapter {
.reverse()
.map(str => reverseStr(str).replace(/\\>/g, '>'))
.join('/')
.replace(/%2C/g, ',') // encodeURIComponent(',') == '%2C'
.replace(/%252C/g, '%2C')
}
}

Expand Down

0 comments on commit 294dbb1

Please sign in to comment.