mirror of https://github.com/tp4a/teleport
Assist support freerdp on MacOS.
parent
8c5dab0991
commit
50d814869c
|
@ -1 +1 @@
|
|||
@charset "utf-8";body{font-family:"Microsoft YaHei","微软雅黑",Helvetica,Arial,sans-serif;font-size:13px;background-color:#fff;color:#333}html,body{height:100%}.header{width:100%;height:48px;position:fixed;top:0;line-height:48px;font-size:80%;background-color:#3b3b3b;color:#fff;z-index:999}.header .title{font-size:16px}.header .sub-title{margin-left:30px;color:#acacac}.header-fix{height:48px}.footer{width:100%;height:24px;position:fixed;bottom:0;text-align:center;line-height:24px;background-color:#d5d5d5;border-top:1px solid #a2a2a2;font-size:80%;z-index:999}.content{margin:20px 0 50px 0}.content .cfg-title{font-size:16px;font-weight:bold}.content .form-group{margin-bottom:5px}.content .col-sm-1,.content .col-sm-2,.content .col-sm-3,.content .col-sm-4,.content .col-sm-5,.content .col-sm-6,.content .col-sm-7{padding-left:3px;padding-right:3px}.content .arg-detail{font-size:11px}.content .arg-detail ol,.content .arg-detail ul{margin-bottom:0}.content .arg-detail-common{background-color:#dbffbe;border-radius:5px;padding:15px}.content .input-args{font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace}.arg-varb{color:#0a6aa1;font-weight:bold;font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace;display:inline-block;width:128px}#gritter-notice-wrapper{z-index:9999}.gritter-bottom,.gritter-item,.gritter-top{background:rgba(0,0,0,0.8) !important}.gritter-top{border-top-left-radius:3px;border-top-right-radius:3px}.gritter-bottom{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.gritter-close,.gritter-light .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%}.gritter-close:before,.gritter-light .gritter-close:before{content:'\f00d' !important;font-family:FontAwesome !important;font-size:9px !important;width:16px !important;height:16px !important;line-height:16px !important;color:#fff !important;text-indent:0 !important;position:absolute !important;text-align:center !important;right:0 !important;top:0 !important}.gritter-title{font-size:13px !important;line-height:16px !important;padding-bottom:5px !important;font-weight:400 !important;color:#fff !important;text-shadow:none !important}.gritter-item{color:#aaa !important;font-size:13px !important;padding:2px 15px 5px !important}.gritter-error .gritter-bottom,.gritter-error .gritter-item,.gritter-error .gritter-top{background:rgba(123,32,32,0.9) !important}.gritter-error .gritter-title{color:#fff !important}.gritter-error .gritter-item{color:#ddd !important}.gritter-error .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%;background:#e33b3b !important}.gritter-success .gritter-bottom,.gritter-success .gritter-item,.gritter-success .gritter-top{background:rgba(1,65,16,0.9) !important}.gritter-success .gritter-title{color:#ddd !important}.gritter-success .gritter-item{color:#ccc !important}.gritter-success .gritter-close{background:#0eb320 !important}#gritter-notice-wrapper{width:320px;max-width:480px}/*# sourceMappingURL=style.css.map */
|
||||
@charset "utf-8";body{font-family:"Microsoft YaHei","微软雅黑",Helvetica,Arial,sans-serif;font-size:13px;background-color:#fff;color:#333}html,body{height:100%}.header{width:100%;height:48px;position:fixed;top:0;line-height:48px;font-size:80%;background-color:#3b3b3b;color:#fff;z-index:999}.header .title{font-size:16px}.header .sub-title{margin-left:30px;color:#acacac}.header-fix{height:48px}.footer{width:100%;height:24px;position:fixed;bottom:0;text-align:center;line-height:24px;background-color:#d5d5d5;border-top:1px solid #a2a2a2;font-size:80%;z-index:999}.content{margin:20px 0 50px 0}.content .cfg-title{font-size:16px;font-weight:bold}.content .form-group{margin-bottom:5px}.content .col-sm-1,.content .col-sm-2,.content .col-sm-3,.content .col-sm-4,.content .col-sm-5,.content .col-sm-6,.content .col-sm-7,.content .col-sm-8,.content .col-sm-9,.content .col-sm-10,.content .col-sm-11,.content .col-sm-12{padding-left:3px;padding-right:3px}.content .arg-detail{font-size:11px}.content .arg-detail ol,.content .arg-detail ul{margin-bottom:0}.content .desc{display:inline-block;margin-top:5px;color:#6b6b6b}.content .arg-detail-common{background-color:#dbffbe;border-radius:5px;padding:15px}.content .input-args{font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace}.arg-varb{color:#0a6aa1;font-weight:bold;font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace;display:inline-block;width:128px}#gritter-notice-wrapper{z-index:9999}.gritter-bottom,.gritter-item,.gritter-top{background:rgba(0,0,0,0.8) !important}.gritter-top{border-top-left-radius:3px;border-top-right-radius:3px}.gritter-bottom{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.gritter-close,.gritter-light .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%}.gritter-close:before,.gritter-light .gritter-close:before{content:'\f00d' !important;font-family:FontAwesome !important;font-size:9px !important;width:16px !important;height:16px !important;line-height:16px !important;color:#fff !important;text-indent:0 !important;position:absolute !important;text-align:center !important;right:0 !important;top:0 !important}.gritter-title{font-size:13px !important;line-height:16px !important;padding-bottom:5px !important;font-weight:400 !important;color:#fff !important;text-shadow:none !important}.gritter-item{color:#aaa !important;font-size:13px !important;padding:2px 15px 5px !important}.gritter-error .gritter-bottom,.gritter-error .gritter-item,.gritter-error .gritter-top{background:rgba(123,32,32,0.9) !important}.gritter-error .gritter-title{color:#fff !important}.gritter-error .gritter-item{color:#ddd !important}.gritter-error .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%;background:#e33b3b !important}.gritter-success .gritter-bottom,.gritter-success .gritter-item,.gritter-success .gritter-top{background:rgba(1,65,16,0.9) !important}.gritter-success .gritter-title{color:#ddd !important}.gritter-success .gritter-item{color:#ccc !important}.gritter-success .gritter-close{background:#0eb320 !important}#gritter-notice-wrapper{width:320px;max-width:480px}/*# sourceMappingURL=style.css.map */
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["style.less"],"names":[],"mappings":"AAAA,SAAS,QAaT,KACE,YAJmB,kBAAmB,iCAItC,CACA,cAAA,CACA,qBAAA,CACA,WAGF,KAAM,KACJ,YAGF,QACE,UAAA,CACA,WAAA,CACA,cAAA,CACA,KAAA,CAEA,gBAAA,CAEA,aAAA,CAEA,wBAAA,CACA,UAAA,CACA,YAZF,OAcE,QACE,eAfJ,OAiBE,YACE,gBAAA,CACA,cAIJ,YACE,YAGF,QACE,UAAA,CACA,WAAA,CACA,cAAA,CACA,QAAA,CACA,iBAAA,CACA,gBAAA,CACA,wBAAA,CACA,4BAAA,CACA,aAAA,CACA,YAGF,SACE,qBADF,QAGE,YACE,cAAA,CACA,iBALJ,QAQE,aACE,kBATJ,QAYE,WAZF,QAYa,WAZb,QAYwB,WAZxB,QAYmC,WAZnC,QAY8C,WAZ9C,QAYyD,WAZzD,QAYoE,WAChE,gBAAA,CACA,kBAdJ,QAiBE,aACE,eAlBJ,QAiBE,YAEE,IAnBJ,QAiBE,YAEM,IACF,gBApBN,QAwBE,oBAEE,wBAAA,CAEA,iBAAA,CACA,aA7BJ,QAiCE,aACE,mDAvF0D,wBA2F9D,UACE,aAAA,CACA,gBAAA,CACA,mDA9F4D,uBA8F5D,CACA,oBAAA,CACA,YAiBF,wBAKE,aAGF,gBAAiB,cAAe,aAE9B,0BAAA,YAGF,aACE,0BAAA,CACA,4BAGF,gBACE,6BAAA,CACA,+BAGF,eAAgB,cAAe,gBAU7B,SAAA,YACA,SAAA,YACA,OAAA,YACA,UAAA,YACA,WAAA,YACA,gBAAA,YACA,aAAA,YACA,kBAGF,cAAc,QAAS,cAAe,eAAc,QAClD,QAAS,OAAT,YACA,uBAAA,YACA,aAAA,YACA,UAAA,YACA,WAAA,YACA,gBAAA,YACA,UAAA,YACA,aAAA,YACA,iBAAA,YACA,iBAAA,YACA,OAAA,YACA,KAAA,YAcF,eACE,cAAA,YACA,gBAAA,YACA,kBAAA,YACA,eAAA,YACA,UAAA,YACA,gBAAA,YAQF,cAEE,UAAA,YACA,cAAA,YACA,oBAAA,YAGF,cACE,iBADF,cACmB,eADnB,cACkC,cAC9B,8BAAA,YAFJ,cAKE,gBACE,UAAA,YANJ,cASE,eACE,UAAA,YAVJ,cAaE,gBACE,SAAA,YACA,SAAA,YACA,OAAA,YACA,UAAA,YACA,WAAA,YACA,gBAAA,YACA,aAAA,YACA,iBAAA,CACA,kBAAA,YAIJ,gBACE,iBADF,gBACmB,eADnB,gBACkC,cAE9B,4BAAA,YAHJ,gBAME,gBAEE,UAAA,YARJ,gBAWE,eAEE,UAAA,YAbJ,gBAgBE,gBACE,kBAAA,YAKJ,wBACE,WAAA,CAEA","file":"style.css","sourceRoot":"../less"}
|
||||
{"version":3,"sources":["style.less"],"names":[],"mappings":"AAAA,SAAS,QAaT,KACE,YAJmB,kBAAmB,iCAItC,CACA,cAAA,CACA,qBAAA,CACA,WAGF,KAAM,KACJ,YAGF,QACE,UAAA,CACA,WAAA,CACA,cAAA,CACA,KAAA,CAEA,gBAAA,CAEA,aAAA,CAEA,wBAAA,CACA,UAAA,CACA,YAZF,OAcE,QACE,eAfJ,OAiBE,YACE,gBAAA,CACA,cAIJ,YACE,YAGF,QACE,UAAA,CACA,WAAA,CACA,cAAA,CACA,QAAA,CACA,iBAAA,CACA,gBAAA,CACA,wBAAA,CACA,4BAAA,CACA,aAAA,CACA,YAGF,SACE,qBADF,QAGE,YACE,cAAA,CACA,iBALJ,QAQE,aACE,kBATJ,QAYE,WAZF,QAYa,WAZb,QAYwB,WAZxB,QAYmC,WAZnC,QAY8C,WAZ9C,QAYyD,WAZzD,QAYoE,WAZpE,QAY+E,WAZ/E,QAY0F,WAZ1F,QAYqG,YAZrG,QAYiH,YAZjH,QAY6H,YACzH,gBAAA,CACA,kBAdJ,QAiBE,aACE,eAlBJ,QAiBE,YAEE,IAnBJ,QAiBE,YAEM,IACF,gBApBN,QAwBE,OACE,oBAAA,CACA,cAAA,CACA,cA3BJ,QA8BE,oBAEE,wBAAA,CAEA,iBAAA,CACA,aAnCJ,QAuCE,aACE,mDA7F0D,wBAiG9D,UACE,aAAA,CACA,gBAAA,CACA,mDApG4D,uBAoG5D,CACA,oBAAA,CACA,YAiBF,wBAKE,aAGF,gBAAiB,cAAe,aAE9B,0BAAA,YAGF,aACE,0BAAA,CACA,4BAGF,gBACE,6BAAA,CACA,+BAGF,eAAgB,cAAe,gBAU7B,SAAA,YACA,SAAA,YACA,OAAA,YACA,UAAA,YACA,WAAA,YACA,gBAAA,YACA,aAAA,YACA,kBAGF,cAAc,QAAS,cAAe,eAAc,QAClD,QAAS,OAAT,YACA,uBAAA,YACA,aAAA,YACA,UAAA,YACA,WAAA,YACA,gBAAA,YACA,UAAA,YACA,aAAA,YACA,iBAAA,YACA,iBAAA,YACA,OAAA,YACA,KAAA,YAcF,eACE,cAAA,YACA,gBAAA,YACA,kBAAA,YACA,eAAA,YACA,UAAA,YACA,gBAAA,YAQF,cAEE,UAAA,YACA,cAAA,YACA,oBAAA,YAGF,cACE,iBADF,cACmB,eADnB,cACkC,cAC9B,8BAAA,YAFJ,cAKE,gBACE,UAAA,YANJ,cASE,eACE,UAAA,YAVJ,cAaE,gBACE,SAAA,YACA,SAAA,YACA,OAAA,YACA,UAAA,YACA,WAAA,YACA,gBAAA,YACA,aAAA,YACA,iBAAA,CACA,kBAAA,YAIJ,gBACE,iBADF,gBACmB,eADnB,gBACkC,cAE9B,4BAAA,YAHJ,gBAME,gBAEE,UAAA,YARJ,gBAWE,eAEE,UAAA,YAbJ,gBAgBE,gBACE,kBAAA,YAKJ,wBACE,WAAA,CAEA","file":"style.css","sourceRoot":"../less"}
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<div class="footer">
|
||||
<div class="container">
|
||||
<p><a href="http://teleport.eomsoft.net/" target="_blank">TELEPORT</a> | ©2015 - 2018,保留所有权利。</p>
|
||||
<p><a href="http://www.tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2018,保留所有权利。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -34,31 +34,57 @@
|
|||
|
||||
<div class="content">
|
||||
|
||||
<p class="cfg-title">本地终端配置</p>
|
||||
<hr/>
|
||||
<p class="cfg-title">本地终端配置(用于SSH)</p>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<label for="term-type" class="col-sm-1 control-label"><strong>终端:</strong></label>
|
||||
<div class="col-sm-2">
|
||||
<div class="col-sm-3">
|
||||
<select id="term-type" class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<label for="term-profile" class="col-sm-1 control-label"><strong>使用配置:</strong></label>
|
||||
<div class="col-sm-2">
|
||||
<div class="col-sm-3">
|
||||
<input id="term-profile" type="text" class="form-control input-args"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
<p class="cfg-title">本地RDP配置</p>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<label for="rdp-type" class="col-sm-1 control-label"><strong>RDP客户端:</strong></label>
|
||||
<div class="col-sm-3">
|
||||
<select id="rdp-type" class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-group-sm">
|
||||
<label for="rdp-app" class="col-sm-1 control-label"><strong>程序路径:</strong></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="rdp-app" type="text" class="form-control input-args"/>
|
||||
<span class="desc"><i class="fa fa-info-circle"></i> 建议使用homebrew安装freerdp,安装后freerdp默认路径在:/usr/local/Cellar/freerdp/x.y.z/bin/xfreerdp</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="col-sm-1"></div>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-3">
|
||||
<a id="btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,8 @@ var g_cfg = null;
|
|||
var dom = {
|
||||
term_type: $('#term-type'),
|
||||
term_profile: $('#term-profile'),
|
||||
rdp_type: $('#rdp-type'),
|
||||
rdp_app: $('#rdp-app'),
|
||||
|
||||
btn_save: $('#btn-save')
|
||||
};
|
||||
|
@ -35,7 +37,7 @@ var get_config = function () {
|
|||
}
|
||||
|
||||
function update_dom() {
|
||||
console.log('---', g_cfg, g_cfg.term, g_cfg.term.available);
|
||||
console.log('---', g_cfg);
|
||||
|
||||
dom.term_type.html('');
|
||||
|
||||
|
@ -66,6 +68,34 @@ function update_dom() {
|
|||
dom.term_profile.val(profile);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_.isUndefined(g_cfg.rdp)) {
|
||||
if (_.isUndefined(g_cfg.rdp.selected)) {
|
||||
g_cfg.rdp.selected = '';
|
||||
}
|
||||
|
||||
if (!_.isUndefined(g_cfg.rdp.available) && g_cfg.rdp.available.length > 0) {
|
||||
var selected = '';
|
||||
var app = '';
|
||||
|
||||
var html = [];
|
||||
for (var i = 0; i < g_cfg.rdp.available.length; i++) {
|
||||
var item = g_cfg.rdp.available[i];
|
||||
|
||||
if (selected === '' || item.name === g_cfg.rdp.selected) {
|
||||
selected = item.name;
|
||||
app = item.app;
|
||||
}
|
||||
|
||||
html.push('<option id="rdp-' + item.name + '" value="' + item.name + '">' + item.display + '</option>');
|
||||
}
|
||||
|
||||
dom.rdp_type.html(html.join(''));
|
||||
|
||||
dom.rdp_type.val(selected);
|
||||
dom.rdp_app.val(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function on_term_change() {
|
||||
|
@ -78,10 +108,22 @@ function on_term_change() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
notify_error('所选的终端配置项并不存在!');
|
||||
}
|
||||
|
||||
function on_rdp_change() {
|
||||
g_cfg.rdp.selected = dom.rdp_type.val();
|
||||
|
||||
for (var i = 0; i < g_cfg.rdp.available.length; i++) {
|
||||
var item = g_cfg.rdp.available[i];
|
||||
if (item.name === g_cfg.rdp.selected) {
|
||||
dom.rdp_app.val(item.app);
|
||||
return;
|
||||
}
|
||||
}
|
||||
notify_error('所选的RDP配置项并不存在!');
|
||||
}
|
||||
|
||||
function on_save() {
|
||||
if (g_cfg === null)
|
||||
return;
|
||||
|
@ -93,6 +135,13 @@ function on_save() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < g_cfg.rdp.available.length; i++) {
|
||||
var item = g_cfg.rdp.available[i];
|
||||
if (item.name === g_cfg.rdp.selected) {
|
||||
item.app = dom.rdp_app.val();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var args_ = encodeURIComponent(JSON.stringify(g_cfg));
|
||||
|
||||
|
@ -146,6 +195,9 @@ $(document).ready(function () {
|
|||
dom.term_type.change(function () {
|
||||
on_term_change();
|
||||
});
|
||||
dom.rdp_type.change(function () {
|
||||
on_rdp_change();
|
||||
});
|
||||
|
||||
dom.btn_save.click(function () {
|
||||
on_save();
|
||||
|
|
|
@ -74,7 +74,7 @@ html, body {
|
|||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7 {
|
||||
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
@ -86,6 +86,12 @@ html, body {
|
|||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
display:inline-block;
|
||||
margin-top:5px;
|
||||
color:rgb(107, 107, 107);
|
||||
}
|
||||
|
||||
.arg-detail-common {
|
||||
//border:1px solid #f33;
|
||||
background-color: #dbffbe;
|
||||
|
|
|
@ -11,13 +11,14 @@
|
|||
#include "csrc/ts_cfg.h"
|
||||
#include "csrc/ts_http_rpc.h"
|
||||
|
||||
bool cpp_main(void* _self, const char* cfg_file, const char* res_path) {
|
||||
int cpp_main(void* _self, const char* cfg_file, const char* res_path) {
|
||||
if(!g_env.init(cfg_file, res_path))
|
||||
return false;
|
||||
return -1;
|
||||
if(!g_cfg.init())
|
||||
return false;
|
||||
return -2;
|
||||
|
||||
http_rpc_start(_self);
|
||||
if(0 != http_rpc_start(_self))
|
||||
return -3;
|
||||
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char* term_type, const char* term_theme, const char* term_title);
|
||||
|
||||
// for cpp global object initialize.
|
||||
bool cpp_main(void* _self, const char* cfg_file, const char* res_path);
|
||||
int cpp_main(void* _self, const char* cfg_file, const char* res_path);
|
||||
|
||||
#endif /* wrap_c_objc_h */
|
||||
|
|
|
@ -74,9 +74,29 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char*
|
|||
NSString *resPath = [[NSBundle mainBundle] resourcePath];
|
||||
std::string cpp_res_path = [resPath cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
std::string cpp_cfg_file = [cfgFile cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if(!cpp_main((__bridge void*)self, cpp_cfg_file.c_str(), cpp_res_path.c_str())) {
|
||||
|
||||
int ret = cpp_main((__bridge void*)self, cpp_cfg_file.c_str(), cpp_res_path.c_str());
|
||||
if(ret != 0) {
|
||||
// TODO: show error message and exit.
|
||||
}
|
||||
NSString *msg = Nil;
|
||||
if(ret == -1)
|
||||
msg = @"初始化运行环境失败!";
|
||||
else if(ret == -2)
|
||||
msg = @"加载配置文件失败!";
|
||||
else if(ret == -3)
|
||||
msg = @"启动本地通讯端口失败!请检查本地50022端口是否被占用!";
|
||||
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:@"无法启动Teleport助手"
|
||||
defaultButton:@"确定"
|
||||
alternateButton:Nil
|
||||
otherButton:Nil
|
||||
informativeTextWithFormat:msg];
|
||||
[alert runModal];
|
||||
|
||||
http_rpc_stop();
|
||||
|
||||
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
|
||||
[NSApp terminate:NSApp]; }
|
||||
}
|
||||
|
||||
- (int) start_ssh_client:(NSString*)cmd_line termType:(NSString*)term_type termTheme:(NSString*)term_theme termTitle:(NSString*)term_title {
|
||||
|
@ -147,7 +167,7 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char*
|
|||
|
||||
- (IBAction)visitWebsite:(id)sender {
|
||||
|
||||
NSURL *url = [NSURL URLWithString:@"http://teleport.eomsoft.net/"];
|
||||
NSURL *url = [NSURL URLWithString:@"http://www.tp4a.com/"];
|
||||
[[NSWorkspace sharedWorkspace] openURL:url];
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ bool TsCfg::_load(const ex_astr& str_json) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// ------------ term ---------------------
|
||||
|
||||
if (!m_root["term"].isObject()) {
|
||||
EXLOGE("invalid config, error 1.\n");
|
||||
return false;
|
||||
|
@ -98,6 +100,60 @@ bool TsCfg::_load(const ex_astr& str_json) {
|
|||
EXLOGE("invalid config, error 6.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------ RDP ---------------------
|
||||
|
||||
if (!m_root["rdp"].isObject()) {
|
||||
EXLOGE("invalid config, error 1.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !m_root["rdp"]["selected"].isString()) {
|
||||
EXLOGE("invalid config, error 2.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
rdp_name = m_root["rdp"]["selected"].asCString();
|
||||
|
||||
if(!m_root["rdp"]["available"].isArray() || m_root["rdp"]["available"].size() == 0) {
|
||||
EXLOGE("invalid config, error 3.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < m_root["rdp"]["available"].size(); ++i) {
|
||||
|
||||
if(
|
||||
!m_root["rdp"]["available"][i]["name"].isString()
|
||||
|| !m_root["rdp"]["available"][i]["app"].isString()
|
||||
//|| !m_root["rdp"]["available"][i]["profile"].isString()
|
||||
) {
|
||||
EXLOGE("invalid config, error 4.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_root["rdp"]["available"][i]["name"].asCString() != rdp_name)
|
||||
continue;
|
||||
|
||||
if(m_root["rdp"]["available"][i]["disp"].isString()) {
|
||||
rdp_display = m_root["term"]["available"][i]["display"].asCString();
|
||||
} else if(m_root["rdp"]["available"][i]["disp"].isNull()) {
|
||||
m_root["rdp"]["available"][i]["disp"] = rdp_name;
|
||||
rdp_display = rdp_name;
|
||||
} else {
|
||||
EXLOGE("invalid config, error 5.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
rdp_app = m_root["rdp"]["available"][i]["app"].asCString();
|
||||
//rdp_profile = m_root["rdp"]["available"][i]["profile"].asCString();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(rdp_name.length() == 0) {
|
||||
EXLOGE("invalid config, error 6.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,11 @@ public:
|
|||
ex_astr term_app;
|
||||
ex_astr term_profile;
|
||||
|
||||
ex_astr rdp_name;
|
||||
ex_astr rdp_display;
|
||||
ex_astr rdp_app;
|
||||
//ex_astr rdp_cmdline;
|
||||
|
||||
protected:
|
||||
bool _load(const ex_astr& str_json);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ TsHttpRpc g_http_interface;
|
|||
|
||||
void* g_app = NULL;
|
||||
|
||||
void http_rpc_start(void* app) {
|
||||
int http_rpc_start(void* app) {
|
||||
g_app = app;
|
||||
|
||||
// if(!g_env.init())
|
||||
|
@ -37,13 +37,16 @@ void http_rpc_start(void* app) {
|
|||
if (!g_http_interface.init(TS_HTTP_RPC_HOST, TS_HTTP_RPC_PORT))
|
||||
{
|
||||
EXLOGE("[ERROR] can not start HTTP-RPC listener, maybe port %d is already in use.\n", TS_HTTP_RPC_PORT);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
EXLOGW("======================================================\n");
|
||||
EXLOGW("[rpc] TeleportAssist-HTTP-RPC ready on %s:%d\n", TS_HTTP_RPC_HOST, TS_HTTP_RPC_PORT);
|
||||
|
||||
g_http_interface.start();
|
||||
if(!g_http_interface.start())
|
||||
return -2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void http_rpc_stop(void)
|
||||
|
@ -465,19 +468,6 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
ex_astr real_host_ip = jsRoot["remote_host_ip"].asCString();
|
||||
ex_astr sid = jsRoot["session_id"].asCString();
|
||||
|
||||
// ex_wstr w_exe_path;
|
||||
// wchar_t w_szCommandLine[MAX_PATH] = { 0 };
|
||||
|
||||
|
||||
// ex_wstr w_sid;
|
||||
// ex_astr2wstr(sid, w_sid);
|
||||
// ex_wstr w_teleport_ip;
|
||||
// ex_astr2wstr(teleport_ip, w_teleport_ip);
|
||||
// ex_wstr w_real_host_ip;
|
||||
// ex_astr2wstr(real_host_ip, w_real_host_ip);
|
||||
// wchar_t w_port[32] = { 0 };
|
||||
// ex_wcsformat(w_port, 32, L"%d", teleport_port);
|
||||
|
||||
ex_astr s_exec;
|
||||
ex_astrs s_argv;
|
||||
|
||||
|
@ -487,11 +477,12 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
//==============================================
|
||||
// RDP
|
||||
//==============================================
|
||||
|
||||
// sorry, RDP not supported yet for macOS.
|
||||
// _create_json_ret(buf, TPE_NOT_IMPLEMENT);
|
||||
// return;
|
||||
|
||||
if(g_cfg.rdp_app.length() == 0) {
|
||||
_create_json_ret(buf, TPE_NOT_EXISTS);
|
||||
return;
|
||||
}
|
||||
|
||||
bool flag_clipboard = (protocol_flag & TP_FLAG_RDP_CLIPBOARD);
|
||||
bool flag_disk = (protocol_flag & TP_FLAG_RDP_DISK);
|
||||
bool flag_console = (protocol_flag & TP_FLAG_RDP_CONSOLE);
|
||||
|
@ -554,9 +545,8 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
//w_exe_path = _T("xfreerdp -u {user_name} {size} {console} {clipboard} {drives} ");
|
||||
//w_exe_path = _T("/usr/local/Cellar/freerdp/1.0.2_1/bin/xfreerdp -u {user_name} {size} {console} ");
|
||||
//w_exe_path = _T("xfreerdp -u {user_name} {size} {console} ");
|
||||
s_exec = "/usr/local/Cellar/freerdp/1.0.2_1/bin/xfreerdp";
|
||||
//s_exec = "xfreerdp";
|
||||
//s_argv.push_back("xfreerdp");
|
||||
//s_exec = "/usr/local/Cellar/freerdp/1.0.2_1/bin/xfreerdp";
|
||||
s_exec = g_cfg.rdp_app;
|
||||
s_argv.push_back(s_exec.c_str());
|
||||
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ json_param
|
|||
|
||||
*/
|
||||
|
||||
void http_rpc_start(void* app);
|
||||
int http_rpc_start(void* app);
|
||||
void http_rpc_stop(void);
|
||||
|
||||
typedef std::map<ex_astr, ex_astr> content_type_map;
|
||||
|
|
|
@ -15,5 +15,16 @@
|
|||
"profile": "Default"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"rdp": {
|
||||
"selected": "FreeRDP",
|
||||
"available": [
|
||||
{
|
||||
"name": "FreeRDP",
|
||||
"display": "FreeRDP",
|
||||
"app": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@
|
|||
C149EBF015D5214600B1F558 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0830;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = eomsoft;
|
||||
};
|
||||
buildConfigurationList = C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "tp_assist" */;
|
||||
|
@ -400,12 +400,20 @@
|
|||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
@ -434,7 +442,7 @@
|
|||
../../external/mongoose,
|
||||
../../external/jsoncpp/include,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
|
@ -447,12 +455,20 @@
|
|||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
@ -474,7 +490,7 @@
|
|||
../../external/mongoose,
|
||||
../../external/jsoncpp/include,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
int Count(void) const
|
||||
{
|
||||
return m_kvs.size();
|
||||
return (int)m_kvs.size();
|
||||
}
|
||||
void Save(FILE* file, int codepage);
|
||||
#ifdef EX_DEBUG
|
||||
|
|
|
@ -9,7 +9,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Project_SOURCE_DIR}/../out/server/x64/bin"
|
|||
aux_source_directory(. DIR_SSH_SRCS)
|
||||
aux_source_directory(../../common DIR_SSH_SRCS)
|
||||
aux_source_directory(../../../../common/libex/src DIR_SSH_SRCS)
|
||||
aux_source_directory(../../../../external/jsoncpp/src/lib_json DIR_SRCS)
|
||||
aux_source_directory(../../../../external/jsoncpp/src/lib_json DIR_SSH_SRCS)
|
||||
|
||||
list(REMOVE_ITEM DIR_SSH_SRCS "./dllmain.cpp")
|
||||
list(REMOVE_ITEM DIR_SSH_SRCS "./stdafx.cpp")
|
||||
|
|
|
@ -9,7 +9,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Project_SOURCE_DIR}/../out/server/x64/bin"
|
|||
aux_source_directory(. DIR_TELNET_SRCS)
|
||||
aux_source_directory(../../common DIR_TELNET_SRCS)
|
||||
aux_source_directory(../../../../common/libex/src DIR_TELNET_SRCS)
|
||||
aux_source_directory(../../../../external/jsoncpp/src/lib_json DIR_SRCS)
|
||||
aux_source_directory(../../../../external/jsoncpp/src/lib_json DIR_TELNET_SRCS)
|
||||
|
||||
list(REMOVE_ITEM DIR_TELNET_SRCS "./dllmain.cpp")
|
||||
list(REMOVE_ITEM DIR_TELNET_SRCS "./stdafx.cpp")
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
<div style="color:#717171;font-size:90%;margin-top:5px;"><span style="display:inline-block;width:50px;text-align: right">服务端:</span><span class="mono">v${app_ver.TP_SERVER_VER}</span></div>
|
||||
<div style="color:#717171;font-size:90%;margin-top:5px;"><span style="display:inline-block;width:50px;text-align: right">助手:</span><span class="mono"><span id="sidebar-tp-assist-ver"><i class="fa fa-cog fa-spin"></i></span></span></div>
|
||||
|
||||
<div style="font-size:80%;margin-top:5px;text-align:center;"><span class="error">技术预览版</span></div>
|
||||
<div style="font-size:80%;margin-top:5px;text-align:center;"><span class="error">beta版</span></div>
|
||||
</div>
|
||||
<hr style="border:none;border-bottom:1px dotted #4a4a4a;margin-bottom:20px;margin-top:5px;"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue