Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ jobs:
done
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MYSQL_ROOT_PASSWORD" -e "ALTER USER '$DATASOURCES_TEST_USERNAME'@'%' IDENTIFIED BY '$DATASOURCES_TEST_PASSWORD';"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MYSQL_ROOT_PASSWORD" -e "GRANT ALL ON *.* TO '$DATASOURCES_TEST_USERNAME'@'%';"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MYSQL_ROOT_PASSWORD" -e "GRANT PROCESS ON *.* TO '$DATASOURCES_TEST_USERNAME'@'%';"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MYSQL_ROOT_PASSWORD" -e "FLUSH PRIVILEGES;"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MYSQL_ROOT_PASSWORD" -e "SET GLOBAL log_bin_trust_function_creators = 1;"
env:
MYSQL_ROOT_PASSWORD: testing-password2
Expand Down Expand Up @@ -547,6 +549,7 @@ jobs:
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MARIADB_ROOT_PASSWORD" -e "ALTER USER '$DATASOURCES_TEST_USERNAME'@'%' IDENTIFIED BY '$DATASOURCES_TEST_PASSWORD';"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MARIADB_ROOT_PASSWORD" -e "GRANT ALL ON *.* TO '$DATASOURCES_TEST_USERNAME'@'%';"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MARIADB_ROOT_PASSWORD" -e "GRANT PROCESS ON *.* TO '$DATASOURCES_TEST_USERNAME'@'%';"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MARIADB_ROOT_PASSWORD" -e "FLUSH PRIVILEGES;"
mysql -h "$DATASOURCES_TEST_HOST" -u root -p"$MARIADB_ROOT_PASSWORD" -e "SET GLOBAL log_bin_trust_function_creators = 1;"
env:
MARIADB_ROOT_PASSWORD: testing-password2
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [6.1.3] - 2026-10-26
### Fixed
- Fix CSP violation by extracting Service Worker registration into standalone `/js/app/service-worker-register.js`
- Bump App Shell cache to `passly-app-shell-v3` with precache registration script

## [6.1.2] - 2026-10-25
### Added
- Enhance App Shell Service Worker v2 with complete precache suite (api-vendors, api-triage, api-app, stylesheets)
- Implement quick network timeout and instant App Shell fallback to eliminate ERR_INTERNET_DISCONNECTED
- Register Service Worker across all layouts including login and default templates

## [6.1.0] - 2026-10-15
### Added
- Add perpetual offline mode settings and defaults for unlimited session duration, retention, and items
Expand Down
20 changes: 10 additions & 10 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Passly 6.1.0 introduces perpetual offline mode support, delta synchronization endpoints, recoverable resource trash API, and CakePHP 5.4 framework upgrades.
Passly 6.1.3 delivers standalone Service Worker registration conforming to strict Content Security Policies, App Shell precache enhancements, and offline resilience improvements.

This release delivers the backend capabilities for offline vault access with perpetual defaults (unlimited session duration, data retention, and item counts), high-efficiency sync endpoints (/sync/meta and /sync/changes) with change journaling, and recoverable trash for resources.

## Highlights
Perpetual offline mode defaults are enabled, supporting unlimited session duration, unlimited data retention, and unlimited items.

Delta synchronization endpoints (/sync/meta and /sync/changes) and change journal logging are introduced to accelerate client sync.

Recoverable resource trash API allows moving resources to trash and restoring them.
## [6.1.3] - 2026-10-26
### Fixed
- Fix CSP violation by extracting Service Worker registration into standalone `/js/app/service-worker-register.js`
- Bump App Shell cache to `passly-app-shell-v3` with precache registration script

Framework upgraded to CakePHP 5.4 with automatic Request to DTO mapping and refreshed upstream CE core logic.
## [6.1.2] - 2026-10-25
### Added
- Enhance App Shell Service Worker v2 with complete precache suite (api-vendors, api-triage, api-app, stylesheets)
- Implement quick network timeout and instant App Shell fallback to eliminate ERR_INTERNET_DISCONNECTED
- Register Service Worker across all layouts including login and default templates

## [6.1.0] - 2026-10-15
### Added
Expand Down
4 changes: 2 additions & 2 deletions config/version.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
return [
'passbolt' => [
'version' => '6.1.0',
'name' => 'Passly 6.1.0',
'version' => '6.1.3',
'name' => 'Passly 6.1.3',
'edition' => 'ce',
],
'php' => [
Expand Down
1 change: 1 addition & 0 deletions templates/layout/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
<?php echo $this->fetch('content'); ?>
</div>
<?php echo $this->fetch('scriptBottom'); ?>
<script src="/js/app/service-worker-register.js?v=6.1.3"></script>
</body>
</html>
1 change: 1 addition & 0 deletions templates/layout/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
</div>
<?= $this->element('Footer/default'); ?>
</div>
<script src="/js/app/service-worker-register.js?v=6.1.3"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions webroot/js/app/service-worker-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Passly - Open source password manager for teams
* Copyright (c) 2026 Svaroh
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Svaroh
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://passly.svaroh.net Passly
*/

if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/service-worker.js', { scope: '/' })
.then(function(registration) {
console.debug('Passly App Shell Service Worker registered successfully with scope:', registration.scope);
})
.catch(function(error) {
console.warn('Passly App Shell Service Worker registration failed:', error);
});
});
}
210 changes: 210 additions & 0 deletions webroot/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
/**
* Passly - Open source password manager for teams
* Copyright (c) 2026 Svaroh
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Svaroh
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://passly.svaroh.net Passly
*/

const CACHE_NAME = 'passly-app-shell-v3';

const PRECACHE_ASSETS = [
'/',
'/auth/login',
'/app/passwords',
'/favicon.ico',
'/favicon.svg',
'/favicon_32.png',
'/favicon_57.png',
'/favicon_76.png',
'/favicon_96.png',
'/favicon_128.png',
'/favicon_192.png',
'/favicon_228.png',
'/js/app/service-worker-register.js',
'/js/app/stylesheet.js',
'/js/app/api-vendors.js',
'/js/app/api-triage.js',
'/js/app/api-app.js',
'/css/themes/default/api_main.min.css',
'/css/themes/default/api_authentication.min.css',
'/css/themes/default/ext_authentication.min.css',
'/css/themes/midgar/api_main.min.css',
'/css/themes/midgar/api_authentication.min.css'
];

self.addEventListener('install', (event) => {
self.skipWaiting();
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return Promise.allSettled(
PRECACHE_ASSETS.map((url) =>
cache.add(new Request(url, { credentials: 'same-origin' })).catch((err) => {
console.warn(`[ServiceWorker] Failed to precache asset ${url}:`, err);
})
)
);
})
);
});

self.addEventListener('activate', (event) => {
event.waitUntil(
Promise.all([
self.clients.claim(),
caches.keys().then((cacheNames) =>
Promise.all(
cacheNames.map((name) => {
if (name.startsWith('passly-') && name !== CACHE_NAME) {
return caches.delete(name);
}
return null;
})
)
)
])
);
});

self.addEventListener('fetch', (event) => {
const request = event.request;

// Only handle GET requests
if (request.method !== 'GET') {
return;
}

const url = new URL(request.url);

// Ignore cross-origin requests
if (url.origin !== self.location.origin) {
return;
}

// API endpoints and dynamic json calls must not be served stale from cache
const isApiRequest =
url.pathname.endsWith('.json') ||
url.pathname.startsWith('/auth/is-authenticated') ||
url.pathname.startsWith('/auth/verify') ||
url.pathname.startsWith('/healthcheck');

if (isApiRequest) {
event.respondWith(
fetch(request).catch(() => {
return new Response(
JSON.stringify({
header: {
status: 'error',
title: 'Offline',
message: 'You are currently offline. Local replica and cached vault state are active.',
code: 503
},
body: {
isOffline: true
}
}),
{
status: 503,
headers: { 'Content-Type': 'application/json; charset=utf-8' }
}
);
})
);
return;
}

// Navigation requests: Network-First with quick timeout and fallback to cached App Shell
if (
request.mode === 'navigate' ||
(request.headers.get('accept') && request.headers.get('accept').includes('text/html'))
) {
event.respondWith(
(async () => {
try {
const fetchPromise = fetch(request);
// 2.5s network timeout for sluggish/offline connections before falling back to cached shell
const timeoutPromise = new Promise((_, reject) =>
setTimeout(() => reject(new Error('Network timeout')), 2500)
);

const networkResponse = await Promise.race([fetchPromise, timeoutPromise]);
if (networkResponse && networkResponse.status === 200) {
const cache = await caches.open(CACHE_NAME);
cache.put(request, networkResponse.clone());
return networkResponse;
}
if (networkResponse && networkResponse.status >= 400) {
// In case server returns 404/500, check if we have a valid cached shell
const cache = await caches.open(CACHE_NAME);
const cached = (await cache.match(request)) || (await cache.match('/auth/login')) || (await cache.match('/'));
if (cached) {
return cached;
}
}
return networkResponse;
} catch (_err) {
// Network failed or offline: serve cached App Shell immediately
const cache = await caches.open(CACHE_NAME);

// 1. Try exact match
const exactMatch = await cache.match(request);
if (exactMatch) {
return exactMatch;
}

// 2. Route to relevant cached App Shell
if (url.pathname.startsWith('/auth/login') || url.pathname === '/') {
const loginPage = (await cache.match('/auth/login')) || (await cache.match('/'));
if (loginPage) {
return loginPage;
}
}

const appShell =
(await cache.match('/app/passwords')) ||
(await cache.match('/auth/login')) ||
(await cache.match('/'));

if (appShell) {
return appShell;
}

return new Response(
'<!doctype html><html><head><meta charset="utf-8"><title>Passly Offline</title></head><body><h2>Passly Offline App Shell</h2><p>Server is offline. Vault cache is available.</p></body></html>',
{
status: 200,
headers: { 'Content-Type': 'text/html; charset=utf-8' }
}
);
}
})()
);
return;
}

// Static assets (CSS, JS, fonts, images): Cache-First with background revalidation
const isStaticAsset = url.pathname.match(/\.(css|js|png|svg|ico|woff|woff2|ttf|eot)$/i);
if (isStaticAsset) {
event.respondWith(
caches.open(CACHE_NAME).then(async (cache) => {
// Strip cache busters query string if needed for matching
const cachedResponse = (await cache.match(request)) || (await cache.match(url.pathname));
const fetchPromise = fetch(request)
.then((networkResponse) => {
if (networkResponse && networkResponse.status === 200) {
cache.put(request, networkResponse.clone());
}
return networkResponse;
})
.catch(() => null);

return cachedResponse || (await fetchPromise);
})
);
}
});
Loading