Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
graceful-updater
Advanced tools
graceful-updater is a software updator management solution for Electron applications, It is convenient to complete full software update and dynamic update.
Electron 应用软件更新解决方案,方便完成软件的全量更新和动态更新。
English | 简体中文
$ npm i graceful-updater --save
点击查看: https://github.com/electron-modules/electron-modules-sample
// 1. 构造 options
const options = {
url: getFeedUrl(),
logger: console, // logger
productName: 'demo',
updateInfoFormatter: (res) => {
return res;
},
ifNeedUpdate: (res) => {
console.log('local version', currentVersion);
console.log('local project version', currentBuildNumber);
console.log('remote version', res.version);
console.log('remote project version', res.project_version);
return semver.gt(res.version, currentVersion) ||
res.project_version > currentBuildNumber;
},
};
// 2. 初始化 updator 实例
const electronUpdator = new MacUpdator(options);
// 3. 绑定全局事件
electronUpdator.on(EventType.UPDATE_DOWNLOADED, (...args) => {
console.log('updator >> %s, args: %j', EventType.UPDATE_DOWNLOADED, args);
});
electronUpdator.on(EventType.CHECKING_FOR_UPDATE, (...args) => {
console.log('updator >> %s, args: %j', EventType.CHECKING_FOR_UPDATE, args);
});
electronUpdator.on(EventType.UPDATE_AVAILABLE, (data) => {
const { version, project_version } = data?.updateInfo || {};
const message = [
'available',
`local version: ${currentVersion}`,
`local project version: ${currentBuildNumber}`,
`remote version: ${version}`,
`remote project version: ${project_version}`,
].join('\n');
dialog.showMessageBoxSync({
message,
});
});
electronUpdator.on(EventType.UPDATE_NOT_AVAILABLE, (data) => {
const { version, project_version } = data?.updateInfo || {};
const message = [
'not available',
`local version: ${currentVersion}`,
`local project version: ${currentBuildNumber}`,
`remote version: ${version}`,
`remote project version: ${project_version}`,
].join('\n');
dialog.showMessageBoxSync({
message,
});
});
electronUpdator.on(EventType.ERROR, (...args) => {
console.log('updator >> %s, args: %j', EventType.ERROR, args);
});
electronUpdator.on(EventType.UPDATE_DOWNLOAD_PROGRESS, (data) => {
const { status, progress } = data;
console.log('updator >> %s, status: %s, progress: %d', EventType.UPDATE_DOWNLOAD_PROGRESS, status, progress);
app.windowManager.get('updator').webContents.send('updator:updateDownloadProgress', { status, progress });
});
字段 | 类型 | 是否必须 | 说明 | 默认值 |
---|---|---|---|---|
url | String | 必须 | 检测更新的远程地址,返回数据遵循 UpdateInfo 对象 | |
ifNeedUpdate | Function | 必须 | 返回是否需要更新 | |
updateInfoFormatter | Function | 非必须 | 服务端返回数据格式适配。如果返回的格式无法与 UpdateInfo 相匹配时,可通过此方法进行格式化 | |
logger | Object | 非必须 | 日志 | console |
productName | String | 必须 | 应用完整名称 | |
autoDownload | String | 非必须 | 是否自动下载 | false |
getWindowsHelperExeDir | Function | 非必须 | Windows 下 helper 目录 | false |
字段 | 类型 | 是否必须 | 说明 | 默认值 |
---|---|---|---|---|
version | String | 必须 | 版本号 | |
projectVersion | Number | 非必须 | 构建号 | |
files | Array<Object> | 必须 | 需要下载的文件列表,返回数据遵循 File 对象 | |
updateType | Enum<String> | 必须 | 更新类型,全量更新或者动态更新。Package 为全量更新,Asar 为动态更新 | |
releaseNotes | Array<String> | 必须 | 更新日志 |
字段 | 类型 | 是否必须 | 说明 | 默认值 |
---|---|---|---|---|
url | String | 必须 | 下载地址 | |
signature | String | 非必须 | 下载签名 | |
updateType | Enum<String> | 必须 | 更新类型,针对动态更新或全量更新提供的下载地址。Package or Asar |
ExecuteType
执行类型(User or Auto)检测是否有需要更新的内容,如果 ExecuteType
为 User,则检查到更新后直接触发 update-available
事件,否则将自动下载完成安装包后触发 update-available
事件
ExecuteType
执行类型(User or Auto)开始下载安装包,如果 ExecuteType
为 User,则不进行预检查,下载完成后直接触发 update-downloaded
事件,否则完成内部完成预检查后再触发 update-downloaded
事件
当开始检查更新的时候触发
UpdateInfo
检测到有可用更新时触发
UpdateInfo
检测到无可用更新时触发
begin
开始下载,downloading
下载中,end
下载结束正在下载过程中触发
完成下载时触发
Error
更新程序内部出现错误时触发
zlyi | xudafeng | snapre |
---|
This project follows the git-contributor spec, auto updated at Tue Jan 31 2023 14:31:40 GMT+0800
.
The MIT License (MIT)
FAQs
graceful-updater is a software updator management solution for Electron applications, It is convenient to complete full software update and dynamic update.
The npm package graceful-updater receives a total of 2 weekly downloads. As such, graceful-updater popularity was classified as not popular.
We found that graceful-updater demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.