Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/Program Files/Avast Software/Avast/gui_resources/1.0.663/ |
//{"name":"DriverUpdater","version":"1.2.344","created":"2021-09-06T10:49:06.061Z"} import t from"./ractive.js";import{productModel as e}from"./napiExtensions.js";import{serviceRequest as s,napiTracker as r,eventer as i}from"./napi.js";import{logger as n}from"./libs.js";const a=t.extend({template:{v:3,t:[{t:7,e:"Page",a:{heading:[{t:3,x:{r:["nls"],s:'_0("driverupdater")'}}],cssCls:"dru",backHash:"#performance"},f:[{t:7,e:"div",a:{slot:"breadcrumbs"},f:[{t:7,e:"Crumbs",a:{customBreadcrumbs:0,section:"performance",moduleId:"driverupdater"}}]}," ",{t:7,e:"div",a:{slot:"page-content"},f:[{t:7,e:"View",f:[{t:7,e:"div",a:{slot:"view-content"},f:[{t:7,e:"section",a:{class:"nui_icon-page"},f:[{t:4,f:[{t:7,e:"kin-loading"}],n:50,r:"loading"},{t:4,n:51,f:[{t:4,f:[{t:7,e:"kin-icon",a:{name:"icon-m-tools-driver-updater",size:"200",class:"kin_view__icon color-disabled -text"}}," ",{t:7,e:"h3",a:{class:"h3 g-margin-bottom--30"},f:[{t:3,x:{r:["nls"],s:'_0("driverupdater.content.title")'}}]}," ",{t:7,e:"kin-button",a:{size:"large"},v:{click:"installDriverUpdater"},f:[{t:3,x:{r:["nls"],s:'_0("settings.install_now")'}}]}],n:50,x:{r:["state"],s:'_0==="notInstalled"'}},{t:4,n:51,f:[{t:4,n:50,x:{r:["state"],s:'_0==="installed"'},f:[{t:7,e:"kin-icon",a:{name:"icon-m-tools-driver-updater",size:"200",class:"kin_view__icon"}}," ",{t:7,e:"h3",a:{class:"h3 g-margin-bottom--30"},f:[{t:3,x:{r:["nls"],s:'_0("driverupdater.content.title")'}}]}," ",{t:7,e:"kin-button",a:{size:"large"},v:{click:"openDriverUpdater"},f:[{t:3,x:{r:["nls"],s:'_0("driverupdater.open")'}}]}]},{t:4,n:50,x:{r:["state"],s:'(!(_0==="installed"))&&(_0==="installing")'},f:[" ",{t:7,e:"Progress",a:{percentage:"unknown"}}," ",{t:7,e:"h2",a:{class:"h2 g-margin-top--20"},f:[{t:3,x:{r:["nls"],s:'_0("driverupdater.installing")'}}]}]}],x:{r:["state"],s:'_0==="notInstalled"'}}],r:"loading"}]}]}]}]}]}]},data:function(){return{duId:"du",loading:!0,brand:e.getBrand()||"avast",state:"notInstalled"}},oninit(){this.log=n.createLogger("driver-updater"),this.listeners=[],this.set({duId:`product.${this.get("brand")}_du`.toLowerCase()+`.du_${this.get("brand")}`.toUpperCase()}),s(`app.${this.get("brand")}.lis.get.install`,{ids:["du"]}).then((t=>t&&t.products&&t.products.du&&t.products.du.installed)).catch((t=>s("app.utils.GetDriverUpdaterState"))).then((t=>{Boolean(t)?(this.log.info("DriverUpdater is installed"),this.set("state","installed")):(this.log.info("DriverUpdater is not installed"),this.set("state","notInstalled")),this.set("loading",!1),this.screenReady()})).catch((t=>{this.log.error("app.utils.GetDriverUpdaterState error: "+JSON.stringify(t)),this.set("state","notInstalled"),this.set("loading",!1),this.screenError()})),this.on("openDriverUpdater",(()=>{r.event("Driver Updater","Click","open","DriverUpdater"),s(`app.${this.get("brand")}.lis.open.ui`,{id:"du"}).catch((()=>s("app.utils.ExecuteDriverUpdater"))).then((()=>{this.log.info("openDriverUpdater")})).catch((t=>{this.log.error("openDriverUpdater error: "+JSON.stringify(t))}))})),this.on("installDriverUpdater",(()=>{this.set("state","installing"),r.event("Driver Updater","Click","install","DriverUpdater"),this._installDriverUpdater().catch((()=>{this._getInstallerUrl().then(this._getHashUrl.bind(this)).then(this._dowloadAndInstall.bind(this)).catch((t=>{this.log.error("installDriverUpdater error: "+JSON.stringify(t)),this.set("state","notInstalled")}))}))}))},_getInstallerUrl:()=>new Promise(((t,e)=>{s("app.settings.Get","avdef://config/DriverUpdater/InstallerURL").then((s=>{if(s){t({url:s})}else e("avdef://config/DriverUpdater/InstallerURL no URL found")})).catch((t=>{e(t)}))})),_getHashUrl:t=>new Promise(((e,r)=>{s("app.settings.Get","avdef://config/DriverUpdater/HashURL").then((s=>{s?(t.hashUrl=s,e(t)):r("avdef://config/DriverUpdater/HashURL no URL found")})).catch((t=>{r(t)}))})),_installDriverUpdater(){const t=this.get("duId");return this.listeners.push(i.on(`app.${this.get("brand")}.lis.install.event`,(e=>{if(e.id===t&&"finish"===e.step){this._removeListeners();0===e.code?(this.log.info("DriverUpdater installed successfully"),this.set("state","installed")):(this.log.info("DriverUpdater was not installed"),this.set("state","notInstalled"))}}))),s(`app.${this.get("brand")}.lis.install`,{products:[{id:t,download:{url_id:"du"},run:{run_id:"du"}}]})},_dowloadAndInstall(t){return this.listeners.push(i.on("app.utils.onProductDownloadComplete",(()=>this._driverUpdaterDownloadComplete()))),new Promise(((e,r)=>{s("app.utils.DownloadAndInstallProduct",t).then((t=>{0===t?(this.log.info("DriverUpdater installed successfully"),this.set("state","installed")):(this.log.info("DriverUpdater was not installed"),this.set("state","notInstalled")),e()})).catch((t=>{r(t)}))}))},_removeListeners(){this.listeners.forEach((t=>{t()}))},_driverUpdaterDownloadComplete(){this.log.info("DriverUpdater download completed"),this._removeListeners()},onteardown(){this._removeListeners()}});export default a;const l={name:"DriverUpdater",version:"1.2.344",created:"2021-09-06T10:49:06.061Z"};export{l as metadata};