mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 11:52:07 +08:00
自动更新优化
This commit is contained in:
@@ -1 +1 @@
|
||||
#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}#app,#app-layout-sider[data-v-1778865c]{height:100%}#app-layout-sider .logo[data-v-1778865c]{border-bottom:1px solid #e8e8e8}#app-layout-sider .pic-logo[data-v-1778865c]{height:32px;margin:10px}#app-layout-sider .layout-sider[data-v-1778865c]{border-top:1px solid #e8e8e8;border-right:1px solid #e8e8e8}#app-layout-sider .menu-item .ant-menu-item[data-v-1778865c]{background-color:#fff;margin-top:0;margin-bottom:0;padding:0 0!important}#app-demo-menu[data-v-dae96be8]{height:100%;text-align:center}#app-demo-menu .layout-sider[data-v-dae96be8]{border-top:1px solid #e8e8e8;border-right:1px solid #e8e8e8;background-color:#fafafa;overflow:auto}@-webkit-keyframes Blink{0%{opacity:0}to{opacity:1}}@keyframes Blink{0%{opacity:0}to{opacity:1}}@-webkit-keyframes hot-key-input-shake{0%{transform:scale(1)}10%,20%{transform:scale(.9) rotate(-1deg)}30%,50%,70%,90%{transform:scale(1.1) rotate(1deg)}40%,60%,80%{transform:scale(1.1) rotate(-1deg)}to{transform:scale(1) rotate(0)}}@keyframes hot-key-input-shake{0%{transform:scale(1)}10%,20%{transform:scale(.9) rotate(-1deg)}30%,50%,70%,90%{transform:scale(1.1) rotate(1deg)}40%,60%,80%{transform:scale(1.1) rotate(-1deg)}to{transform:scale(1) rotate(0)}}.hot-key-input-shark{-webkit-animation:hot-key-input-shake .8s ease-in 1;animation:hot-key-input-shake .8s ease-in 1}.hot-key-input-component{display:flex;padding:5px;border:1px solid #dcdcdc;background-color:#fff;color:#333;cursor:text;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.hot-key-input-component:before{content:attr(placeholder);color:#afafaf}.hot-key-input-component.cursor:after{content:"|";-webkit-animation:Blink 1.2s ease 0s infinite;animation:Blink 1.2s ease 0s infinite;position:absolute;left:10px}.hot-item{display:flex;align-items:center;background-color:#f4f4f5;border-color:#e9e9eb;color:#909399;padding:0 5px;margin-right:5px}.hot-key-input-component .hot-item .icon-close{display:block;content:"";background:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M512 64C264.58 64 64 264.58 64 512s200.58 448 448 448 448-200.58 448-448S759.42 64 512 64zm0 832c-212.08 0-384-171.92-384-384s171.92-384 384-384 384 171.92 384 384-171.92 384-384 384z' fill='%23909399'/%3E%3Cpath d='M625.14 353.61L512 466.75 398.86 353.61a32 32 0 00-45.25 45.25L466.75 512 353.61 625.14a32 32 0 0045.25 45.25L512 557.25l113.14 113.14a32 32 0 0045.25-45.25L557.25 512l113.14-113.14a32 32 0 00-45.25-45.25z' fill='%23909399'/%3E%3C/svg%3E") no-repeat 50%;background-size:contain;width:14px;height:14px;transform:scale(.9);opacity:.6}.hot-key-input-component .hot-item .icon-close:hover{cursor:pointer;opacity:1}
|
||||
#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}#app,#app-layout-sider[data-v-1778865c]{height:100%}#app-layout-sider .logo[data-v-1778865c]{border-bottom:1px solid #e8e8e8}#app-layout-sider .pic-logo[data-v-1778865c]{height:32px;margin:10px}#app-layout-sider .layout-sider[data-v-1778865c]{border-top:1px solid #e8e8e8;border-right:1px solid #e8e8e8}#app-layout-sider .menu-item .ant-menu-item[data-v-1778865c]{background-color:#fff;margin-top:0;margin-bottom:0;padding:0 0!important}#app-demo-menu[data-v-abe3cca6]{height:100%;text-align:center}#app-demo-menu .layout-sider[data-v-abe3cca6]{border-top:1px solid #e8e8e8;border-right:1px solid #e8e8e8;background-color:#fafafa;overflow:auto}@-webkit-keyframes Blink{0%{opacity:0}to{opacity:1}}@keyframes Blink{0%{opacity:0}to{opacity:1}}@-webkit-keyframes hot-key-input-shake{0%{transform:scale(1)}10%,20%{transform:scale(.9) rotate(-1deg)}30%,50%,70%,90%{transform:scale(1.1) rotate(1deg)}40%,60%,80%{transform:scale(1.1) rotate(-1deg)}to{transform:scale(1) rotate(0)}}@keyframes hot-key-input-shake{0%{transform:scale(1)}10%,20%{transform:scale(.9) rotate(-1deg)}30%,50%,70%,90%{transform:scale(1.1) rotate(1deg)}40%,60%,80%{transform:scale(1.1) rotate(-1deg)}to{transform:scale(1) rotate(0)}}.hot-key-input-shark{-webkit-animation:hot-key-input-shake .8s ease-in 1;animation:hot-key-input-shake .8s ease-in 1}.hot-key-input-component{display:flex;padding:5px;border:1px solid #dcdcdc;background-color:#fff;color:#333;cursor:text;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.hot-key-input-component:before{content:attr(placeholder);color:#afafaf}.hot-key-input-component.cursor:after{content:"|";-webkit-animation:Blink 1.2s ease 0s infinite;animation:Blink 1.2s ease 0s infinite;position:absolute;left:10px}.hot-item{display:flex;align-items:center;background-color:#f4f4f5;border-color:#e9e9eb;color:#909399;padding:0 5px;margin-right:5px}.hot-key-input-component .hot-item .icon-close{display:block;content:"";background:url("data:image/svg+xml;charset=utf-8,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M512 64C264.58 64 64 264.58 64 512s200.58 448 448 448 448-200.58 448-448S759.42 64 512 64zm0 832c-212.08 0-384-171.92-384-384s171.92-384 384-384 384 171.92 384 384-171.92 384-384 384z' fill='%23909399'/%3E%3Cpath d='M625.14 353.61L512 466.75 398.86 353.61a32 32 0 00-45.25 45.25L466.75 512 353.61 625.14a32 32 0 0045.25 45.25L512 557.25l113.14 113.14a32 32 0 0045.25-45.25L557.25 512l113.14-113.14a32 32 0 00-45.25-45.25z' fill='%23909399'/%3E%3C/svg%3E") no-repeat 50%;background-size:contain;width:14px;height:14px;transform:scale(.9);opacity:.6}.hot-key-input-component .hot-item .icon-close:hover{cursor:pointer;opacity:1}
|
||||
1
app/public/css/chunk-4922ae20.42e97468.css
Normal file
1
app/public/css/chunk-4922ae20.42e97468.css
Normal file
@@ -0,0 +1 @@
|
||||
#app-demo-window[data-v-667bcd63]{padding:0 10px;text-align:left;width:100%}#app-demo-window .one-block-1[data-v-667bcd63]{font-size:16px;padding-top:10px}#app-demo-window .one-block-2[data-v-667bcd63]{padding-top:10px}
|
||||
@@ -4,4 +4,4 @@
|
||||
::-webkit-scrollbar-track{background:0 0}
|
||||
::-webkit-scrollbar-thumb{background:#E6FFEE;-webkit-transition:.3s;transition:.3s}
|
||||
::-webkit-scrollbar-thumb:hover{background-color:#07C160}
|
||||
::-webkit-scrollbar-thumb:active{background-color:#E6FFEE}</style><link href="/css/chunk-0077e808.c3b8cac0.css" rel="prefetch"><link href="/css/chunk-076bae15.0e63f560.css" rel="prefetch"><link href="/css/chunk-0836256a.f9eb0256.css" rel="prefetch"><link href="/css/chunk-11be261c.ebd4d1e1.css" rel="prefetch"><link href="/css/chunk-1882667e.929cc0b0.css" rel="prefetch"><link href="/css/chunk-21264600.a03f25bd.css" rel="prefetch"><link href="/css/chunk-28594f30.f0a66429.css" rel="prefetch"><link href="/css/chunk-5ebbe05a.f54b3985.css" rel="prefetch"><link href="/css/chunk-6f5b76aa.8d2a6191.css" rel="prefetch"><link href="/css/chunk-73a34e00.e9f0edb8.css" rel="prefetch"><link href="/css/chunk-c3a37878.855045b3.css" rel="prefetch"><link href="/css/chunk-d08d7a24.35b85a67.css" rel="prefetch"><link href="/css/chunk-d82cf548.df6950da.css" rel="prefetch"><link href="/css/chunk-f6d2456a.5e5339e6.css" rel="prefetch"><link href="/css/chunk-fe0c189e.0fd43177.css" rel="prefetch"><link href="/js/chunk-0077e808.45699d1f.js" rel="prefetch"><link href="/js/chunk-076bae15.3f7e16cd.js" rel="prefetch"><link href="/js/chunk-0836256a.bd54b664.js" rel="prefetch"><link href="/js/chunk-11be261c.ee3ef6e9.js" rel="prefetch"><link href="/js/chunk-1882667e.a92213d6.js" rel="prefetch"><link href="/js/chunk-21264600.12d6c454.js" rel="prefetch"><link href="/js/chunk-28594f30.76724dcb.js" rel="prefetch"><link href="/js/chunk-5ebbe05a.560b208a.js" rel="prefetch"><link href="/js/chunk-6f5b76aa.4fe9bd4f.js" rel="prefetch"><link href="/js/chunk-73a34e00.b8ad79b7.js" rel="prefetch"><link href="/js/chunk-c3a37878.42d55cc1.js" rel="prefetch"><link href="/js/chunk-d08d7a24.22b16454.js" rel="prefetch"><link href="/js/chunk-d82cf548.4e60d99d.js" rel="prefetch"><link href="/js/chunk-f6d2456a.daa7989b.js" rel="prefetch"><link href="/js/chunk-fe0c189e.3dc3ff26.js" rel="prefetch"><link href="/css/app.ed866963.css" rel="preload" as="style"><link href="/css/chunk-vendors.9ca8efee.css" rel="preload" as="style"><link href="/js/app.f33ab358.js" rel="preload" as="script"><link href="/js/chunk-vendors.5200e059.js" rel="preload" as="script"><link href="/css/chunk-vendors.9ca8efee.css" rel="stylesheet"><link href="/css/app.ed866963.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but electron-egg doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.5200e059.js"></script><script src="/js/app.f33ab358.js"></script></body></html>
|
||||
::-webkit-scrollbar-thumb:active{background-color:#E6FFEE}</style><link href="/css/chunk-0077e808.c3b8cac0.css" rel="prefetch"><link href="/css/chunk-076bae15.0e63f560.css" rel="prefetch"><link href="/css/chunk-0836256a.f9eb0256.css" rel="prefetch"><link href="/css/chunk-11be261c.ebd4d1e1.css" rel="prefetch"><link href="/css/chunk-1882667e.929cc0b0.css" rel="prefetch"><link href="/css/chunk-21264600.a03f25bd.css" rel="prefetch"><link href="/css/chunk-28594f30.f0a66429.css" rel="prefetch"><link href="/css/chunk-4922ae20.42e97468.css" rel="prefetch"><link href="/css/chunk-5ebbe05a.f54b3985.css" rel="prefetch"><link href="/css/chunk-6f5b76aa.8d2a6191.css" rel="prefetch"><link href="/css/chunk-73a34e00.e9f0edb8.css" rel="prefetch"><link href="/css/chunk-c3a37878.855045b3.css" rel="prefetch"><link href="/css/chunk-d08d7a24.35b85a67.css" rel="prefetch"><link href="/css/chunk-d82cf548.df6950da.css" rel="prefetch"><link href="/css/chunk-f6d2456a.5e5339e6.css" rel="prefetch"><link href="/css/chunk-fe0c189e.0fd43177.css" rel="prefetch"><link href="/js/chunk-0077e808.45699d1f.js" rel="prefetch"><link href="/js/chunk-076bae15.3f7e16cd.js" rel="prefetch"><link href="/js/chunk-0836256a.bd54b664.js" rel="prefetch"><link href="/js/chunk-11be261c.ee3ef6e9.js" rel="prefetch"><link href="/js/chunk-1882667e.a92213d6.js" rel="prefetch"><link href="/js/chunk-21264600.12d6c454.js" rel="prefetch"><link href="/js/chunk-28594f30.76724dcb.js" rel="prefetch"><link href="/js/chunk-4922ae20.1bf6678e.js" rel="prefetch"><link href="/js/chunk-5ebbe05a.560b208a.js" rel="prefetch"><link href="/js/chunk-6f5b76aa.4fe9bd4f.js" rel="prefetch"><link href="/js/chunk-73a34e00.b8ad79b7.js" rel="prefetch"><link href="/js/chunk-c3a37878.42d55cc1.js" rel="prefetch"><link href="/js/chunk-d08d7a24.22b16454.js" rel="prefetch"><link href="/js/chunk-d82cf548.4e60d99d.js" rel="prefetch"><link href="/js/chunk-f6d2456a.daa7989b.js" rel="prefetch"><link href="/js/chunk-fe0c189e.3dc3ff26.js" rel="prefetch"><link href="/css/app.84c646e9.css" rel="preload" as="style"><link href="/css/chunk-vendors.9ca8efee.css" rel="preload" as="style"><link href="/js/app.708bbbaf.js" rel="preload" as="script"><link href="/js/chunk-vendors.5200e059.js" rel="preload" as="script"><link href="/css/chunk-vendors.9ca8efee.css" rel="stylesheet"><link href="/css/app.84c646e9.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but electron-egg doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.5200e059.js"></script><script src="/js/app.708bbbaf.js"></script></body></html>
|
||||
2
app/public/js/app.708bbbaf.js
Normal file
2
app/public/js/app.708bbbaf.js
Normal file
File diff suppressed because one or more lines are too long
1
app/public/js/app.708bbbaf.js.map
Normal file
1
app/public/js/app.708bbbaf.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
app/public/js/chunk-4922ae20.1bf6678e.js
Normal file
2
app/public/js/chunk-4922ae20.1bf6678e.js
Normal file
@@ -0,0 +1,2 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4922ae20"],{"2e16":function(t,n,e){"use strict";e.r(n);var o=function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{attrs:{id:"app-demo-window"}},[t._m(0),e("div",{staticClass:"one-block-2"},[e("a-space",[e("a-button",{on:{click:function(n){return t.checkForUpdater()}}},[t._v("检查更新")]),e("a-button",{on:{click:function(n){return t.download()}}},[t._v("下载并安装")])],1)],1)])},a=[function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"one-block-1"},[e("span",[t._v(" 1. 自动更新 ")])])}],c={data:function(){return{status:0}},mounted:function(){this.init()},methods:{init:function(){var t=this;t.$ipc.on("app.updater",(function(n,e){e=JSON.parse(e),console.log("app updater:",e);var o=e.desc;t.status=e.status,t.$message.info(o)}))},checkForUpdater:function(){var t=this;t.$ipcCallMain("example.checkForUpdater").then((function(t){console.log(t)}))},download:function(){if(1===this.status){var t=this;t.$ipcCallMain("example.downloadApp").then((function(t){console.log(t)}))}else this.$message.info("没有可用版本")}}},i=c,s=(e("d1e9"),e("2877")),u=Object(s["a"])(i,o,a,!1,null,"667bcd63",null);n["default"]=u.exports},"55bb":function(t,n,e){},d1e9:function(t,n,e){"use strict";e("55bb")}}]);
|
||||
//# sourceMappingURL=chunk-4922ae20.1bf6678e.js.map
|
||||
1
app/public/js/chunk-4922ae20.1bf6678e.js.map
Normal file
1
app/public/js/chunk-4922ae20.1bf6678e.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -4,4 +4,4 @@
|
||||
::-webkit-scrollbar-track{background:0 0}
|
||||
::-webkit-scrollbar-thumb{background:#E6FFEE;-webkit-transition:.3s;transition:.3s}
|
||||
::-webkit-scrollbar-thumb:hover{background-color:#07C160}
|
||||
::-webkit-scrollbar-thumb:active{background-color:#E6FFEE}</style><link href="/css/chunk-0077e808.c3b8cac0.css" rel="prefetch"><link href="/css/chunk-076bae15.0e63f560.css" rel="prefetch"><link href="/css/chunk-0836256a.f9eb0256.css" rel="prefetch"><link href="/css/chunk-11be261c.ebd4d1e1.css" rel="prefetch"><link href="/css/chunk-1882667e.929cc0b0.css" rel="prefetch"><link href="/css/chunk-21264600.a03f25bd.css" rel="prefetch"><link href="/css/chunk-28594f30.f0a66429.css" rel="prefetch"><link href="/css/chunk-5ebbe05a.f54b3985.css" rel="prefetch"><link href="/css/chunk-6f5b76aa.8d2a6191.css" rel="prefetch"><link href="/css/chunk-73a34e00.e9f0edb8.css" rel="prefetch"><link href="/css/chunk-c3a37878.855045b3.css" rel="prefetch"><link href="/css/chunk-d08d7a24.35b85a67.css" rel="prefetch"><link href="/css/chunk-d82cf548.df6950da.css" rel="prefetch"><link href="/css/chunk-f6d2456a.5e5339e6.css" rel="prefetch"><link href="/css/chunk-fe0c189e.0fd43177.css" rel="prefetch"><link href="/js/chunk-0077e808.45699d1f.js" rel="prefetch"><link href="/js/chunk-076bae15.3f7e16cd.js" rel="prefetch"><link href="/js/chunk-0836256a.bd54b664.js" rel="prefetch"><link href="/js/chunk-11be261c.ee3ef6e9.js" rel="prefetch"><link href="/js/chunk-1882667e.a92213d6.js" rel="prefetch"><link href="/js/chunk-21264600.12d6c454.js" rel="prefetch"><link href="/js/chunk-28594f30.76724dcb.js" rel="prefetch"><link href="/js/chunk-5ebbe05a.560b208a.js" rel="prefetch"><link href="/js/chunk-6f5b76aa.4fe9bd4f.js" rel="prefetch"><link href="/js/chunk-73a34e00.b8ad79b7.js" rel="prefetch"><link href="/js/chunk-c3a37878.42d55cc1.js" rel="prefetch"><link href="/js/chunk-d08d7a24.22b16454.js" rel="prefetch"><link href="/js/chunk-d82cf548.4e60d99d.js" rel="prefetch"><link href="/js/chunk-f6d2456a.daa7989b.js" rel="prefetch"><link href="/js/chunk-fe0c189e.3dc3ff26.js" rel="prefetch"><link href="/css/app.ed866963.css" rel="preload" as="style"><link href="/css/chunk-vendors.9ca8efee.css" rel="preload" as="style"><link href="/js/app.f33ab358.js" rel="preload" as="script"><link href="/js/chunk-vendors.5200e059.js" rel="preload" as="script"><link href="/css/chunk-vendors.9ca8efee.css" rel="stylesheet"><link href="/css/app.ed866963.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but electron-egg doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.5200e059.js"></script><script src="/js/app.f33ab358.js"></script></body></html>
|
||||
::-webkit-scrollbar-thumb:active{background-color:#E6FFEE}</style><link href="/css/chunk-0077e808.c3b8cac0.css" rel="prefetch"><link href="/css/chunk-076bae15.0e63f560.css" rel="prefetch"><link href="/css/chunk-0836256a.f9eb0256.css" rel="prefetch"><link href="/css/chunk-11be261c.ebd4d1e1.css" rel="prefetch"><link href="/css/chunk-1882667e.929cc0b0.css" rel="prefetch"><link href="/css/chunk-21264600.a03f25bd.css" rel="prefetch"><link href="/css/chunk-28594f30.f0a66429.css" rel="prefetch"><link href="/css/chunk-4922ae20.42e97468.css" rel="prefetch"><link href="/css/chunk-5ebbe05a.f54b3985.css" rel="prefetch"><link href="/css/chunk-6f5b76aa.8d2a6191.css" rel="prefetch"><link href="/css/chunk-73a34e00.e9f0edb8.css" rel="prefetch"><link href="/css/chunk-c3a37878.855045b3.css" rel="prefetch"><link href="/css/chunk-d08d7a24.35b85a67.css" rel="prefetch"><link href="/css/chunk-d82cf548.df6950da.css" rel="prefetch"><link href="/css/chunk-f6d2456a.5e5339e6.css" rel="prefetch"><link href="/css/chunk-fe0c189e.0fd43177.css" rel="prefetch"><link href="/js/chunk-0077e808.45699d1f.js" rel="prefetch"><link href="/js/chunk-076bae15.3f7e16cd.js" rel="prefetch"><link href="/js/chunk-0836256a.bd54b664.js" rel="prefetch"><link href="/js/chunk-11be261c.ee3ef6e9.js" rel="prefetch"><link href="/js/chunk-1882667e.a92213d6.js" rel="prefetch"><link href="/js/chunk-21264600.12d6c454.js" rel="prefetch"><link href="/js/chunk-28594f30.76724dcb.js" rel="prefetch"><link href="/js/chunk-4922ae20.1bf6678e.js" rel="prefetch"><link href="/js/chunk-5ebbe05a.560b208a.js" rel="prefetch"><link href="/js/chunk-6f5b76aa.4fe9bd4f.js" rel="prefetch"><link href="/js/chunk-73a34e00.b8ad79b7.js" rel="prefetch"><link href="/js/chunk-c3a37878.42d55cc1.js" rel="prefetch"><link href="/js/chunk-d08d7a24.22b16454.js" rel="prefetch"><link href="/js/chunk-d82cf548.4e60d99d.js" rel="prefetch"><link href="/js/chunk-f6d2456a.daa7989b.js" rel="prefetch"><link href="/js/chunk-fe0c189e.3dc3ff26.js" rel="prefetch"><link href="/css/app.84c646e9.css" rel="preload" as="style"><link href="/css/chunk-vendors.9ca8efee.css" rel="preload" as="style"><link href="/js/app.708bbbaf.js" rel="preload" as="script"><link href="/js/chunk-vendors.5200e059.js" rel="preload" as="script"><link href="/css/chunk-vendors.9ca8efee.css" rel="stylesheet"><link href="/css/app.84c646e9.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but electron-egg doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.5200e059.js"></script><script src="/js/app.708bbbaf.js"></script></body></html>
|
||||
@@ -318,5 +318,19 @@ exports.checkForUpdater = function (event, channel, arg) {
|
||||
autoUpdater.checkUpdate();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载新版本
|
||||
*/
|
||||
exports.downloadApp = function (event, channel, arg) {
|
||||
const updateConfig = config.get('autoUpdate');
|
||||
if ((is.windows() && updateConfig.windows) || (is.macOS() && updateConfig.macOS)
|
||||
|| (is.linux() && updateConfig.linux)) {
|
||||
const autoUpdater = require('../lib/autoUpdater');
|
||||
autoUpdater.download();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ const config = require('../config');
|
||||
const {app} = require('electron');
|
||||
const eLogger = require('./eLogger').get();
|
||||
const helper = require('./helper');
|
||||
const constant = require('./constant');
|
||||
|
||||
/**
|
||||
* 安装模块
|
||||
@@ -33,30 +34,44 @@ exports.setup = function () {
|
||||
}
|
||||
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
sendStatusToWindow('正在检查更新...');
|
||||
//sendStatusToWindow('正在检查更新...');
|
||||
})
|
||||
autoUpdater.on('update-available', (info) => {
|
||||
sendStatusToWindow('有可用更新');
|
||||
info.status = constant.appUpdaterStatus.available;
|
||||
info.desc = '有可用更新';
|
||||
sendStatusToWindow(info);
|
||||
})
|
||||
autoUpdater.on('update-not-available', (info) => {
|
||||
sendStatusToWindow('没有可用更新');
|
||||
info.status = constant.appUpdaterStatus.noAvailable;
|
||||
info.desc = '没有可用更新';
|
||||
sendStatusToWindow(info);
|
||||
})
|
||||
autoUpdater.on('error', (err) => {
|
||||
sendStatusToWindow('更新异常: ' + err);
|
||||
let info = {
|
||||
status: constant.appUpdaterStatus.error,
|
||||
desc: err
|
||||
}
|
||||
sendStatusToWindow(info);
|
||||
})
|
||||
autoUpdater.on('download-progress', (progressObj) => {
|
||||
let log_message = "下载进度: " + progressObj.bytesPerSecond;
|
||||
log_message = log_message + ' - 已下载 ' + progressObj.percent + '%';
|
||||
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
|
||||
sendStatusToWindow(log_message);
|
||||
let text = "下载进度: " + progressObj.bytesPerSecond;
|
||||
text = text + ' - 已下载 ' + progressObj.percent + '%';
|
||||
text = text + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
|
||||
|
||||
let info = {
|
||||
status: constant.appUpdaterStatus.downloading,
|
||||
desc: text
|
||||
}
|
||||
sendStatusToWindow(info);
|
||||
})
|
||||
autoUpdater.on('update-downloaded', (info) => {
|
||||
sendStatusToWindow('下载完成');
|
||||
console.log('downloaded info:', info)
|
||||
info.status = constant.appUpdaterStatus.downloaded;
|
||||
info.desc = '下载完成';
|
||||
sendStatusToWindow(info);
|
||||
// quit and update
|
||||
if (updateConfig.force) {
|
||||
helper.appQuit();
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
helper.appQuit();
|
||||
autoUpdater.quitAndInstall();
|
||||
});
|
||||
|
||||
};
|
||||
@@ -65,9 +80,14 @@ exports.checkUpdate = function () {
|
||||
autoUpdater.checkForUpdates();
|
||||
}
|
||||
|
||||
function sendStatusToWindow(text) {
|
||||
eLogger.info(text);
|
||||
MAIN_WINDOW.webContents.send('public.message', text);
|
||||
exports.download = function () {
|
||||
autoUpdater.downloadUpdate();
|
||||
}
|
||||
|
||||
function sendStatusToWindow(content = {}) {
|
||||
const textJson = JSON.stringify(content);
|
||||
eLogger.info(textJson);
|
||||
MAIN_WINDOW.webContents.send(constant.ipcChannels.appUpdater, textJson);
|
||||
}
|
||||
|
||||
exports = module.exports;
|
||||
@@ -7,4 +7,15 @@ module.exports = {
|
||||
]
|
||||
}
|
||||
},
|
||||
ipcChannels: {
|
||||
appMessage: 'app.message',
|
||||
appUpdater: 'app.updater'
|
||||
},
|
||||
appUpdaterStatus: {
|
||||
error: -1,
|
||||
available: 1,
|
||||
noAvailable: 2,
|
||||
downloading: 3,
|
||||
downloaded: 4,
|
||||
}
|
||||
};
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
methods: {
|
||||
initIpc () {
|
||||
const self = this;
|
||||
// 公共频道
|
||||
self.$ipc.on('public.message', (event, result) => {
|
||||
// 使用ant-desing-vue, message组件
|
||||
self.$message.info(result);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="one-block-2">
|
||||
<a-space>
|
||||
<a-button @click="checkForUpdater()">检查更新</a-button>
|
||||
<!-- <a-button @click="check(0)">打开哔哩哔哩</a-button> -->
|
||||
<a-button @click="download()">下载并安装</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<!-- <div class="one-block-1">
|
||||
@@ -28,19 +28,39 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
views: [],
|
||||
status: 0, // -1:异常,1:有可用更新,2:没有可用更新,3:下载中, 4:下载完成
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
//this.init();
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
const self = this;
|
||||
self.$ipc.on('app.updater', (event, result) => {
|
||||
result = JSON.parse(result);
|
||||
console.log('app updater:', result);
|
||||
let text = result.desc;
|
||||
self.status = result.status;
|
||||
self.$message.info(text);
|
||||
})
|
||||
},
|
||||
checkForUpdater () {
|
||||
const self = this;
|
||||
self.$ipcCallMain('example.checkForUpdater').then(r => {
|
||||
console.log(r);
|
||||
})
|
||||
},
|
||||
download () {
|
||||
if (this.status !== 1) {
|
||||
this.$message.info('没有可用版本');
|
||||
return
|
||||
}
|
||||
const self = this;
|
||||
self.$ipcCallMain('example.downloadApp').then(r => {
|
||||
console.log(r);
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user