@glance-apps/sync 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.5.3] - 2026-07-04
11
+
12
+ ### Fixed
13
+
14
+ - **Generic WebDAV auto-backups now nest under the app folder instead of the
15
+ server root.** The `webdav` backup provider built its upload directory as the
16
+ bare WebDAV root (`<webdavUrl>/`), so backups landed at
17
+ `<webdavUrl>/<prefix><ts>.json`. On NAS targets whose base URL is the server
18
+ root (Synology/fnOS), a `PUT` to `/` is rejected with `405 Method Not Allowed`
19
+ because writes are only permitted inside a shared folder, so auto-backups
20
+ silently failed (lifeGLANCE issue #206). The provider now writes to
21
+ `<webdavUrl>/<appFolderName>/backups/` — matching how the sync file path
22
+ (`<webdavUrl>/<appFolderName>/<syncFilename>`) and the `nextcloud` backup
23
+ provider (`<appFolder>/backups/`) are constructed — and issues an `MKCOL` for
24
+ the app folder and the `backups/` subdir on a `404`/`409` before retrying the
25
+ `PUT`, so the first backup to a fresh target succeeds. `listBackups`,
26
+ `downloadBackup`, `deleteBackup`, and retention all target the same nested
27
+ directory. The folder segment comes from `appFolderName` (the sync folder),
28
+ not the dead `config.folder` field.
29
+
10
30
  ## [1.5.2] - 2026-06-19
11
31
 
12
32
  ### Fixed
@@ -295,7 +315,9 @@ entire sync infrastructure can be shared across the GLANCE app family.
295
315
  - TypeScript declarations in `types/index.d.ts`.
296
316
  - WebDAV CORS proxy handler in `api/webdav-proxy.js`.
297
317
 
298
- [Unreleased]: https://github.com/glance-apps/glance-sync/compare/v1.1.2...HEAD
318
+ [Unreleased]: https://github.com/glance-apps/glance-sync/compare/v1.5.3...HEAD
319
+ [1.5.3]: https://github.com/glance-apps/glance-sync/compare/v1.5.2...v1.5.3
320
+ [1.5.2]: https://github.com/glance-apps/glance-sync/compare/v1.5.1...v1.5.2
299
321
  [1.1.2]: https://github.com/glance-apps/glance-sync/compare/v1.1.1...v1.1.2
300
322
  [1.1.1]: https://github.com/glance-apps/glance-sync/compare/v1.1.0...v1.1.1
301
323
  [1.1.0]: https://github.com/glance-apps/glance-sync/compare/v1.0.3...v1.1.0
package/README.md CHANGED
@@ -114,7 +114,7 @@ Pass `encryptionEnabled: true` in the sync config object stored via `engine.setC
114
114
  |--------|-------------|
115
115
  | `sync()` / `download()` | Full cycle: download → validate → merge → apply → upload if changed. |
116
116
  | `upload(opts?)` | Upload local state to the remote provider. |
117
- | `runBackup(frequency)` | Save a snapshot to IDB and upload it to the remote backup folder. |
117
+ | `runBackup(frequency)` | Save a snapshot to IDB and upload it to the remote backup folder (`<appFolderName>/backups/`, a sibling of the sync file inside the app folder). |
118
118
  | `test(config)` | Test the connection to the configured provider. |
119
119
  | `getConfig()` / `setConfig(cfg)` | Read/write the persisted sync config (credentials, provider, flags). |
120
120
  | `getLastSynced()` | ISO 8601 timestamp of the last successful sync. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glance-apps/sync",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/autoBackup.js CHANGED
@@ -195,7 +195,12 @@ export function createAutoBackupProviders(config) {
195
195
  { key: 'appPassword', label: 'Password / App Password', type: 'password', placeholder: 'your-password' }
196
196
  ],
197
197
  _getBackupDirUrl(providerConfig) {
198
- return `${providerConfig.webdavUrl.replace(/\/+$/, '')}/`;
198
+ // Nest backups under the app folder (mirroring the sync file path
199
+ // `${webdavUrl}/${appFolderName}/${syncFilename}` and the nextcloud
200
+ // provider's `${appFolder}/backups/`). Writing to the bare WebDAV root
201
+ // fails with 405 on NAS targets (Synology/fnOS) that only permit PUT
202
+ // inside a shared folder.
203
+ return `${providerConfig.webdavUrl.replace(/\/+$/, '')}/${appFolder}/backups/`;
199
204
  },
200
205
  _getAuthHeaders(providerConfig) {
201
206
  return { 'X-WebDAV-Auth': 'Basic ' + toBase64(providerConfig.username + ':' + providerConfig.appPassword) };
@@ -213,6 +218,11 @@ export function createAutoBackupProviders(config) {
213
218
  wdFetch('PUT', fileUrl, authHeaders, body, { 'Content-Type': 'application/json' });
214
219
  let res = await doUpload();
215
220
  if (res.status === 404 || res.status === 409) {
221
+ // Create the app folder before the backups/ subdir so the first
222
+ // backup to a fresh target doesn't 404/409 (mirrors the nextcloud
223
+ // provider). MKCOL on an existing collection is a harmless no-op.
224
+ const parentDir = `${providerConfig.webdavUrl.replace(/\/+$/, '')}/${appFolder}/`;
225
+ await wdFetch('MKCOL', parentDir, authHeaders);
216
226
  await wdFetch('MKCOL', dirUrl, authHeaders);
217
227
  res = await doUpload();
218
228
  }