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

feat(private tabs): Avoid syncing private tabs #1446

Merged
merged 4 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
98 changes: 68 additions & 30 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,58 @@ concurrency:
cancel-in-progress: true

jobs:
php:
init:
runs-on: ubuntu-latest

strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
node-version: [ 20.x ]
npm-version: [ 10.x ]

steps:
- name: Checkout floccus
uses: actions/checkout@v2
with:
path: floccus

- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Set up npm ${{ matrix.npm-version }}
run: npm i -g npm@"${{ matrix.npm-version }}"

- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install dependencies & build
working-directory: floccus
run: |
npm ci
npm run build-release --if-present

- name: Save context
uses: buildjet/cache/save@v3
with:
key: selenium-context-${{ github.run_id }}
path: ./

selenium:
runs-on: ubuntu-latest
needs: init

env:
SELENIUM_HUB_HOST: hub
TEST_HOST: nextcloud
Expand Down Expand Up @@ -129,10 +178,13 @@ jobs:
MYSQL_ROOT_PASSWORD: ${{env.MYSQL_PASSWORD}}

steps:
- name: Checkout floccus
uses: actions/checkout@v2

- name: Restore context
uses: buildjet/cache/restore@v3
with:
path: floccus
fail-on-cache-miss: true
key: selenium-context-${{ github.run_id }}
path: ./

- name: Checkout bookmarks app
uses: actions/checkout@v2
Expand Down Expand Up @@ -169,32 +221,6 @@ jobs:
[ $NEXT_WAIT_TIME -lt 25 ]
if: matrix.floccus-adapter != 'fake'

- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Set up npm ${{ matrix.npm-version }}
run: npm i -g npm@"${{ matrix.npm-version }}"

- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install dependencies & build
working-directory: floccus
run: |
npm ci
npm run build-release --if-present

- name: Wait for Selenium
run: |
sudo apt install -y jq
Expand All @@ -216,3 +242,15 @@ jobs:
APP_VERSION: ${{ matrix.app-version }}
run: |
npm run test

summary:
runs-on: ubuntu-latest
needs: [ init, selenium ]

if: always()

name: selenium-summary

steps:
- name: Summary status
run: if ${{ needs.init.result != 'success' || ( needs.selenium.result != 'success' && needs.selenium.result != 'skipped' ) }}; then exit 1; fi
6 changes: 4 additions & 2 deletions src/lib/LocalTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export default class LocalTabs implements IResource {
}

async getBookmarksTree():Promise<Folder> {
const tabs = await browser.tabs.query({
let tabs = await browser.tabs.query({
windowType: 'normal' // no devtools or panels or popups
})
tabs = tabs.filter(tab => !tab.incognito)

return new Folder({
title: '',
Expand Down Expand Up @@ -56,7 +57,8 @@ export default class LocalTabs implements IResource {
windowId: typeof bookmark.parentId === 'string' ? parseInt(bookmark.parentId) : bookmark.parentId,
url: bookmark.url,
// Only firefox allows discarded prop
...(typeof browser.BookmarkTreeNodeType !== 'undefined' && { discarded: true })
...(typeof browser.BookmarkTreeNodeType !== 'undefined' && { discarded: true }),
active: false,
})
)
return node.id
Expand Down
Loading