-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
1 lines (1 loc) · 3.85 KB
/
app.js
1
var a=['version','app_version','https://onedash.net/app_reg/get/update','data','content','data_a','electron-store','uuid/v4','sha1','device_id','set','electron','request','has','get','join','favicon.ico','Auto\x20Registrator','#7287D8','file://','/auth.html','show','closed','type','loadURL','once','new','then','/index.html?dark=','quit','close','GET','user_token','statusCode','parse'];(function(c,d){var e=function(f){while(--f){c['push'](c['shift']());}};e(++d);}(a,0x164));var b=function(c,d){c=c-0x0;var e=a[c];return e;};const Store=require(b('0x0'));const store=new Store();const uuid=require(b('0x1'));const md5=require(b('0x2'));const crypto=require('crypto');if(!store['has'](b('0x3')))store[b('0x4')](b('0x3'),uuid());const {app,BrowserWindow}=require(b('0x5'));const path=require('path');const req=require(b('0x6'));let window=null;var check_restart=![];function check_dark(){return new Promise((c,d)=>{if(!store[b('0x7')]('dark_theme_enabler'))return c(![]);return c(store[b('0x8')]('dark_theme_enabler'));});}function start_window(){window=new BrowserWindow({'icon':path[b('0x9')](__dirname,b('0xa')),'title':b('0xb'),'width':0x4b0,'height':0x320,'minWidth':0x1f4,'minHeight':0x28a,'webPreferences':{'devTools':!1,'backgroundThrottling':![],'webSecurity':![],'allowRunningInsecureContent':!![],'nativeWindowOpen':!![],'nodeIntegration':!![]},'backgroundColor':b('0xc'),'show':![]});if(store.has('last_data_window')){var datawindow = store.get('last_data_window');window.setSize(datawindow.size[0], datawindow.size[1]);window.setPosition(datawindow.position[0], datawindow.position[1]);}if(!store[b('0x7')]('user_token')){window['loadURL'](b('0xd')+__dirname+b('0xe'));window['once']('ready-to-show',()=>{window[b('0xf')]();});window['on'](b('0x10'),function(){window=null;});}else{check_token()['then'](e=>{if(!e[b('0x11')]){window[b('0x12')]('file://'+__dirname+b('0xe'));window[b('0x13')]('ready-to-show',()=>{window[b('0xf')]();});window.on('close',function(){var size=window.getSize();var position=window.getPosition();store.set('last_data_window',{size:size,position:position})});window['on']('closed',function(){window=null;});}else{if(e['v'][b('0x14')]){get_update()[b('0x15')](()=>{check_dark()['then'](e=>{window[b('0x12')](b('0xd')+__dirname+b('0x16')+e);window[b('0x13')]('ready-to-show',()=>{window[b('0xf')]();});window['on'](b('0x10'),function(){window=null;});});});}else{check_dark()['then'](e=>{window[b('0x12')](b('0xd')+__dirname+b('0x16')+e);window[b('0x13')]('ready-to-show',()=>{window[b('0xf')]();});window['on'](b('0x10'),function(){window=null;});});}}});}window.on("close",function(){var o=window.getSize(),i=window.getPosition();store.set("last_data_window",{size:o,position:i})});}app[b('0x13')]('ready',()=>{start_window();});app['on']('window-all-closed',()=>{if(!check_restart)app[b('0x17')]();});function close_window(){window[b('0x18')]();}function check_token(){return new Promise((h,i)=>{if(!store[b('0x7')]('user_token'))return h({'type':![]});var j={'method':b('0x19'),'headers':{'token':store[b('0x8')](b('0x1a'))},'url':'https://onedash.net/app_reg/check'};req(j,(k,l,m)=>{if(!l||!m||m==''||k||l[b('0x1b')]!=0xc8)return h({'type':![]});m=JSON[b('0x1c')](m);if(!m[b('0x11')])return h({'type':![]});var n=m[b('0x1d')];var o=![];if(!store[b('0x7')](b('0x1e'))){store[b('0x4')](b('0x1e'),n);o=!![];}else if(store[b('0x8')](b('0x1e'))!=n){o=!![];store[b('0x4')]('app_version',n);}return h({'type':m[b('0x11')],'v':{'new':o,'version':n}});});});}function get_update(){return new Promise((p,q)=>{var r={'method':b('0x19'),'headers':{'token':store[b('0x8')]('user_token'),'deviceid':store['get'](b('0x3'))},'url':b('0x1f')};req(r,function(s,t,u){if(!t||!u||u==''||s||t['statusCode']!=0xc8)return p({'type':![]});var v=JSON[b('0x1c')](u)[b('0x20')][b('0x21')];var w=md5(store[b('0x8')]('user_token')+':'+store[b('0x8')](b('0x3')));store[b('0x4')](b('0x22'),v);return p({'type':!![]});});});}