Compare commits
11 Commits
74105a1a4f
...
dev
Author | SHA1 | Date | |
---|---|---|---|
64d4861bc7 | |||
7f3996f15b | |||
43ec6cbcdf | |||
571cf1bf5e | |||
fa0bc88221 | |||
00fcee6ac8 | |||
30152feb79 | |||
db2854f569 | |||
934df30846 | |||
6c29f57d61 | |||
6968483acc |
84
README.md
84
README.md
@ -39,51 +39,55 @@ docker run -itd --name electron-distribution --restart always \
|
|||||||
wy373226722/electron-distribution:latest
|
wy373226722/electron-distribution:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
China user: `docker pull registry.cn-shenzhen.aliyuncs.com/yi-ge/electron-distribution:latest` or `docker pull ccr.ccs.tencentyun.com/yi-ge/electron-distribution:latest`
|
**China user**
|
||||||
|
Aliyun: `docker pull registry.cn-shenzhen.aliyuncs.com/yi-ge/electron-distribution:latest`
|
||||||
|
|
||||||
|
TencentYun: `docker pull ccr.ccs.tencentyun.com/yi-ge/electron-distribution:latest`
|
||||||
|
|
||||||
|
**Notice**
|
||||||
You need to configure nginx and SSL by yourself. SCHEME only a tip.
|
You need to configure nginx and SSL by yourself. SCHEME only a tip.
|
||||||
|
|
||||||
#### Environment
|
#### Environment
|
||||||
|
|
||||||
| ENV Var | Default | Description |
|
| ENV Var | Default | Description |
|
||||||
|---|---|---|
|
| ----------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `NAME` | `"APP"` | `Your app name. Numbers, letters and "-".` |
|
| `NAME` | `"APP"` | `Your app name. Numbers, letters and "-".` |
|
||||||
| `SCHEME` | `"https"` | `Production environment only work with SSL.` |
|
| `SCHEME` | `"https"` | `Production environment only work with SSL.` |
|
||||||
| `DOMAIN` | `"www.example.com"` | `Your Electron Distribution server-side domain.` |
|
| `DOMAIN` | `"www.example.com"` | `Your Electron Distribution server-side domain.` |
|
||||||
| `TOKEN` | `"1jH27dJf9s852"` | `Your Electron Distribution API TOKEN.` |
|
| `TOKEN` | `"1jH27dJf9s852"` | `Your Electron Distribution API TOKEN.` |
|
||||||
| `REPOPATH` | `"git@github.com:yi-ge/electron-distribution.git"` | `Your electron app repository.` |
|
| `REPOPATH` | `"git@github.com:yi-ge/electron-distribution.git"` | `Your electron app repository.` |
|
||||||
| `BUILD_TYPE` | `"win,linux"` | `win,linux,mac` |
|
| `BUILD_TYPE` | `"win,linux"` | `win,linux,mac` |
|
||||||
| `WORKPATH` | `"/data"` | `-v /data:/data, The two path must be consistent.` |
|
| `WORKPATH` | `"/data"` | `-v /data:/data, The two path must be consistent.` |
|
||||||
| `DOCKER_SOCKET` | `"/var/run/docker.sock"` | `Docker socket path.` |
|
| `DOCKER_SOCKET` | `"/var/run/docker.sock"` | `Docker socket path.` |
|
||||||
| `MAC_SERVER_HOST` | `"127.0.0.1"` | `Your macOS server host.` |
|
| `MAC_SERVER_HOST` | `"127.0.0.1"` | `Your macOS server host.` |
|
||||||
| `MAC_SERVER_PORT` | `"22"` | `Your macOS server ssh port.` |
|
| `MAC_SERVER_PORT` | `"22"` | `Your macOS server ssh port.` |
|
||||||
| `MAC_SERVER_USERNAME` | `"guest"` | `Your macOS server ssh username.` |
|
| `MAC_SERVER_USERNAME` | `"guest"` | `Your macOS server ssh username.` |
|
||||||
| `LINUX_SERVER_HOST` | `"127.0.0.1"` | `Only require build mac application. Your linux server host.` |
|
| `LINUX_SERVER_HOST` | `"127.0.0.1"` | `Only require build mac application. Your linux server host.` |
|
||||||
| `LINUX_SERVER_PORT` | `"22"` | `Only require build mac application. Your linux server ssh port.` |
|
| `LINUX_SERVER_PORT` | `"22"` | `Only require build mac application. Your linux server ssh port.` |
|
||||||
| `LINUX_SERVER_USERNAME` | `"guest"` | `Only require build mac application. Your linux server ssh username.` |
|
| `LINUX_SERVER_USERNAME` | `"guest"` | `Only require build mac application. Your linux server ssh username.` |
|
||||||
| `GH_TOKEN` | `""` | `If you set publish option.` |
|
| `GH_TOKEN` | `""` | `If you set publish option.` |
|
||||||
| `CSC_LINK` | `""` | `https://www.electron.build/code-signing` |
|
| `CSC_LINK` | `""` | `https://www.electron.build/code-signing` |
|
||||||
| `CSC_KEY_PASSWORD` | `""` | `https://www.electron.build/code-signing` |
|
| `CSC_KEY_PASSWORD` | `""` | `https://www.electron.build/code-signing` |
|
||||||
| `CSC_NAME`, | `""` | `https://www.electron.build/code-signing` |
|
| `CSC_NAME`, | `""` | `https://www.electron.build/code-signing` |
|
||||||
| `BUILD_CPU_LIMIT` | `"0"` | `Linux and Windows build cpu limit. CPUs in which to allow execution (e.g., 0-3, 0,1)` |
|
| `BUILD_CPU_LIMIT` | `"0"` | `Linux and Windows build cpu limit. CPUs in which to allow execution (e.g., 0-3, 0,1)` |
|
||||||
| `BUILD_MEMORY_LIMIT` | `0` | `Linux and Windows memory limit in bytes. 1024 * 1024 * 1024 bytes = 1073741824 bytes = 1GB` |
|
| `BUILD_MEMORY_LIMIT` | `0` | `Linux and Windows memory limit in bytes. 1024 * 1024 * 1024 bytes = 1073741824 bytes = 1GB` |
|
||||||
| `OBJECT_STORAGE_TYPE` | `"cos"` | `cos: Tencent Cloud Object Storage; oss: Aliyun Object Storage; qiniu: Qiniu Object Storage.` |
|
| `OBJECT_STORAGE_TYPE` | `"cos"` | `cos: Tencent Cloud Object Storage; oss: Aliyun Object Storage; qiniu: Qiniu Object Storage.` |
|
||||||
| `QINIU_ACCESS_KEY` | `""` | `Qiniu Object Storage, accessKey.` |
|
| `QINIU_ACCESS_KEY` | `""` | `Qiniu Object Storage, accessKey.` |
|
||||||
| `QINIU_SECRET_KEY` | `""` | `Qiniu Object Storage, secretKey.` |
|
| `QINIU_SECRET_KEY` | `""` | `Qiniu Object Storage, secretKey.` |
|
||||||
| `QINIU_BUCKET_KEY` | `""` | `Qiniu Object Storage, bucket.` |
|
| `QINIU_BUCKET_KEY` | `""` | `Qiniu Object Storage, bucket.` |
|
||||||
| `QINIU_ZONE` | `"Zone_z0"` | `华东 Zone_z0、华北 Zone_z1、华南 Zone_z2、北美 Zone_na0` |
|
| `QINIU_ZONE` | `"Zone_z0"` | `华东 Zone_z0、华北 Zone_z1、华南 Zone_z2、北美 Zone_na0` |
|
||||||
| `QINIU_URL` | `"https://cdn.xxx.com"` | `Qiniu Object Storage CDN url.` |
|
| `QINIU_URL` | `"https://cdn.xxx.com"` | `Qiniu Object Storage CDN url.` |
|
||||||
| `OSS_ACCESS_KEY_ID` | `"id"` | `Aliyun accessKeyId.` |
|
| `OSS_ACCESS_KEY_ID` | `"id"` | `Aliyun accessKeyId.` |
|
||||||
| `OSS_ACCESS_SECRET` | `"secret"` | `Aliyun accessKeySecret.` |
|
| `OSS_ACCESS_SECRET` | `"secret"` | `Aliyun accessKeySecret.` |
|
||||||
| `OSS_REGION` | `"oss-cn-qingdao"` | `Aliyun Object Storage, Region.` |
|
| `OSS_REGION` | `"oss-cn-qingdao"` | `Aliyun Object Storage, Region.` |
|
||||||
| `OSS_BUCKET` | `"bucket"` | `Aliyun Object Storage, Bucket.` |
|
| `OSS_BUCKET` | `"bucket"` | `Aliyun Object Storage, Bucket.` |
|
||||||
| `OSS_URL` | `"https://cdn.xxx.com"` | `Aliyun Object Storage CDN url.` |
|
| `OSS_URL` | `"https://cdn.xxx.com"` | `Aliyun Object Storage CDN url.` |
|
||||||
| `OSS_INTERNAL` | `false` | `Access aliyun OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set "true" to save lot of money.` |
|
| `OSS_INTERNAL` | `false` | `Access aliyun OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set "true" to save lot of money.` |
|
||||||
| `COS_SECRE_ID` | `""` | `Tencent Cloud Object Storage SecretId.` |
|
| `COS_SECRE_ID` | `""` | `Tencent Cloud Object Storage SecretId.` |
|
||||||
| `COS_SECRE_KEY` | `""` | `SecretKey.` |
|
| `COS_SECRE_KEY` | `""` | `SecretKey.` |
|
||||||
| `COS_BUCKET` | `"bucketname-12345678"` | `Bucket.` |
|
| `COS_BUCKET` | `"bucketname-12345678"` | `Bucket.` |
|
||||||
| `COS_REGION` | `"ap-chengdu"` | `Region.` |
|
| `COS_REGION` | `"ap-chengdu"` | `Region.` |
|
||||||
| `COS_URL` | `"https://cdn.xxx.com"` | `Object Storage CDN url.` |
|
| `COS_URL` | `"https://cdn.xxx.com"` | `Object Storage CDN url.` |
|
||||||
|
|
||||||
Qiniu Object Storage: [https://developer.qiniu.com/kodo/sdk/1289/nodejs](https://developer.qiniu.com/kodo/sdk/1289/nodejs)
|
Qiniu Object Storage: [https://developer.qiniu.com/kodo/sdk/1289/nodejs](https://developer.qiniu.com/kodo/sdk/1289/nodejs)
|
||||||
Aliyun Object Storage: [https://github.com/ali-sdk/ali-oss](https://github.com/ali-sdk/ali-oss)
|
Aliyun Object Storage: [https://github.com/ali-sdk/ali-oss](https://github.com/ali-sdk/ali-oss)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
一个`git`仓库对应一个`Electron`应用程序,对应使用一套应用分发系统。
|
一个`git`仓库对应一个`Electron`应用程序,对应使用一套应用分发系统。
|
||||||
|
|
||||||
`Electron 应用分发系统`服务器端工作在64位Linux操作系统(必须)和MacOS(可选),默认编译x64应用程序, 其它平台及架构需要修改相应代码(不过这很容易实现).
|
`Electron 应用分发系统`服务器端工作在 64 位 Linux 操作系统(必须)和 MacOS(可选),默认编译 x64 应用程序, 其它平台及架构需要修改相应代码(不过这很容易实现).
|
||||||
|
|
||||||
## 快速开始
|
## 快速开始
|
||||||
|
|
||||||
@ -37,51 +37,55 @@ docker run -itd --name electron-distribution --restart always \
|
|||||||
wy373226722/electron-distribution
|
wy373226722/electron-distribution
|
||||||
```
|
```
|
||||||
|
|
||||||
国内用户: `docker pull registry.cn-shenzhen.aliyuncs.com/yi-ge/electron-distribution:latest` or `docker pull ccr.ccs.tencentyun.com/yi-ge/electron-distribution:latest`
|
**国内用户**
|
||||||
|
阿里云镜像:`docker pull registry.cn-shenzhen.aliyuncs.com/yi-ge/electron-distribution:latest`
|
||||||
|
|
||||||
你需要自行安装Nginx并配置使其支持SSL,这是必须的,否则应用程序自动更新可能会失效。`SCHEME`只是一个标识。
|
腾讯云镜像:`docker pull ccr.ccs.tencentyun.com/yi-ge/electron-distribution:latest`
|
||||||
|
|
||||||
|
**注意**
|
||||||
|
你需要自行安装 Nginx 并配置使其支持 SSL,这是必须的,否则应用程序自动更新可能会失效。`SCHEME`只是一个标识。
|
||||||
|
|
||||||
#### 环境变量
|
#### 环境变量
|
||||||
|
|
||||||
| 变量名 | 默认值 | 描述 |
|
| 变量名 | 默认值 | 描述 |
|
||||||
|---|---|---|
|
| ----------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `NAME` | `"APP"` | `Your app name. Numbers, letters and "-".` |
|
| `NAME` | `"APP"` | `Your app name. Numbers, letters and "-".` |
|
||||||
| `SCHEME` | `"https"` | `Production environment only work with SSL.` |
|
| `SCHEME` | `"https"` | `Production environment only work with SSL.` |
|
||||||
| `DOMAIN` | `"www.example.com"` | `Your Electron Distribution server-side domain.` |
|
| `DOMAIN` | `"www.example.com"` | `Your Electron Distribution server-side domain.` |
|
||||||
| `TOKEN` | `"1jH27dJf9s852"` | `Your Electron Distribution API TOKEN.` |
|
| `TOKEN` | `"1jH27dJf9s852"` | `Your Electron Distribution API TOKEN.` |
|
||||||
| `REPOPATH` | `"git@github.com:yi-ge/electron-distribution.git"` | `Your electron app repository.` |
|
| `REPOPATH` | `"git@github.com:yi-ge/electron-distribution.git"` | `Your electron app repository.` |
|
||||||
| `BUILD_TYPE` | `"win,linux"` | `win,linux,mac` |
|
| `BUILD_TYPE` | `"win,linux"` | `win,linux,mac` |
|
||||||
| `WORKPATH` | `"/data"` | `-v /data:/data, The two path must be consistent.` |
|
| `WORKPATH` | `"/data"` | `-v /data:/data, The two path must be consistent.` |
|
||||||
| `DOCKER_SOCKET` | `"/var/run/docker.sock"` | `Docker socket path.` |
|
| `DOCKER_SOCKET` | `"/var/run/docker.sock"` | `Docker socket path.` |
|
||||||
| `MAC_SERVER_HOST` | `"127.0.0.1"` | `Your macOS server host.` |
|
| `MAC_SERVER_HOST` | `"127.0.0.1"` | `Your macOS server host.` |
|
||||||
| `MAC_SERVER_PORT` | `"22"` | `Your macOS server ssh port.` |
|
| `MAC_SERVER_PORT` | `"22"` | `Your macOS server ssh port.` |
|
||||||
| `MAC_SERVER_USERNAME` | `"guest"` | `Your macOS server ssh username.` |
|
| `MAC_SERVER_USERNAME` | `"guest"` | `Your macOS server ssh username.` |
|
||||||
| `LINUX_SERVER_HOST` | `"127.0.0.1"` | `Only require build mac application. Your linux server host.` |
|
| `LINUX_SERVER_HOST` | `"127.0.0.1"` | `Only require build mac application. Your linux server host.` |
|
||||||
| `LINUX_SERVER_PORT` | `"22"` | `Only require build mac application. Your linux server ssh port.` |
|
| `LINUX_SERVER_PORT` | `"22"` | `Only require build mac application. Your linux server ssh port.` |
|
||||||
| `LINUX_SERVER_USERNAME` | `"root"` | `Only require build mac application. Your linux server ssh username.` |
|
| `LINUX_SERVER_USERNAME` | `"root"` | `Only require build mac application. Your linux server ssh username.` |
|
||||||
| `GH_TOKEN` | `""` | `If you set publish option.` |
|
| `GH_TOKEN` | `""` | `If you set publish option.` |
|
||||||
| `CSC_LINK` | `""` | `https://www.electron.build/code-signing` |
|
| `CSC_LINK` | `""` | `https://www.electron.build/code-signing` |
|
||||||
| `CSC_KEY_PASSWORD` | `""` | `https://www.electron.build/code-signing` |
|
| `CSC_KEY_PASSWORD` | `""` | `https://www.electron.build/code-signing` |
|
||||||
| `CSC_NAME`, | `""` | `https://www.electron.build/code-signing` |
|
| `CSC_NAME`, | `""` | `https://www.electron.build/code-signing` |
|
||||||
| `BUILD_CPU_LIMIT` | `"0"` | `Linux and Windows build cpu limit. CPUs in which to allow execution (e.g., 0-3, 0,1)` |
|
| `BUILD_CPU_LIMIT` | `"0"` | `Linux and Windows build cpu limit. CPUs in which to allow execution (e.g., 0-3, 0,1)` |
|
||||||
| `BUILD_MEMORY_LIMIT` | `0` | `Linux and Windows memory limit in bytes. 1024 * 1024 * 1024 bytes = 1073741824 bytes = 1GB` |
|
| `BUILD_MEMORY_LIMIT` | `0` | `Linux and Windows memory limit in bytes. 1024 * 1024 * 1024 bytes = 1073741824 bytes = 1GB` |
|
||||||
| `OBJECT_STORAGE_TYPE` | `"cos"` | `cos: Tencent Cloud Object Storage; oss: Aliyun Object Storage; qiniu: Qiniu Object Storage.` |
|
| `OBJECT_STORAGE_TYPE` | `"cos"` | `cos: Tencent Cloud Object Storage; oss: Aliyun Object Storage; qiniu: Qiniu Object Storage.` |
|
||||||
| `QINIU_ACCESS_KEY` | `""` | `Qiniu Object Storage, accessKey.` |
|
| `QINIU_ACCESS_KEY` | `""` | `Qiniu Object Storage, accessKey.` |
|
||||||
| `QINIU_SECRET_KEY` | `""` | `Qiniu Object Storage, secretKey.` |
|
| `QINIU_SECRET_KEY` | `""` | `Qiniu Object Storage, secretKey.` |
|
||||||
| `QINIU_BUCKET_KEY` | `""` | `Qiniu Object Storage, bucket.` |
|
| `QINIU_BUCKET_KEY` | `""` | `Qiniu Object Storage, bucket.` |
|
||||||
| `QINIU_ZONE` | `"Zone_z0"` | `华东 Zone_z0、华北 Zone_z1、华南 Zone_z2、北美 Zone_na0` |
|
| `QINIU_ZONE` | `"Zone_z0"` | `华东 Zone_z0、华北 Zone_z1、华南 Zone_z2、北美 Zone_na0` |
|
||||||
| `QINIU_URL` | `"https://cdn.xxx.com"` | `Qiniu Object Storage CDN url.` |
|
| `QINIU_URL` | `"https://cdn.xxx.com"` | `Qiniu Object Storage CDN url.` |
|
||||||
| `OSS_ACCESS_KEY_ID` | `"id"` | `Aliyun accessKeyId.` |
|
| `OSS_ACCESS_KEY_ID` | `"id"` | `Aliyun accessKeyId.` |
|
||||||
| `OSS_ACCESS_SECRET` | `"secret"` | `Aliyun accessKeySecret.` |
|
| `OSS_ACCESS_SECRET` | `"secret"` | `Aliyun accessKeySecret.` |
|
||||||
| `OSS_REGION` | `"oss-cn-qingdao"` | `Aliyun Object Storage, Region.` |
|
| `OSS_REGION` | `"oss-cn-qingdao"` | `Aliyun Object Storage, Region.` |
|
||||||
| `OSS_BUCKET` | `"bucket"` | `Aliyun Object Storage, Bucket.` |
|
| `OSS_BUCKET` | `"bucket"` | `Aliyun Object Storage, Bucket.` |
|
||||||
| `OSS_URL` | `"https://cdn.xxx.com"` | `Aliyun Object Storage CDN url.` |
|
| `OSS_URL` | `"https://cdn.xxx.com"` | `Aliyun Object Storage CDN url.` |
|
||||||
| `OSS_INTERNAL` | `false` | `Access aliyun OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set "true" to save lot of money.` |
|
| `OSS_INTERNAL` | `false` | `Access aliyun OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set "true" to save lot of money.` |
|
||||||
| `COS_SECRE_ID` | `""` | `Tencent Cloud Object Storage SecretId.` |
|
| `COS_SECRE_ID` | `""` | `Tencent Cloud Object Storage SecretId.` |
|
||||||
| `COS_SECRE_KEY` | `""` | `SecretKey.` |
|
| `COS_SECRE_KEY` | `""` | `SecretKey.` |
|
||||||
| `COS_BUCKET` | `"bucketname-12345678"` | `Bucket.` |
|
| `COS_BUCKET` | `"bucketname-12345678"` | `Bucket.` |
|
||||||
| `COS_REGION` | `"ap-chengdu"` | `Region.` |
|
| `COS_REGION` | `"ap-chengdu"` | `Region.` |
|
||||||
| `COS_URL` | `"https://cdn.xxx.com"` | `Object Storage CDN url.` |
|
| `COS_URL` | `"https://cdn.xxx.com"` | `Object Storage CDN url.` |
|
||||||
|
|
||||||
七牛对象存储: [https://developer.qiniu.com/kodo/sdk/1289/nodejs](https://developer.qiniu.com/kodo/sdk/1289/nodejs)
|
七牛对象存储: [https://developer.qiniu.com/kodo/sdk/1289/nodejs](https://developer.qiniu.com/kodo/sdk/1289/nodejs)
|
||||||
阿里云对象存储: [https://github.com/ali-sdk/ali-oss](https://github.com/ali-sdk/ali-oss)
|
阿里云对象存储: [https://github.com/ali-sdk/ali-oss](https://github.com/ali-sdk/ali-oss)
|
||||||
@ -91,7 +95,7 @@ docker run -itd --name electron-distribution --restart always \
|
|||||||
|
|
||||||
**Swagger:** https://yourdomain/documentation
|
**Swagger:** https://yourdomain/documentation
|
||||||
|
|
||||||
API中的token需要进行`SHA-512`加密。
|
API 中的 token 需要进行`SHA-512`加密。
|
||||||
|
|
||||||
**Github webhooks:** https://yourdomain/build/webhooks
|
**Github webhooks:** https://yourdomain/build/webhooks
|
||||||
|
|
||||||
@ -157,7 +161,7 @@ yarn add electron-builder electron-simple-updater -D
|
|||||||
|
|
||||||
## Mac APP 编译及代码签名
|
## Mac APP 编译及代码签名
|
||||||
|
|
||||||
在macOS Majave (10.14.4)中安装 `Xcode 10.2` \ `brew (yarn 1.15.2)` \ `nvm (node 11.13.0)`, 至少运行一次`Xcode`。
|
在 macOS Majave (10.14.4)中安装 `Xcode 10.2` \ `brew (yarn 1.15.2)` \ `nvm (node 11.13.0)`, 至少运行一次`Xcode`。
|
||||||
|
|
||||||
操作系统默认安装了 Git 和 rsync。
|
操作系统默认安装了 Git 和 rsync。
|
||||||
|
|
||||||
@ -167,7 +171,7 @@ yarn add electron-builder electron-simple-updater -D
|
|||||||
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
|
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
|
||||||
```
|
```
|
||||||
|
|
||||||
添加你的服务器公钥到Mac `~/.ssh/authorized_keys`。
|
添加你的服务器公钥到 Mac `~/.ssh/authorized_keys`。
|
||||||
添加你的Mac公钥到服务器 `~/.ssh/authorized_keys`。
|
添加你的 Mac 公钥到服务器 `~/.ssh/authorized_keys`。
|
||||||
|
|
||||||
在你的Linux服务器中安装`rsync`,并开启SSH服务。
|
在你的 Linux 服务器中安装`rsync`,并开启 SSH 服务。
|
||||||
|
51
package.json
51
package.json
@ -1,45 +1,44 @@
|
|||||||
{
|
{
|
||||||
"name": "electron-distribution",
|
"name": "electron-distribution",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "Electron Distribution",
|
"description": "Electron Distribution",
|
||||||
"author": "yi-ge <a@wyr.me>",
|
"author": "yi-ge <a@wyr.me>",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env NODE_ENV=development nodemon src/dev.js",
|
"dev": "nodemon src/dev.js",
|
||||||
"build": "babel src -d dist",
|
"build": "babel src -d dist",
|
||||||
"start": "node dist/app.js"
|
"start": "node dist/app.js"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ali-oss": "^6.1.1",
|
"ali-oss": "^6.4.0",
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.19.1",
|
||||||
"chalk": "^2.4.2",
|
"chalk": "^3.0.0",
|
||||||
"chance": "^1.0.18",
|
"chance": "^1.1.4",
|
||||||
"cos-nodejs-sdk-v5": "^2.5.7",
|
"cos-nodejs-sdk-v5": "^2.5.14",
|
||||||
"cross-env": "^5.2.0",
|
"dockerode": "^3.0.2",
|
||||||
"dockerode": "^2.5.8",
|
|
||||||
"hapi": "^18.1.0",
|
"hapi": "^18.1.0",
|
||||||
"hapi-swagger": "^9.4.2",
|
"hapi-swagger": "^12.0.0",
|
||||||
"inert": "^5.1.2",
|
"inert": "^5.1.3",
|
||||||
"joi": "^13.7.0",
|
"joi": "^14.3.1",
|
||||||
"jssha": "^2.3.1",
|
"jssha": "^2.3.1",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.15",
|
||||||
"lowdb": "^1.0.0",
|
"lowdb": "^1.0.0",
|
||||||
"moment-timezone": "^0.5.23",
|
"moment-timezone": "^0.5.27",
|
||||||
"qiniu": "^7.2.1",
|
"qiniu": "^7.3.0",
|
||||||
"simple-git": "^1.110.0",
|
"simple-git": "^1.129.0",
|
||||||
"socket.io": "^2.2.0",
|
"socket.io": "^2.3.0",
|
||||||
"ssh2": "^0.8.2",
|
"ssh2": "^0.8.7",
|
||||||
"vision": "^5.4.4"
|
"vision": "^5.4.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.2.3",
|
"@babel/cli": "^7.8.3",
|
||||||
"@babel/core": "^7.4.0",
|
"@babel/core": "^7.8.3",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.4.0",
|
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||||
"@babel/plugin-proposal-decorators": "^7.4.0",
|
"@babel/plugin-proposal-decorators": "^7.8.3",
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
|
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
||||||
"@babel/preset-env": "^7.4.2",
|
"@babel/preset-env": "^7.8.3",
|
||||||
"@babel/register": "^7.4.0",
|
"@babel/register": "^7.8.3",
|
||||||
"nodemon": "^1.18.10"
|
"nodemon": "^2.0.2"
|
||||||
},
|
},
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
"ignore": [
|
"ignore": [
|
||||||
|
@ -6,7 +6,6 @@ const mac = new qiniu.auth.digest.Mac(QINIU.accessKey, QINIU.secretKey)
|
|||||||
const putPolicy = new qiniu.rs.PutPolicy({
|
const putPolicy = new qiniu.rs.PutPolicy({
|
||||||
scope: QINIU.bucket
|
scope: QINIU.bucket
|
||||||
})
|
})
|
||||||
const uploadToken = putPolicy.uploadToken(mac)
|
|
||||||
|
|
||||||
const config = new qiniu.conf.Config()
|
const config = new qiniu.conf.Config()
|
||||||
// 空间对应的机房
|
// 空间对应的机房
|
||||||
@ -18,6 +17,7 @@ config.useHttpsDomain = true
|
|||||||
|
|
||||||
export const uploadLocalFileToQiniu = (key, localFile) => {
|
export const uploadLocalFileToQiniu = (key, localFile) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const uploadToken = putPolicy.uploadToken(mac)
|
||||||
var resumeUploader = new qiniu.resume_up.ResumeUploader(config)
|
var resumeUploader = new qiniu.resume_up.ResumeUploader(config)
|
||||||
var putExtra = new qiniu.resume_up.PutExtra()
|
var putExtra = new qiniu.resume_up.PutExtra()
|
||||||
// 如果指定了断点记录文件,那么下次会从指定的该文件尝试读取上次上传的进度,以实现断点续传
|
// 如果指定了断点记录文件,那么下次会从指定的该文件尝试读取上次上传的进度,以实现断点续传
|
||||||
|
Reference in New Issue
Block a user