graceful-updater 34.0.2 → 34.0.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/README.en.md CHANGED
@@ -188,11 +188,11 @@ Triggered when an error occurs inside the updater
188
188
 
189
189
  ## Contributors
190
190
 
191
- |[<img src="https://avatars.githubusercontent.com/u/1011681?v=4" width="100px;"/><br/><sub><b>xudafeng</b></sub>](https://github.com/xudafeng)<br/>|[<img src="https://avatars.githubusercontent.com/u/4081746?v=4" width="100px;"/><br/><sub><b>zlyi</b></sub>](https://github.com/zlyi)<br/>|[<img src="https://avatars.githubusercontent.com/u/52845048?v=4" width="100px;"/><br/><sub><b>snapre</b></sub>](https://github.com/snapre)<br/>|[<img src="https://avatars.githubusercontent.com/u/46579290?v=4" width="100px;"/><br/><sub><b>yinrouni</b></sub>](https://github.com/yinrouni)<br/>|
192
- | :---: | :---: | :---: | :---: |
191
+ |[<img src="https://avatars.githubusercontent.com/u/1011681?v=4" width="100px;"/><br/><sub><b>xudafeng</b></sub>](https://github.com/xudafeng)<br/>|[<img src="https://avatars.githubusercontent.com/u/4081746?v=4" width="100px;"/><br/><sub><b>zlyi</b></sub>](https://github.com/zlyi)<br/>|[<img src="https://avatars.githubusercontent.com/u/30524126?v=4" width="100px;"/><br/><sub><b>z0gSh1u</b></sub>](https://github.com/z0gSh1u)<br/>|[<img src="https://avatars.githubusercontent.com/u/11213298?v=4" width="100px;"/><br/><sub><b>WynterDing</b></sub>](https://github.com/WynterDing)<br/>|[<img src="https://avatars.githubusercontent.com/u/52845048?v=4" width="100px;"/><br/><sub><b>snapre</b></sub>](https://github.com/snapre)<br/>|[<img src="https://avatars.githubusercontent.com/u/46579290?v=4" width="100px;"/><br/><sub><b>yinrouni</b></sub>](https://github.com/yinrouni)<br/>|
192
+ | :---: | :---: | :---: | :---: | :---: | :---: |
193
193
 
194
194
 
195
- This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Wed May 21 2025 20:05:27 GMT+0800`.
195
+ This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Jun 10 2025 19:00:22 GMT+0800`.
196
196
 
197
197
  <!-- GITCONTRIBUTOR_END -->
198
198
 
package/README.md CHANGED
@@ -188,11 +188,11 @@ electronUpdator.on(EventType.UPDATE_DOWNLOAD_PROGRESS, (data) => {
188
188
 
189
189
  ## 贡献者
190
190
 
191
- |[<img src="https://avatars.githubusercontent.com/u/1011681?v=4" width="100px;"/><br/><sub><b>xudafeng</b></sub>](https://github.com/xudafeng)<br/>|[<img src="https://avatars.githubusercontent.com/u/4081746?v=4" width="100px;"/><br/><sub><b>zlyi</b></sub>](https://github.com/zlyi)<br/>|[<img src="https://avatars.githubusercontent.com/u/52845048?v=4" width="100px;"/><br/><sub><b>snapre</b></sub>](https://github.com/snapre)<br/>|[<img src="https://avatars.githubusercontent.com/u/46579290?v=4" width="100px;"/><br/><sub><b>yinrouni</b></sub>](https://github.com/yinrouni)<br/>|
192
- | :---: | :---: | :---: | :---: |
191
+ |[<img src="https://avatars.githubusercontent.com/u/1011681?v=4" width="100px;"/><br/><sub><b>xudafeng</b></sub>](https://github.com/xudafeng)<br/>|[<img src="https://avatars.githubusercontent.com/u/4081746?v=4" width="100px;"/><br/><sub><b>zlyi</b></sub>](https://github.com/zlyi)<br/>|[<img src="https://avatars.githubusercontent.com/u/30524126?v=4" width="100px;"/><br/><sub><b>z0gSh1u</b></sub>](https://github.com/z0gSh1u)<br/>|[<img src="https://avatars.githubusercontent.com/u/11213298?v=4" width="100px;"/><br/><sub><b>WynterDing</b></sub>](https://github.com/WynterDing)<br/>|[<img src="https://avatars.githubusercontent.com/u/52845048?v=4" width="100px;"/><br/><sub><b>snapre</b></sub>](https://github.com/snapre)<br/>|[<img src="https://avatars.githubusercontent.com/u/46579290?v=4" width="100px;"/><br/><sub><b>yinrouni</b></sub>](https://github.com/yinrouni)<br/>|
192
+ | :---: | :---: | :---: | :---: | :---: | :---: |
193
193
 
194
194
 
195
- [git-contributor 说明](https://github.com/xudafeng/git-contributor),自动生成时间:`Wed May 21 2025 20:05:27 GMT+0800`。
195
+ [git-contributor 说明](https://github.com/xudafeng/git-contributor),自动生成时间:`Tue Jun 10 2025 19:00:22 GMT+0800`。
196
196
 
197
197
  <!-- GITCONTRIBUTOR_END -->
198
198
 
@@ -203,6 +203,7 @@ class AppUpdator extends eventemitter3_1.EventEmitter {
203
203
  progressHandle: (data) => {
204
204
  this.emit(constants_1.EventType.UPDATE_DOWNLOAD_PROGRESS, { ...data, executeType });
205
205
  },
206
+ headers: this.options?.headers,
206
207
  });
207
208
  this.logger.info('downloadUpdateFile:Downloaded');
208
209
  this.setState(constants_1.StateType.Downloaded);
@@ -52,6 +52,7 @@ export interface IAppUpdatorOptions {
52
52
  autoDownload?: boolean;
53
53
  productName?: string;
54
54
  getWindowsHelperExeDir?: () => string;
55
+ headers?: Record<string, string>;
55
56
  }
56
57
 
57
58
  interface IProgressHandleArg {
@@ -65,6 +66,7 @@ export interface IDownloadFileOptions {
65
66
  signature: string;
66
67
  targetDir: string;
67
68
  progressHandle: (progress: IProgressHandleArg) => void;
69
+ headers?: Record<string, string>;
68
70
  }
69
71
 
70
72
  export interface IAvailableUpdate {
@@ -8,4 +8,4 @@ import { IDownloadFileOptions } from "../common/types";
8
8
  * @param progressHandle 下载状态回调
9
9
  * @return
10
10
  */
11
- export declare const downloadFile: ({ logger, url, signature, targetDir, progressHandle }: IDownloadFileOptions) => Promise<unknown>;
11
+ export declare const downloadFile: ({ logger, url, signature, targetDir, progressHandle, headers }: IDownloadFileOptions) => Promise<unknown>;
@@ -16,7 +16,7 @@ const _1 = require(".");
16
16
  * @param progressHandle 下载状态回调
17
17
  * @return
18
18
  */
19
- const downloadFile = async ({ logger, url, signature, targetDir, progressHandle }) => {
19
+ const downloadFile = async ({ logger, url, signature, targetDir, progressHandle, headers }) => {
20
20
  logger.info('downloadFile#downloadFile (start)');
21
21
  const writeStream = (0, _1.createWriteStream)(targetDir);
22
22
  let currentLength = 0;
@@ -30,6 +30,7 @@ const downloadFile = async ({ logger, url, signature, targetDir, progressHandle
30
30
  streaming: true,
31
31
  followRedirect: true,
32
32
  timeout: 10 * 60 * 1000,
33
+ headers,
33
34
  })
34
35
  .then((res) => {
35
36
  const totalLength = res.headers['content-length'];
@@ -95,7 +95,7 @@ const existFile = async (path) => {
95
95
  };
96
96
  exports.existFile = existFile;
97
97
  const requestUpdateInfo = async (options) => {
98
- const { url } = options;
98
+ const { url, headers } = options;
99
99
  if (!url) {
100
100
  throw new Error('request url can\'t be empty');
101
101
  }
@@ -104,6 +104,7 @@ const requestUpdateInfo = async (options) => {
104
104
  res = await urllib_1.default.request(url, {
105
105
  dataType: 'json',
106
106
  timeout: 10 * 1000,
107
+ headers,
107
108
  });
108
109
  }
109
110
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graceful-updater",
3
- "version": "34.0.2",
3
+ "version": "34.0.3",
4
4
  "description": "graceful-updater is a software updator management solution for Electron applications, It is convenient to complete full software update and dynamic update.",
5
5
  "scripts": {
6
6
  "build": "sh ./build.sh",
@@ -72,4 +72,4 @@
72
72
  }
73
73
  },
74
74
  "license": "MIT"
75
- }
75
+ }