@xiboplayer/cache 0.6.11 → 0.6.13

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.
@@ -169,6 +169,26 @@ The ContentStore manages files on disk with metadata:
169
169
 
170
170
  ## Download Flow
171
171
 
172
+ ### Cache-Through with XMDS Support (v0.6.12)
173
+
174
+ The proxy's `cacheThrough()` function serves files from the ContentStore or fetches them from the CMS on cache miss. It supports both REST and XMDS transports:
175
+
176
+ ```
177
+ Request for /player/api/v2/media/file/42.mp4
178
+
179
+ ├── Check ContentStore → HIT → serve from disk
180
+
181
+ └── MISS → build CMS fetch URL:
182
+ ├── Has X-Cms-Download-Url header? → use it (XMDS signed URL)
183
+ └── No header? → build REST URL: ${cmsUrl}/player/api/v2/media/file/42.mp4
184
+
185
+ └── Fetch from CMS → store in ContentStore → serve
186
+ ```
187
+
188
+ The `X-Cms-Download-Url` header carries the original XMDS signed URL (e.g., `xmds.php?file=42.mp4&X-Amz-Signature=...`). This is set by:
189
+ - `DownloadTask` in `download-manager.js` (when `fileInfo.cmsDownloadUrl` is present)
190
+ - `RequestHandler._handleXmdsFile()` in the Service Worker (for intercepted XMDS URLs)
191
+
172
192
  ### Service Worker Download
173
193
 
174
194
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiboplayer/cache",
3
- "version": "0.6.11",
3
+ "version": "0.6.13",
4
4
  "description": "Offline caching and download management with parallel chunk downloads",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "spark-md5": "^3.0.2",
19
- "@xiboplayer/utils": "0.6.11"
19
+ "@xiboplayer/utils": "0.6.13"
20
20
  },
21
21
  "devDependencies": {
22
22
  "vitest": "^2.0.0",
@@ -146,6 +146,9 @@ export class DownloadTask {
146
146
  if (this.fileInfo.updateInterval) {
147
147
  headers['X-Cache-TTL'] = String(this.fileInfo.updateInterval);
148
148
  }
149
+ if (this.fileInfo.cmsDownloadUrl) {
150
+ headers['X-Cms-Download-Url'] = this.fileInfo.cmsDownloadUrl;
151
+ }
149
152
 
150
153
  const maxRetries = this._typeConfig.maxRetries;
151
154