Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to manifest v3 #1396

Merged
merged 46 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8538e40
First pass migrating to manifest v3
marcelklehr May 30, 2023
71f4132
Manifest v3: Fix browser-api
marcelklehr May 30, 2023
8ec03ba
Manifest v3: Fix Controller dispatch
marcelklehr May 30, 2023
cd7792c
Manifest v3: Fix webpack development config
marcelklehr May 30, 2023
0569df5
fix(native): Make manifest v3 changes work on android
marcelklehr Jun 1, 2023
b37e990
fix(native): Make manifest v3 changes work on web again
marcelklehr Jun 1, 2023
02feb21
Fix manifest v3 changes to work in firefox
marcelklehr Jun 3, 2023
c196442
Fix BrowserController#onchange: Don't error out on deleted items
marcelklehr Jun 3, 2023
652838e
Fix bookmarks cahgne detection
marcelklehr Jun 3, 2023
e5a82f8
fix(permissions): Ask for permissions if necessary
marcelklehr Jun 4, 2023
585877e
fix(permissions): Ask for permissions if necessary
marcelklehr Jun 4, 2023
393eb94
[browser] remove unlock passphrase feature
marcelklehr Jun 4, 2023
45aa9a8
fix(ci): Update selenium docker images to v4
marcelklehr Jun 4, 2023
3c790c7
fix(manifest): Use background.scripts
marcelklehr Jun 4, 2023
474bd72
tests.yml: Use selenium 4
marcelklehr Jul 19, 2023
44648db
CI: cancel-in-progress
marcelklehr Jul 19, 2023
ed4d6f9
package-lock.json: Update selenium-webdriver
marcelklehr Jul 19, 2023
b414252
selenium-runner.js: Add debug logs
marcelklehr Jul 23, 2023
70732c3
tests.yml: Try to fix selenium docker config
marcelklehr Jul 23, 2023
49469e1
tests.yml: Install jq with sudo
marcelklehr Jul 23, 2023
c8db960
selenium-runner.js: Go back to xpi build
marcelklehr Jul 23, 2023
fa8ff01
selenium-runner.js: Enable selenium logging
marcelklehr Jul 23, 2023
3ee6453
selenium-runner.js: Install unzipped extension
marcelklehr Jul 23, 2023
3a3da15
selenium-runner.js: New strategy for getting WebExtensionPolicy
marcelklehr Jul 23, 2023
cf65fa7
Controller.ts: Avoid leaking event listeners
marcelklehr Jul 23, 2023
7c4bb7e
selenium-runner.js: Try to enable host permissions manually
marcelklehr Jul 23, 2023
92083c5
selenium-runner.js: Try to enable host permissions manually
marcelklehr Jul 23, 2023
cb44677
selenium-runner.js: Try to enable host permissions manually
marcelklehr Jul 23, 2023
fa54fec
selenium-runner.js: Try to enable host permissions manually
marcelklehr Jul 23, 2023
9ee6703
Update selenium
marcelklehr Aug 2, 2023
01b3216
selenium-runner.js: New try to set permission manually
marcelklehr Aug 2, 2023
a8221bf
selenium-runner.js: New try to set permission manually
marcelklehr Aug 2, 2023
c62e8d5
remove passphrase feature
marcelklehr Aug 22, 2023
6e76cdd
Fix webdav test names
marcelklehr Aug 22, 2023
c752b11
CI: default tests to ncbm@stable12
marcelklehr Aug 22, 2023
9f4fc30
selenium-runner.js: Don't log page source
marcelklehr Aug 22, 2023
74b92f4
NextcloudBookmarks: Do not write lock after onSyncCompleted
marcelklehr Aug 22, 2023
6a72109
tests: Always check whether a sync run errored
marcelklehr Aug 22, 2023
0874d70
Fix test "sync root folder ignoring unsupported folders"
marcelklehr Aug 23, 2023
3795a62
Tests: Increase default timeout to 120s to accomodate nc26 :/
marcelklehr Aug 23, 2023
19e1580
Fix test: sync root folder ignoring unsupported folders
marcelklehr Aug 23, 2023
5ea4efb
gulpfile: Distinguish between build for chrome and build for firefox
marcelklehr Aug 23, 2023
03cde5a
CI: test in chrome
marcelklehr Aug 23, 2023
135d0c9
CI: test in chrome
marcelklehr Aug 23, 2023
57f760f
Tests: Fix tests in chrome
marcelklehr Aug 23, 2023
995a53b
XbelSerializer: Use fast-xml-parser instead of DOMParser to allow it …
marcelklehr Aug 25, 2023
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
48 changes: 34 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
env:
APP_NAME: bookmarks

concurrency:
group: floccus-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
php:
runs-on: ubuntu-latest
Expand All @@ -26,7 +30,6 @@ jobs:
TEST_HOST: nextcloud
SERVER_BRANCH: ${{ matrix.server-version }}
NC_APP_VERSION: ${{ matrix.app-version }}
SELENIUM_VERSION: 3
MYSQL_PASSWORD: root

strategy:
Expand All @@ -35,9 +38,8 @@ jobs:
matrix:
node-version: [14.x]
npm-version: [7.x]
server-version: ['26']
app-version: ['stable']
selenium-version: ['3']
server-version: ['25']
app-version: ['stable12']
floccus-adapter:
- fake
- nextcloud-bookmarks
Expand All @@ -51,10 +53,12 @@ jobs:
test-name:
- test
- benchmark root
browsers: ['firefox']
browsers:
- firefox
- chrome
include:
- app-version: stable12
server-version: 25
- app-version: stable
server-version: 26
floccus-adapter: nextcloud-bookmarks
test-name: test
browsers: firefox
Expand Down Expand Up @@ -93,20 +97,25 @@ jobs:

services:
hub:
image: selenium/hub:3
image: selenium/hub:4.11.0-20230801
ports:
- 4442:4442
- 4443:4443
- 4444:4444
firefox:
image: selenium/node-firefox:3
image: selenium/node-firefox:4.11.0-20230801

env:
HUB_HOST: hub
HUB_PORT: 4444
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
options: --shm-size="2g"
chrome:
image: selenium/node-chrome:3
image: selenium/node-chrome:4.11.0-20230801
env:
HUB_HOST: hub
HUB_PORT: 4444
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
options: --shm-size="2g"
nextcloud:
image: nextcloud:${{ matrix.server-version }}
Expand Down Expand Up @@ -193,6 +202,17 @@ jobs:
npm ci
npm run build-release --if-present

- name: Wait for Selenium
run: |
sudo apt install -y jq
while ! curl -sSL "http://localhost:4444/wd/hub/status" 2>&1 \
| jq -r '.value.ready' 2>&1 | grep "true" >/dev/null; do
echo 'Waiting for the Grid'
sleep 1
done

echo "Selenium Grid is up - executing tests"

- name: Run tests
working-directory: floccus
env:
Expand Down
15 changes: 3 additions & 12 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
"Error035": {
"message": "E035: Failed to create the following bookmark on the server: {0}"
},
"Error036": {
"message": "E036: Missing permissions to access the sync server"
},
"LabelWebdavurl": {
"message": "WebDAV URL"
},
Expand Down Expand Up @@ -263,12 +266,6 @@
"LabelAddaccount": {
"message": "Add account"
},
"LabelSecurecredentials": {
"message": "Secure your credentials"
},
"LabelSecuredcredentials": {
"message": "Your credentials are secure"
},
"LabelOpenintab": {
"message": "Open in tab"
},
Expand All @@ -287,12 +284,6 @@
"LabelUntitledfolder": {
"message": "Untitled folder"
},
"LabelSetkey": {
"message": "Set a passphrase for floccus"
},
"DescriptionSetkey": {
"message": "When you set a passphrase you will have to enter this pass phrase everytime you start your browser if you want to access and synchronize your bookmarks, change your settings or do anything else with floccus."
},
"LabelSetkeybutton": {
"message": "Set passphrase"
},
Expand Down
43 changes: 35 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const paths = {
'!key.pem',
'!android/**',
'!ios/**',
'!manifest*.json'
],
views: './html/*.html',
nativeHTML: './html/index.html',
Expand All @@ -53,6 +54,10 @@ const paths = {
icons: 'icons/*',
dist: './dist/**'
}

paths.chromeZip = [...paths.zip, 'manifest.chrome.json']
paths.firefoxZip = [...paths.zip, 'manifest.firefox.json']

const WEBSTORE_ID = 'fnaicdffflnofjppbagibeoednhnbjhg'

let WEBSTORE_CREDENTIALS
Expand Down Expand Up @@ -120,36 +125,58 @@ const build = gulp.parallel(assets, js)

const main = gulp.series(build, native)

const zip = function() {
const chromeZip = function() {
return gulp
.src(paths.zip, { buffer: false })
.pipe(gulpZip(`floccus-build-v${VERSION}.zip`))
.src(paths.chromeZip, { buffer: false })
.pipe(rename((path) => {
if (path.basename.startsWith('manifest') && path.extname === '.json') {
path.basename = 'manifest'
}
}))
.pipe(gulpZip(`floccus-build-v${VERSION}-chrome.zip`))
.pipe(gulp.dest(paths.builds))
}

const firefoxZip = function() {
return gulp
.src(paths.firefoxZip, { buffer: false })
.pipe(rename((path) => {
if (path.basename.startsWith('manifest') && path.extname === '.json') {
path.basename = 'manifest'
}
}))
.pipe(gulpZip(`floccus-build-v${VERSION}-firefox.zip`))
.pipe(gulp.dest(paths.builds))
}

const xpi = function() {
return gulp
.src(paths.zip, { buffer: false })
.src(paths.firefoxZip, { buffer: false })
.pipe(rename((path) => {
if (path.basename.startsWith('manifest') && path.extname === '.json') {
path.basename = 'manifest'
}
}))
.pipe(gulpZip(`floccus-build-v${VERSION}.xpi`))
.pipe(gulp.dest(paths.builds))
}

const crx = function() {
return crx3(
fs.createReadStream(`${paths.builds}/floccus-build-v${VERSION}.zip`),
fs.createReadStream(`${paths.builds}/floccus-build-v${VERSION}-chrome.zip`),
{
keyPath: 'key.pem',
crxPath: `${paths.builds}/floccus-build-v${VERSION}.crx`,
}
)
}

const release = gulp.series(main, gulp.parallel(zip, xpi), crx)
const release = gulp.series(main, gulp.parallel(firefoxZip, chromeZip, xpi), crx)

const publish = gulp.series(main, zip, function() {
const publish = gulp.series(main, chromeZip, function() {
return webstore
.uploadExisting(
fs.createReadStream(`${paths.builds}floccus-build-v${VERSION}.zip`)
fs.createReadStream(`${paths.builds}floccus-build-v${VERSION}-chrome.zip`)
)
.then(function() {
return webstore.publish('default')
Expand Down
11 changes: 0 additions & 11 deletions html/background.html

This file was deleted.

1 change: 0 additions & 1 deletion html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
</head>
<body>
<div id="app"></div>
<script src="../../lib/chrome-promise.js"></script>
<script src="../js/options.js"></script>
</body>
</html>
1 change: 0 additions & 1 deletion html/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<div id="mocha"></div>

<script src="../js/mocha.js"></script>
<script src="../../lib/chrome-promise.js"></script>
<script src="../js/test.js"></script>
</body>
</html>
83 changes: 0 additions & 83 deletions lib/chrome-promise.js

This file was deleted.

40 changes: 40 additions & 0 deletions manifest.chrome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"manifest_version": 3,
"name": "floccus bookmarks sync",
"short_name": "floccus",
"version": "5.0.0",
"description": "__MSG_DescriptionExtension__",
"icons": {
"48": "icons/logo.png",
"64": "icons/logo_64.png",
"128": "icons/logo_128.png"
},

"default_locale": "en",

"permissions": ["alarms", "bookmarks", "storage", "unlimitedStorage", "tabs", "identity"],
"host_permissions": [
"*://*/*"
],
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self';"
},

"options_ui": {
"page": "dist/html/options.html",
"browser_style": false
},

"action": {
"browser_style": false,
"default_icon": {
"48": "icons/logo.png"
},
"default_title": "Open Floccus options",
"default_popup": "dist/html/options.html"
},

"background": {
"service_worker": "dist/js/background-script.js"
}
}
Loading
Loading