@vacantthinker/firefox-addon-framework-easy 2026.623.1103 → 2026.623.1206

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.
@@ -3,7 +3,8 @@
3
3
  */
4
4
  export interface DownloadParams {
5
5
  downlink: string;
6
- filename?: string | null;
6
+ filename?: string;
7
+ referrer?: string;
7
8
  }
8
- export declare function browserDownloadByDownlink({ downlink, filename, }: DownloadParams): Promise<void>;
9
+ export declare function browserDownloadByDownlink(params: DownloadParams): Promise<void>;
9
10
  //# sourceMappingURL=browserDownload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browserDownload.d.ts","sourceRoot":"","sources":["../src/browserDownload.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,wBAAsB,yBAAyB,CAC7C,EACE,QAAQ,EACR,QAAe,GAChB,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlC"}
1
+ {"version":3,"file":"browserDownload.d.ts","sourceRoot":"","sources":["../src/browserDownload.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBvC"}
@@ -1,10 +1,19 @@
1
- export async function browserDownloadByDownlink({ downlink, filename = null, }) {
1
+ export async function browserDownloadByDownlink(params) {
2
+ const { downlink, filename, referrer } = params;
3
+ if (downlink == undefined)
4
+ return;
2
5
  const options = {
3
6
  url: downlink,
4
- saveAs: false,
5
7
  };
6
8
  if (filename) {
7
9
  options.filename = filename;
8
10
  }
11
+ // Inject the Referer header to bypass hotlink protection
12
+ if (referrer && options.headers) {
13
+ options.headers.push({
14
+ name: 'referer',
15
+ value: referrer
16
+ });
17
+ }
9
18
  await browser.downloads.download(options);
10
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serviceCommon.d.ts","sourceRoot":"","sources":["../src/serviceCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAK5E;;GAEG;AACH,wBAAsB,iBAAiB,kBAGtC;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBvC"}
1
+ {"version":3,"file":"serviceCommon.d.ts","sourceRoot":"","sources":["../src/serviceCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAK5E;;GAEG;AACH,wBAAsB,iBAAiB,kBAGtC;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAUvC"}
@@ -16,16 +16,14 @@ export async function serviceResetAddon() {
16
16
  * * @param params The download parameters.
17
17
  */
18
18
  export async function serviceDownloadByDownlink(params) {
19
- const { filename, downlink } = params;
20
19
  try {
21
20
  // Attempt 1: Full download with provided parameters
22
21
  await browserDownloadByDownlink(params);
23
- await browserNotificationCreateBasicContent(`downloading! ${filename ?? 'file'}`);
24
22
  }
25
23
  catch (error) {
26
24
  // Notify about the failure
27
25
  await browserNotificationCreateBasicContent(`reason=${error}`);
28
- // Attempt 2: Fallback retry using only the downlink
29
- await browserDownloadByDownlink({ downlink });
26
+ const { filename, ...rest } = params;
27
+ await browserDownloadByDownlink(rest);
30
28
  }
31
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0623.1103",
3
+ "version": "2026.0623.1206",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",