main.js 12.4 KB
'use strict';
const _0xea56 = [
    'closed',
    '../cocos-i',
    'bind',
    'msOCf',
    'GcozP',
    'MPQfF',
    'DejwD',
    'PDVOL',
    'webRequest',
    'registerHe',
    'setReqHead',
    '2|0|4|1|3',
    'JUmHS',
    'Path',
    'nspector-c',
    'insertCSS',
    'has\x20tray\x20a',
    'loadURL',
    'ready-to-s',
    'tryShowWin',
    'returnValu',
    'dow',
    'versions',
    'mainPreloa',
    '?port=',
    'isteners',
    'sendToAll',
    'showWindow',
    'process',
    'kAxlS',
    'v.switchMo',
    '1Flijpm',
    'join',
    '&mode=',
    'previewPor',
    'requestHea',
    'nativeWin',
    'tml',
    'lready!',
    'removeAllL',
    'utf-8',
    'index_low_',
    'de(',
    'asset',
    'onfig.json',
    'file://',
    'setMenu',
    'parse',
    'aderUrls',
    'icRTt',
    'NGZai',
    'assets:hin',
    'node',
    'focusNode',
    '580702ygnIUE',
    'setMenuBar',
    '10885CCgiJi',
    'lYEXz',
    '497133UdCCit',
    '1535750OfCtfA',
    'show',
    'Cocos\x20Insp',
    'ZWOmW',
    'path',
    'OJTiR',
    'json',
    'electron',
    ':focusNode',
    'setImage',
    'defaultSes',
    'ver',
    'warn',
    'ector\x20v',
    'Window',
    'how',
    'Ipc',
    'executeJav',
    'haaQZ',
    'Sec',
    'webContent',
    'readFileSy',
    'QoEvF',
    'mnExG',
    'createFrom',
    'baszG',
    'gUYzL',
    '137KAJXsf',
    'ders',
    '1553848EmZdsz',
    'XsBMu',
    'existsSync',
    'ndHeaders',
    'Selection',
    'fxEMP',
    'exports',
    ':focusAsse',
    'config.jso',
    'electron.h',
    'error',
    'name',
    'Visibility',
    '222304lIRopH',
    'select',
    'onBeforeSe',
    'sion',
    './icon.png',
    'aScript',
    './package.',
    'setHeader',
    'focusAsset',
    'resize',
    'version',
    'index.html',
    'DZXtH',
    'click',
    '2845310iMsafm',
    'split',
    '#2e2c29',
    'ector',
    'disableWeb',
    'd.js',
    'destroy',
    'PreviewSer',
    './tj',
    'url'
];
const _0x3fdaaf = _0x4c0a;
(function (_0x28eb80, _0x174e75) {
    const _0x5a0876 = _0x4c0a;
    while (!![]) {
        try {
            const _0x5307d0 = parseInt(_0x5a0876(0x19e)) + -parseInt(_0x5a0876(0x173)) + parseInt(_0x5a0876(0x171)) * parseInt(_0x5a0876(0x18f)) + parseInt(_0x5a0876(0x191)) + parseInt(_0x5a0876(0x16f)) * -parseInt(_0x5a0876(0x158)) + parseInt(_0x5a0876(0x174)) + -parseInt(_0x5a0876(0x1ac));
            if (_0x5307d0 === _0x174e75)
                break;
            else
                _0x28eb80['push'](_0x28eb80['shift']());
        } catch (_0x4a8a6b) {
            _0x28eb80['push'](_0x28eb80['shift']());
        }
    }
}(_0xea56, -0x153073 + -0x599df + 0x2837d4 * 0x1));
function _0x4c0a(_0x1f55b3, _0x1a6e8b) {
    _0x1f55b3 = _0x1f55b3 - (0xcfe + 0x2 * 0x72f + -0x1a0b);
    let _0x2cbbe3 = _0xea56[_0x1f55b3];
    return _0x2cbbe3;
}
const {Tray, BrowserWindow, nativeImage, app, remote, ipcMain, session} = require(_0x3fdaaf(0x17b)), path = require(_0x3fdaaf(0x178)), pcs = require(_0x3fdaaf(0x155)), folder = '', devTools = ![];
let win, tray = null, mode = -0x1525 + -0x16db + 0x2c00, unloaded = ![];
const PKG_NAME = require(_0x3fdaaf(0x1a4) + _0x3fdaaf(0x17a))[_0x3fdaaf(0x19c)], PKG_VERSION = require(_0x3fdaaf(0x1a4) + _0x3fdaaf(0x17a))[_0x3fdaaf(0x1a8)];
let {ebtMain} = require(_0x3fdaaf(0x1b4)), fs = require('fs'), _configPath = path[_0x3fdaaf(0x159)](__dirname, _0x3fdaaf(0x199) + 'n'), __parentConfig = path[_0x3fdaaf(0x159)](__dirname, _0x3fdaaf(0x1b7) + _0x3fdaaf(0x1c4) + _0x3fdaaf(0x165));
function readConfig() {
    const _0x119ac6 = _0x3fdaaf, _0x2f1798 = { 'NGZai': _0x119ac6(0x161) };
    let _0x103b6b = '';
    return fs[_0x119ac6(0x193)](__parentConfig) ? _0x103b6b = fs[_0x119ac6(0x189) + 'nc'](__parentConfig, { 'encoding': _0x2f1798[_0x119ac6(0x16b)] }) : _0x103b6b = fs[_0x119ac6(0x189) + 'nc'](_configPath, { 'encoding': _0x2f1798[_0x119ac6(0x16b)] }), JSON[_0x119ac6(0x168)](_0x103b6b);
}
let disableWebSec = Boolean(readConfig()[_0x3fdaaf(0x1b0) + _0x3fdaaf(0x187)]);
const customHeaders = {};
module[_0x3fdaaf(0x197)] = {
    async 'load'() {
        const _0x3dfee8 = _0x3fdaaf;
        ipcMain['on'](PKG_NAME + _0x3dfee8(0x17c), this[_0x3dfee8(0x16e)][_0x3dfee8(0x1b8)](this)), ipcMain['on'](PKG_NAME + (_0x3dfee8(0x198) + 't'), this[_0x3dfee8(0x1a6)][_0x3dfee8(0x1b8)](this)), ipcMain['on'](_0x3dfee8(0x1bf) + _0x3dfee8(0x169), this[_0x3dfee8(0x1bf) + _0x3dfee8(0x169)][_0x3dfee8(0x1b8)](this)), ipcMain['on'](_0x3dfee8(0x1c0) + 'er', this[_0x3dfee8(0x1a5)][_0x3dfee8(0x1b8)](this));
    },
    'unload'() {
        const _0x5427fb = _0x3fdaaf, _0x252559 = { 'baszG': _0x5427fb(0x1c1) }, _0x48f68f = _0x252559[_0x5427fb(0x18d)][_0x5427fb(0x1ad)]('|');
        let _0x35dcda = 0x164e + 0x1732 + -0x2d80;
        while (!![]) {
            switch (_0x48f68f[_0x35dcda++]) {
            case '0':
                ipcMain[_0x5427fb(0x160) + _0x5427fb(0x152)](PKG_NAME + _0x5427fb(0x17c));
                continue;
            case '1':
                ipcMain[_0x5427fb(0x160) + _0x5427fb(0x152)](_0x5427fb(0x1bf) + _0x5427fb(0x169));
                continue;
            case '2':
                unloaded = !![];
                continue;
            case '3':
                ipcMain[_0x5427fb(0x160) + _0x5427fb(0x152)](_0x5427fb(0x1c0) + 'er');
                continue;
            case '4':
                ipcMain[_0x5427fb(0x160) + _0x5427fb(0x152)](PKG_NAME + (_0x5427fb(0x198) + 't'));
                continue;
            }
            break;
        }
    },
    'focusNode'(_0x558ea4, _0x114977) {
        const _0x4dc38b = _0x3fdaaf, _0x13eca2 = { 'lYEXz': _0x4dc38b(0x16d) };
        Editor[_0x4dc38b(0x195)][_0x4dc38b(0x19f)](_0x13eca2[_0x4dc38b(0x172)], _0x114977);
    },
    'focusAsset'(_0x422822, _0xc61147) {
        const _0x2a153b = _0x3fdaaf, _0x1d6cec = {
                'XsBMu': _0x2a153b(0x16c) + 't',
                'fxEMP': _0x2a153b(0x164)
            };
        Editor[_0x2a153b(0x184)][_0x2a153b(0x153)](_0x1d6cec[_0x2a153b(0x192)], _0xc61147), Editor[_0x2a153b(0x195)][_0x2a153b(0x19f)](_0x1d6cec[_0x2a153b(0x196)], _0xc61147);
    },
    'registerHeaderUrls'(_0x425d2b, _0x5de918) {
        const _0x30ee24 = _0x3fdaaf, _0x339d83 = {
                'msOCf': function (_0x59aaea, _0x4daa6a) {
                    return _0x59aaea(_0x4daa6a);
                }
            }, _0x4dbef2 = { 'urls': _0x5de918 };
        session[_0x30ee24(0x17e) + _0x30ee24(0x1a1)][_0x30ee24(0x1be)][_0x30ee24(0x1a0) + _0x30ee24(0x194)](_0x4dbef2, (_0x38cb73, _0x72d963) => {
            const _0xd776d = _0x30ee24;
            try {
                let _0x452055 = customHeaders[_0x38cb73[_0xd776d(0x1b5)]];
                for (let _0x308c33 in _0x452055) {
                    _0x38cb73[_0xd776d(0x15c) + _0xd776d(0x190)][_0x308c33] = _0x452055[_0x308c33];
                }
                _0x339d83[_0xd776d(0x1b9)](_0x72d963, { 'requestHeaders': _0x38cb73[_0xd776d(0x15c) + _0xd776d(0x190)] });
            } catch (_0x320445) {
                Editor[_0xd776d(0x19b)](_0x320445), _0x320445[_0xd776d(0x1ca) + 'e'] = ![];
            }
        }), _0x425d2b[_0x30ee24(0x1ca) + 'e'] = !![];
    },
    'setHeader'(_0x3e6a7f, _0xe95c87, _0x52be16) {
        const _0x42669f = _0x3fdaaf;
        customHeaders[_0xe95c87] = _0x52be16, _0x3e6a7f[_0x42669f(0x1ca) + 'e'] = !![];
    },
    'showWindow'() {
        const _0x1da5de = _0x3fdaaf, _0x5954c2 = {
                'JUmHS': _0x1da5de(0x176) + _0x1da5de(0x1af),
                'mnExG': function (_0x5144bc, _0x381ace) {
                    return _0x5144bc + _0x381ace;
                },
                'OJTiR': _0x1da5de(0x176) + _0x1da5de(0x181),
                'kAxlS': _0x1da5de(0x1ae),
                'DZXtH': _0x1da5de(0x1c8) + _0x1da5de(0x183),
                'GcozP': _0x1da5de(0x1b6),
                'ZWOmW': function (_0x435d88, _0x24274d) {
                    return _0x435d88 >= _0x24274d;
                },
                'DejwD': function (_0x32ff1e, _0x2b670c) {
                    return _0x32ff1e + _0x2b670c;
                },
                'PDVOL': function (_0x584071, _0x412356) {
                    return _0x584071 + _0x412356;
                },
                'gUYzL': _0x1da5de(0x151),
                'icRTt': _0x1da5de(0x15a)
            };
        if (win) {
            win[_0x1da5de(0x175)](), win[_0x1da5de(0x188) + 's'][_0x1da5de(0x185) + _0x1da5de(0x1a3)](_0x1da5de(0x157) + _0x1da5de(0x163) + mode + ')');
            return;
        }
        win = new Editor[(_0x1da5de(0x182))](_0x5954c2[_0x1da5de(0x1c2)], {
            'minWidth': 0x36e,
            'minHeight': 0x258,
            'width': 0x36e,
            'height': 0x258,
            'title': _0x5954c2[_0x1da5de(0x18b)](_0x5954c2[_0x1da5de(0x179)], PKG_VERSION),
            'backgroundColor': _0x5954c2[_0x1da5de(0x156)],
            'useContentSize': ![],
            'webPreferences': {
                'enablePreferredSizeMode': !![],
                'preferredSizeMode': !![],
                'webviewTag': !![],
                'nodeIntegration': !![],
                'enableRemoteModule': !![],
                'sandbox': ![],
                'devTools': devTools,
                'contextIsolation': ![],
                'webSecurity': !disableWebSec,
                'preload': path[_0x1da5de(0x159)](__dirname, folder + (_0x1da5de(0x1cd) + _0x1da5de(0x1b1)))
            }
        })[_0x1da5de(0x15d)];
        win[_0x1da5de(0x188) + 's'] && (win[_0x1da5de(0x188) + 's'][_0x1da5de(0x1c5)] = function (..._0x657e7c) {
        });
        try {
            win[_0x1da5de(0x167)](null), win[_0x1da5de(0x170) + _0x1da5de(0x19d)](![]);
        } catch (_0x4ce46a) {
        }
        win['on'](_0x5954c2[_0x1da5de(0x1aa)], () => {
            const _0x143242 = _0x1da5de;
            win[_0x143242(0x175)]();
        }), win['on'](_0x5954c2[_0x1da5de(0x1ba)], () => {
            const _0x3e8d6e = _0x1da5de;
            win[_0x3e8d6e(0x1b2)](), win = null;
            if (tray)
                tray[_0x3e8d6e(0x1b2)]();
            tray = null;
        });
        let _0x3649e9 = folder + (_0x1da5de(0x162) + _0x1da5de(0x19a) + _0x1da5de(0x15e));
        _0x5954c2[_0x1da5de(0x177)](process[_0x1da5de(0x1cc)][_0x1da5de(0x17b)][_0x1da5de(0x1ad)]('.')[0x1 * -0x425 + 0x36d * 0x7 + -0x13d6], -0xa2d + -0x23c2 * -0x1 + -0x1990) && (_0x3649e9 = folder + _0x1da5de(0x1a9));
        let _0x516ec1 = path[_0x1da5de(0x159)](__dirname, _0x5954c2[_0x1da5de(0x18b)](_0x5954c2[_0x1da5de(0x1bc)](_0x5954c2[_0x1da5de(0x1bd)](_0x5954c2[_0x1da5de(0x1bd)](_0x3649e9, _0x5954c2[_0x1da5de(0x18e)]), Editor[_0x1da5de(0x1b3) + _0x1da5de(0x17f)][_0x1da5de(0x15b) + 't']), _0x5954c2[_0x1da5de(0x16a)]), mode));
        win[_0x1da5de(0x1c7)](_0x1da5de(0x166) + _0x516ec1);
    },
    'tryShowWindow'(_0x108f26) {
        const _0x4df5b7 = _0x3fdaaf, _0x513764 = {
                'QoEvF': _0x4df5b7(0x1a2),
                'MPQfF': _0x4df5b7(0x1ab),
                'haaQZ': _0x4df5b7(0x1c6) + _0x4df5b7(0x15f)
            };
        try {
            let _0x47baec = nativeImage[_0x4df5b7(0x18c) + _0x4df5b7(0x1c3)](path[_0x4df5b7(0x159)](__dirname, _0x513764[_0x4df5b7(0x18a)]));
            _0x47baec = _0x47baec[_0x4df5b7(0x1a7)]({
                'width': 0x10,
                'height': 0x10
            });
            tray && tray[_0x4df5b7(0x17d)](_0x47baec);
            if (!tray)
                tray = new Tray(_0x47baec), tray['on'](_0x513764[_0x4df5b7(0x1bb)], function () {
                    const _0x4b180e = _0x4df5b7;
                    win[_0x4b180e(0x175)]();
                });
            else {
                if (devTools)
                    Editor[_0x4df5b7(0x180)](_0x513764[_0x4df5b7(0x186)]);
            }
        } catch (_0x748672) {
            if (devTools)
                Editor[_0x4df5b7(0x19b)](_0x748672);
        }
        mode = _0x108f26;
        try {
            this[_0x4df5b7(0x154)]();
        } catch (_0x848e90) {
            Editor[_0x4df5b7(0x19b)](_0x848e90);
        }
    },
    'messages': {
        'previewMode'() {
            const _0x23e2a2 = _0x3fdaaf;
            if (unloaded)
                return;
            this[_0x23e2a2(0x1c9) + _0x23e2a2(0x1cb)](0x21c + 0x1 * 0x32b + 0x547 * -0x1);
        },
        'buildMode'() {
            const _0x80a3f2 = _0x3fdaaf;
            if (unloaded)
                return;
            this[_0x80a3f2(0x1c9) + _0x80a3f2(0x1cb)](-0xd3 * -0x13 + 0xd * -0x7d + -0x94f);
        },
        'openCustomPage'() {
            const _0x157f2d = _0x3fdaaf;
            if (unloaded)
                return;
            this[_0x157f2d(0x1c9) + _0x157f2d(0x1cb)](-0x32f * 0xa + -0x1614 + -0xe * -0x3da);
        }
    }
};