Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0f99ec6
Titles of horizontal separators are better visible consecutive lines.
macrogreg Jan 26, 2025
67d30bb
Create vertical separators on the Bookmarks Bar
macrogreg Jan 27, 2025
6f95334
Tests for vertical separators on the Bookmarks Bar
macrogreg Jan 27, 2025
785f2a7
Translate _locales/en/messages.json in zh_CN
transifex-integration[bot] Jan 27, 2025
a199cb7
Fix typos
macrogreg Jan 27, 2025
1341d31
For local development for Firefox.
peter-lyons-kehl Jan 27, 2025
9e3eacd
Merge pull request #1848 from peter-lyons-kehl/manifest-firefox-override
marcelklehr Jan 27, 2025
b9a2add
Fix indentation
macrogreg Jan 28, 2025
d81610c
Fix trailing spaces
macrogreg Jan 28, 2025
b64822a
Fix link issues in files unrelated to overall change
macrogreg Jan 28, 2025
fc13881
Add Win-specific npm build scripts
macrogreg Jan 28, 2025
460c9cc
Merge branch 'bookmarks-bar-separators' of github.com:macrogreg/flocc…
marcelklehr Jan 30, 2025
3dce2a9
fix(BrowserTree#getBookmarksTree): Pass parent node to next recursion
marcelklehr Jan 30, 2025
6d20625
fix(separator tests): Set correct separator ids and create artificial…
marcelklehr Jan 30, 2025
bab3214
Make sure that only the actual toolbar gets separator special casing
macrogreg Jan 31, 2025
ce0da59
Add a unit test to validate that separators are converted correctly
macrogreg Jan 31, 2025
f8fe422
Delete files that cause sync artifacts
macrogreg Jan 31, 2025
b01c149
Reset files that caused sync artifacts
macrogreg Jan 31, 2025
88389ef
Include separator improvements in changelog.
macrogreg Jan 31, 2025
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
4 changes: 2 additions & 2 deletions _locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@
"message": "密码"
},
"LabelBookmarksfile": {
"message": "书签路径"
"message": "书签文件"
},
"DescriptionBookmarksfile": {
"message": "相对于WebDAV URL的书签路径(所有路径必须已经存在).例如:personal_stuff/bookmarks.xbel "
},
"DescriptionBookmarksfilegoogle": {
"message": "书签文件的文件名,该文件将存放在 Google Drive 中(确保该名称在 Google Drive 中是唯一的)。"
"message": " Google 云盘内保存的书签文件的名称。不要输入完整的文件路径,只输入文件名即可。请确保该名称在你的 Google 云盘内是唯一的。"
},
"DescriptionBookmarksfilegit": {
"message": "相对于你的 Git 存储库根目录的书签文件路径 (路径中的所有文件夹必须都已存在)。如,personal_stuff/bookmarks.xbel"
Expand Down
30 changes: 30 additions & 0 deletions manifest-firefox-override.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/sh

# Local development workaround for Firefox.
#
# Once you build this extension (with `npm install` and `npm run build`, as per <README.md>), to
# load it, visit Firefox special URL about:debugging#/runtime/this-firefox. Click button "Load
# Temporary Add-on..." That button shows a file/folder picker.
#
# Problem: The file picker does allow you to select `manifest.firefox.json`, BUT it will not load
# it. It loads `manifest.json` (from the directory where you selected `manifest.firefox.json`)
# instead. (Indeed, a Firefox defect - but life is too short for us to waste it on Mozilla's
# bugzilla....)
#
# Firefox doesn't allow to use symlinks to workaround the above problem (see
# https://bugzilla.mozilla.org/show_bug.cgi?id=803999 - symlinks are a security problem).
#
# Workaround: This script
# 1. copies manifest.firefox.json over manifest.json
# 2. prevents that change from being accidentally committed to GIT.

# Enter the directory where this script is (in case we call it from somewhere else).
cd "${0%/*}"

# Invoking `/usr/bin/cp` directly, in case there's an alias that warns about overriding existing
# files.
/usr/bin/cp manifest.firefox.json manifest.json

# See also
# https://stackoverflow.com/questions/13630849/git-difference-between-assume-unchanged-and-skip-worktree
git update-index --skip-worktree manifest.json
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"description": "Sync your bookmarks privately across browsers and devices",
"scripts": {
"build": "NODE_OPTIONS=--max-old-space-size=5000 gulp",
"build-win": "SET NODE_OPTIONS=--max-old-space-size=5000 & gulp",
"build-release": "NODE_OPTIONS=--max-old-space-size=5000 gulp release",
"build-release-win": "SET NODE_OPTIONS=--max-old-space-size=5000 & gulp release",
"watch": "NODE_OPTIONS=--max-old-space-size=5000 gulp watch",
"watch-win": "SET NODE_OPTIONS=--max-old-space-size=5000 & gulp watch",
"test": "node --unhandled-rejections=strict test/selenium-runner.js",
"lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix"
Expand Down
25 changes: 16 additions & 9 deletions src/lib/browser/BrowserTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export default class BrowserTree implements IResource<typeof ItemLocation.LOCAL>
await this.absoluteRootPromise
const allAccounts = await (await Account.getAccountClass()).getAllAccounts()

const recurse = (node, parentId?, rng?) => {
const recurse = (node, parentId?, isOnToolbar?, rng?) => {
const TITLE_BOOKMARKS_BAR = 'Bookmarks Bar',
TITLE_OTHER_BOOKMARKS = 'Other Bookmarks',
TITLE_BOOKMARKS_MENU = 'Bookmarks Menu',
TITLE_MOBILE_BOOKMARKS = 'Mobile Bookmarks'
if (
allAccounts.some(
acc => acc.getData().localRoot === node.id && String(node.id) !== String(this.rootId) && !acc.getData().nestedSync
Expand All @@ -49,22 +53,23 @@ export default class BrowserTree implements IResource<typeof ItemLocation.LOCAL>
// This is the root folder of a different account and the user doesn't want nested sync
return
}
let overrideTitle, isRoot
let overrideTitle, isRoot, isToolbar
if (node.parentId === this.absoluteRoot.id && !isVivaldiBrowser) {
switch (node.id) {
case '1': // Chrome
case 'toolbar_____': // Firefox
overrideTitle = 'Bookmarks Bar'
overrideTitle = TITLE_BOOKMARKS_BAR
isToolbar = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! Very elegant!

break
case '2': // Chrome
case 'unfiled_____': // Firefox
overrideTitle = 'Other Bookmarks'
overrideTitle = TITLE_OTHER_BOOKMARKS
break
case 'menu________': // Firefox
overrideTitle = 'Bookmarks Menu'
overrideTitle = TITLE_BOOKMARKS_MENU
break
case 'mobile______': // Firefox
overrideTitle = 'Mobile Bookmarks'
overrideTitle = TITLE_MOBILE_BOOKMARKS
}
if (overrideTitle) {
Logger.log(
Expand All @@ -91,7 +96,7 @@ export default class BrowserTree implements IResource<typeof ItemLocation.LOCAL>
title: parentId ? overrideTitle || node.title : undefined,
children: node.children
.map((child) => {
return recurse(child, node.id, rng)
return recurse(child, node.id, isToolbar, rng)
})
.filter(child => !!child) // filter out `undefined` from nested accounts
})
Expand All @@ -103,10 +108,12 @@ export default class BrowserTree implements IResource<typeof ItemLocation.LOCAL>
location: ItemLocation.LOCAL,
id: node.id,
parentId,
title: '-----',
title: isOnToolbar ? '' : '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯',
// If you have more than a quarter million separators in one folder, call me
// Floccus breaks down much earlier atm
url: `https://separator.floccus.org/?id=${rng.int(0,1000000)}`,
url: 'https://separator.floccus.org/' +
(isOnToolbar ? 'vertical.html' : '') +
`?id=${rng.int(0,1000000)}`,
})
} else {
return new Tree.Bookmark({
Expand Down
61 changes: 47 additions & 14 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,10 @@ describe('Floccus', function() {
title: 'foo',
parentId: barFolder.id
})
const bookmarksBar = await browser.bookmarks.create({
title: 'Bookmarks Bar',
parentId: localRoot
})
await browser.bookmarks.create({
title: 'url',
url: 'http://ur.l/',
Expand All @@ -2337,6 +2341,15 @@ describe('Floccus', function() {
type: 'separator',
parentId: fooFolder.id
})
await browser.bookmarks.create({
title: 'url3',
url: 'http://ur3.l',
parentId: bookmarksBar.id
})
await browser.bookmarks.create({
type: 'separator',
parentId: bookmarksBar.id
})

await account.sync() // propagate to server
expect(account.getData().error).to.not.be.ok
Expand All @@ -2352,11 +2365,16 @@ describe('Floccus', function() {
new Folder({title: 'foo',
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=731368'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=731368'})
]}),
]}),
new Folder({title: 'Bookmarks Bar',
children: [
new Bookmark({title: 'url3',url: 'http://ur3.l'}),
new Bookmark({title: '', url: 'https://separator.floccus.org/vertical.html?id=591710'})
]})
]}),
false
)
Expand All @@ -2369,11 +2387,16 @@ describe('Floccus', function() {
new Folder({title: 'foo',
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=731368'})
]}),
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=731368'})
]})
]}),
new Folder({title: 'Bookmarks Bar',
children: [
new Bookmark({title: 'url3',url: 'http://ur3.l'}),
new Bookmark({title: '', url: 'https://separator.floccus.org/vertical.html?id=591710'})
]})
]}),
false
)
Expand Down Expand Up @@ -2401,10 +2424,15 @@ describe('Floccus', function() {
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'})
]}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=379999'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=379999'})
]}),
new Folder({title: 'Bookmarks Bar',
children: [
new Bookmark({title: 'url3',url: 'http://ur3.l'}),
new Bookmark({title: '', url: 'https://separator.floccus.org/vertical.html?id=591710'})
]})
]}),
false
)
Expand All @@ -2419,10 +2447,15 @@ describe('Floccus', function() {
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=731368'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=731368'})
]}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'})
]}),
new Folder({title: 'Bookmarks Bar',
children: [
new Bookmark({title: 'url3',url: 'http://ur3.l'}),
new Bookmark({title: '', url: 'https://separator.floccus.org/vertical.html?id=591710'})
]})
]}),
false
)
Expand Down Expand Up @@ -2482,9 +2515,9 @@ describe('Floccus', function() {
new Folder({title: 'foo',
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=731368'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=731368'})
]}),
]}),
]}),
Expand All @@ -2499,9 +2532,9 @@ describe('Floccus', function() {
new Folder({title: 'foo',
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=731368'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=731368'})
]}),
]}),
]}),
Expand All @@ -2528,7 +2561,7 @@ describe('Floccus', function() {
children: [
new Bookmark({title: 'url', url: 'http://ur.l/'}),
new Bookmark({title: 'url2',url: 'http://ur2.l'}),
new Bookmark({title: '-----', url: 'https://separator.floccus.org/?id=467366'})
new Bookmark({title: '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯', url: 'https://separator.floccus.org/?id=467366'})
]}),
]}),

Expand Down
8 changes: 4 additions & 4 deletions src/ui/components/AccountCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
</template>
<template v-if="status === 'scheduled'">
<v-btn
:color="statusType"
class="float-right"
x-small
@click="onForceSync">
:color="statusType"
class="float-right"
x-small
@click="onForceSync">
{{ t('LabelScheduledforcesync') }}
</v-btn>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/components/OptionsGoogleDrive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
</v-card-title>
<v-card-text>
<OptionAutoSync
:value="enabled"
@input="$emit('update:enabled', $event)" />
:value="enabled"
@input="$emit('update:enabled', $event)" />
<OptionSyncInterval
:value="syncInterval"
@input="$emit('update:syncInterval', $event)" />
Expand Down