Merge remote-tracking branch 'remotes/origin/dev'

pull/32/merge
apexliu 2017-04-18 02:32:47 +08:00
commit c26e255a6f
24 changed files with 493 additions and 410 deletions

View File

@ -61,6 +61,9 @@ def main():
if x == 'c': if x == 'c':
clean_all() clean_all()
continue continue
elif x == 'a':
clean_everything()
continue
try: try:
x = int(x) x = int(x)
@ -90,8 +93,27 @@ def main():
def clean_all(): def clean_all():
cc.e('sorry, clean not implemented yet.') # cc.e('sorry, clean not implemented yet.')
# utils.remove(os.path.join(env.root_path, 'out')) utils.remove(os.path.join(env.root_path, 'out'))
def clean_everything():
utils.remove(os.path.join(env.root_path, 'out'))
utils.remove(os.path.join(env.root_path, 'external', 'jsoncpp'))
utils.remove(os.path.join(env.root_path, 'external', 'libuv'))
utils.remove(os.path.join(env.root_path, 'external', 'mbedtls'))
utils.remove(os.path.join(env.root_path, 'external', 'mongoose'))
utils.remove(os.path.join(env.root_path, 'external', 'openssl'))
utils.remove(os.path.join(env.root_path, 'external', 'python'))
utils.remove(os.path.join(env.root_path, 'external', 'libssh-win-static', 'lib'))
utils.remove(os.path.join(env.root_path, 'external', 'libssh-win-static', 'src'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'tmp'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'release', 'lib', 'libmbedcrypto.a'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'release', 'lib', 'libmbedtls.a'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'release', 'lib', 'libmbedx509.a'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'release', 'lib', 'libsqlite3.a'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'release', 'lib', 'libssh.a'))
utils.remove(os.path.join(env.root_path, 'external', 'linux', 'release', 'lib', 'libuv.a'))
def do_opt(opt): def do_opt(opt):
@ -210,7 +232,7 @@ def get_input(msg, log_func=cc.w):
def show_logo(): def show_logo():
cc.v('[]=======================================================[]') cc.v('[]=======================================================[]')
cc.o((cc.CR_VERBOSE, ' | '), (cc.CR_INFO, 'Teleport Projects Builder'), (cc.CR_VERBOSE, ' |')) cc.o((cc.CR_VERBOSE, ' | '), (cc.CR_INFO, 'Teleport Projects Builder'), (cc.CR_VERBOSE, ' |'))
cc.v(' | auth: apexliu@eomsoft.net |') cc.v(' | auth: apex.liu@qq.com |')
cc.v('[]=======================================================[]') cc.v('[]=======================================================[]')
@ -224,7 +246,8 @@ def show_menu():
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, '%2d' % options[o]['id']), (cc.CR_NORMAL, '] ', options[o]['disp'])) cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, '%2d' % options[o]['id']), (cc.CR_NORMAL, '] ', options[o]['disp']))
cc.v(' -------------------------------------------------------') cc.v(' -------------------------------------------------------')
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' C'), (cc.CR_NORMAL, '] clean build and dist env.')) cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' C'), (cc.CR_NORMAL, '] clean build and dist.'))
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' A'), (cc.CR_NORMAL, '] clean everything.'))
cc.v(' -------------------------------------------------------') cc.v(' -------------------------------------------------------')
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' Q'), (cc.CR_NORMAL, '] exit')) cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' Q'), (cc.CR_NORMAL, '] exit'))

View File

@ -73,6 +73,7 @@ class BuilderWin(BuilderBase):
utils.copy_ex(out_path, bin_path, 'tp_web.exe') utils.copy_ex(out_path, bin_path, 'tp_web.exe')
utils.copy_ex(out_path, bin_path, 'tp_core.exe') utils.copy_ex(out_path, bin_path, 'tp_core.exe')
utils.copy_ex(out_path, bin_path, 'tpssh.dll') utils.copy_ex(out_path, bin_path, 'tpssh.dll')
utils.copy_ex(out_path, bin_path, 'tprdp.dll')
utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt')) utils.copy_ex(os.path.join(env.root_path, 'out', 'pysrt'), bin_path, (ctx.dist_path, 'pysrt'))

View File

@ -63,6 +63,9 @@ class Env(object):
if not self._load_config(warn_miss_tool): if not self._load_config(warn_miss_tool):
return False return False
if not self._load_version():
return False
return True return True
def _load_config(self, warn_miss_tool): def _load_config(self, warn_miss_tool):
@ -73,24 +76,8 @@ class Env(object):
_cfg = configparser.ConfigParser() _cfg = configparser.ConfigParser()
_cfg.read(_cfg_file) _cfg.read(_cfg_file)
if 'external_ver' not in _cfg.sections() or 'toolchain' not in _cfg.sections(): if 'toolchain' not in _cfg.sections():
cc.e('invalid configuration file: need `external_ver` and `toolchain` section.') cc.e('invalid configuration file: need `toolchain` section.')
return False
_tmp = _cfg['external_ver']
try:
_v_openssl = _tmp['openssl'].split(',')
self.ver_openssl = _v_openssl[0].strip()
self.ver_openssl_number = _v_openssl[1].strip()
self.ver_libuv = _tmp['libuv']
self.ver_mbedtls = _tmp['mbedtls']
self.ver_sqlite = _tmp['sqlite']
self.ver_libssh = _tmp['libssh']
self.ver_jsoncpp = _tmp['jsoncpp']
self.ver_mongoose = _tmp['mongoose']
except KeyError:
cc.e('invalid configuration file: not all necessary external version are set.')
return False return False
_tmp = _cfg['toolchain'] _tmp = _cfg['toolchain']
@ -120,6 +107,9 @@ class Env(object):
if self.nasm is None or not os.path.exists(self.nasm): if self.nasm is None or not os.path.exists(self.nasm):
if warn_miss_tool: if warn_miss_tool:
cc.w(' - can not locate `nasm`, so I can build openssl.') cc.w(' - can not locate `nasm`, so I can build openssl.')
else:
_nasm_path = os.path.abspath(os.path.join(self.nasm, '..'))
os.environ['path'] = os.environ['path'] + ';' + _nasm_path
if 'perl' in _tmp: if 'perl' in _tmp:
self.perl = _tmp['perl'] self.perl = _tmp['perl']
@ -165,6 +155,36 @@ class Env(object):
return True return True
def _load_version(self):
_ver_file = os.path.join(self.root_path, 'external', 'version.ini')
if not os.path.exists(_ver_file):
cc.e('can not load version configuration for external.')
return False
_cfg = configparser.ConfigParser()
_cfg.read(_ver_file)
if 'external_ver' not in _cfg.sections():
cc.e('invalid configuration file: need `external_ver` section.')
return False
_tmp = _cfg['external_ver']
try:
_v_openssl = _tmp['openssl'].split(',')
self.ver_openssl = _v_openssl[0].strip()
self.ver_openssl_number = _v_openssl[1].strip()
self.ver_libuv = _tmp['libuv']
self.ver_mbedtls = _tmp['mbedtls']
self.ver_sqlite = _tmp['sqlite']
self.ver_libssh = _tmp['libssh']
self.ver_jsoncpp = _tmp['jsoncpp']
self.ver_mongoose = _tmp['mongoose']
except KeyError:
cc.e('invalid configuration file: not all necessary external version are set.')
return False
return True
def _get_msbuild(self): def _get_msbuild(self):
# 14.0 = VS2015 # 14.0 = VS2015
# 12.0 = VS2012 # 12.0 = VS2012

View File

@ -1,3 +1,3 @@
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
VER_TELEPORT_SERVER = "2.2.5.1" VER_TELEPORT_SERVER = "2.2.6.1"
VER_TELEPORT_ASSIST = "2.2.5.1" VER_TELEPORT_ASSIST = "2.2.5.1"

View File

@ -30,13 +30,3 @@ wget = C:\Program Files (x86)\wget\wget.exe
# if not set cmake path, default to '/usr/bin/cmake' # if not set cmake path, default to '/usr/bin/cmake'
cmake = /opt/cmake/bin/cmake cmake = /opt/cmake/bin/cmake
[external_ver]
openssl = 1.0.2h,1000208f
libuv = 1.11.0
mbedtls = 2.3.0
sqlite = 3170000
libssh = 0.7.4
jsoncpp = 0.10.6
mongoose = 6.6

View File

@ -517,7 +517,7 @@ class InstallerLinux(InstallerBase):
def _fix_path(self): def _fix_path(self):
self._config_path = '/etc/teleport' self._config_path = '/etc/teleport'
self._data_path = os.path.join('/var/teleport') self._data_path = os.path.join('/var/lib/teleport')
self._log_path = os.path.join('/var/log/teleport') self._log_path = os.path.join('/var/log/teleport')
def _copy_files(self): def _copy_files(self):

42
external/version.ini vendored Normal file
View File

@ -0,0 +1,42 @@
[toolchain]
#============================================
# for windows
#============================================
# Need wget to download necessary dependency files.
wget = C:\Program Files (x86)\wget\wget.exe
# Need 7z to unzip downloaded files.
7z = C:\Program Files (x86)\7zip\7z.exe
# need perl to build openssl on Windows, if not set, default to get it from register.
# suggest install ActivePerl.
#perl = C:\Perl\bin\perl.exe
# need nasm to build openssl on Windows, if not set, default to locate it from register.
#nasm = C:\Users\username\AppData\Local\NASM\nasm.exe
# if not set nsis path, default to get it by register.
#nsis = C:\Program Files (x86)\NSIS\Unicode\makensis.exe
# if not set msbuild path, default to get it by register.
#msbuild = C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
# ============================================
# for linux
# ============================================
# if not set cmake path, default to '/usr/bin/cmake'
cmake = /opt/cmake/bin/cmake
[external_ver]
openssl = 1.0.2h,1000208f
libuv = 1.11.0
mbedtls = 2.3.0
sqlite = 3170000
libssh = 0.7.4
jsoncpp = 0.10.6
mongoose = 6.6

Binary file not shown.

View File

@ -1,6 +1,6 @@
#ifndef __TS_SERVER_VER_H__ #ifndef __TS_SERVER_VER_H__
#define __TS_SERVER_VER_H__ #define __TS_SERVER_VER_H__
#define TP_SERVER_VER L"2.2.5.1" #define TP_SERVER_VER L"2.2.6.1"
#endif // __TS_SERVER_VER_H__ #endif // __TS_SERVER_VER_H__

View File

@ -965,55 +965,55 @@ int SshSession::_on_server_channel_data(ssh_session session, ssh_channel channel
} }
else else
{ {
if (len > 5 && len < 256) // if (len > 5 && len < 256)
{ // {
const ex_u8* _begin = ex_memmem((const ex_u8*)data, len, (const ex_u8*)"\033]0;", 4); // const ex_u8* _begin = ex_memmem((const ex_u8*)data, len, (const ex_u8*)"\033]0;", 4);
if (NULL != _begin) // if (NULL != _begin)
{ // {
size_t len_before = _begin - (const ex_u8*)data; // size_t len_before = _begin - (const ex_u8*)data;
const ex_u8* _end = ex_memmem(_begin + 4, len - len_before, (const ex_u8*)"\007", 1); // const ex_u8* _end = ex_memmem(_begin + 4, len - len_before, (const ex_u8*)"\007", 1);
if (NULL != _end) // if (NULL != _end)
{ // {
_end++; // _end++;
//
// 这个包中含有改变标题的数据,将标题换为我们想要的 // // 这个包中含有改变标题的数据,将标题换为我们想要的
size_t len_end = len - (_end - (const ex_u8*)data); // size_t len_end = len - (_end - (const ex_u8*)data);
MemBuffer mbuf; // MemBuffer mbuf;
//
if (len_before > 0) // if (len_before > 0)
mbuf.append((ex_u8*)data, len_before); // mbuf.append((ex_u8*)data, len_before);
//
mbuf.append((ex_u8*)"\033]0;tpssh://", 13); // mbuf.append((ex_u8*)"\033]0;tpssh://", 13);
mbuf.append((ex_u8*)_this->m_server_ip.c_str(), _this->m_server_ip.length()); // mbuf.append((ex_u8*)_this->m_server_ip.c_str(), _this->m_server_ip.length());
mbuf.append((ex_u8*)"\007", 1); // mbuf.append((ex_u8*)"\007", 1);
//
if (len_end > 0) // if (len_end > 0)
mbuf.append((ex_u8*)_end, len_end); // mbuf.append((ex_u8*)_end, len_end);
//
if(mbuf.size() > 0) // if(mbuf.size() > 0)
{ // {
ret = ssh_channel_write(info->channel, mbuf.data(), mbuf.size()); // ret = ssh_channel_write(info->channel, mbuf.data(), mbuf.size());
if (ret <= 0) // if (ret <= 0)
EXLOGE("[ssh] send to client failed (1).\n"); // EXLOGE("[ssh] send to client failed (1).\n");
else // else
ret = len; // ret = len;
} // }
else // else
{ // {
ret = ssh_channel_write(info->channel, data, len); // ret = ssh_channel_write(info->channel, data, len);
} // }
} // }
else // else
{ // {
ret = ssh_channel_write(info->channel, data, len); // ret = ssh_channel_write(info->channel, data, len);
} // }
} // }
else // else
{ // {
ret = ssh_channel_write(info->channel, data, len); // ret = ssh_channel_write(info->channel, data, len);
} // }
} // }
else // else
{ {
ret = ssh_channel_write(info->channel, data, len); ret = ssh_channel_write(info->channel, data, len);
} }

Binary file not shown.

View File

@ -1,6 +1,6 @@
#ifndef __TS_SERVER_VER_H__ #ifndef __TS_SERVER_VER_H__
#define __TS_SERVER_VER_H__ #define __TS_SERVER_VER_H__
#define TP_SERVER_VER L"2.2.5.1" #define TP_SERVER_VER L"2.2.6.1"
#endif // __TS_SERVER_VER_H__ #endif // __TS_SERVER_VER_H__

View File

@ -128,6 +128,14 @@ class TPDatabase:
if not os.path.exists(db_path): if not os.path.exists(db_path):
log.e('can not create folder `{}` to store database file.\n'.format(db_path)) log.e('can not create folder `{}` to store database file.\n'.format(db_path))
return False return False
# 创建一个空数据文件这样才能进行connect。
if not os.path.exists(self.db_source['file']):
try:
with open(self.db_source['file'], 'w') as f:
pass
except:
log.e('can not create db file `{}`.\n'.format(self.db_source['file']))
return False
if create_and_init(self, step_begin, step_end): if create_and_init(self, step_begin, step_end):
log.v('database created.\n') log.v('database created.\n')
@ -154,6 +162,7 @@ class TPDatabase:
fields_names: 如果为None则不修改字段名否则应该是一个list其中每个元素是包含两个str的list表示将此list第一个指定的字段改名为第二个指定的名称 fields_names: 如果为None则不修改字段名否则应该是一个list其中每个元素是包含两个str的list表示将此list第一个指定的字段改名为第二个指定的名称
@return: None or Boolean @return: None or Boolean
""" """
# TODO: 此函数尚未完成
if self.db_source['type'] == self.DB_TYPE_SQLITE: if self.db_source['type'] == self.DB_TYPE_SQLITE:
if not isinstance(table_names, list) and field_names is None: if not isinstance(table_names, list) and field_names is None:
log.w('nothing to do.\n') log.w('nothing to do.\n')
@ -224,7 +233,8 @@ class TPDatabasePool:
thread_id = threading.get_ident() thread_id = threading.get_ident()
if thread_id not in self._connections: if thread_id not in self._connections:
_conn = self._do_connect() _conn = self._do_connect()
self._connections[thread_id] = _conn if _conn is not None:
self._connections[thread_id] = _conn
else: else:
_conn = self._connections[thread_id] _conn = self._connections[thread_id]
@ -246,6 +256,10 @@ class TPSqlitePool(TPDatabasePool):
self._db_file = db_file self._db_file = db_file
def _do_connect(self): def _do_connect(self):
if not os.path.exists(self._db_file):
log.e('[sqlite] can not connect, database file not exists.\n')
return None
try: try:
return sqlite3.connect(self._db_file) return sqlite3.connect(self._db_file)
except: except:
@ -259,6 +273,7 @@ class TPSqlitePool(TPDatabasePool):
db_ret = cursor.fetchall() db_ret = cursor.fetchall()
return db_ret return db_ret
except sqlite3.OperationalError: except sqlite3.OperationalError:
# log.e('_do_query() error.\n')
return None return None
finally: finally:
cursor.close() cursor.close()
@ -270,6 +285,7 @@ class TPSqlitePool(TPDatabasePool):
conn.commit() conn.commit()
return True return True
except sqlite3.OperationalError: except sqlite3.OperationalError:
# log.e('_do_exec() error.\n')
return False return False
finally: finally:
cursor.close() cursor.close()

View File

@ -50,9 +50,6 @@ controllers = [
(r'/user', user.IndexHandler), (r'/user', user.IndexHandler),
(r'/user/list', user.GetListHandler), (r'/user/list', user.GetListHandler),
# add another path to static-path
# todo: 重放数据路径是动态从core服务的json-rpc接口获取的因此这里的数据获取方式需要改变
#(r"/log/replay/(.*)", tornado.web.StaticFileHandler, {"path": os.path.join(cfg.data_path, 'replay')}), #(r"/log/replay/(.*)", tornado.web.StaticFileHandler, {"path": os.path.join(cfg.data_path, 'replay')}),
(r"/log/replay/(.*)", record.ReplayStaticFileHandler, {"path": os.path.join(cfg.data_path, 'replay')}), (r"/log/replay/(.*)", record.ReplayStaticFileHandler, {"path": os.path.join(cfg.data_path, 'replay')}),

View File

@ -453,16 +453,8 @@ class ExportHostHandler(TPBaseAdminAuthHandler):
class GetCertList(TPBaseUserAuthJsonHandler): class GetCertList(TPBaseUserAuthJsonHandler):
def post(self): def post(self):
# args = self.get_argument('args', None)
# if args is not None:
# args = json.loads(args)
# # print('args', args)
# else:
# # ret = {'code':-1}
# self.write_json(-1)
# return
_certs = host.get_cert_list() _certs = host.get_cert_list()
if _certs is None: if _certs is None or len(_certs) == 0:
self.write_json(-1) self.write_json(-1)
return return
else: else:
@ -900,8 +892,12 @@ class SysUserAdd(TPBaseUserAuthJsonHandler):
args['user_pswd'] = return_data['data'] args['user_pswd'] = return_data['data']
if host.sys_user_add(args) < 0: user_id = host.sys_user_add(args)
return self.write_json(-1) if user_id < 0:
if user_id == -100:
return self.write_json(user_id, '同名账户已经存在!')
else:
return self.write_json(user_id, '数据库操作失败!')
return self.write_json(0) return self.write_json(0)

View File

@ -78,7 +78,6 @@ class RpcThreadManage:
'steps': self._threads[task_id]['steps'] 'steps': self._threads[task_id]['steps']
} }
if not self._threads[task_id]['running']: if not self._threads[task_id]['running']:
print('remove task-id', task_id)
del self._threads[task_id] del self._threads[task_id]
return ret return ret
else: else:
@ -153,15 +152,12 @@ thread_mgr = RpcThreadManage()
class RpcHandler(TPBaseAdminAuthJsonHandler): class RpcHandler(TPBaseAdminAuthJsonHandler):
def post(self): def post(self):
args = self.get_argument('args', None) args = self.get_argument('args', None)
# print('args', args)
if args is not None: if args is not None:
args = json.loads(args) args = json.loads(args)
else: else:
self.write_json(-1) self.write_json(-1)
return return
# print(args)
cmd = args['cmd'] cmd = args['cmd']
if cmd == 'create_db': if cmd == 'create_db':
if not get_db().need_create: if not get_db().need_create:
@ -176,7 +172,6 @@ class RpcHandler(TPBaseAdminAuthJsonHandler):
return self.write_json(0, data={"task_id": task_id}) return self.write_json(0, data={"task_id": task_id})
elif cmd == 'get_task_ret': elif cmd == 'get_task_ret':
# return self.write_json(-1)
r = thread_mgr.get_task(args['tid']) r = thread_mgr.get_task(args['tid'])
if r is None: if r is None:
return self.write_json(0, data={'running': False, 'steps': []}) return self.write_json(0, data={'running': False, 'steps': []})

View File

@ -51,6 +51,8 @@ def get_all_host_info_list(_filter, order, limit, with_pwd=False):
'{};'.format(db.table_prefix, db.table_prefix, _where) '{};'.format(db.table_prefix, db.table_prefix, _where)
db_ret = db.query(sql) db_ret = db.query(sql)
if db_ret is None:
return 0, list()
total_count = db_ret[0][0] total_count = db_ret[0][0]
# 修正分页数据 # 修正分页数据
@ -88,7 +90,7 @@ def get_all_host_info_list(_filter, order, limit, with_pwd=False):
db_ret = db.query(sql) db_ret = db.query(sql)
if db_ret is None: if db_ret is None:
return 0, None return 0, list()
ret = list() ret = list()
for item in db_ret: for item in db_ret:
@ -310,9 +312,11 @@ def get_cert_list():
sql = 'SELECT {} FROM `{}key` AS a;'.format(','.join(['`a`.`{}`'.format(i) for i in field_a]), db.table_prefix) sql = 'SELECT {} FROM `{}key` AS a;'.format(','.join(['`a`.`{}`'.format(i) for i in field_a]), db.table_prefix)
db_ret = db.query(sql) db_ret = db.query(sql)
if db_ret is None:
return None
ret = list() ret = list()
if db_ret is None:
return ret
for item in db_ret: for item in db_ret:
x = DbItem() x = DbItem()

View File

@ -19,7 +19,7 @@ def verify_user(name, password):
# 因此可以特别地处理用户验证用户名admin密码admin可以登录为管理员 # 因此可以特别地处理用户验证用户名admin密码admin可以登录为管理员
if cfg.app_mode == APP_MODE_MAINTENANCE: if cfg.app_mode == APP_MODE_MAINTENANCE:
if name == 'admin' and password == 'admin': if name == 'admin' and password == 'admin':
return 1, 100, 'admin' return 1, 100, 'admin', 0
return 0, 0, '', 0 return 0, 0, '', 0
if len(db_ret) != 1: if len(db_ret) != 1:

View File

@ -1,4 +1,4 @@
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
TS_VER = "2.2.5.1" TS_VER = "2.2.6.1"
TP_ASSIST_LAST_VER = "2.2.5.1" TP_ASSIST_LAST_VER = "2.2.5.1"
TP_ASSIST_REQUIRE = "2.0.0.1" TP_ASSIST_REQUIRE = "2.0.0.1"

View File

@ -11,8 +11,8 @@
var g_assist = null; var g_assist = null;
var g_host_table = null; var g_host_table = null;
var g_cert_list = {}; var g_cert_list = [];
var g_group_list = {}; var g_group_list = [];
var g_dlg_edit_host = null; var g_dlg_edit_host = null;
var g_dlg_edit_host_user = null; var g_dlg_edit_host_user = null;
var g_dlg_sys_user = null; var g_dlg_sys_user = null;
@ -669,14 +669,11 @@ ywl.create_host_edit_dlg = function (tbl) {
}; };
dlg_edit_host.on_sys_type_change = function () { dlg_edit_host.on_sys_type_change = function () {
dlg_edit_host.sys_type = parseInt($('#auth-sys-type').val()); dlg_edit_host.sys_type = parseInt($('#auth-sys-type').val());
console.log('sys-type', dlg_edit_host.sys_type, 'protocol:', dlg_edit_host.protocol);
if (dlg_edit_host.sys_type === OS_TYPE_WINDOWS) {// && dlg_edit_host.protocol === 0) { if (dlg_edit_host.sys_type === OS_TYPE_WINDOWS) {// && dlg_edit_host.protocol === 0) {
dlg_edit_host.protocol = PROTOCOL_TYPE_RDP; dlg_edit_host.protocol = PROTOCOL_TYPE_RDP;
console.log('--1', dlg_edit_host.protocol);
} }
else if (dlg_edit_host.sys_type === OS_TYPE_LINUX) {// && dlg_edit_host.protocol === 0) { else if (dlg_edit_host.sys_type === OS_TYPE_LINUX) {// && dlg_edit_host.protocol === 0) {
dlg_edit_host.protocol = PROTOCOL_TYPE_SSH; dlg_edit_host.protocol = PROTOCOL_TYPE_SSH;
console.log('--2', dlg_edit_host.protocol);
} }
$('#host-protocol-type').val(dlg_edit_host.protocol); $('#host-protocol-type').val(dlg_edit_host.protocol);
@ -686,7 +683,6 @@ ywl.create_host_edit_dlg = function (tbl) {
dlg_edit_host.on_protocol_change = function () { dlg_edit_host.on_protocol_change = function () {
dlg_edit_host.protocol = parseInt($('#host-protocol-type').val()); dlg_edit_host.protocol = parseInt($('#host-protocol-type').val());
console.log('xx', dlg_edit_host.protocol);
if (dlg_edit_host.protocol === PROTOCOL_TYPE_RDP) if (dlg_edit_host.protocol === PROTOCOL_TYPE_RDP)
$('#dlg-edit-host-protocol-port').val('3389'); $('#dlg-edit-host-protocol-port').val('3389');
else if (dlg_edit_host.protocol === PROTOCOL_TYPE_SSH) else if (dlg_edit_host.protocol === PROTOCOL_TYPE_SSH)
@ -1266,7 +1262,7 @@ ywl.create_sys_user = function (tbl) {
dlg_sys_user.check_args = function () { dlg_sys_user.check_args = function () {
dlg_sys_user.auth_mode = parseInt($('#auth-user-type').val()); dlg_sys_user.auth_mode = parseInt($('#auth-user-type').val());
dlg_sys_user.user_name = parseInt($('#auth-user-host-username').val()); dlg_sys_user.user_name = $('#auth-user-host-username').val();
if (dlg_sys_user.auth_mode !== AUTH_NONE && if (dlg_sys_user.auth_mode !== AUTH_NONE &&
dlg_sys_user.user_name.length === 0) { dlg_sys_user.user_name.length === 0) {
ywl.notify_error('请输入系统用户名!'); ywl.notify_error('请输入系统用户名!');

View File

@ -1,6 +1,4 @@
/** "use strict";
* Created by mi on 2016/7/4.
*/
ywl.on_init = function (cb_stack, cb_args) { ywl.on_init = function (cb_stack, cb_args) {
var dom_id = '#ywl_log_list'; var dom_id = '#ywl_log_list';
@ -36,7 +34,6 @@ ywl.on_init = function (cb_stack, cb_args) {
fields: {id: 'id'} fields: {id: 'id'}
}, },
{title: "ID", key: "id"}, {title: "ID", key: "id"},
// {title: "Session", key: "session_id"},
{title: "操作者", key: "account_name"}, {title: "操作者", key: "account_name"},
{title: "系统用户", key: "user_name"}, {title: "系统用户", key: "user_name"},
{title: "协议", key: "protocol", render: 'protocol', fields: {protocol: 'protocol'}}, {title: "协议", key: "protocol", render: 'protocol', fields: {protocol: 'protocol'}},
@ -51,7 +48,7 @@ ywl.on_init = function (cb_stack, cb_args) {
width: 160, width: 160,
header_align: 'left', cell_align: 'left', header_align: 'left', cell_align: 'left',
render: 'make_action_btn', render: 'make_action_btn',
fields: {ID: 'id', sys_type: 'sys_type', cost_time: 'cost_time', protocol: 'protocol'} fields: {ID: 'id', ret_code:'ret_code', sys_type: 'sys_type', cost_time: 'cost_time', protocol: 'protocol'}
} }
], ],
paging: {selector: dom_id + " [ywl-paging='log-list']", per_page: paging_normal}, paging: {selector: dom_id + " [ywl-paging='log-list']", per_page: paging_normal},
@ -164,16 +161,14 @@ ywl.on_host_table_created = function (tbl) {
//ywl.update_add_to_batch_btn(); //ywl.update_add_to_batch_btn();
}); });
} else if (col_key == 'action') { } else if (col_key === 'action') {
var row_data = tbl.get_row(row_id); var row_data = tbl.get_row(row_id);
//console.log('row_data', row_data);
var protocol = parseInt(row_data.protocol); var protocol = parseInt(row_data.protocol);
if (protocol == 1) { if (protocol === PROTOCOL_TYPE_RDP) {
$(cell_obj).find('[ywl-btn-record]').click(function () { $(cell_obj).find('[ywl-btn-record]').click(function () {
var ip = window.location.hostname;//ywl.page_options.ts_server.ip; var ip = window.location.hostname;
var port = parseInt(window.location.port);//ywl.page_options.ts_server.port; var port = parseInt(window.location.port);
var url = 'http://' + ip + ':' + port + '/log/replay/rdp/' + row_data.id; var url = 'http://' + ip + ':' + port + '/log/replay/rdp/' + row_data.id;
var tail = 'log/replay/rdp/' + prefixInteger(row_data.id, 6); var tail = 'log/replay/rdp/' + prefixInteger(row_data.id, 6);
var args = {}; var args = {};
@ -187,7 +182,7 @@ ywl.on_host_table_created = function (tbl) {
ywl.notify_success('RDP 录像播放器成功启动!'); ywl.notify_success('RDP 录像播放器成功启动!');
}, },
function (code, msg) { function (code, msg) {
if (code == TPE_NO_ASSIST) if (code === TPE_NO_ASSIST)
g_assist.alert_assist_not_found(); g_assist.alert_assist_not_found();
else { else {
ywl.notify_error(msg); ywl.notify_error(msg);
@ -196,7 +191,7 @@ ywl.on_host_table_created = function (tbl) {
}); });
}); });
} }
else if (protocol == 2) { else if (protocol === PROTOCOL_TYPE_SSH) {
$(cell_obj).find('[ywl-btn-record]').click(function () { $(cell_obj).find('[ywl-btn-record]').click(function () {
window.open('/log/record/' + parseInt(row_data.protocol) + '/' + row_data.id); window.open('/log/record/' + parseInt(row_data.protocol) + '/' + row_data.id);
}); });
@ -214,8 +209,8 @@ ywl.on_host_table_created = function (tbl) {
var msg = ''; var msg = '';
switch (fields.ret_code) { switch (fields.ret_code) {
case 0: case 0:
// return '<span class="badge badge-warning">正在使用中</span>' return '<span class="badge badge-warning">使用中</span>'
return '-'; // return '-';
case 9999: case 9999:
return '<span class="badge badge-success">成功</span>'; return '<span class="badge badge-success">成功</span>';
case 1: case 1:
@ -261,7 +256,7 @@ ywl.on_host_table_created = function (tbl) {
render.cost_time = function (row_id, fields) { render.cost_time = function (row_id, fields) {
if (fields.ret_code == 0) { if (fields.ret_code == 0) {
return '<span class="badge badge-warning">正在使用中</span>'; return '<span class="badge badge-warning">使用中</span>';
} else { } else {
return '<span class="badge badge-success">' + second2str(fields.cost_time) + '</span>'; return '<span class="badge badge-success">' + second2str(fields.cost_time) + '</span>';
} }
@ -302,19 +297,17 @@ ywl.on_host_table_created = function (tbl) {
render.make_action_btn = function (row_id, fields) { render.make_action_btn = function (row_id, fields) {
var ret = []; var ret = [];
if (fields.protocol == 1) { if (fields.protocol === PROTOCOL_TYPE_RDP) {
ret.push('<a href="javascript:;" class="btn btn-sm btn-primary" protocol=' + fields.protocol + ' ywl-btn-record="' + fields.ID + '">录像查看</a>&nbsp'); ret.push('<a href="javascript:;" class="btn btn-sm btn-primary" protocol=' + fields.protocol + ' ywl-btn-record="' + fields.ID + '">录像查看</a>&nbsp');
} else if (fields.protocol == 2) { } else if (fields.protocol === PROTOCOL_TYPE_SSH) {
if (fields.cost_time > 0) { if (fields.ret_code === 9999 && fields.cost_time > 0) {
ret.push('<a href="javascript:;" class="btn btn-sm btn-primary" protocol=' + fields.protocol + ' ywl-btn-record="' + fields.ID + '">录像查看</a>&nbsp'); ret.push('<a href="javascript:;" class="btn btn-sm btn-primary" protocol=' + fields.protocol + ' ywl-btn-record="' + fields.ID + '">录像查看</a>&nbsp');
ret.push('<a href="javascript:;" class="btn btn-sm btn-success" protocol=' + fields.protocol + ' ywl-btn-log="' + fields.ID + '">日志查看</a>&nbsp'); ret.push('<a href="javascript:;" class="btn btn-sm btn-success" protocol=' + fields.protocol + ' ywl-btn-log="' + fields.ID + '">日志查看</a>&nbsp');
} }
} }
return ret.join(''); return ret.join('');
} }
}; };
}; };
@ -378,7 +371,6 @@ ywl.create_table_filter_user_list = function (tbl, selector, on_created) {
_tblf_st._on_select = function () { _tblf_st._on_select = function () {
var user_name = $(this).html(); var user_name = $(this).html();
var cb_stack = CALLBACK_STACK.create(); var cb_stack = CALLBACK_STACK.create();
cb_stack cb_stack
.add(_tblf_st._table_ctrl.load_data) .add(_tblf_st._table_ctrl.load_data)
@ -392,4 +384,3 @@ ywl.create_table_filter_user_list = function (tbl, selector, on_created) {
return _tblf_st; return _tblf_st;
}; };

View File

@ -68,6 +68,11 @@
<div id="steps-detail" class="steps-detail"></div> <div id="steps-detail" class="steps-detail"></div>
</div> </div>
<div id="step2" style="display:none;">
<hr/>
<h2>已完成!</h2>
<p>是的没有第二步了安装配置已经完成了刷新页面即可进入Teleport主界面啦~~</p>
</div>
</div> </div>
</div> </div>
@ -157,6 +162,7 @@
if (!ret.data.running) { if (!ret.data.running) {
$('#step2').show('fast');
return; return;
} }

View File

@ -62,6 +62,11 @@
<div id="steps-detail" class="steps-detail"></div> <div id="steps-detail" class="steps-detail"></div>
</div> </div>
<div id="step2" style="display:none;">
<hr/>
<h2>已完成!</h2>
<p>是的没有第二步了升级操作已经完成了刷新页面即可进入Teleport主界面啦~~</p>
</div>
</div> </div>
</div> </div>
@ -145,6 +150,7 @@
if (!ret.data.running) { if (!ret.data.running) {
$('#step2').show('fast');
return; return;
} }

View File

@ -14,6 +14,6 @@ Build 构建号。构建号用于表明此版本发布之前进行了多少
TELEPORT_SERVER 2.2.5.1 TELEPORT_SERVER 2.2.6.1
TELEPORT_ASSIST 2.2.5.1 TELEPORT_ASSIST 2.2.5.1
TELEPORT_ASSIST_REQUIRE 2.0.0.1 TELEPORT_ASSIST_REQUIRE 2.0.0.1