mirror of https://github.com/tp4a/teleport
add varb {host_name} for client display.
parent
17f32ba5d9
commit
1950c0723a
|
@ -47,6 +47,7 @@
|
|||
<ul>
|
||||
<li><span class="arg-varb">{host_ip}</span> 替换主机IP地址</li>
|
||||
<li><span class="arg-varb">{host_port}</span> 替换主机端口号</li>
|
||||
<li><span class="arg-varb">{host_name}</span> 替换主机名称</li>
|
||||
<li><span class="arg-varb">{user_name}</span> 替换用户名</li>
|
||||
<li><span class="arg-varb">{real_ip}</span> 替换为远程主机真实IP(仅用于显示,例如客户端的窗口标题或标签页标题等)</li>
|
||||
<li><span class="arg-varb">{assist_tools_path}</span> 替换为助手工具所在的tools目录的绝对路径</li>
|
||||
|
|
|
@ -660,6 +660,8 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf) {
|
|||
ex_astr teleport_ip = jsRoot["teleport_ip"].asCString();
|
||||
int teleport_port = jsRoot["teleport_port"].asUInt();
|
||||
|
||||
ex_astr remote_host_name = jsRoot["remote_host_name"].asCString();
|
||||
|
||||
ex_astr real_host_ip = jsRoot["remote_host_ip"].asCString();
|
||||
ex_astr sid = jsRoot["session_id"].asCString();
|
||||
|
||||
|
@ -673,6 +675,8 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf) {
|
|||
ex_astr2wstr(teleport_ip, w_teleport_ip);
|
||||
ex_wstr w_real_host_ip;
|
||||
ex_astr2wstr(real_host_ip, w_real_host_ip);
|
||||
ex_wstr w_remote_host_name;
|
||||
ex_astr2wstr(remote_host_name, w_remote_host_name);
|
||||
WCHAR w_port[32] = { 0 };
|
||||
swprintf_s(w_port, _T("%d"), teleport_port);
|
||||
|
||||
|
@ -905,9 +909,10 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf) {
|
|||
w_exe_path += g_cfg.telnet_cmdline;
|
||||
}
|
||||
|
||||
ex_replace_all(w_exe_path, _T("{host_port}"), w_port);
|
||||
ex_replace_all(w_exe_path, _T("{host_ip}"), w_teleport_ip.c_str());
|
||||
ex_replace_all(w_exe_path, _T("{host_port}"), w_port);
|
||||
ex_replace_all(w_exe_path, _T("{user_name}"), w_sid.c_str());
|
||||
ex_replace_all(w_exe_path, _T("{host_name}"), w_remote_host_name.c_str());
|
||||
ex_replace_all(w_exe_path, _T("{real_ip}"), w_real_host_ip.c_str());
|
||||
ex_replace_all(w_exe_path, _T("{assist_tools_path}"), g_env.m_tools_path.c_str());
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ $assist.do_teleport = function (args, func_success, func_error) {
|
|||
// 第二步:获取到临时会话ID后,将此ID传递给助手,准备开启一次远程会话
|
||||
var session_id = ret.data.session_id;
|
||||
var remote_host_ip = ret.data.host_ip;
|
||||
var remote_host_name = ret.data.host_name;
|
||||
var teleport_port = ret.data.teleport_port;
|
||||
var data = {
|
||||
//server_ip: g_host_name, //args.server_ip,
|
||||
|
@ -166,6 +167,7 @@ $assist.do_teleport = function (args, func_success, func_error) {
|
|||
teleport_ip: $assist.teleport_ip,
|
||||
teleport_port: teleport_port,
|
||||
remote_host_ip: remote_host_ip,
|
||||
remote_host_name: remote_host_name,
|
||||
// remote_host_port: args.host_port,
|
||||
// rdp_size: args.rdp_size,
|
||||
// rdp_console: args.rdp_console,
|
||||
|
|
|
@ -298,6 +298,7 @@ class DoGetSessionIDHandler(TPBaseJsonHandler):
|
|||
data = dict()
|
||||
data['session_id'] = ret_data['sid']
|
||||
data['host_ip'] = host_info['ip']
|
||||
data['host_name'] = host_info['name']
|
||||
data['protocol_flag'] = acc_info['protocol_flag']
|
||||
|
||||
if conn_info['protocol_type'] == TP_PROTOCOL_TYPE_RDP:
|
||||
|
|
|
@ -13,7 +13,7 @@ from app.base.utils import tp_timestamp_utc_now
|
|||
|
||||
def get_host_info(host_id):
|
||||
s = SQL(get_db())
|
||||
s.select_from('host', ['id', 'type', 'ip', 'router_ip', 'router_port', 'state'], alt_name='h')
|
||||
s.select_from('host', ['id', 'name', 'type', 'ip', 'router_ip', 'router_port', 'state'], alt_name='h')
|
||||
s.where('h.id={}'.format(host_id))
|
||||
err = s.query()
|
||||
if err != TPE_OK:
|
||||
|
|
Loading…
Reference in New Issue