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":"RescueDisk","version":"1.2.364","created":"2021-09-06T10:47:40.722Z"} import t from"./ractive.js";import{nls as s}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=t.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:"kin-button",v:{click:"confirmEnd"},a:{size:"large",class:"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:"kin-button",v:{click:"confirmEnd"},a:{size:"large",class:"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:"kin-button",v:{click:"stop"},a:{size:"large",type:"secondary",class:"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:"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:"rsd_page"},f:[{t:7,e:"div",a:{class:"rsd_cube__wrap"},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:"kin-button",a:{type:"secondary",fake:"true",size:"small"},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:"rsd_cube__wrap"},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:"kin-button",a:{type:"secondary",fake:"true",size:"small"},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")'}}]}]}]}]}," ",{t:4,f:[{t:7,e:"div",a:{class:"rsd_note"},f:[{t:7,e:"div",a:{class:"rsd_note__gap"},f:[{t:7,e:"input",a:{type:"checkbox",class:"checkbox",checked:[{t:2,r:"uefiBootEnv"}],id:"rsd_create-cd-uefi","data-test":"rsd_create-cd-uefi",title:[{t:2,x:{r:["nls"],s:'_0("rescuedisk.uefiBoot.checkbox")'}}]}}," ",{t:7,e:"label",a:{for:"rsd_create-cd-uefi","bs-input-label":0,class:"checkbox__label "},f:[{t:2,x:{r:["nls"],s:'_0("rescuedisk.uefiBoot.checkbox")'}}]}," ",{t:7,e:"div",a:{class:"p rsd_uefi_desc g-margin-left--5 -secondary -small"},f:[{t:2,x:{r:["nls"],s:'_0("rescuedisk.uefiBoot.checkbox.desc")'}}]}]}]}],n:50,x:{r:["uefiBootEnv"],s:"_0!=null"}}]}]}]}],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:"kin-icon",a:{name:"icon-m-usb-stick",size:"24"}}]}," ",{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:"kin-button",v:{click:"close"},a:{"data-test":"cancel",type:"secondary",class:"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:"kin-button",v:{click:"confirm"},a:{"data-test":"cancel",class:"g-margin-top--20"},f:[{t:3,x:{r:["nls"],s:'_0("rescuedisk.overwriteUsb")'}}]}," ",{t:7,e:"kin-button",v:{click:"close"},a:{"data-test":"confirm",type:"secondary",class:"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: 8.5rem;\n display: grid;\n grid-template-columns: max-content max-content;\n align-content: center;\n justify-content: center;\n}\n.rsd_cube__wrap {\n align-self: center;\n justify-self: center;\n text-align: center;\n}\n.rsd_note {\n margin: 1.5rem 1.5rem 0;\n grid-column: 1/span 2;\n justify-content: center;\n}\n.rsd_note__gap {\n width: 40rem;\n column-gap: 0.35rem;\n display: grid;\n margin: 0 auto;\n grid-template-columns: auto auto;\n text-align: left;\n}\n.rsd_actions {\n margin-top: 14rem;\n text-align: center;\n}\n.rsd_uefi_desc {\n grid-column: 2;\n}\n",data:()=>({status:{},usbDrives:null,showProgressInfo:!1,createPerformed:!1,uefiBootEnv:null,loading:!0,userStopped:!1}),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.allSettled([n("app.rescueDisc.STATES"),n("app.rescueDisc.TARGET_TYPES"),n("app.utils.GetSystemInfo"),n("asw.systools.SystemInformation.GetBootEnvironment")]).then((([t,s,e,i])=>{if(this.log.info("all init requests done"),"rejected"===t.status||"rejected"===s.status)throw"loading failed";this.set("STATES",t.value),this.set("TARGET_TYPES",s.value),e.value&&"x86"!==e.value.platform_name&&this.set("uefiBootEnv","uefi"===i.value),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(s("global.loadingModuleFailed"))}))},onteardown(){this.log.debug("onteardown"),this.offStatusChanged&&this.offStatusChanged(),this.stopUsbPolling&&this.stopUsbPolling()},onStatusChanged(t){const s="string"==typeof t;this.log.info("status changed"),this.log.debug(t);try{if(s&&(t=JSON.parse(t)),null===t||"object"!=typeof t)throw new Error}catch(n){return void console.log("Failed to parse RD onStatusChanged data",t)}const e=this.get("STATES"),i={};t.state===e.FINISHED&&this.get("userStopped")&&(t.state=e.STOPPED);for(const o in t)i["status."+o]=t[o];this.set(i);const r=parseInt(localStorage.getItem("rescueDisk.lastKnownState"))||e.READY;if(null!=t.state){switch(this.set("createPerformed",!1),t.state){case e.RUNNING:case e.STOPPING:this.setProgressInfoVisibility(!0);break;case e.STOPPED:this.setProgressInfoVisibility(!1);break;case e.FAILED:this.setProgressInfoVisibility(!1),r!==e.FAILED&&this.onFailed()}localStorage.setItem("rescueDisk.lastKnownState",t.state)}},onFailed(){1127===this.get("status.error")?i.inform(s("rescuedisk.error.notBootable")):i.inform(s("rescuedisk.error"))},onConfirmEnd(){this.log.debug("end confirmed"),this.setProgressInfoVisibility(!1)},setProgressInfoVisibility(t){this.get("showProgressInfo")!==t&&(this.log.info((t?"displaying":"hiding")+" progress info"),this.set("showProgressInfo",t))},onStop(){this.log.info("going to stop the process"),this.get("status.state")===this.get("STATES.RUNNING")?(this.set("userStopped",!0),n("app.rescueDisc.Stop").then((()=>{this.log.info("stop request performed successfully.. waiting when fully stopped")})).catch((t=>{this.log.error("error while executing app.rescueDisc.Stop",t),i.inform(s("rescuedisk.stop.error"))}))):this.log.warn("not running.. doing nothing")},onCreate(t,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{this.set("status",{}),this.set("userStopped",!1);const t=e===this.get("TARGET_TYPES.ISO");(t?this.dialogISO():this.dialogUSB()).then((r=>{if(r){this.log.info("creating disc, path: "+r);const o={targetType:e,targetPath:r},a=this.get("uefiBootEnv");t&&null!=a&&(o.bootEnvironment=a?"uefi":"legacy"),n("app.rescueDisc.Create",o).then((()=>{this.log.info("the create request performed successfully.. waiting until it really starts"),this.set("createPerformed",!0),this.setProgressInfoVisibility(!0)})).catch((t=>{this.log.error("error while executing app.rescueDisc.Create",t),i.inform(s("rescuedisk.create.error"))}))}else this.log.info("unable to create rescue disk, no path was selected")})).catch((t=>this.log.error("an error occured while creating rescue disk",t)))}},dialogISO(){return this.log.debug("opening the saveAs dialog"),n("app.utils.SaveAsDialog",{ext:"iso",file_name:"rescuedisk",filter:"*.iso||"}).then((t=>(this.log.debug("saveAs result "+(t&&JSON.stringify(t))),"ok"===t.dialogReturnCode?t.pathName:null))).catch((t=>this.log.error("error while executing app.utils.SaveAsDialog",t)))},dialogUSB(){return this.log.debug("opening the USB drive dialog"),this.startUsbPolling(),new Promise((t=>{this.once("selectusb",((s,e)=>{this.log.debug("selecting drive result "+(e||JSON.stringify(e))),t(e.drive)})),this.once("close *.close",(()=>{this.log.debug("dialog closed"),t()}))})).then((t=>{if(this.log.debug("stopping USB drive polling"),this.stopUsbPolling&&this.stopUsbPolling(),this.set("usbDrives",null),t)return this.confirmUsb(t)}))},confirmUsb(t){return this.log.debug("opening USB overwrite confirmation dialog, drive: "+t),new Promise((s=>{this.set("confirmOverwrite",t),this.once("confirm",(()=>{this.log.debug("USB overwrite confirmed"),this.set("confirmOverwrite",null),s(t)})),this.once("close *.close",(()=>{this.log.debug("the USB overwrite dialog closed"),this.set("confirmOverwrite",null),s()}))}))},startUsbPolling(){this.log.info("starting USB drive polling"),this.stopUsbPolling&&this.stopUsbPolling();const t=()=>{this.log.debug("polling USB drives"),n("app.utils.GetUsbDriveList").then((t=>{null!=this.stopUsbPolling&&(this.log.debug("USB drives polled, count: "+(t&&t.length)),this.set("usbDrives",t))})).catch((t=>this.log.error("error while executing app.utils.GetUsbDriveList",t)))};t();const s=setInterval(t,1e3);return this.stopUsbPolling=()=>{this.log.info("stopping USB drive polling"),this.stopUsbPolling=null,clearInterval(s)},this.stopUsbPolling},pollStatus(){return this.log.info("going to poll the status"),n("app.rescueDisc.GetStatus").then((t=>(this.log.info("status polled"),this.log.debug("status: "+JSON.stringify(t)),this.onStatusChanged(t),t))).catch((t=>(this.log.error("an error occured while executing app.rescueDisc.GetStatus",t),Promise.reject())))},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.364",created:"2021-09-06T10:47:40.722Z"};export{a as metadata};