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/default_av/ |
//{"name":"RescueDisk","version":"1.2.164","created":"2021-03-09T09:21:12.373Z"} import s from"./ractive.js";import{nls as t}from"./i18n.js";import{logger as e}from"./libs.js";import{modals as i}from"./ractiveComponents.js";import{eventer as r,serviceRequest as n}from"./napi.js";const o=s.extend({template:{v:3,t:[{t:7,e:"Page",a:{heading:[{t:3,x:{r:["nls"],s:'_0("rescuedisk")'}}],cssCls:"rsd",backHash:"#Scans"},f:[{t:7,e:"div",a:{slot:"breadcrumbs"},f:[{t:7,e:"Crumbs",a:{customBreadcrumbs:["[{title: ",{t:3,x:{r:["nls"],s:'_0("security")'}},", url : '#security', section: true}, {title: ",{t:3,x:{r:["nls"],s:'_0("scans")'}},", url: '#Scans'}, {title: ",{t:3,x:{r:["nls"],s:'_0("rescuedisk")'}},", url: '#RescueDisk'}]"]}}]}," ",{t:7,e:"div",a:{slot:"page-content",class:"kin_page-content -scan"},f:[{t:4,f:[{t:7,e:"div",a:{class:"kin_scan"},f:[{t:7,e:"div",a:{class:"kin_scan__progress"},f:[{t:7,e:"kin-progress",a:{percentage:[{t:2,r:"progress"}],dotted:"true"}}]}," ",{t:7,e:"div",a:{class:"kin_scan__subtitle"},f:[{t:4,f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.starting")'}}]}],n:50,r:"createPerformed"},{t:4,n:51,f:[{t:4,n:50,x:{r:["status.state","STATES.FAILED"],s:"_0===_1"},f:[{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.error")'}}]}]},{t:4,n:50,x:{r:["STATES.FAILED","status.state","STATES.FINISHED"],s:"(!(_1===_0))&&(_1===_2)"},f:[" ",{t:7,e:"p",a:{class:"p"},f:[{t:4,f:[{t:3,x:{r:["nls","status.targetPath"],s:'_0("rescuedisk.createUSB.done",_1)'}}],n:50,x:{r:["status.targetType","TARGET_TYPES.USB"],s:"_0===_1"}},{t:4,n:51,f:[{t:4,n:50,x:{r:["status.targetType","TARGET_TYPES.ISO"],s:"_0===_1"},f:[{t:3,x:{r:["nls","status.targetPath"],s:'_0("rescuedisk.createCD.done",_1)'}}]}],x:{r:["status.targetType","TARGET_TYPES.USB"],s:"_0===_1"}}]}]},{t:4,n:50,x:{r:["STATES.FAILED","STATES.FINISHED","status.state","STATES.RUNNING"],s:"(!(_2===_0))&&((!(_2===_1))&&(_2===_3))"},f:[" ",{t:7,e:"p",a:{class:"p"},f:[{t:4,f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.createUSB.progress")'}}],n:50,x:{r:["status.targetType","TARGET_TYPES.USB"],s:"_0===_1"}},{t:4,n:51,f:[{t:4,n:50,x:{r:["status.targetType","TARGET_TYPES.ISO"],s:"_0===_1"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.createCD.progress")'}}]}],x:{r:["status.targetType","TARGET_TYPES.USB"],s:"_0===_1"}}]}]},{t:4,n:50,x:{r:["STATES.FAILED","STATES.FINISHED","STATES.RUNNING","status.state","STATES.STOPPING"],s:"(!(_3===_0))&&((!(_3===_1))&&((!(_3===_2))&&(_3===_4)))"},f:[" ",{t:7,e:"p",a:{class:"p"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.stopping")'}}]}]}],r:"createPerformed"}]}," ",{t:7,e:"div",a:{class:"kin_scan__actions"},f:[{t:4,f:[{t:7,e:"button",v:{click:"confirmEnd"},a:{class:"btn -large g-margin-top--10","data-test":"rsd_back"},f:[{t:3,x:{r:["nls"],s:'_0("global.ok")'}}]}],n:50,x:{r:["status.state","STATES.FAILED"],s:"_0===_1"}},{t:4,n:51,f:[{t:4,n:50,x:{r:["status.state","STATES.FINISHED"],s:"_0===_1"},f:[{t:7,e:"button",v:{click:"confirmEnd"},a:{class:"btn -large g-margin-top--10","data-test":"rsd_back"},f:[{t:3,x:{r:["nls"],s:'_0("global.ok")'}}]}]},{t:4,n:50,x:{r:["STATES.FINISHED","status.state","STATES.RUNNING"],s:"(!(_1===_0))&&(_1===_2)"},f:[" ",{t:7,e:"button",v:{click:"stop"},a:{class:"btn -secondary -large -white g-margin-top--10"},f:[{t:3,x:{r:["nls"],s:'_0("global.stop")'}}]}]}],x:{r:["status.state","STATES.FAILED"],s:"_0===_1"}}]}]}],n:50,r:"showProgressInfo"},{t:4,n:51,f:[{t:7,e:"kin-view",f:[{t:7,e:"div",a:{slot:"description"},f:[{t:7,e:"p",a:{class:"kin_description__text"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.desc.1.text")'}}]}]}," ",{t:7,e:"div",a:{slot:"view-content"},f:[{t:7,e:"section",a:{class:"nui_page__flex rsd_page"},f:[{t:7,e:"div",a:{class:"nui_page__center"},f:[{t:7,e:"button",a:{class:"cube -blank","data-test":"rsd_create-cd"},v:{click:{n:"create",d:[{t:2,r:"TARGET_TYPES.ISO"}]}},f:[{t:7,e:"Icon",a:{name:"cd",cssCls:"cube__icon"}}," ",{t:7,e:"span",a:{class:"btn -secondary"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.createCD")'}}]}," ",{t:7,e:"span",a:{class:"cube__label"},f:[{t:7,e:"span",a:{class:"cube__desc"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.createCD.desc")'}}]}]}]}]}," ",{t:7,e:"div",a:{class:"nui_page__center"},f:[{t:7,e:"button",a:{class:"cube -blank","data-test":"rsd_create-usb"},v:{click:{n:"create",d:[{t:2,r:"TARGET_TYPES.USB"}]}},f:[{t:7,e:"Icon",a:{name:"usb",cssCls:"cube__icon"}}," ",{t:7,e:"span",a:{class:"btn -secondary"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.createUSB")'}}]}," ",{t:7,e:"span",a:{class:"cube__label"},f:[{t:7,e:"span",a:{class:"cube__desc"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.createUSB.desc")'}}]}]}]}]}]}]}]}],r:"showProgressInfo"}]}]}," ",{t:4,f:[{t:7,e:"Modal",a:{cssCls:"nui_modal",title:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.selectUsbDrive")'}}]},f:[{t:4,f:[{t:7,e:"div",a:{class:"selectlist__wrap"},f:[{t:4,f:[{t:7,e:"button",v:{click:{n:"selectusb",d:[{t:2,r:"."}]}},a:{class:"selectlist"},f:[{t:7,e:"span",a:{class:"selectlist__item selectlist__icon"},f:[{t:7,e:"SvgIcon",a:{name:"usb"}}]}," ",{t:7,e:"span",a:{class:"selectlist__item"},f:[{t:2,r:"displayText"}]}]}],r:"usbDrives"}]}],n:50,r:"usbDrives"},{t:4,n:51,f:[{t:7,e:"p",a:{class:"p -margins"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.noUsbFound")'}}]}],r:"usbDrives"}," ",{t:7,e:"button",v:{click:"close"},a:{"data-test":"cancel",class:"btn -secondary g-margin-top--20"},f:[{t:3,x:{r:["nls"],s:'_0("global.cancel")'}}]}]}],n:50,x:{r:["usbDrives"],s:"_0!=null"}},{t:4,f:[{t:7,e:"Modal",a:{cssCls:"nui_modal",title:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.selectUsbDrive")'}}]},f:[{t:7,e:"p",f:[{t:3,x:{r:["nls","confirmOverwrite"],s:'_0("rescuedisk.confirmOverwrite",_1)'}}]}," ",{t:7,e:"button",v:{click:"confirm"},a:{"data-test":"cancel",class:"btn g-margin-top--20"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.overwriteUsb")'}}]}," ",{t:7,e:"button",v:{click:"close"},a:{"data-test":"confirm",class:"btn -secondary g-margin-left--10 g-margin-top--20"},f:[{t:3,x:{r:["nls"],s:'_0("global.cancel")'}}]}]}],n:50,r:"confirmOverwrite"}]},css:".rsd_page {\n margin-top: 85px;\n}\n.rsd_actions {\n margin-top: 14rem;\n text-align: center;\n}\n",data:()=>({status:{},usbDrives:null,showProgressInfo:!1,createPerformed:!1,loading:!0}),computed:{progress:function(){return this.isInProgress()||this.get("status.state")===this.get("STATES.STOPPED")||this.get("createPerformed")?this.get("status.progress"):100}},oninit(){this.log=e.createLogger("rescuedisk"),this.log.debug("oninit"),this.on("create",this.onCreate.bind(this)),this.on("stop",this.onStop.bind(this)),this.on("confirmEnd",this.onConfirmEnd.bind(this)),this.offStatusChanged=r.on("rescueDisc.onStatusChanged",this.onStatusChanged.bind(this)),Promise.all([n("app.rescueDisc.STATES"),n("app.rescueDisc.TARGET_TYPES")]).then((s=>{this.log.info("all init requests done"),this.set("STATES",s[0]),this.set("TARGET_TYPES",s[1]),this.pollStatus().then((()=>{this.set("loading",!1),this.screenReady()})).catch((()=>{this.set("loading",!1),this.screenError()}))})).catch((()=>{this.log.warn("some init request failed"),this.screenError(t("global.loadingModuleFailed"))}))},onteardown(){this.log.debug("onteardown"),this.offStatusChanged&&this.offStatusChanged(),this.stopUsbPolling&&this.stopUsbPolling()},onStatusChanged(s){const t="string"==typeof s;this.log.info("status changed"),this.log.debug(s);try{if(t&&(s=JSON.parse(s)),null===s||"object"!=typeof s)throw new Error}catch(r){return void console.log("Failed to parse RD onStatusChanged data",s)}const e=this.get("STATES"),i={};for(const n in s)i["status."+n]=s[n];if(this.set(i),null!=s.state)switch(this.set("createPerformed",!1),s.state){case e.RUNNING:case e.STOPPING:this.setProgressInfoVisibility(!0);break;case e.STOPPED:this.setProgressInfoVisibility(!1);break;case e.FAILED:this.onFailed()}},onFailed(){this.setProgressInfoVisibility(!1),1127===this.get("status.error")?i.inform(t("rescuedisk.error.notBootable")):i.inform(t("rescuedisk.error"))},onConfirmEnd(){this.log.debug("end confirmed"),this.setProgressInfoVisibility(!1)},setProgressInfoVisibility(s){this.get("showProgressInfo")!==s&&(this.log.info((s?"displaying":"hiding")+" progress info"),this.set("showProgressInfo",s))},onStop(){this.log.info("going to stop the process"),this.get("status.state")===this.get("STATES.RUNNING")?n("app.rescueDisc.Stop").then((()=>{this.log.info("stop request performed successfully.. waiting when fully stopped")})).catch((s=>{this.log.error("error while executing app.rescueDisc.Stop",s),i.inform(t("rescuedisk.stop.error"))})):this.log.warn("not running.. doing nothing")},onCreate(s,e){if(this.log.info("going to start the creation process, type: "+e),this.isInProgress())this.log.warn("an action in progress.. doing nothing");else{(e===this.get("TARGET_TYPES.ISO")?this.dialogISO():this.dialogUSB()).then((s=>{s?(this.log.info("creating disc, path: "+s),n("app.rescueDisc.Create",{targetType:e,targetPath:s}).then((()=>{this.log.info("the create request performed successfully.. waiting until it really starts"),this.set("createPerformed",!0),this.setProgressInfoVisibility(!0)})).catch((s=>{this.log.error("error while executing app.rescueDisc.Create",s),i.inform(t("rescuedisk.create.error"))}))):this.log.info("unable to create rescue disk, no path was selected")})).catch((s=>this.log.error("an error occured while creating rescue disk",s)))}},dialogISO(){return this.log.debug("opening the saveAs dialog"),n("app.utils.SaveAsDialog",{ext:"iso",file_name:"rescuedisk",filter:"*.iso||"}).then((s=>(this.log.debug("saveAs result "+(s&&JSON.stringify(s))),"ok"===s.dialogReturnCode?s.pathName:null))).catch((s=>this.log.error("error while executing app.utils.SaveAsDialog",s)))},dialogUSB(){return this.log.debug("opening the USB drive dialog"),this.startUsbPolling(),new Promise((s=>{this.once("selectusb",((t,e)=>{this.log.debug("selecting drive result "+(e||JSON.stringify(e))),s(e.drive)})),this.once("close *.close",(()=>{this.log.debug("dialog closed"),s()}))})).then((s=>{if(this.log.debug("stopping USB drive polling"),this.stopUsbPolling(),this.set("usbDrives",null),s)return this.confirmUsb(s)}))},confirmUsb(s){return this.log.debug("opening USB overwrite confirmation dialog, drive: "+s),new Promise((t=>{this.set("confirmOverwrite",s),this.once("confirm",(()=>{this.log.debug("USB overwrite confirmed"),this.set("confirmOverwrite",null),t(s)})),this.once("close *.close",(()=>{this.log.debug("the USB overwrite dialog closed"),this.set("confirmOverwrite",null),t()}))}))},startUsbPolling(){this.log.info("starting USB drive polling"),this.stopUsbPolling&&this.stopUsbPolling();const s=()=>{this.log.debug("polling USB drives"),n("app.utils.GetUsbDriveList").then((s=>{null!=this.stopUsbPolling&&(this.log.debug("USB drives polled, count: "+(s&&s.length)),this.set("usbDrives",s))})).catch((s=>this.log.error("error while executing app.utils.GetUsbDriveList",s)))};s();const t=setInterval(s,1e3);return this.stopUsbPolling=()=>{this.log.info("stopping USB drive polling"),this.stopUsbPolling=null,clearInterval(t)},this.stopUsbPolling},pollStatus(){return this.log.info("going to poll the status"),new Promise(((s,t)=>{n("app.rescueDisc.GetStatus").then((t=>{this.log.info("status polled"),this.log.debug("status: "+JSON.stringify(t)),this.onStatusChanged(t),s(t)})).catch((s=>{this.log.error("an error occured while executing app.rescueDisc.GetStatus",s),t()}))}))},isInProgress(){return this.get("status.state")===this.get("STATES.RUNNING")||this.get("status.state")===this.get("STATES.STOPPING")}});export default o;const a={name:"RescueDisk",version:"1.2.164",created:"2021-03-09T09:21:12.373Z"};export{a as metadata};