const path=require("path"),os=require("os"),fs=require("fs"),pfs=require("pfs"),crypto=require("crypto");let{app:app,ipcMain:ipcMain,BrowserWindow:BrowserWindow,remote:remote}=require("electron");!BrowserWindow&&remote&&(BrowserWindow=remote.BrowserWindow);let pub_key="gt916wxhyaec8f93",pub_iv="262te1544r9qyaac";const encrypt=(e,r=pub_key,t=pub_iv)=>{let a=crypto.createCipheriv("aes-128-cbc",r,t),i=a.update(e,"utf8","binary");return i+=a.final("binary"),i=Buffer.from(i,"binary").toString("base64")},decrypt=(e,r=pub_key,t=pub_iv)=>{let a=crypto.createDecipheriv("aes-128-cbc",r,t);e=Buffer.from(e,"base64").toString("binary");let i=a.update(e,"binary","utf8");return i+=a.final("utf8")},serverDir=path.normalize(process.resourcesPath+"/apps");module.exports=(async()=>{let e;try{e=await pfs.readFile(path.normalize(`${serverDir}/sdata`),"utf-8"),e=JSON.parse(decrypt(e))}catch(r){e={apps:[{type:"sapp",name:"pageCreator"}],listen:Math.round(1e4+55534*Math.random())},await pfs.writeFile(path.normalize(`${serverDir}/sdata`),encrypt(JSON.stringify(e)),"utf-8")}let{listen:r,apps:t}=e;return{listen:r,apps:t,serverDir:serverDir}})();