Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from this 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],
- to this
- const Store = require('electron-store');
- const store = new Store();
- const uuid = require('uuid/v4');
- const md5 = require('sha1');
- const crypto = require('crypto');
- if (!store.has('device_id')) store.set('device_id', uuid());
- const {
- app,
- BrowserWindow
- } = require('electron');
- const path = require('path');
- const req = require('request');
- let window = null;
- var check_restart = false;
- function check_dark() {
- return new Promise((c, d) => {
- if (!store.has('dark_theme_enabler')) return c(false);
- return c(store.get('dark_theme_enabler'));
- });
- }
- function start_window() {
- window = new BrowserWindow({
- 'icon': path.join(__dirname, 'favicon.ico'),
- 'title': 'Auto Registrator',
- 'width': 1200,
- 'height': 800,
- 'minWidth': 500,
- 'minHeight': 650,
- 'webPreferences': {
- 'devTools': false,
- 'backgroundThrottling': false,
- 'webSecurity': false,
- 'allowRunningInsecureContent': true,
- 'nativeWindowOpen': true,
- 'nodeIntegration': true
- },
- 'backgroundColor': '#7287D8',
- 'show': false
- });
- 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.has('user_token')) {
- window.loadURL('file://' + __dirname + '/auth.html');
- window.once('ready-to-show', () => {
- window.show();
- });
- window.on('closed', function () {
- window = null;
- });
- } else {
- check_token().then(e => {
- if (!e.type) {
- window.loadURL('file://' + __dirname + '/auth.html');
- window.once('ready-to-show', () => {
- window.show();
- });
- 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.new) {
- get_update().then(() => {
- check_dark().then(e => {
- window.loadURL('file://' + __dirname + '/index.html?dark=' + e);
- window.once('ready-to-show', () => {
- window.show();
- });
- window.on('closed', function () {
- window = null;
- });
- });
- });
- } else {
- check_dark().then(e => {
- window.loadURL('file://' + __dirname + '/index.html?dark=' + e);
- window.once('ready-to-show', () => {
- window.show();
- });
- window.on('closed', function () {
- window = null;
- });
- });
- }
- }
- });
- }
- window.on("close", function () {
- var o = window.getSize(),
- i = window.getPosition();
- store.set("last_data_window", {
- size: o,
- position: i
- })
- });
- }
- app.once('ready', () => {
- start_window();
- });
- app.on('window-all-closed', () => {
- if (!check_restart) app.quit();
- });
- function close_window() {
- window.close();
- }
- function check_token() {
- return new Promise((h, i) => {
- if (!store.has('user_token')) return h({
- 'type': false
- });
- var j = {
- 'method': 'GET',
- 'headers': {
- 'token': store.get('user_token')
- },
- 'url': 'https://onedash.net/app_reg/check'
- };
- req(j, (k, l, m) => {
- if (!l || !m || m == '' || k || l.statusCode != 200) return h({
- 'type': false
- });
- m = JSON.parse(m);
- if (!m.type) return h({
- 'type': false
- });
- var n = m.version;
- var o = false;
- if (!store.has('app_version')) {
- store.set('app_version', n);
- o = true;
- } else if (store.get('app_version') != n) {
- o = true;
- store.set('app_version', n);
- }
- return h({
- 'type': m.type,
- 'v': {
- 'new': o,
- 'version': n
- }
- });
- });
- });
- }
- function get_update() {
- return new Promise((p, q) => {
- var r = {
- 'method': 'GET',
- 'headers': {
- 'token': store.get('user_token'),
- 'deviceid': store.get('device_id')
- },
- 'url': 'https://onedash.net/app_reg/get/update'
- };
- req(r, function (s, t, u) {
- if (!t || !u || u == '' || s || t.statusCode != 200) return p({
- 'type': false
- });
- var v = JSON.parse(u).data.content;
- var w = md5(store.get('user_token') + ':' + store.get('device_id'));
- store.set('data_a', v);
- return p({
- 'type': true
- });
- });
- });
- }
Add Comment
Please, Sign In to add comment