One Hat Cyber Team
  • Dir : ~/www/server/panel/BTPanel/static/amd/
  • Edit File: utils.min.js
    \n
    \n \n\t\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t' ) .concat( setup ? '' : '', '\n\t\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t\t
    \n Name\n
    \n \n
    \n
    \n\t\t\t\t\t\t\t\t\t\t
    \n Url\n
    \n \n
    \n
    \n\t\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t' ) .concat( setup ? '' : '', '\n\t\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t
    \n
    \n
    \n
    \n ID\n
    \n \n
    \n
    \n
    \n TOKEN\n
    \n \n
    \n
    \n \n \n ' ) .concat( setup ? '' : '', '\n
    \n
    \n
    \n \n
    \n \n \n \n ' ), success: function ($layer) { $('.bt-w-menu p').click(function () { var index = $(this).index(); $(this).addClass('bgw').siblings().removeClass('bgw'); $('.conter_box').eq(index).removeClass('hide').siblings().addClass('hide'); }); $('.addRecipient').on('click', function () { return _this_1.addMessageMail(); }); $('.setMailMessageView').on('click', function () { return _this_1.setMailMessageView(info); }); $('#receive_table').on('click', '.del_email', function (ev) { return __awaiter(_this_1, void 0, void 0, function () { var email, res, err_1; return __generator(this, function (_a) { switch (_a.label) { case 0: email = $(ev.target).data('mail'); _a.label = 1; case 1: _a.trys.push([1, 6, , 7]); return [4, this.$confirm({ title: 'Delete Email ['.concat(email, ']'), msg: 'Are your sure to delete the Email?' })]; case 2: _a.sent(); return [4, this.$request('delMailAddress', { email: email })]; case 3: res = _a.sent(); if (!res.status) return [2]; return [4, this.$delay()]; case 4: _a.sent(); return [4, this.renderMailMessageList()]; case 5: _a.sent(); return [3, 7]; case 6: err_1 = _a.sent(); return [3, 7]; case 7: return [2]; } }); }); }); $('.addTelegram').click(function () { return __awaiter(_this_1, void 0, void 0, function () { var id_1, token_1, res, err_2; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 4]); id_1 = $('input[name="telegram_id"]').val(); token_1 = $('input[name="telegram_token"]').val(); return [4, this.$verifySubmit(id_1 == '' || token_1 == '', 'input box cannot be empty!')]; case 1: _a.sent(); return [4, this.$request('setTelegramConfig', { my_id: id_1, bot_token: token_1 })]; case 2: res = _a.sent(); if (!res.status) return [2]; $('.addTelegram').after(''); this.setLinkText('.setMessageChannelTelegram', 'Telegram is set', 'btlink'); return [3, 4]; case 3: err_2 = _a.sent(); return [3, 4]; case 4: return [2]; } }); }); }); $layer.on('click', '.delTelegram', function () { return __awaiter(_this_1, void 0, void 0, function () { var res, err_3; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 4]); return [4, this.$confirm({ title: 'Clear set', msg: 'Delete Clear Settings?' })]; case 1: _a.sent(); return [4, this.$request('clearTelegramConfig')]; case 2: res = _a.sent(); if (!res.status) return [2]; $('.delTelegram').remove(); $('input[name="telegram_id"]').val(''); $('input[name="telegram_token"]').val(''); this.setLinkText('.setMessageChannelTelegram', 'Telegram is not set', 'bt_warning'); return [3, 4]; case 3: err_3 = _a.sent(); return [3, 4]; case 4: return [2]; } }); }); }); $('.addDingDing').click(function () { return __awaiter(_this_1, void 0, void 0, function () { var name_2, url, res, err_4; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 3, , 4]); name_2 = $('input[name=chatName]').val(); url = $('[name=dingding_url]').val(); return [4, this.$verifySubmit(name_2 == '' || url == '', 'input box cannot be empty!')]; case 1: _a.sent(); return [4, this.$request('setDingDingConfig', { title: name_2, url: url, atall: 'True' })]; case 2: res = _a.sent(); if (!res.status) return [2]; return [3, 4]; case 3: err_4 = _a.sent(); return [3, 4]; case 4: return [2]; } }); }); }); _this_1.fixedTableHead('#receive_table', '356px'); _this_1.renderMailMessageList(); }, }), ]; case 2: _b.sent(); return [3, 4]; case 3: error_2 = _b.sent(); return [3, 4]; case 4: return [2]; } }); }); }; Public.prototype.setLinkText = function (el, text, type) { var $el = $(el); switch (type) { case 'btlink': $el.text(text).addClass('btlink').removeClass('bt_warning'); break; case 'bt_warning': $el.text(text).addClass('bt_warning').removeClass('btlink'); break; } }; Public.prototype.addMessageMail = function () { return __awaiter(this, void 0, void 0, function () { var error_3; var _this_1 = this; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [ 4, this.$open({ area: '400px', title: 'Add recipient email', btn: ['Create', 'Close'], content: '
    \n
    \n Recipient mailbox\n
    \n \n
    \n
    \n
    ', yes: function (config) { return __awaiter(_this_1, void 0, void 0, function () { var email, rdata; return __generator(this, function (_a) { switch (_a.label) { case 0: email = $('input[name=creater_email_value]').val(); return [ 4, this.$verifySubmitList([ [email === '', 'Recipient mailbox cannot be empty!'], [!this.$checkEmail(email), 'Recipient mailbox format is incorrect!'], ]), ]; case 1: _a.sent(); return [4, this.$request('addMailAddress', { email: email })]; case 2: rdata = _a.sent(); if (!rdata.status) return [3, 5]; config.close(); return [4, this.$delay()]; case 3: _a.sent(); return [4, this.renderMailMessageList()]; case 4: _a.sent(); _a.label = 5; case 5: return [2]; } }); }); }, }), ]; case 1: _a.sent(); return [3, 3]; case 2: error_3 = _a.sent(); return [3, 3]; case 3: return [2]; } }); }); }; Public.prototype.setMailMessageView = function (info) { return __awaiter(this, void 0, void 0, function () { var rdata, _a, qq_mail, qq_stmp_pwd, hosts, port, verifyPortList, err_5; var _this_1 = this; return __generator(this, function (_b) { switch (_b.label) { case 0: _b.trys.push([0, 3, , 4]); return [4, this.$request('getMsgConfig')]; case 1: rdata = _b.sent(); (_a = rdata.user_mail.info.msg), (qq_mail = _a.qq_mail), (qq_stmp_pwd = _a.qq_stmp_pwd), (hosts = _a.hosts), (port = _a.port); qq_mail = qq_mail || ''; qq_stmp_pwd = qq_stmp_pwd || ''; hosts = hosts || ''; port = port || ''; verifyPortList = ['25', '465', '587', '']; return [ 4, this.$open({ title: 'Set sender email information', area: '466px', content: '
    \n
    \n Sender email\n
    \n
    \n
    \n SMTP password\n
    \n
    \n
    \n SMTP server\n
    \n
    \n
    \n SMTP port\n
    \n \n \n
    \n
    \n \n
    \n ' ) .concat( qq_mail ? '' : '', '\n \n \n
    \n
    ' ), success: function (layers, indexs) { return __awaiter(_this_1, void 0, void 0, function () { var portSelect, mailPort; var _this_1 = this; return __generator(this, function (_a) { portSelect = $('#port_select'); mailPort = $('input[name=channel_email_port]'); portSelect.change(function (ev) { var that = $(ev.target), mailPort = $('input[name=channel_email_port]'); that.css('width', ev.target.value === 'other' ? '100px' : '300px'); mailPort.css('display', ev.target.value === 'other' ? 'inline-block' : 'none'); }); $('.SetChannelEmail').click(function () { return __awaiter(_this_1, void 0, void 0, function () { var email, stmp_pwd, hosts, port, portSelectVal, rdata, text, type; return __generator(this, function (_a) { switch (_a.label) { case 0: email = $('input[name="channel_email_value"]').val(); stmp_pwd = $('input[name="channel_email_password"]').val(); hosts = $('input[name="channel_email_server"]').val(); (port = ''), (portSelectVal = portSelect.val()); port = portSelectVal === 'other' ? mailPort.val() : portSelectVal; return [ 4, this.$verifySubmitList([ [!email, 'Email address cannot be empty!'], [!stmp_pwd, 'STMP password cannot be empty!'], [!hosts, 'STMP server address cannot be empty!'], [!port, 'STMP server port cannot be empty!'], [!this.$checkPort(port), 'STMP server port format is incorrect'], ]), ]; case 1: _a.sent(); return [4, this.$request('setMailConfig', { email: email, stmp_pwd: stmp_pwd, hosts: hosts, port: port })]; case 2: rdata = _a.sent(); if (!rdata.status) return [2]; layer.close(indexs); info.isSetEmail = true; text = info.mail ? 'Already set' : 'Not set'; type = info.mail ? 'btlink' : 'bt_warning'; this.setLinkText('.setMessageChannelMail', 'Email is set', 'btlink'); this.setLinkText('.setAlarmMail', text, type); return [4, this.$delay()]; case 3: _a.sent(); return [4, this.renderMailMessageList()]; case 4: _a.sent(); return [2]; } }); }); }); $('.smtp_closeBtn').click(function () { layer.close(indexs); }); $('.set_empty').click(function () { return __awaiter(_this_1, void 0, void 0, function () { var rdata; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4, this.$request(['config/set_empty', 'notification, please wait...'], { type: 'mail' })]; case 1: rdata = _a.sent(); if (!rdata.status) return [2]; layer.close(indexs); info.isSetEmail = false; this.setLinkText('.setMessageChannelMail', 'Email is not set', 'bt_warning'); this.setLinkText('.setAlarmMail', 'Email is not set', 'bt_warning'); return [2]; } }); }); }); return [2]; }); }); }, }), ]; case 2: _b.sent(); return [3, 4]; case 3: err_5 = _b.sent(); return [3, 4]; case 4: return [2]; } }); }); }; Public.prototype.renderMailMessageList = function () { return __awaiter(this, void 0, void 0, function () { var rdata, _html, _list, i, item; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4, this.$request('getMailList', { loading: true, msg: false })]; case 1: rdata = _a.sent(); (_html = ''), (_list = rdata.user_mail.mail_list); if (_list.length > 0) { for (i = 0; i < _list.length; i++) { item = _list[i]; _html += '\n ' .concat(item, '.\n \n Del\n \n '); } } else { _html = 'No Data'; } $('#receive_table tbody').html(_html); return [2]; } }); }); }; return Public; })(utils_1.default); exports.default = Public; });