diff --git a/client/cfg/cacert.cer b/client/cfg/cacert.cer new file mode 100644 index 0000000..d8f5d0c --- /dev/null +++ b/client/cfg/cacert.cer @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID4TCCAsmgAwIBAgIBADANBgkqhkiG9w0BAQsFADBSMQswCQYDVQQGEwJDTjEN +MAsGA1UECgwEVFA0QTEZMBcGA1UECwwQVFA0QSBUZWxlcG9ydCBDQTEZMBcGA1UE +AwwQVFA0QSBUZWxlcG9ydCBDQTAgFw0xODExMDgxNzMyMjJaGA8yMTE4MTAxNTE3 +MzIyMlowUjELMAkGA1UEBhMCQ04xDTALBgNVBAoMBFRQNEExGTAXBgNVBAsMEFRQ +NEEgVGVsZXBvcnQgQ0ExGTAXBgNVBAMMEFRQNEEgVGVsZXBvcnQgQ0EwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCml/ERetMxXh17Uf4IlLjDfgGwnpQZ +L0UoCO2vAHk0h4eRx5x4fMB/Ml1YHYghVKJ9rxWeb+v5wWz9a8CFtNu+s46nG9cw +XdneQ2UT4L5+7a+mOyNGAcascfLWfUYoMnF0ugIf3OfsUeAwinMnvKi2I2b8XdXH +cXRqToEYmcovPLKaXByXFLjcMHMRwR5Es0zIRx+4uuIvCICndLRX5IGy/HGEPZyV +Vtrrrvkngz54UHB3C3sKuHuHBOxvJ1grJV9fLFptsbPhMonXfYKJpf+ODwmkEDFS ++4vV61ctYvUiElCPeQte23v6lIujqoLoHzYoi8J5BxEwBggeCgAZ/YYFAgMBAAGj +gb8wgbwwHQYDVR0OBBYEFKHqO88fYp8ard6SKPi8X4Gpr+uiMHoGA1UdIwRzMHGA +FKHqO88fYp8ard6SKPi8X4Gpr+uioVakVDBSMQswCQYDVQQGEwJDTjENMAsGA1UE +CgwEVFA0QTEZMBcGA1UECwwQVFA0QSBUZWxlcG9ydCBDQTEZMBcGA1UEAwwQVFA0 +QSBUZWxlcG9ydCBDQYIBADAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjANBgkqhkiG9w0BAQsFAAOCAQEAQWYR/WBsaWEwTE9IuoULsGs0G5CWwfIvezil +HUmtQQb2G3P0kxv43xU3PT3czfbd22h9diSHyyYXOShHIfNx7ZD4SUMGyukcfPst +oyLcnlMK2hxtu3s5hTc76D+m7ylLQgV52jwHOXXS9toRhIo76HY6Q5Qbz9koP/x+ +MOwmNJ+dLQj/qI1WZZI7FS7Idi2dB5KMp11a2kxgeBIxwkCreBm/MLfdLRyaMdGX +1L05AI0d7lCu+N+Fu2QX9wToBZ4rRQFrdakgCXqXCdM1O4Akf1KvCDXHUJKgMQUE +Hav+XOE7nrtxIwfH4VjmCZYRE+8ZTYbG8xSHDwIRMxhsLnb63w== +-----END CERTIFICATE----- diff --git a/client/cfg/localhost.key b/client/cfg/localhost.key new file mode 100644 index 0000000..852ff91 --- /dev/null +++ b/client/cfg/localhost.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDxI1ZDRvuNnkVB +JgTZmnwF97d7Ace+R0gSSkWi2l2oezakLSdUUkiysr1wx45u2Du36FNqMGg7LiCZ +SX1e2Zba96PI6vwNGnlprCfXTe2eV3W8kMPKA6c9X8BTktMZINNHO3K591jGx+uM +fyrl6/CFVPHNkl73Ium9u91JXIX9BOata4RTlphmHADc+hPXuC6oeN8qayZvV2rV +Jfx1wMlWCMiGJM36JJO5pywteBCKQkVJuJ7y29XF2wT690o+i6ugk+yI2/2OpiET +2E5SYdvyhlbcU+iBERsnY3X7IvFY8/m00YIjIc3reGSEwt9M5WTPRCjgonnpQGAx +9xWXwqkzAgMBAAECggEAT9b2YdInye0EWxy+cFoBBGzPeE/PlcW+LCghRFlutzEM +l3FH21hfL6OUq7m3BCZeJ3cp3zfl2upb6sT1WKlMlHV36jc7ew8v8fgJPPVVXp7w +oZ2A5estvVltsX4knOZMbgJV6xLldvOMnvkf9/6VpV/Jq9nxzXvmzmZcT0TuLCaF +uPk/g/yD5qQ8LkWXDVJeBiDrrOZYo5F+T8bveYKKIEZV0ZAlXwJqVOUFnhffIaDF +fZVDOv4K3+q0aRDLTY2hxptHZiKzpLXgU634nBN3fiy0Fj88upNIus22gjaz+Jfx +2pYv22iGNXAMFQwGaeuT7d4+qhgxze8C7YlLJsJWCQKBgQD8kkXbgYG+8NoKmovz +ki9nuK1R6On5pNjZ344SJm6t/s4FaxQhE/4oHvODwgolqKyT2Sq1K8/5NInRGA29 +xPqqkkhwWk3Zf9VTXgmuXsOikPhbCOuiehO+6/ZthmHYy1jBMqkAIWYaL9Ytn2qb +dKMHwzNdnppQNdQnwmXI2ZdRBQKBgQD0aVTSOmKfKdIxH9qFLdbi2CoyJMzjAjm9 +Ss5M0OhI9wZnCXyjPBx4hOs+M/BKx4lQ296u2Dh+gSK3L8K3x8lVqqx8gd614qaC +EWzXZpAbd1S835o2vVYEWXU0iI9s0jkj+VnILEWBMRPYManRUATB2phwRPulimdu +o+BWN0GG1wKBgCYBxO1hMasQB1+tHf5LM0MCcWJwEDV27wLqNzDYA7O/MjVyhZbs +sURMVAyxuGEuXrno5hpZO3SeyVZjrj2uVKIyXSA7FpfyOqHO9tn8fKgL9LOORhcv +E6WZUH3uyO6cuwBnpTLV082BAVPgN2SpSpcycppV8Za8Yu6QvExbIgAZAoGBALcq +ANETxDj3hHggIQlRkwqpaOXvQkSVtGOxne1fWdTkmz24lFlYgRWotwsErX29D6Ez +RSzPCXd0m2mhN1G3PaEfqOgeA6NXWeV73Y+HY1PSGAT7pXyEY+QajoVyGdo5qWzW +P3yOAQCSoQaSIWulhgspILhyWgxzLpRx53t1KXw9AoGBAOxsrIrx/S6onTz58ncZ +m99OWwJX4WmY5KKhc5dWrfgHrNfldSbhjRhjALy6hSPzkaVy01wXKeeIZl64rUbd +S/r58yALQ5wuIHAi53BLStxgqEdHQHLg16GqL3b/+Waaf+Fy9y5eoUQ976HPr33G +uDJ1AAnWjX3KvcyZeWLFTU2/ +-----END PRIVATE KEY----- diff --git a/client/cfg/localhost.pem b/client/cfg/localhost.pem new file mode 100644 index 0000000..b91d7e1 --- /dev/null +++ b/client/cfg/localhost.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEGTCCAwGgAwIBAgIEASUKPDANBgkqhkiG9w0BAQsFADBSMQswCQYDVQQGEwJD +TjENMAsGA1UECgwEVFA0QTEZMBcGA1UECwwQVFA0QSBUZWxlcG9ydCBDQTEZMBcG +A1UEAwwQVFA0QSBUZWxlcG9ydCBDQTAgFw0xODExMDgxNzMyMjdaGA8yMTE4MTAx +NTE3MzIyN1owXzELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkJKMQswCQYDVQQHDAJ0 +cDERMA8GA1UECgwIVGVsZXBvcnQxDzANBgNVBAsMBkFzc2lzdDESMBAGA1UEAwwJ +bG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8SNWQ0b7 +jZ5FQSYE2Zp8Bfe3ewHHvkdIEkpFotpdqHs2pC0nVFJIsrK9cMeObtg7t+hTajBo +Oy4gmUl9XtmW2vejyOr8DRp5aawn103tnld1vJDDygOnPV/AU5LTGSDTRztyufdY +xsfrjH8q5evwhVTxzZJe9yLpvbvdSVyF/QTmrWuEU5aYZhwA3PoT17guqHjfKmsm +b1dq1SX8dcDJVgjIhiTN+iSTuacsLXgQikJFSbie8tvVxdsE+vdKPouroJPsiNv9 +jqYhE9hOUmHb8oZW3FPogREbJ2N1+yLxWPP5tNGCIyHN63hkhMLfTOVkz0Qo4KJ5 +6UBgMfcVl8KpMwIDAQABo4HnMIHkMB0GA1UdDgQWBBRc5d0h39QISTM55kCqPyy1 +dohEHTB6BgNVHSMEczBxgBSh6jvPH2KfGq3ekij4vF+Bqa/roqFWpFQwUjELMAkG +A1UEBhMCQ04xDTALBgNVBAoMBFRQNEExGTAXBgNVBAsMEFRQNEEgVGVsZXBvcnQg +Q0ExGTAXBgNVBAMMEFRQNEEgVGVsZXBvcnQgQ0GCAQAwDAYDVR0TAQH/BAIwADAO +BgNVHQ8BAf8EBAMCA4gwEwYDVR0lBAwwCgYIKwYBBQUHAwEwFAYDVR0RBA0wC4IJ +bG9jYWxob3N0MA0GCSqGSIb3DQEBCwUAA4IBAQAfj/CpFDhv5CrnN2kxhtRAmesJ +q6/KxxkBaimjbS/BpfvqfC9RxGH7MIqGUkbC4/ADkEt2OmVU4+f2R3+rCl+x+r1t +9+3r/JSYYVBxFnF1GbDhiY9sKahgb4HoFjE2Fj8eVODcEzdApLr198p5IIIyfBys +WHV4CYFMvq5qCKbSR/JMfrm9GArAh1J+B+JMIfm8xwerFi0tfK2YT+N4QkvbidjG +sd+RKlR51GHo9m4iEQ7mDd9H8joVrVs2MVLGf2EoVU5y/Ahee4g7k3SKrn3GI/Ec +6BRCht+INCLI3bnC3MtJHJRzv5Vmu4pSh3cwnVHfe+VWLGvGlp2+KeC02xZ2 +-----END CERTIFICATE----- diff --git a/client/cfg/tp-assist.macos.json b/client/cfg/tp-assist.macos.json new file mode 100644 index 0000000..ceafa76 --- /dev/null +++ b/client/cfg/tp-assist.macos.json @@ -0,0 +1,106 @@ +{ + "file_version": 3, + "ssh": { + "selected": "terminal", + "available": [ + { + "name":"terminal", + "display": "终端(系统自带)", + "app": "Terminal.app", + "cmdline": "Basic", + "desc": [] + }, + { + "name": "iterm2", + "display": "iTerm2", + "app": "iTerm2.app", + "cmdline": "Default", + "desc": [] + }, + { + "name": "securecrt", + "display": "SecureCRT", + "app": "SecureCRT.app", + "cmdline": "/T /N \"TP#ssh://{real_ip}\" /SSH2 /P {host_port} /PASSWORD **** {user_name}@{host_ip}", + "desc": [] + }, + { + "name": "other", + "display": "自定义", + "app": "", + "cmdline": "", + "desc": [] + } + ] + }, + + "sftp": { + "selected": "securefx", + "available": [ + { + "name": "securefx", + "display": "SecureFX", + "app": "SecureCRT.app", + "cmdline": "/T /N \"TP#ssh://{real_ip}\" /SSH2 /P {host_port} /PASSWORD **** {user_name}@{host_ip}", + "desc": [] + }, + { + "name": "other", + "display": "自定义", + "app": "", + "cmdline": "", + "desc": [] + } + ] + }, + + "telnet": { + "selected": "terminal", + "available": [ + { + "name":"terminal", + "display": "终端(系统自带)", + "app": "Terminal.app", + "cmdline": "Basic", + "desc": [] + }, + { + "name": "iterm2", + "display": "iTerm2", + "app": "iTerm2.app", + "cmdline": "Default", + "desc": [] + }, + { + "name": "securecrt", + "display": "SecureCRT", + "app": "SecureCRT.app", + "cmdline": "/T /N \"TP#ssh://{real_ip}\" /SSH2 /P {host_port} /PASSWORD **** {user_name}@{host_ip}", + "desc": [] + }, + { + "name": "other", + "display": "自定义", + "app": "", + "cmdline": "", + "desc": [] + } + ] + }, + + "rdp": { + "selected": "freerdp", + "available": [ + { + "name": "FreeRDP", + "display": "FreeRDP", + "app": "", + "cmdline": "", + "desc": [ + "建议使用homebrew安装freerdp,安装后freerdp默认路径在:/usr/local/Cellar/freerdp/x.y.z/bin/xfreerdp", + "首次安装freerdp后需要重新启动计算机" + ] + } + ] + } +} diff --git a/client/cfg/tp-assist.windows.json b/client/cfg/tp-assist.windows.json new file mode 100755 index 0000000..f4fc876 --- /dev/null +++ b/client/cfg/tp-assist.windows.json @@ -0,0 +1,82 @@ +{ + "ssh": { + "selected": "putty", + "available": [ + { + "name":"putty", + "display": "PuTTY(内置)", + "app": "{assist_tools_path}\\putty\\putty.exe", + "cmdline": "-ssh -pw **** -P {host_port} -l {user_name} {host_ip}" + }, + { + "name": "crt", + "display": "SecureCRT", + "app": "", + "cmdline": "/T /N \"TP#ssh://{real_ip}\" /SSH2 /P {host_port} /PASSWORD **** {user_name}@{host_ip}" + }, + { + "name": "xshell", + "display": "Xshell", + "app": "", + "cmdline": "-newtab \"TP#ssh://{real_ip}\" -url ssh://{user_name}:****@{host_ip}:{host_port}" + }, + { + "name": "other", + "display": "自定义", + "app": "", + "cmdline": "" + } + ] + }, + "scp": { + "selected": "winscp", + "available": [ + { + "name":"winscp", + "display": "WinSCP(内置)", + "app": "{assist_tools_path}\\winscp\\winscp.exe", + "cmdline": "/sessionname=\"TP#{real_ip}\" {user_name}:****@{host_ip}:{host_port}" + }, + { + "name": "other", + "display": "自定义", + "app": "", + "cmdline": "" + } + ] + }, + "telnet": { + "selected": "putty", + "available": [ + { + "name":"putty", + "display": "PuTTY(内置)", + "app": "{assist_tools_path}\\putty\\putty.exe", + "cmdline": "telnet://{user_name}@{host_ip}:{host_port}" + }, + { + "name": "crt", + "display": "SecureCRT", + "app": "", + "cmdline": "/T /N \"TP#telnet://{real_ip}\" /ARG {user_name} /SCRIPT \"{assist_tools_path}\\securecrt-telnet.vbs\" /TELNET {host_ip} {host_port}" + }, + { + "name": "other", + "display": "自定义", + "app": "", + "cmdline": "" + } + ] + }, + "rdp" : { + "available" : [ + { + "app" : "{assist_tools_path}\\tprdp\\tprdp-client.exe", + "cmdline" : "/v:{host_ip}:{host_port} /u:{user_name} /t:\"TP#{real_ip}\"", + "display" : "FreeRDP(内置)", + "name" : "freerdp" + } + ], + "selected" : "freerdp" + } +} diff --git a/client/tp_assist_macos/apple-scripts/compile.sh b/client/tp_assist_macos/apple-scripts/compile.sh index 97b2bc1..7503566 100755 --- a/client/tp_assist_macos/apple-scripts/compile.sh +++ b/client/tp_assist_macos/apple-scripts/compile.sh @@ -4,8 +4,8 @@ PATH_ROOT=$(cd "$(dirname "$0")/.."; pwd) echo "compiling applescripts for OS X terminal..." -rm ${PATH_ROOT}/src/apple-scpt/Terminal.scpt -rm ${PATH_ROOT}/src/apple-scpt/iTerm2.scpt +rm ${PATH_ROOT}/src/apple-scpt/terminal.scpt +rm ${PATH_ROOT}/src/apple-scpt/iterm2.scpt -osacompile -o ${PATH_ROOT}/src/apple-scpt/Terminal.scpt -x ${PATH_ROOT}/apple-scripts/scripts/Terminal.applescript -osacompile -o ${PATH_ROOT}/src/apple-scpt/iTerm2.scpt -x ${PATH_ROOT}/apple-scripts/scripts/iTerm2.applescript +osacompile -o ${PATH_ROOT}/src/apple-scpt/terminal.scpt -x ${PATH_ROOT}/apple-scripts/scripts/terminal.applescript +osacompile -o ${PATH_ROOT}/src/apple-scpt/iterm2.scpt -x ${PATH_ROOT}/apple-scripts/scripts/iterm2.applescript diff --git a/client/tp_assist_macos/apple-scripts/scripts/Terminal.applescript b/client/tp_assist_macos/apple-scripts/scripts/Terminal.applescript deleted file mode 100644 index 3b78a92..0000000 --- a/client/tp_assist_macos/apple-scripts/scripts/Terminal.applescript +++ /dev/null @@ -1,44 +0,0 @@ -on scriptRun(argsCmd, argsProfile, argsTitle) - set theCmd to (argsCmd) - set theProfile to (argsProfile) - set theTitle to (argsTitle) - CommandRun(theCmd, theProfile, theTitle) -end scriptRun - -on CommandRun(theCmd, theProfile, theTitle) - tell application "Terminal" - if it is not running then - --if this is the first time Terminal is running you have specify window 1 - --if you dont do this you will get two windows and the title wont be set - activate - set newTerm to do script theCmd in window 1 - set newTerm's current settings to settings set theProfile - set custom title of front window to theTitle - else - --Terminal is running get the window count - set windowCount to (count every window) - if windowCount = 0 then - --Terminal is running but no windows are open - --run our script in a new window - reopen - activate - do script theCmd in window 1 - else - --Terminal is running and we have a window run in a new tab - reopen - activate - tell application "System Events" - tell process "Terminal" - delay 0.2 - keystroke "t" using {command down} - end tell - end tell - activate - do script theCmd in front window - end if - set current settings of selected tab of front window to settings set theProfile - set title displays custom title of front window to true - set custom title of selected tab of front window to theTitle - end if - end tell -end CommandRun diff --git a/client/tp_assist_macos/apple-scripts/scripts/iTerm2.applescript b/client/tp_assist_macos/apple-scripts/scripts/iterm2.applescript similarity index 100% rename from client/tp_assist_macos/apple-scripts/scripts/iTerm2.applescript rename to client/tp_assist_macos/apple-scripts/scripts/iterm2.applescript diff --git a/client/tp_assist_macos/apple-scripts/scripts/terminal.applescript b/client/tp_assist_macos/apple-scripts/scripts/terminal.applescript new file mode 100644 index 0000000..3357a40 --- /dev/null +++ b/client/tp_assist_macos/apple-scripts/scripts/terminal.applescript @@ -0,0 +1,77 @@ +on scriptRun(argsCmd, argsProfile, argsTitle) + set theCmd to (argsCmd) + set theProfile to (argsProfile) + set theTitle to (argsTitle) + set useless to "useless" + CommandRun(theCmd, theProfile, theTitle) +end scriptRun + +on CommandRun(theCmd, theProfile, theTitle) + tell application "Terminal" + if it is not running then + --if this is the first time Terminal is running you have specify window 1 + --if you dont do this you will get two windows and the title wont be set + activate + delay 1.0 + set newTerm to do script theCmd in window 1 + set newTerm's current settings to settings set theProfile + set custom title of front window to theTitle + + delay 1.0 + reopen + activate + tell application "System Events" to key code 36 + else + --Terminal is running get the window count + set windowCount to (count every window) + if windowCount = 0 then + --Terminal is running but no windows are open + --run our script in a new window + reopen + activate + + do script theCmd in window 1 + + set current settings of selected tab of front window to settings set theProfile + set title displays custom title of front window to true + set custom title of selected tab of front window to theTitle + + delay 1.0 + reopen + activate + tell application "System Events" to key code 36 + + else + --Terminal is running and we have a window run in a new tab + reopen + activate + + tell application "System Events" + tell process "Terminal" + delay 0.5 + keystroke "t" using {command down} + end tell + end tell + + reopen + activate + do script theCmd in front window + + set current settings of selected tab of front window to settings set theProfile + set title displays custom title of front window to true + set custom title of selected tab of front window to theTitle + + delay 1.0 + reopen + activate + tell application "System Events" to key code 36 + + end if + +# set current settings of selected tab of front window to settings set theProfile +# set title displays custom title of front window to true +# set custom title of selected tab of front window to theTitle + end if + + end tell +end CommandRun diff --git a/client/tp_assist_macos/site/css/style.css b/client/tp_assist_macos/site/css/style.css index 82956e3..36da044 100644 --- a/client/tp_assist_macos/site/css/style.css +++ b/client/tp_assist_macos/site/css/style.css @@ -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,.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 */ \ No newline at end of file +@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;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;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{padding-left:3px;padding-right:3px}.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:164px}#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 */ \ No newline at end of file diff --git a/client/tp_assist_macos/site/css/style.css.map b/client/tp_assist_macos/site/css/style.css.map deleted file mode 100644 index f0bfed4..0000000 --- a/client/tp_assist_macos/site/css/style.css.map +++ /dev/null @@ -1 +0,0 @@ -{"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"} \ No newline at end of file diff --git a/client/tp_assist_macos/site/index.html b/client/tp_assist_macos/site/index.html index 13850f3..e942ef6 100644 --- a/client/tp_assist_macos/site/index.html +++ b/client/tp_assist_macos/site/index.html @@ -1,220 +1,225 @@ - - - - - - - TELEPORT助手配置 - - - - - - - - - - - - -
-
- Teleport助手本地配置 - - 此处配置保存到本地计算机上,如果更换计算机,需要重新配置! -
-
- - - - -
- -
-
-

此处配置保存到本地计算机上,如果更换计算机,需要重新配置!

- 注意:命令行参数设置中,可以用以下变量替换(注意大小写!): -
    -
  • {host_ip} 替换主机IP地址
  • -
  • {host_port} 替换主机端口号
  • -
  • {user_name} 替换用户名
  • -
  • {real_ip} 替换为远程主机真实IP(仅用于显示,例如客户端的窗口标题或标签页标题等)
  • -
-
- -
-

本地 SSH 客户端配置

- -
-
- -
- -
-
- -
- -
-
- - -
-
-
- -
- -
- -
-
- -
- -
-

本地 SFTP 客户端配置

- - -
-
- -
- -
-
- -
- -
-
- - -
-
-
- -
- -
- -
-
- -
- -
-

本地 TELNET 客户端配置

- -
-
- -
- -
-
- -
- -
-
- - -
-
-
- -
- -
- -
-
- -
- -
-

本地RDP配置

- -
-
- -
- -
-
- -
- -
-
- - -
-
-
- -
- -
- -
-
- -
- -
-

本地RDP配置

- -
-
- -
- -
-
-
- -
- - 建议使用homebrew安装freerdp,安装后freerdp默认路径在:/usr/local/Cellar/freerdp/x.y.z/bin/xfreerdp - 首次安装freerdp后需要重新启动计算机 -
-
-
- - -
-
-
-
- -
-
- - -
- -
- - - - - - - - - - - - - - + + + + + + + + + + + TELEPORT助手配置 + + + + + + + + + + + + +
+
+ Teleport 助手本地配置 + +
+
+
+ + + + +
+ +
+ +
+

此处配置保存到本地计算机上,如果更换计算机,需要重新配置!

+ 注意:命令行参数设置中,可以用以下变量替换(注意大小写!): +
    +
  • {host_ip} 替换主机IP地址
  • +
  • {host_port} 替换主机端口号
  • +
  • {user_name} 替换用户名
  • +
  • {real_ip} 替换为远程主机真实IP(仅用于显示,例如客户端的窗口标题或标签页标题等)
  • +
  • {assist_tools_path} 替换为助手工具所在的tools目录的绝对路径
  • +
+
+ + +
+

本地 SSH 客户端配置

+ +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+ + +
+

本地 SFTP 客户端配置

+ +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+ +
+ + +
+

本地 TELNET 客户端配置

+ +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+ +
+ + +
+

本地 RDP 客户端配置

+ + + + + + + + + + + + + +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+ + +
+
+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/tp_assist_macos/site/js/config.js b/client/tp_assist_macos/site/js/config.js index 66900e9..4722b3f 100644 --- a/client/tp_assist_macos/site/js/config.js +++ b/client/tp_assist_macos/site/js/config.js @@ -5,16 +5,53 @@ var g_url_base = 'http://127.0.0.1:50022'; var g_cfg = null; var dom = { - term_type: $('#term-type'), - term_profile: $('#term-profile'), + version: $('#version'), + + ssh_type: $('#ssh-type'), + ssh_app: $('#ssh-app'), + ssh_cmdline: $('#ssh-cmdline'), + ssh_select_app: $('#ssh-select-app'), + + sftp_type: $('#sftp-type'), + sftp_app: $('#sftp-app'), + sftp_cmdline: $('#sftp-cmdline'), + sftp_select_app: $('#sftp-select-app'), + + telnet_type: $('#telnet-type'), + telnet_app: $('#telnet-app'), + telnet_cmdline: $('#telnet-cmdline'), + telnet_select_app: $('#telnet-select-app'), + rdp_type: $('#rdp-type'), rdp_app: $('#rdp-app'), + rdp_cmdline: $('#rdp-cmdline'), + rdp_select_app: $('#rdp-select-app'), btn_save: $('#btn-save') }; +function get_version() { + $.ajax({ + type: 'GET', + timeout: 5000, + url: g_url_base + '/api/get_version', + jsonp: 'callback', + dataType: 'json', + success: function (ret) { + if (ret.code == 0) { + dom.version.text('v' + ret.version); + } else { + alert("获取助手版本信息失败!"); + } + }, + error: function (jqXhr, _error, _e) { + console.log('state:', jqXhr.state()); + alert("获取助手版本信息失败!"); + } + }); +} -var get_config = function () { +function get_config() { $.ajax({ type: 'GET', timeout: 5000, @@ -24,51 +61,122 @@ var get_config = function () { success: function (ret) { if (ret.code == 0) { g_cfg = ret.data; + console.log(g_cfg); update_dom(); } else { - notify_error("获取配置信息失败!"); + alert("获取配置信息失败!"); } }, error: function (jqXhr, _error, _e) { console.log('state:', jqXhr.state()); - notify_error("获取配置信息失败!"); + alert("获取配置信息失败!"); } }); } function update_dom() { - console.log('---', g_cfg); + if (_.isNull(g_cfg)) + return; - dom.term_type.html(''); - - if (!_.isUndefined(g_cfg.term)) { - if (_.isUndefined(g_cfg.term.selected)) { - g_cfg.term.selected = ''; + dom.ssh_type.html(''); + if (!_.isUndefined(g_cfg.ssh)) { + if (_.isUndefined(g_cfg.ssh.selected)) { + g_cfg.ssh.selected = ''; } - if (!_.isUndefined(g_cfg.term.available) && g_cfg.term.available.length > 0) { + if (!_.isUndefined(g_cfg.ssh.available) && g_cfg.ssh.available.length > 0) { var selected = ''; - var profile = ''; + var app = ''; + var cmdline = ''; var html = []; - for (var i = 0; i < g_cfg.term.available.length; i++) { - var item = g_cfg.term.available[i]; + for (var i = 0; i < g_cfg.ssh.available.length; i++) { + var item = g_cfg.ssh.available[i]; - if (selected === '' || item.name === g_cfg.term.selected) { + if (selected === '' || item.name === g_cfg.ssh.selected) { selected = item.name; - profile = item.profile; + app = item.app; + cmdline = item.cmdline; } - html.push(''); + html.push(''); } - dom.term_type.html(html.join('')); + dom.ssh_type.html(html.join('')); - dom.term_type.val(selected); - dom.term_profile.val(profile); + dom.ssh_type.val(selected); + dom.ssh_app.val(app); + dom.ssh_cmdline.val(cmdline); } } + dom.sftp_type.html(''); + if (!_.isUndefined(g_cfg.sftp)) { + if (_.isUndefined(g_cfg.sftp.selected)) { + g_cfg.sftp.selected = ''; + } + + if (!_.isUndefined(g_cfg.sftp.available) && g_cfg.sftp.available.length > 0) { + var selected = ''; + var app = ''; + var cmdline = ''; + + var html = []; + for (var i = 0; i < g_cfg.sftp.available.length; i++) { + var item = g_cfg.sftp.available[i]; + + if (selected === '' || item.name === g_cfg.sftp.selected) { + selected = item.name; + app = item.app; + cmdline = item.cmdline; + } + + html.push(''); + } + + dom.sftp_type.html(html.join('')); + + dom.sftp_type.val(selected); + dom.sftp_app.val(app); + dom.sftp_cmdline.val(cmdline); + } + } + + + dom.telnet_type.html(''); + if (!_.isUndefined(g_cfg.telnet)) { + if (_.isUndefined(g_cfg.telnet.selected)) { + g_cfg.telnet.selected = ''; + } + + if (!_.isUndefined(g_cfg.telnet.available) && g_cfg.telnet.available.length > 0) { + var selected = ''; + var app = ''; + var cmdline = ''; + + var html = []; + for (var i = 0; i < g_cfg.telnet.available.length; i++) { + var item = g_cfg.telnet.available[i]; + + if (selected === '' || item.name === g_cfg.telnet.selected) { + selected = item.name; + app = item.app; + cmdline = item.cmdline; + } + + html.push(''); + } + + dom.telnet_type.html(html.join('')); + + dom.telnet_type.val(selected); + dom.telnet_app.val(app); + dom.telnet_cmdline.val(cmdline); + } + } + + + dom.rdp_type.html(''); if (!_.isUndefined(g_cfg.rdp)) { if (_.isUndefined(g_cfg.rdp.selected)) { g_cfg.rdp.selected = ''; @@ -77,6 +185,7 @@ function update_dom() { if (!_.isUndefined(g_cfg.rdp.available) && g_cfg.rdp.available.length > 0) { var selected = ''; var app = ''; + var cmdline = ''; var html = []; for (var i = 0; i < g_cfg.rdp.available.length; i++) { @@ -85,60 +194,55 @@ function update_dom() { if (selected === '' || item.name === g_cfg.rdp.selected) { selected = item.name; app = item.app; + cmdline = item.cmdline; } - html.push(''); + html.push(''); } dom.rdp_type.html(html.join('')); dom.rdp_type.val(selected); dom.rdp_app.val(app); + dom.rdp_cmdline.val(cmdline); } } } -function on_term_change() { - g_cfg.term.selected = dom.term_type.val(); - - for (var i = 0; i < g_cfg.term.available.length; i++) { - var item = g_cfg.term.available[i]; - if (item.name === g_cfg.term.selected) { - dom.term_profile.val(item.profile); - 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; - for (var i = 0; i < g_cfg.term.available.length; i++) { - var item = g_cfg.term.available[i]; - if (item.name === g_cfg.term.selected) { - item.profile = dom.term_profile.val(); + var i = 0; + for (i = 0; i < g_cfg.ssh.available.length; i++) { + var item = g_cfg.ssh.available[i]; + if (item.name === g_cfg.ssh.selected) { + item.app = dom.ssh_app.val(); + item.cmdline = dom.ssh_cmdline.val(); break; } } - for (var i = 0; i < g_cfg.rdp.available.length; i++) { + for (i = 0; i < g_cfg.sftp.available.length; i++) { + var item = g_cfg.sftp.available[i]; + if (item.name === g_cfg.sftp.selected) { + item.app = dom.sftp_app.val(); + item.cmdline = dom.sftp_cmdline.val(); + break; + } + } + for (i = 0; i < g_cfg.telnet.available.length; i++) { + var item = g_cfg.telnet.available[i]; + if (item.name === g_cfg.telnet.selected) { + item.app = dom.telnet_app.val(); + item.cmdline = dom.telnet_cmdline.val(); + break; + } + } + for (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(); + item.cmdline = dom.rdp_cmdline.val(); break; } } @@ -165,6 +269,30 @@ function on_save() { }); } +var select_local_file = function (callback) { + var data = { + action: 1 + }; + var args_ = encodeURIComponent(JSON.stringify(data)); + + $.ajax({ + type: 'GET', + timeout: -1, + url: g_url_base + '/api/file_action/' + args_, + jsonp: 'callback', + dataType: 'json', + success: function (ret) { + if(ret.code === 0) + callback(0, ret.path); + }, + error: function (jqXhr, _error, _e) { + console.log('state:', jqXhr.state()); + callback(-1, ""); + } + }); +} + + function notify_error(message_, title_) { var _title = title_ || ''; $.gritter.add({ @@ -188,18 +316,104 @@ function notify_success(message_, title_) { }); }; - $(document).ready(function () { + get_version(); + get_config(); - dom.term_type.change(function () { - on_term_change(); + dom.ssh_type.change(function () { + g_cfg.ssh.selected = dom.ssh_type.val(); + for (var i = 0; i < g_cfg.ssh.available.length; i++) { + var item = g_cfg.ssh.available[i]; + if (item.name === g_cfg.ssh.selected) { + dom.ssh_app.val(item.app); + dom.ssh_cmdline.val(item.cmdline); + return; + } + } + notify_error('所选的配置项不存在!'); }); + dom.ssh_select_app.click(function () { + select_local_file(function (code, path) { + if (code == 0) { + dom.ssh_app.val(path); + } else { + console.log("can not select file."); + } + }); + }); + + + dom.sftp_type.change(function () { + g_cfg.sftp.selected = dom.sftp_type.val(); + for (var i = 0; i < g_cfg.sftp.available.length; i++) { + var item = g_cfg.sftp.available[i]; + if (item.name === g_cfg.sftp.selected) { + dom.sftp_app.val(item.app); + dom.sftp_cmdline.val(item.cmdline); + return; + } + } + notify_error('所选的配置项不存在!'); + }); + dom.sftp_select_app.click(function () { + select_local_file(function (code, path) { + if (code == 0) { + dom.sftp_app.val(path); + } else { + console.log("can not select file."); + } + }); + }); + + + dom.telnet_type.change(function () { + g_cfg.telnet.selected = dom.telnet_type.val(); + for (var i = 0; i < g_cfg.telnet.available.length; i++) { + var item = g_cfg.telnet.available[i]; + if (item.name === g_cfg.telnet.selected) { + dom.telnet_app.val(item.app); + dom.telnet_cmdline.val(item.cmdline); + return; + } + } + notify_error('所选的配置项不存在!'); + }); + dom.telnet_select_app.click(function () { + select_local_file(function (code, path) { + if (code == 0) { + dom.telnet_app.val(path); + } else { + console.log("can not select file."); + } + }); + }); + + dom.rdp_type.change(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); + dom.rdp_cmdline.val(item.cmdline); + return; + } + } + notify_error('所选的配置项不存在!'); }); + dom.rdp_select_app.click(function () { + select_local_file(function (code, path) { + if (code == 0) { + dom.rdp_app.val(path); + } else { + console.log("can not select file."); + } + }); + }); + dom.btn_save.click(function () { on_save(); }); -}); +}); \ No newline at end of file diff --git a/client/tp_assist_macos/site/less/style.less b/client/tp_assist_macos/site/less/style.less index 964264a..6560fe8 100644 --- a/client/tp_assist_macos/site/less/style.less +++ b/client/tp_assist_macos/site/less/style.less @@ -30,7 +30,7 @@ html, body { //text-align: center; line-height: @header-height; //border-bottom: 1px solid darken(@toolbar-bg, 20%); - font-size: 80%; + //font-size: 80%; background-color: #3b3b3b; color: #fff; @@ -58,7 +58,7 @@ html, body { line-height: @footer-height; background-color: @toolbar-bg; border-top: 1px solid darken(@toolbar-bg, 20%); - font-size: 80%; + //font-size: 80%; z-index: 999; } @@ -74,24 +74,18 @@ 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-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + .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 { padding-left: 3px; padding-right: 3px; } .arg-detail { - font-size: 11px; + //font-size: 13px; ol, ul { margin-bottom: 0; } } - .desc { - display:inline-block; - margin-top:5px; - color:rgb(107, 107, 107); - } - .arg-detail-common { //border:1px solid #f33; background-color: #dbffbe; @@ -111,7 +105,7 @@ html, body { font-weight: bold; font-family: @font-family-mono; display: inline-block; - width: 128px; + width: 164px; //margin-right:20px; } diff --git a/client/tp_assist_macos/src/AboutWindowController.m b/client/tp_assist_macos/src/AboutWindowController.m index d7d2d98..32d17b6 100644 --- a/client/tp_assist_macos/src/AboutWindowController.m +++ b/client/tp_assist_macos/src/AboutWindowController.m @@ -38,28 +38,29 @@ NSDictionary *plistDict; plistDict = [[NSBundle mainBundle] infoDictionary]; //Get the application name. - id applicationName = [plistDict objectForKey:@"CFBundleName"]; +// id applicationName = [plistDict objectForKey:@"CFBundleName"]; //Get the build version. id applicationVersion = [plistDict objectForKey:@"CFBundleVersion"]; //Get the copyright. - id applicationCopyright = [plistDict objectForKey:@"NSHumanReadableCopyright"]; +// id applicationCopyright = [plistDict objectForKey:@"NSHumanReadableCopyright"]; //Build the string for the windows title. - NSString *aboutTitle = [NSString stringWithFormat:@"%@%@", NSLocalizedString(@"About ",nil), applicationName]; - [aboutWindow.window setTitle:aboutTitle]; + // NSString *aboutTitle = [NSString stringWithFormat:@"%@%@", NSLocalizedString(@"About ",nil), applicationName]; + NSString *strTitle = [NSString stringWithFormat:@"%@%@", + NSLocalizedString(@"about ",nil), + NSLocalizedString(@"app_name",nil)]; + [aboutWindow.window setTitle:strTitle]; //Build the string for the application name. appName - tagline - NSString *progName = [NSString stringWithFormat:@"%@", NSLocalizedString(@"Teleport Assist",nil)]; - [appName setStringValue:progName]; + NSString *strProgName = [NSString stringWithFormat:@"%@", NSLocalizedString(@"app_full_name", nil)]; + [appName setStringValue:strProgName]; //Build the string for the version. Version: $build - NSString *progVersion = [NSString stringWithFormat:@"%@", applicationVersion]; - [appVersion setStringValue:progVersion]; - - //Make the copyright font smaller. -// [appCopyright setFont:[NSFont systemFontOfSize:10]]; - [appCopyright setStringValue:applicationCopyright]; - + NSString *strVersion = [NSString stringWithFormat:@"%@%@", NSLocalizedString(@"version", nil), applicationVersion]; + [appVersion setStringValue:strVersion]; + + NSString *strCopyright = [NSString stringWithFormat:@"%@", NSLocalizedString(@"copyright", nil)]; + [appCopyright setStringValue:strCopyright]; } - (IBAction)btnHomepage:(id)sender { diff --git a/client/tp_assist_macos/src/AppDelegate.mm b/client/tp_assist_macos/src/AppDelegate.mm index 1791214..c9ed446 100644 --- a/client/tp_assist_macos/src/AppDelegate.mm +++ b/client/tp_assist_macos/src/AppDelegate.mm @@ -44,7 +44,7 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char* // if the config file does not exist, create a default one if ( ![[NSFileManager defaultManager] fileExistsAtPath:cfgFile] ) { - NSString *cfgFileInResource = [[NSBundle mainBundle] pathForResource:@"tp-assist.default" ofType:@"json"]; + NSString *cfgFileInResource = [[NSBundle mainBundle] pathForResource:@"tp-assist.macos" ofType:@"json"]; [[NSFileManager defaultManager] copyItemAtPath:cfgFileInResource toPath:cfgFile error:nil]; } @@ -67,9 +67,6 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char* // Needed to trigger the menuWillOpen event [menu setDelegate:self]; - - - //http_rpc_start((__bridge void*)self); NSString *resPath = [[NSBundle mainBundle] resourcePath]; std::string cpp_res_path = [resPath cStringUsingEncoding:NSUTF8StringEncoding]; @@ -87,11 +84,20 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char* else msg = @"发生未知错误!"; - NSAlert *alert = [NSAlert alertWithMessageText:@"无法启动Teleport助手" - defaultButton:@"确定" - alternateButton:Nil - otherButton:Nil - informativeTextWithFormat:msg]; + NSAlert *alert = [[NSAlert alloc] init]; + alert.icon = [NSImage imageNamed:@"tpassist"]; + + [alert addButtonWithTitle:@"确定"]; + [alert setMessageText:@"无法启动Teleport助手"]; + [alert setInformativeText:msg]; + + [alert runModal]; + +// NSAlert *alert = [NSAlert alertWithMessageText:@"无法启动Teleport助手" +// defaultButton:@"确定" +// alternateButton:Nil +// otherButton:Nil +// informativeTextWithFormat:@"%@", msg]; [alert runModal]; http_rpc_stop(); @@ -134,7 +140,8 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char* //Create the container event - //We need these constants from the Carbon OpenScripting framework, but we don't actually need Carbon.framework... + // We need these constants from the Carbon OpenScripting framework, + // but we don't actually need Carbon.framework... #define kASAppleScriptSuite 'ascr' #define kASSubroutineEvent 'psbr' #define keyASSubroutineName 'snam' diff --git a/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib b/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib index c2bd698..f9946ed 100644 --- a/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib +++ b/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib @@ -1,8 +1,8 @@ - + - + @@ -16,11 +16,11 @@ - + - + @@ -53,7 +53,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/client/tp_assist_macos/src/Base.lproj/Localizable.strings b/client/tp_assist_macos/src/Base.lproj/Localizable.strings index fc24123..e10f545 100644 --- a/client/tp_assist_macos/src/Base.lproj/Localizable.strings +++ b/client/tp_assist_macos/src/Base.lproj/Localizable.strings @@ -2,3 +2,13 @@ Localizable.strings TPAssist */ + +"app_name" = "Teleport助手"; + +//============================================= +// for About Window +//============================================= +"version" = "Version: "; +"app_full_name" = "Teleport Assist for macOS"; +"copyright" = "Copyright © 2017~2018 TP4A. All rights reserved."; +"visit_tp4a_website" = "Visit Teleport Website" diff --git a/client/tp_assist_macos/src/Base.lproj/MainMenu.xib b/client/tp_assist_macos/src/Base.lproj/MainMenu.xib index a93d3c7..d0fe852 100644 --- a/client/tp_assist_macos/src/Base.lproj/MainMenu.xib +++ b/client/tp_assist_macos/src/Base.lproj/MainMenu.xib @@ -1,8 +1,9 @@ - + - + + diff --git a/client/tp_assist_macos/src/apple-scpt/Terminal.scpt b/client/tp_assist_macos/src/apple-scpt/Terminal.scpt deleted file mode 100644 index 12b084c..0000000 Binary files a/client/tp_assist_macos/src/apple-scpt/Terminal.scpt and /dev/null differ diff --git a/client/tp_assist_macos/src/apple-scpt/iTerm2.scpt b/client/tp_assist_macos/src/apple-scpt/iterm2.scpt similarity index 80% rename from client/tp_assist_macos/src/apple-scpt/iTerm2.scpt rename to client/tp_assist_macos/src/apple-scpt/iterm2.scpt index 2ff77de..85f01b9 100644 Binary files a/client/tp_assist_macos/src/apple-scpt/iTerm2.scpt and b/client/tp_assist_macos/src/apple-scpt/iterm2.scpt differ diff --git a/client/tp_assist_macos/src/apple-scpt/terminal.scpt b/client/tp_assist_macos/src/apple-scpt/terminal.scpt new file mode 100644 index 0000000..bd6e757 Binary files /dev/null and b/client/tp_assist_macos/src/apple-scpt/terminal.scpt differ diff --git a/client/tp_assist_macos/src/csrc/ts_cfg.cpp b/client/tp_assist_macos/src/csrc/ts_cfg.cpp index afa1f03..341036d 100644 --- a/client/tp_assist_macos/src/csrc/ts_cfg.cpp +++ b/client/tp_assist_macos/src/csrc/ts_cfg.cpp @@ -19,6 +19,20 @@ bool TsCfg::init(void) { if(!_load(file_content)) return false; + if(!m_root.isObject()) { + EXLOGE("invalid config file, not in json format?\n"); + return false; + } + + if(m_root["file_version"].isNull()) { + EXLOGE("invalid config file, maybe need create new one?\n"); + return false; + } + + if(!m_root["file_version"].isInt()) { + + } + return true; } @@ -38,6 +52,78 @@ bool TsCfg::save(const ex_astr& new_value) return true; } +bool TsCfg::_parse_app(const Json::Value& m_root, const ex_astr& str_app, APP_CONFIG& cfg) { + const Json::Value& jApp = m_root[str_app.c_str()]; + if(!jApp.isObject()) + return false; + + if (!jApp["selected"].isString()) { + EXLOGE("invalid config, error 2.\n"); + return false; + } + ex_astr _selected = jApp["selected"].asCString();; + + if (!jApp["available"].isArray() || jApp["available"].size() == 0) { + EXLOGE("invalid config, error 3.\n"); + return false; + } + const Json::Value& jAppList = jApp["available"]; + + int i = 0; + for (i = 0; i < jAppList.size(); ++i) { + if ( + !jAppList[i]["name"].isString() + || !jAppList[i]["app"].isString() + || !jAppList[i]["cmdline"].isString() + || !jAppList[i]["desc"].isArray() + ) { + EXLOGE("invalid config, error 4.\n"); + return false; + } + + if(jAppList[i]["name"].asString().empty()) { + EXLOGE("invalid config, need name.\n"); + return false; + } + + if (jAppList[i]["display"].isNull() || jAppList[i]["display"].asString().empty()) { + cfg.display = jAppList[i]["name"].asCString(); + } else + cfg.display = jAppList[i]["display"].asCString(); + + if (jAppList[i]["name"].asCString() != _selected) + continue; + + cfg.name = jAppList[i]["name"].asCString(); + cfg.display = jAppList[i]["display"].asCString(); + cfg.application = jAppList[i]["app"].asCString(); + cfg.cmdline = jAppList[i]["cmdline"].asCString(); + + if(jAppList[i]["desc"].size() > 0) { +// cfg.description = jApp["available"][i]["app"].asCString(); + + const Json::Value& jAppDescList = jAppList[i]["desc"]; + + int j = 0; + for(j = 0; j < jAppDescList.size(); ++j) { + if(!jAppDescList[i].isString()) + return false; + cfg.description.push_back(jAppDescList[i].asCString()); + } + } + + break; + } + + if (cfg.application.empty() || cfg.cmdline.empty()) { + EXLOGE("invalid config, error 6.\n"); + return false; + } + + return true; +} + + bool TsCfg::_load(const ex_astr& str_json) { Json::Reader jreader; @@ -46,14 +132,13 @@ bool TsCfg::_load(const ex_astr& str_json) { return false; } - ex_astr sel_name; - int i = 0; - ex_astr tmp; - //=================================== // check ssh config //=================================== - + if(!_parse_app(m_root, "ssh", ssh)) + return false; + +#if 0 if (!m_root["ssh"].isObject()) { EXLOGE("invalid config, error 1.\n"); return false; @@ -265,6 +350,7 @@ bool TsCfg::_load(const ex_astr& str_json) { EXLOGE("invalid config, error 6.\n"); return false; } +#endif #if 0 // ------------ term --------------------- diff --git a/client/tp_assist_macos/src/csrc/ts_cfg.h b/client/tp_assist_macos/src/csrc/ts_cfg.h index 1e7b6ec..741b5d9 100644 --- a/client/tp_assist_macos/src/csrc/ts_cfg.h +++ b/client/tp_assist_macos/src/csrc/ts_cfg.h @@ -6,6 +6,14 @@ #include +typedef struct APP_CONFIG { + ex_astr name; + ex_astr display; + ex_astr application; + ex_astr cmdline; + ex_astrs description; +}APP_CONFIG; + class TsCfg { public: @@ -17,29 +25,14 @@ public: Json::Value& get_root() {return m_root;} -// ex_astr term_name; -// ex_astr term_display; -// ex_astr term_app; -// ex_astr term_profile; - - ex_astr ssh_app; - ex_astr ssh_cmdline; - ex_astr scp_app; - ex_astr scp_cmdline; - ex_astr telnet_app; - ex_astr telnet_cmdline; - ex_astr rdp_name; - ex_astr rdp_app; - ex_astr rdp_cmdline; + APP_CONFIG ssh; + APP_CONFIG sftp; + APP_CONFIG telnet; + APP_CONFIG rdp; - -// ex_astr rdp_name; -// ex_astr rdp_display; -// ex_astr rdp_app; - //ex_astr rdp_cmdline; - protected: bool _load(const ex_astr& str_json); + bool _parse_app(const Json::Value& m_root, const ex_astr& str_app, APP_CONFIG& cfg); protected: Json::Value m_root; diff --git a/client/tp_assist_macos/src/csrc/ts_env.cpp b/client/tp_assist_macos/src/csrc/ts_env.cpp index fb7fc8d..fc196d9 100644 --- a/client/tp_assist_macos/src/csrc/ts_env.cpp +++ b/client/tp_assist_macos/src/csrc/ts_env.cpp @@ -1,4 +1,3 @@ -//#include "stdafx.h" #include "ts_env.h" #include @@ -24,12 +23,12 @@ bool TsEnv::init(const char* cfg_file, const char* res_path) ex_astr2wstr(cfg_file, m_cfg_file); ex_astr2wstr(res_path, m_res_path); -//#ifdef EX_DEBUG -// m_site_path = L"/Users/apex/work/tp4a/teleport/client/tp_assist_macos/site"; -//#else +#ifdef EX_DEBUG + m_site_path = L"/Users/apex/work/tp4a/teleport/client/tp_assist_macos/site"; +#else m_site_path = m_res_path; ex_path_join(m_site_path, false, L"site", NULL); -//#endif +#endif return true; } diff --git a/client/tp_assist_macos/src/csrc/ts_http_rpc.cpp b/client/tp_assist_macos/src/csrc/ts_http_rpc.cpp index d697b93..dc76798 100644 --- a/client/tp_assist_macos/src/csrc/ts_http_rpc.cpp +++ b/client/tp_assist_macos/src/csrc/ts_http_rpc.cpp @@ -1,9 +1,3 @@ -//#include "stdafx.h" - -//#pragma warning(disable:4091) - -//#include -//#include #include #include @@ -15,7 +9,6 @@ #include "../AppDelegate-C-Interface.h" #include "ts_http_rpc.h" -//#include "dlg_main.h" #include "ts_ver.h" #include "ts_env.h" #include "ts_cfg.h" @@ -140,7 +133,7 @@ bool TsHttpRpc::init(const char* ip, int port) void TsHttpRpc::_thread_loop(void) { - while (!m_stop_flag) + while (!m_need_stop) { mg_mgr_poll(&m_mg_mgr, 500); } @@ -148,10 +141,10 @@ void TsHttpRpc::_thread_loop(void) EXLOGV("[core] rpc main loop end.\n"); } -void TsHttpRpc::_set_stop_flag(void) -{ - m_stop_flag = true; -} +//void TsHttpRpc::_set_stop_flag(void) +//{ +// m_stop_flag = true; +//} void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_data) { @@ -478,7 +471,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf) // RDP //============================================== - if(g_cfg.rdp_app.length() == 0) { + if(g_cfg.rdp.application.length() == 0) { _create_json_ret(buf, TPE_NOT_EXISTS); return; } @@ -546,7 +539,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf) //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 = g_cfg.rdp_app; + s_exec = g_cfg.rdp.application; s_argv.push_back(s_exec.c_str()); { @@ -594,18 +587,21 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf) if (pro_sub == TP_PROTOCOL_TYPE_SSH_SHELL) { - char szCmd[1024] = {0}; - ex_strformat(szCmd, 1023, "ssh %s@%s -p %d", sid.c_str(), teleport_ip.c_str(), teleport_port); - - char szTitle[128] = {0}; - ex_strformat(szTitle, 127, "TP#%s", real_host_ip.c_str()); - - int ret = AppDelegate_start_ssh_client(g_app, szCmd, g_cfg.term_name.c_str(), g_cfg.term_profile.c_str(), szTitle); - if(ret == 0) - _create_json_ret(buf, TPE_OK); - else - _create_json_ret(buf, TPE_FAILED); - return; + if(g_cfg.ssh.name == "terminal" || g_cfg.ssh.name == "iterm2") { + char szCmd[1024] = {0}; + ex_strformat(szCmd, 1023, "ssh %s@%s -p %d", sid.c_str(), teleport_ip.c_str(), teleport_port); + + char szTitle[128] = {0}; + ex_strformat(szTitle, 127, "TP#%s", real_host_ip.c_str()); + + int ret = AppDelegate_start_ssh_client(g_app, szCmd, g_cfg.ssh.name.c_str(), g_cfg.ssh.cmdline.c_str(), szTitle); + if(ret == 0) + _create_json_ret(buf, TPE_OK); + else + _create_json_ret(buf, TPE_FAILED); + return; + } + } else { diff --git a/client/tp_assist_macos/src/csrc/ts_http_rpc.h b/client/tp_assist_macos/src/csrc/ts_http_rpc.h index 9f5786b..ff31ec3 100644 --- a/client/tp_assist_macos/src/csrc/ts_http_rpc.h +++ b/client/tp_assist_macos/src/csrc/ts_http_rpc.h @@ -14,29 +14,38 @@ /* //================================================================= -ӿʹ˵ -󣬼 127.0.0.1:50022httpʽҪ£ + # HTTP-RPC-INTERFACE: + + listen on http://localhost:50022 and https://localhost:50023. + + ---------------- + GET method: + http://127.0.0.1:50022/method/json_param + + here `json_param` is string in json format and encoded by url_encode(). -GET ʽ -http://127.0.0.1:50022/method/json_param -json_paramʹurl_encodeбjsonʽַ + ---------------- + POST method + http://127.0.0.1:50022/method -POST ʽ -http://127.0.0.1:50022/method -postjson_param + here the data field of POST should be json_param. + + + ## URI detail: + + - method the method to request to execute. + - json_param param of the method and it is optional. -УURIΪ֣ -method ִе񷽷 -json_param 񷽷ĸӲûиӲⲿֿʡԡ + ## RESULT -ظʽִн󣬷һjsonʽַߣʽ£ - -{"code":0,"data":varb} - -УcodeDZеģֵһ룬0ʾɹʧܣûdata򡣲ɹʱdata -ķݣʽݾִе񷽷ͬͬ + A string in json format should returned with following format: + + {"code":0,"data":varb} + `code` field always exists and 0 means success. + `data` field is optional. + */ int http_rpc_start(void* app); @@ -67,7 +76,8 @@ public: protected: void _thread_loop(void); - void _set_stop_flag(void); +// void _set_stop_flag(void); +// void _on_stop(); private: int _parse_request(struct http_message* req, ex_astr& func_cmd, ex_astr& func_args); diff --git a/client/tp_assist_macos/src/csrc/ts_ver.h b/client/tp_assist_macos/src/csrc/ts_ver.h index b2b4e76..a296cc3 100644 --- a/client/tp_assist_macos/src/csrc/ts_ver.h +++ b/client/tp_assist_macos/src/csrc/ts_ver.h @@ -1,6 +1,6 @@ #ifndef __TS_ASSIST_VER_H__ #define __TS_ASSIST_VER_H__ -#define TP_ASSIST_VER L"3.1.0" +#define TP_ASSIST_VER L"3.2.0" #endif // __TS_ASSIST_VER_H__ diff --git a/client/tp_assist_macos/src/en.lproj/AboutWindowController.strings b/client/tp_assist_macos/src/en.lproj/AboutWindowController.strings index 5aa3681..f4d60d1 100644 --- a/client/tp_assist_macos/src/en.lproj/AboutWindowController.strings +++ b/client/tp_assist_macos/src/en.lproj/AboutWindowController.strings @@ -1,15 +1,2 @@ - -/* Class = "NSTextFieldCell"; title = "Version"; ObjectID = "6fl-Xm-UPS"; */ -"6fl-Xm-UPS.title" = "Version"; - -/* Class = "NSTextFieldCell"; title = "Copyright"; ObjectID = "Cmu-CQ-3V9"; */ -"Cmu-CQ-3V9.title" = "Copyright"; - -/* Class = "NSWindow"; title = "Window"; ObjectID = "F0z-JX-Cv5"; */ -"F0z-JX-Cv5.title" = "Window"; - -/* Class = "NSTextFieldCell"; title = "Program Name and Tag Line"; ObjectID = "tb3-eK-HAT"; */ -"tb3-eK-HAT.title" = "Teleport Assistor for MacOS"; - /* Class = "NSButtonCell"; title = "Homepage"; ObjectID = "uUM-88-32s"; */ -"uUM-88-32s.title" = "Visit TELEPORT Website"; +"uUM-88-32s.title" = "Visit Teleport Website"; diff --git a/client/tp_assist_macos/src/en.lproj/MainMenu.strings b/client/tp_assist_macos/src/en.lproj/MainMenu.strings index 136cf79..cb217cb 100644 --- a/client/tp_assist_macos/src/en.lproj/MainMenu.strings +++ b/client/tp_assist_macos/src/en.lproj/MainMenu.strings @@ -15,7 +15,7 @@ "136.title" = "Quit TPAssist"; /* Class = "NSMenuItem"; title = "About"; ObjectID = "638"; */ -"638.title" = "About"; +"638.title" = "About Teleport Assist"; /* Class = "NSMenuItem"; title = "Quit"; ObjectID = "644"; */ "644.title" = "Quit"; @@ -23,11 +23,4 @@ /* Class = "NSMenuItem"; title = "Settings"; ObjectID = "646"; */ "646.title" = "Settings"; -/* Class = "NSMenu"; title = "Settings"; ObjectID = "647"; */ -"647.title" = "Settings"; - -/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "648"; */ -"648.title" = "Edit"; - -/* Class = "NSMenuItem"; title = "Quit"; ObjectID = "649"; */ -"649.title" = "Quit"; +"pkv-BD-W9b.title" = "Visit Teleport Website"; diff --git a/client/tp_assist_macos/teleport.icns b/client/tp_assist_macos/src/teleport.icns similarity index 100% rename from client/tp_assist_macos/teleport.icns rename to client/tp_assist_macos/src/teleport.icns diff --git a/client/tp_assist_macos/src/tp-assist.default.json b/client/tp_assist_macos/src/tp-assist.default.json deleted file mode 100644 index 7428afb..0000000 --- a/client/tp_assist_macos/src/tp-assist.default.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "term": { - "selected": "Terminal", - "available": [ - { - "name":"Terminal", - "display": "终端(系统自带)", - "app": "Terminal.app", - "profile": "Basic" - }, - { - "name": "iTerm2", - "display": "iTerm2", - "app": "iTerm2.app", - "profile": "Default" - } - ] - }, - - "rdp": { - "selected": "FreeRDP", - "available": [ - { - "name": "FreeRDP", - "display": "FreeRDP", - "app": "" - } - ] - } -} diff --git a/client/tp_assist_macos/src/tp_assist-Info.plist b/client/tp_assist_macos/src/tp_assist-Info.plist index bb67df1..63fffbc 100644 --- a/client/tp_assist_macos/src/tp_assist-Info.plist +++ b/client/tp_assist_macos/src/tp_assist-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.1.0 + 3.2.0 CFBundleSignature ???? CFBundleVersion - 3.1.0 + 3.2.0 LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/client/tp_assist_macos/src/tpassist.png b/client/tp_assist_macos/src/tpassist.png new file mode 100755 index 0000000..ac7d3ac Binary files /dev/null and b/client/tp_assist_macos/src/tpassist.png differ diff --git a/client/tp_assist_macos/src/zh-Hans.lproj/AboutWindowController.strings b/client/tp_assist_macos/src/zh-Hans.lproj/AboutWindowController.strings index dae265c..2c620e8 100644 --- a/client/tp_assist_macos/src/zh-Hans.lproj/AboutWindowController.strings +++ b/client/tp_assist_macos/src/zh-Hans.lproj/AboutWindowController.strings @@ -1,15 +1,2 @@ - -/* Class = "NSTextFieldCell"; title = "Version"; ObjectID = "6fl-Xm-UPS"; */ -"6fl-Xm-UPS.title" = "Version"; - -/* Class = "NSTextFieldCell"; title = "Copyright"; ObjectID = "Cmu-CQ-3V9"; */ -"Cmu-CQ-3V9.title" = "Copyright"; - -/* Class = "NSWindow"; title = "Window"; ObjectID = "F0z-JX-Cv5"; */ -"F0z-JX-Cv5.title" = "Window"; - -/* Class = "NSTextFieldCell"; title = "Program Name and Tag Line"; ObjectID = "tb3-eK-HAT"; */ -"tb3-eK-HAT.title" = "Teleport助手 for MacOS"; - /* Class = "NSButtonCell"; title = "官方网站"; ObjectID = "uUM-88-32s"; */ -"uUM-88-32s.title" = "访问TELEPORT官方网站"; +"uUM-88-32s.title" = "访问 Teleport 网站"; diff --git a/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings b/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings index 7ec6657..1c1fec3 100644 --- a/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings +++ b/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings @@ -7,9 +7,13 @@ /* NSLocalizedString(@"",nil)*/ -"About " = "关于 "; -//"Version: " = "版本:"; -"Teleport Assist" = "Teleport 助手 - macOS"; +"app_name" = "Teleport助手"; -"Quit" = "退出"; -//"Continue" = "继续"; +//============================================= +// for About Window +//============================================= +"about " = "关于 "; +"version" = "版本:"; +"app_full_name" = "Teleport助手 - macOS"; +"copyright" = "© 2017~2018 TP4A,保留所有权利。"; +"visit_tp4a_website" = "访问 Teleport 网站"; diff --git a/client/tp_assist_macos/src/zh-Hans.lproj/MainMenu.strings b/client/tp_assist_macos/src/zh-Hans.lproj/MainMenu.strings index 2613abc..986704e 100644 --- a/client/tp_assist_macos/src/zh-Hans.lproj/MainMenu.strings +++ b/client/tp_assist_macos/src/zh-Hans.lproj/MainMenu.strings @@ -15,7 +15,7 @@ "136.title" = "退出 TPAssist"; /* Class = "NSMenuItem"; title = "关于"; ObjectID = "638"; */ -"638.title" = "关于"; +"638.title" = "关于Teleport助手"; /* Class = "NSMenuItem"; title = "退出"; ObjectID = "644"; */ "644.title" = "退出"; @@ -23,11 +23,4 @@ /* Class = "NSMenuItem"; title = "设置"; ObjectID = "646"; */ "646.title" = "设置"; -/* Class = "NSMenu"; title = "设置"; ObjectID = "647"; */ -"647.title" = "设置"; - -/* Class = "NSMenuItem"; title = "编辑"; ObjectID = "648"; */ -"648.title" = "编辑"; - -/* Class = "NSMenuItem"; title = "Quit"; ObjectID = "649"; */ -"649.title" = "Quit"; +"pkv-BD-W9b.title" = "访问Teleport网站"; diff --git a/client/tp_assist_macos/tp_assist.xcodeproj/project.pbxproj b/client/tp_assist_macos/tp_assist.xcodeproj/project.pbxproj index 02d9cd0..2b8037e 100644 --- a/client/tp_assist_macos/tp_assist.xcodeproj/project.pbxproj +++ b/client/tp_assist_macos/tp_assist.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -11,12 +11,18 @@ 0ADB3B0D178EF8DB004E9BB9 /* StatusIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 0ADB3B09178EF8DB004E9BB9 /* StatusIcon.png */; }; 7A0C94AA1F68BD2900E04C3E /* AboutWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6FC541A51D45CF7F00A896E3 /* AboutWindowController.xib */; }; 7A18188F1F7D5D7F00F3C882 /* AppDelegate-C-Interface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A18188E1F7D5D7F00F3C882 /* AppDelegate-C-Interface.cpp */; }; - 7A1818911F7FBBC200F3C882 /* tp-assist.default.json in Resources */ = {isa = PBXBuildFile; fileRef = 7A1818901F7FBBC200F3C882 /* tp-assist.default.json */; }; - 7A1F87AD215D59BD00B69F88 /* Terminal.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 7A1F87AB215D59BD00B69F88 /* Terminal.scpt */; }; - 7A1F87AE215D59BD00B69F88 /* iTerm2.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 7A1F87AC215D59BD00B69F88 /* iTerm2.scpt */; }; 7A1F87B1215D5A1600B69F88 /* StatusIconAlt@2X.png in Resources */ = {isa = PBXBuildFile; fileRef = 7A1F87AF215D5A1600B69F88 /* StatusIconAlt@2X.png */; }; 7A1F87B2215D5A1600B69F88 /* StatusIcon@2X.png in Resources */ = {isa = PBXBuildFile; fileRef = 7A1F87B0215D5A1600B69F88 /* StatusIcon@2X.png */; }; 7A27E4A91F6A8EEC004FDE5D /* ts_env.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A27E4A71F6A8EEC004FDE5D /* ts_env.cpp */; }; + 7A7C6C9121973C24006869D9 /* StatusIconAlt@3X.png in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C8F21973C24006869D9 /* StatusIconAlt@3X.png */; }; + 7A7C6C9221973C24006869D9 /* StatusIcon@3X.png in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C9021973C24006869D9 /* StatusIcon@3X.png */; }; + 7A7C6C9621973C69006869D9 /* tpassist.png in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C9521973C69006869D9 /* tpassist.png */; }; + 7A7C6C9C21974094006869D9 /* cacert.cer in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C9921974094006869D9 /* cacert.cer */; }; + 7A7C6C9D21974094006869D9 /* localhost.key in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C9A21974094006869D9 /* localhost.key */; }; + 7A7C6C9E21974094006869D9 /* localhost.pem in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C9B21974094006869D9 /* localhost.pem */; }; + 7A7C6CA02197410B006869D9 /* tp-assist.macos.json in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */; }; + 7A7C6CAA21977F07006869D9 /* iterm2.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6CA821977F07006869D9 /* iterm2.scpt */; }; + 7A7C6CAB21977F07006869D9 /* terminal.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 7A7C6CA921977F07006869D9 /* terminal.scpt */; }; 7AA2CD381F6A92620074C92B /* ts_http_rpc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD371F6A92620074C92B /* ts_http_rpc.cpp */; }; 7AA2CD3B1F6A955A0074C92B /* ts_cfg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD391F6A955A0074C92B /* ts_cfg.cpp */; }; 7AA2CD441F6AB9750074C92B /* ex_ini.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD3D1F6AB9750074C92B /* ex_ini.cpp */; }; @@ -45,7 +51,6 @@ 0ADB3B08178EF8DB004E9BB9 /* StatusIconAlt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = StatusIconAlt.png; sourceTree = ""; }; 0ADB3B09178EF8DB004E9BB9 /* StatusIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = StatusIcon.png; sourceTree = ""; }; 7A18188E1F7D5D7F00F3C882 /* AppDelegate-C-Interface.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "AppDelegate-C-Interface.cpp"; sourceTree = ""; }; - 7A1818901F7FBBC200F3C882 /* tp-assist.default.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "tp-assist.default.json"; sourceTree = ""; }; 7A1818951F8242E900F3C882 /* apple-scripts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "apple-scripts"; sourceTree = ""; }; 7A1F8797215D565600B69F88 /* ex_util.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_util.h; path = ../../../../common/libex/include/ex/ex_util.h; sourceTree = ""; }; 7A1F8798215D565600B69F88 /* ex_ini.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_ini.h; path = ../../../../common/libex/include/ex/ex_ini.h; sourceTree = ""; }; @@ -55,7 +60,7 @@ 7A1F879D215D565600B69F88 /* ex_types.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_types.h; path = ../../../../common/libex/include/ex/ex_types.h; sourceTree = ""; }; 7A1F879E215D565700B69F88 /* ex_str.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_str.h; path = ../../../../common/libex/include/ex/ex_str.h; sourceTree = ""; }; 7A1F879F215D565700B69F88 /* ex_path.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_path.h; path = ../../../../common/libex/include/ex/ex_path.h; sourceTree = ""; }; - 7A1F87A0215D565700B69F88 /* ex_thread.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_thread.h; path = ../../../../common/libex/include/ex/ex_thread.h; sourceTree = ""; }; + 7A1F87A0215D565700B69F88 /* ex_thread.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 2147486000; name = ex_thread.h; path = ../../../../common/libex/include/ex/ex_thread.h; sourceTree = ""; }; 7A1F87A1215D56B500B69F88 /* writer.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = writer.h; path = ../../../../external/jsoncpp/include/json/writer.h; sourceTree = ""; }; 7A1F87A2215D570000B69F88 /* value.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = value.h; path = ../../../../external/jsoncpp/include/json/value.h; sourceTree = ""; }; 7A1F87A3215D570000B69F88 /* reader.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = reader.h; path = ../../../../external/jsoncpp/include/json/reader.h; sourceTree = ""; }; @@ -66,14 +71,22 @@ 7A1F87A8215D574500B69F88 /* assertions.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = assertions.h; path = ../../../../external/jsoncpp/include/json/assertions.h; sourceTree = ""; }; 7A1F87A9215D574500B69F88 /* autolink.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = autolink.h; path = ../../../../external/jsoncpp/include/json/autolink.h; sourceTree = ""; }; 7A1F87AA215D574500B69F88 /* version.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = version.h; path = ../../../../external/jsoncpp/include/json/version.h; sourceTree = ""; }; - 7A1F87AB215D59BD00B69F88 /* Terminal.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = Terminal.scpt; sourceTree = ""; }; - 7A1F87AC215D59BD00B69F88 /* iTerm2.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTerm2.scpt; sourceTree = ""; }; 7A1F87AF215D5A1600B69F88 /* StatusIconAlt@2X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIconAlt@2X.png"; sourceTree = ""; }; 7A1F87B0215D5A1600B69F88 /* StatusIcon@2X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIcon@2X.png"; sourceTree = ""; }; 7A27E4A61F6A899B004FDE5D /* ts_const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ts_const.h; sourceTree = ""; }; 7A27E4A71F6A8EEC004FDE5D /* ts_env.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ts_env.cpp; sourceTree = ""; }; 7A27E4A81F6A8EEC004FDE5D /* ts_env.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ts_env.h; sourceTree = ""; }; 7A40FFE21F7B2A4500F11697 /* AppDelegate-C-Interface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate-C-Interface.h"; sourceTree = ""; }; + 7A7C6C8F21973C24006869D9 /* StatusIconAlt@3X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIconAlt@3X.png"; sourceTree = ""; }; + 7A7C6C9021973C24006869D9 /* StatusIcon@3X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIcon@3X.png"; sourceTree = ""; }; + 7A7C6C9521973C69006869D9 /* tpassist.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tpassist.png; sourceTree = ""; }; + 7A7C6C9921974094006869D9 /* cacert.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = cacert.cer; path = ../../../cfg/cacert.cer; sourceTree = ""; }; + 7A7C6C9A21974094006869D9 /* localhost.key */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.key; path = ../../../cfg/localhost.key; sourceTree = ""; }; + 7A7C6C9B21974094006869D9 /* localhost.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.pem; path = ../../../cfg/localhost.pem; sourceTree = ""; }; + 7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "tp-assist.macos.json"; path = "../../../cfg/tp-assist.macos.json"; sourceTree = ""; }; + 7A7C6CA12197786B006869D9 /* ts_ver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ts_ver.h; sourceTree = ""; }; + 7A7C6CA821977F07006869D9 /* iterm2.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = iterm2.scpt; sourceTree = ""; }; + 7A7C6CA921977F07006869D9 /* terminal.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = terminal.scpt; sourceTree = ""; }; 7AA2CD361F6A92380074C92B /* ts_http_rpc.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 2147486000; path = ts_http_rpc.h; sourceTree = ""; }; 7AA2CD371F6A92620074C92B /* ts_http_rpc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ts_http_rpc.cpp; sourceTree = ""; }; 7AA2CD391F6A955A0074C92B /* ts_cfg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ts_cfg.cpp; sourceTree = ""; }; @@ -114,7 +127,7 @@ C149EC0B15D5214600B1F558 /* tp_assist-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tp_assist-Prefix.pch"; sourceTree = ""; }; C149EC0F15D5214600B1F558 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; C149EC1015D5214600B1F558 /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; - C159DC2715D5DE7F00F5DE24 /* teleport.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = teleport.icns; path = ../teleport.icns; sourceTree = ""; }; + C159DC2715D5DE7F00F5DE24 /* teleport.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = teleport.icns; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -132,6 +145,9 @@ 0ADB3B10178EF8E2004E9BB9 /* Images */ = { isa = PBXGroup; children = ( + 7A7C6C9021973C24006869D9 /* StatusIcon@3X.png */, + 7A7C6C8F21973C24006869D9 /* StatusIconAlt@3X.png */, + 7A7C6C9521973C69006869D9 /* tpassist.png */, 7A1F87B0215D5A1600B69F88 /* StatusIcon@2X.png */, 7A1F87AF215D5A1600B69F88 /* StatusIconAlt@2X.png */, 0ADB3B09178EF8DB004E9BB9 /* StatusIcon.png */, @@ -140,6 +156,17 @@ name = Images; sourceTree = ""; }; + 7A45423D2196E32800FEB5B4 /* cfg */ = { + isa = PBXGroup; + children = ( + 7A7C6C9921974094006869D9 /* cacert.cer */, + 7A7C6C9A21974094006869D9 /* localhost.key */, + 7A7C6C9B21974094006869D9 /* localhost.pem */, + 7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */, + ); + path = cfg; + sourceTree = ""; + }; 7AA2CD3C1F6AB9560074C92B /* libex */ = { isa = PBXGroup; children = ( @@ -206,6 +233,7 @@ 7A27E4A71F6A8EEC004FDE5D /* ts_env.cpp */, 7A27E4A81F6A8EEC004FDE5D /* ts_env.h */, 7A27E4A61F6A899B004FDE5D /* ts_const.h */, + 7A7C6CA12197786B006869D9 /* ts_ver.h */, ); path = csrc; sourceTree = ""; @@ -213,8 +241,8 @@ A12D9BE61BCF2C72004F52A6 /* apple-scpt */ = { isa = PBXGroup; children = ( - 7A1F87AC215D59BD00B69F88 /* iTerm2.scpt */, - 7A1F87AB215D59BD00B69F88 /* Terminal.scpt */, + 7A7C6CA821977F07006869D9 /* iterm2.scpt */, + 7A7C6CA921977F07006869D9 /* terminal.scpt */, ); path = "apple-scpt"; sourceTree = ""; @@ -224,9 +252,9 @@ children = ( 7A1818951F8242E900F3C882 /* apple-scripts */, 7AA2CD581F6AC0DA0074C92B /* site */, - C149EC0315D5214600B1F558 /* src */, C149EBFC15D5214600B1F558 /* Frameworks */, C149EBFA15D5214600B1F558 /* Products */, + C149EC0315D5214600B1F558 /* src */, ); sourceTree = ""; }; @@ -260,10 +288,10 @@ C149EC0315D5214600B1F558 /* src */ = { isa = PBXGroup; children = ( - 7A1818901F7FBBC200F3C882 /* tp-assist.default.json */, + 7A45423D2196E32800FEB5B4 /* cfg */, 7AD3E8741F6A7CC600D2EB48 /* csrc */, A12D9BE61BCF2C72004F52A6 /* apple-scpt */, - C159DC2715D5DE7F00F5DE24 /* teleport.icns */, + C149EC0915D5214600B1F558 /* main.m */, C149EC0F15D5214600B1F558 /* AppDelegate.h */, C149EC1015D5214600B1F558 /* AppDelegate.mm */, C149EC1215D5214600B1F558 /* MainMenu.xib */, @@ -281,9 +309,9 @@ C149EC0415D5214600B1F558 /* Supporting Files */ = { isa = PBXGroup; children = ( + C159DC2715D5DE7F00F5DE24 /* teleport.icns */, C149EC0515D5214600B1F558 /* tp_assist-Info.plist */, C149EC0615D5214600B1F558 /* InfoPlist.strings */, - C149EC0915D5214600B1F558 /* main.m */, C149EC0B15D5214600B1F558 /* tp_assist-Prefix.pch */, A1B7B9DF1DB53ED200809327 /* Localizable.strings */, ); @@ -317,10 +345,10 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0930; - ORGANIZATIONNAME = eomsoft; + ORGANIZATIONNAME = TP4A; }; buildConfigurationList = C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "tp_assist" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 10.0"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( @@ -345,17 +373,23 @@ files = ( 7AA2CD591F6AC0DA0074C92B /* site in Resources */, A1B7B9DD1DB53ED200809327 /* Localizable.strings in Resources */, - 0ADB3B0D178EF8DB004E9BB9 /* StatusIcon.png in Resources */, - 7A1F87B1215D5A1600B69F88 /* StatusIconAlt@2X.png in Resources */, - 7A1F87AE215D59BD00B69F88 /* iTerm2.scpt in Resources */, - 0ADB3B0C178EF8DB004E9BB9 /* StatusIconAlt.png in Resources */, C149EC0815D5214600B1F558 /* InfoPlist.strings in Resources */, - 7A1F87AD215D59BD00B69F88 /* Terminal.scpt in Resources */, + 7A7C6CA02197410B006869D9 /* tp-assist.macos.json in Resources */, + 7A7C6C9E21974094006869D9 /* localhost.pem in Resources */, + 7A7C6C9621973C69006869D9 /* tpassist.png in Resources */, + 7A7C6C9C21974094006869D9 /* cacert.cer in Resources */, C149EC1415D5214600B1F558 /* MainMenu.xib in Resources */, + 7A7C6C9D21974094006869D9 /* localhost.key in Resources */, C159DC2815D5DE8000F5DE24 /* teleport.icns in Resources */, 7A0C94AA1F68BD2900E04C3E /* AboutWindowController.xib in Resources */, - 7A1818911F7FBBC200F3C882 /* tp-assist.default.json in Resources */, + 0ADB3B0D178EF8DB004E9BB9 /* StatusIcon.png in Resources */, 7A1F87B2215D5A1600B69F88 /* StatusIcon@2X.png in Resources */, + 7A7C6C9221973C24006869D9 /* StatusIcon@3X.png in Resources */, + 0ADB3B0C178EF8DB004E9BB9 /* StatusIconAlt.png in Resources */, + 7A1F87B1215D5A1600B69F88 /* StatusIconAlt@2X.png in Resources */, + 7A7C6C9121973C24006869D9 /* StatusIconAlt@3X.png in Resources */, + 7A7C6CAA21977F07006869D9 /* iterm2.scpt in Resources */, + 7A7C6CAB21977F07006869D9 /* terminal.scpt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -481,9 +515,10 @@ ../../external/mongoose, ../../external/jsoncpp/include, ); - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; + VALID_ARCHS = x86_64; }; name = Debug; }; @@ -530,8 +565,9 @@ ../../external/mongoose, ../../external/jsoncpp/include, ); - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; SDKROOT = macosx; + VALID_ARCHS = x86_64; }; name = Release; }; @@ -543,9 +579,10 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "src/tp_assist-Prefix.pch"; INFOPLIST_FILE = "src/tp_assist-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "teleport.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + VALID_ARCHS = x86_64; WRAPPER_EXTENSION = app; }; name = Debug; @@ -558,9 +595,10 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "src/tp_assist-Prefix.pch"; INFOPLIST_FILE = "src/tp_assist-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_BUNDLE_IDENTIFIER = "teleport.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + VALID_ARCHS = x86_64; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/common/libex/include/ex/ex_ini.h b/common/libex/include/ex/ex_ini.h index 6efde7d..38749f5 100644 --- a/common/libex/include/ex/ex_ini.h +++ b/common/libex/include/ex/ex_ini.h @@ -92,7 +92,7 @@ public: int Count(void) const { - return m_secs.size(); + return (int)(m_secs.size()); } void Save(int codepage = EX_CODEPAGE_UTF8); #ifdef EX_DEBUG diff --git a/common/libex/src/ex_path.cpp b/common/libex/src/ex_path.cpp index 930723e..fd3e7f4 100644 --- a/common/libex/src/ex_path.cpp +++ b/common/libex/src/ex_path.cpp @@ -174,7 +174,7 @@ EX_BOOL ex_copy_file(const wchar_t* from_file, const wchar_t* to_file) { if (S_ISLNK(src_stat.st_mode)) { char lnk[1024] = {0}; - int lnk_size; + ssize_t lnk_size; if ((lnk_size = readlink(source.c_str(), lnk, 1023)) == -1) return EX_FALSE; lnk[lnk_size] = '\0'; @@ -183,7 +183,7 @@ EX_BOOL ex_copy_file(const wchar_t* from_file, const wchar_t* to_file) { } else if (S_ISREG(src_stat.st_mode)) { int src = -1, dst = -1; - int rsize = 0; + ssize_t rsize = 0; char buf[1024] = {0}; if ((src = open(source.c_str(), O_RDONLY)) == -1) { close(dst); diff --git a/common/libex/src/ex_util.cpp b/common/libex/src/ex_util.cpp index 79d142b..a84a001 100644 --- a/common/libex/src/ex_util.cpp +++ b/common/libex/src/ex_util.cpp @@ -308,166 +308,170 @@ void ex_dlclose(EX_DYLIB_HANDLE dylib) { // return _inet_ntop4((const unsigned char *) &(src->sin_addr), dst, size); // } // -static const char * _inet_ntop_v4(const void *src, char *dst, size_t size) -{ - const char digits[] = "0123456789"; - int i; - struct in_addr *addr = (struct in_addr *)src; - u_long a = ntohl(addr->s_addr); - const char *orig_dst = dst; - - if (size < EX_IPV4_NAME_LEN) { - //errno = ENOSPC; - return NULL; - } - for (i = 0; i < 4; ++i) { - int n = (a >> (24 - i * 8)) & 0xFF; - int non_zerop = 0; - - if (non_zerop || n / 100 > 0) { - *dst++ = digits[n / 100]; - n %= 100; - non_zerop = 1; - } - if (non_zerop || n / 10 > 0) { - *dst++ = digits[n / 10]; - n %= 10; - non_zerop = 1; - } - *dst++ = digits[n]; - if (i != 3) - *dst++ = '.'; - } - *dst++ = '\0'; - return orig_dst; +static const char * _inet_ntop_v4(const void *src, char *dst, size_t size) +{ + const char digits[] = "0123456789"; + int i; + struct in_addr *addr = (struct in_addr *)src; + u_long a = ntohl(addr->s_addr); + const char *orig_dst = dst; + + if (size < EX_IPV4_NAME_LEN) { + //errno = ENOSPC; + return NULL; + } + for (i = 0; i < 4; ++i) { + int n = (a >> (24 - i * 8)) & 0xFF; + int non_zerop = 0; + + if (non_zerop || n / 100 > 0) { + *dst++ = digits[n / 100]; + n %= 100; + non_zerop = 1; + } + if (non_zerop || n / 10 > 0) { + *dst++ = digits[n / 10]; + n %= 10; + non_zerop = 1; + } + *dst++ = digits[n]; + if (i != 3) + *dst++ = '.'; + } + *dst++ = '\0'; + return orig_dst; } -#define IN6ADDRSZ 16 +#define IN6ADDRSZ 16 #define INT16SZ 2 -static const char * _inet_ntop_v6(const ex_u8 *src, char *dst, size_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[EX_IPV6_NAME_LEN]; - char *tp; - struct { - long base; - long len; - } best, cur; - u_long words[IN6ADDRSZ / INT16SZ]; - int i; - - /* Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, 0, sizeof(words)); - for (i = 0; i < IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - - best.base = -1; - cur.base = -1; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) - { - if (words[i] == 0) - { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else cur.len++; - } - else if (cur.base != -1) - { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - if ((cur.base != -1) && (best.base == -1 || cur.len > best.len)) - best = cur; - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* Format the result. - */ - tp = tmp; - size_t tmp_size = 0; - size_t offset = 0; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) - { - /* Are we inside the best run of 0x00's? - */ - if (best.base != -1 && i >= best.base && i < (best.base + best.len)) - { - if (i == best.base) { - *tp++ = ':'; - offset += 1; - } - continue; - } - - /* Are we following an initial run of 0x00s or any real hex? - */ - if (i != 0) { - *tp++ = ':'; - offset += 1; - } - - /* Is this address an encapsulated IPv4? - */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) - { - if (!_inet_ntop_v4(src + 12, tp, sizeof(tmp) - (tp - tmp))) - { - //errno = ENOSPC; - return (NULL); - } - tmp_size = strlen(tp); - tp += tmp_size; - offset += tmp_size; - break; - } - //tp += ex_strformat(tp, "%lX", words[i]); - tmp_size = ex_strformat(tp, EX_IPV6_NAME_LEN-offset, "%lX", words[i]); - tp += tmp_size; - offset += tmp_size; - } - - /* Was it a trailing run of 0x00's? - */ - if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) - { - //errno = ENOSPC; - return (NULL); - } - //return strcpy(dst, tmp); - return ex_strcpy(dst, size, tmp); - //return (NULL); +static const char * _inet_ntop_v6(const ex_u8 *src, char *dst, size_t size) +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[EX_IPV6_NAME_LEN]; + char *tp; + struct { + long base; + long len; + } best, cur; + u_long words[IN6ADDRSZ / INT16SZ]; + int i; + + /* Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, 0, sizeof(words)); + for (i = 0; i < IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + + best.base = -1; + cur.base = -1; + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + { + if (words[i] == 0) + { + if (cur.base == -1) { + cur.base = i; + cur.len = 1; + } + else{ + cur.len++; + } + } + else if (cur.base != -1) + { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + if ((cur.base != -1) && (best.base == -1 || cur.len > best.len)) + best = cur; + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* Format the result. + */ + tp = tmp; + size_t tmp_size = 0; + size_t offset = 0; + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + { + /* Are we inside the best run of 0x00's? + */ + if (best.base != -1 && i >= best.base && i < (best.base + best.len)) + { + if (i == best.base) { + *tp++ = ':'; + offset += 1; + } + continue; + } + + /* Are we following an initial run of 0x00s or any real hex? + */ + if (i != 0) { + *tp++ = ':'; + offset += 1; + } + + /* Is this address an encapsulated IPv4? + */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) + { + if (!_inet_ntop_v4(src + 12, tp, sizeof(tmp) - (tp - tmp))) + { + //errno = ENOSPC; + return (NULL); + } + tmp_size = strlen(tp); + tp += tmp_size; + offset += tmp_size; + break; + } + //tp += ex_strformat(tp, "%lX", words[i]); + tmp_size = ex_strformat(tp, EX_IPV6_NAME_LEN-offset, "%lX", words[i]); + tp += tmp_size; + offset += tmp_size; + } + + /* Was it a trailing run of 0x00's? + */ + if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) + { + //errno = ENOSPC; + return (NULL); + } + //return strcpy(dst, tmp); + return ex_strcpy(dst, size, tmp); + //return (NULL); +} + +const char* ex_inet_ntop(int af, const void *src, char *dst, size_t size) { + switch (af) { + case AF_INET: + return _inet_ntop_v4(src, dst, size); + case AF_INET6: + return _inet_ntop_v6((const ex_u8*)src, dst, size); + default: + errno = EAFNOSUPPORT; + return NULL; + } } -const char* ex_inet_ntop(int af, const void *src, char *dst, size_t size) { - switch (af) { - case AF_INET: - return _inet_ntop_v4(src, dst, size); - case AF_INET6: - return _inet_ntop_v6((const ex_u8*)src, dst, size); - default: - errno = EAFNOSUPPORT; - return NULL; - } -} - int ex_ip4_name(const struct sockaddr_in *src, char *dst, size_t size) { if (NULL == _inet_ntop_v4((const unsigned char *)&(src->sin_addr), dst, size)) return -1;