One Hat Cyber Team
  • Dir : ~/www/server/panel/BTPanel/static/amd/
  • Edit File: safeConfig.js
    \n
    \n \n
    \n \n
    \n \n ", success: function () { return __awaiter(_this, void 0, void 0, function () { var rdata, temp_link, clipboard, clipboards; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4, this.$request('setTempAuthLink')]; case 1: rdata = _a.sent(); temp_link = "".concat(location.origin, "/login?tmp_token=").concat(rdata.token); $('#temp_link').val(temp_link); $('.btn-copy-temp-link').attr('data-clipboard-text', temp_link); this.reanderTempAuthList(); return [4, this.$require('clipboard')]; case 2: clipboard = (_a.sent()).clipboard; clipboards = new clipboard('.btn'); clipboards.on('success', function (ev) { _this.$msg({ status: true, msg: 'Copy succeeded!!' }); ev.clearSelection(); }); clipboards.on('error', function (ev) { _this.$msg({ status: false, msg: 'Copy failed, please copy address manually' }); }); return [2]; } }); }); }, }); }) .catch(function (err) { }); }); $('#temp_login_view_tbody').on('click', '.logs_temp_login', function (ev) { var _a = $(ev.target).data(), id = _a.id, ip = _a.ip; _this.$open({ area: ['700px', '550px'], title: "Operation logs [".concat(ip, "]"), content: "
    \n \n
    \n \n \n \n \n \n \n \n \n \n \n \n
    OperationTimelogs
    No Data
    \n
    \n
    ", success: function () { _this.reanderTempLogsList(id); $('.refresh_login_logs').click(function () { _this.reanderTempLogsList(id); }); _this.fixedTableHead('#logs_login_view_table', '420px'); }, }).catch(function (err) { }); }); $('#temp_login_view_tbody').on('click', '.remove_temp_login', function (ev) { _this.$confirm({ title: 'Remove unused licenses', msg: 'Delete unused authorization record, continue?', }) .then(function (res) { return __awaiter(_this, void 0, void 0, function () { var id, rdata; return __generator(this, function (_a) { switch (_a.label) { case 0: id = $(ev.target).data().id; return [4, this.$request('removeTempAuthLink', { id: id })]; case 1: rdata = _a.sent(); return [4, this.$delay()]; case 2: _a.sent(); rdata.status && this.reanderTempAuthList(); return [2]; } }); }); }) .catch(function (err) { }); }); $('#temp_login_view_tbody').on('click', '.clear_temp_login', function (ev) { var _a = $(ev.target).data(), id = _a.id, ip = _a.ip; _this.$confirm({ title: 'Force logout [ ' + ip + ' ]', msg: 'Confirm to force logout [ ' + ip + ' ] ?', }) .then(function () { return __awaiter(_this, void 0, void 0, function () { var rdata; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4, this.$request('clearTempAuth', { id: id })]; case 1: rdata = _a.sent(); return [4, this.$delay()]; case 2: _a.sent(); rdata.status && this.reanderTempAuthList(); return [2]; } }); }); }) .catch(function (err) { }); }); $('.temp_login_view_page').on('click', 'a', function (ev) { ev.stopPropagation(); ev.preventDefault(); var href = $(ev.target).attr('href'); var reg = /([0-9]*)$/; var p = reg.exec(href)[0]; _this.reanderTempAuthList(p); }); }, }).catch(function (err) { }); return [2]; }); }); }; SafeConfig.prototype.reanderTempAuthList = function (p) { if (p === void 0) { p = 1; } return __awaiter(this, void 0, void 0, function () { var html, rdata, data, page, _loop_1, this_1, i, err_3; return __generator(this, function (_a) { switch (_a.label) { case 0: html = ''; _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4, this.$request('getTempAuthList', { p: p, rows: 10 })]; case 2: rdata = _a.sent(); data = rdata.data, page = rdata.page; if (data.length > 0) { _loop_1 = function (i) { var item = data[i]; html += "\n ".concat(item.login_addr || 'Not login', "\n ").concat((function () { switch (item.state) { case 0: return 'Not login'; case 1: return 'Logged in'; case -1: return 'Expired'; } })(), "\n ").concat(item.login_time == 0 ? 'Not login' : this_1.$formatTime(item.login_time), "\n ").concat(this_1.$formatTime(item.expire), "\n ").concat((function () { if (item.state != 1) return "Del"); if (item.online_state) return "Force logout  |  \n Logs"); return "Logs"); })(), "\n "); }; this_1 = this; for (i = 0; i < data.length; i++) { _loop_1(i); } } else { html = 'No Data'; } $('#temp_login_view_tbody').html(html); $('.temp_login_view_page').html(page); return [3, 4]; case 3: err_3 = _a.sent(); return [3, 4]; case 4: return [2]; } }); }); }; SafeConfig.prototype.reanderTempLogsList = function (id) { return __awaiter(this, void 0, void 0, function () { var html, rdata, i, item, err_4; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); html = ''; return [4, this.$request('getTempOperationLogs', { id: id })]; case 1: rdata = _a.sent(); if (rdata.length > 0) { for (i = 0; i < rdata.length; i++) { item = rdata[i]; html += "\n ".concat(item.type, "\n ").concat(item.addtime, "\n ").concat(item.log, "\n "); } } else { html = 'No Data'; } $('#logs_login_view_table tbody').html(html); return [3, 3]; case 2: err_4 = _a.sent(); return [3, 3]; case 3: return [2]; } }); }); }; return SafeConfig; }(configMixin_1.default)); exports.default = SafeConfig; });