Merge branch 'dev'

pull/236/head v3.2.0
Apex Liu 2019-01-08 15:45:45 +08:00
commit b269a1e392
1121 changed files with 227677 additions and 15248 deletions

21
.gitignore vendored
View File

@ -12,25 +12,27 @@
# for CMake
CMakeFiles
cmake_install.cmake
Makefile
cmake-build
cmake-build-debug
client/tp_assist_macos/build
**/xcode_build
**/DerivedData
# for Python
__pycache__
*.pyc
# for pyCharm
# for JetBrains IDEs.
**/.idea/workspace.xml
**/.idea/misc.xml
**/.idea/modules.xml
**/.idea/dictionaries
**/.idea/watcherTasks.xml
**/.idea/inspectionProfiles
**/.idea/vcs.xml
**/.idea/codeStyles
**/.idea/inspectionProfiles
**/.idea/vcs.xml
**/.idea/modules.xml
*.css.map
@ -44,15 +46,13 @@ __pycache__
/external/openssl
/external/python
/external/libssh
/external/libssh-win-static/include/libssh
/external/libssh-win-static/src
/external/libssh-win-static/lib
/external/mbedtls
/external/sqlite
/external/libuv
/client/tools/putty
/client/tools/winscp
/client/tp_assist_macos/DerivedData
/server/**/test/
/server/**/tests/
# for dist folder
**/_tmp_
@ -71,6 +71,7 @@ __pycache__
# for generated files.
/config.ini
/build.bat
/build.sh
# for not finished code
/common/libex/test
@ -84,7 +85,7 @@ __pycache__
# for MacOS.
.DS_Store
# Xcode
# for Xcode
build/*
*.pbxuser
!default.pbxuser
@ -100,4 +101,4 @@ xcuserdata
profile
*.moved-aside
/server/share/tmp
/build.sh

51
.idea/encodings.xml Normal file
View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/common/libex/include/ex/ex_log.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/libex/include/ex/ex_path.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/libex/include/ex/ex_thread.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/libex/include/ex/ex_util.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/libex/src/ex_ini.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/libex/src/ex_log.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/libex/src/ex_util.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/pyshell/include/pys.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/pyshell/src/pys_api.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/pyshell/src/pys_core.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/common/teleport/teleport_const.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/base_env.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/base_record.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/base_record.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/protocol_interface.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/ts_const.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/ts_membuf.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/ts_membuf.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/common/ts_memstream.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/main.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_env.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_http_rpc.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_http_rpc.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_main.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_session.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_session.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_web_rpc.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_web_rpc.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_conn.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_conn.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_proxy.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_session.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_session.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_proxy.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_proxy.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_recorder.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_recorder.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_session.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_session.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/telnet/telnet_conn.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/telnet/telnet_conn.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/telnet/telnet_proxy.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/telnet/telnet_session.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/telnet/telnet_session.h" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_web/src/main.cpp" charset="GBK" />
<file url="file://$PROJECT_DIR$/server/tp_web/src/ts_env.cpp" charset="GBK" />
</component>
</project>

2
.idea/teleport.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

29
CMakeCfg.txt Normal file
View File

@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.5)
MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
MESSAGE(STATUS "root source directory is ${PROJECT_SOURCE_DIR}")
MESSAGE(STATUS "current source directory is ${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/out/server/x64/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/out/server/x64/bin")
set(CMAKE_CONFIGURATION_TYPES Debug Release)
# Determine the platform.
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
MESSAGE(STATUS "build on macOS...")
set(OS_MACOS 1)
set(OS_POSIX 1)
set(TP_EXTERNAL_RELEASE_DIR "${PROJECT_SOURCE_DIR}/external/macos/release")
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(OS_LINUX 1)
set(OS_POSIX 1)
MESSAGE(STATUS "build on Linux...")
# add_subdirectory(server/tp_web/src)
set(TP_EXTERNAL_RELEASE_DIR "${PROJECT_SOURCE_DIR}/external/linux/release")
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
# MESSAGE(FATAL_ERROR "unsupported platform: Windows")
else ()
MESSAGE(FATAL_ERROR "unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif ()

43
CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.5)
project(teleport)
include(CMakeCfg.txt)
#MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
#MESSAGE(STATUS "current source directory is ${CMAKE_CURRENT_SOURCE_DIR}")
#
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/out/server/x64/bin")
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/out/server/x64/bin")
#
#set(CMAKE_CONFIGURATION_TYPES Debug Release)
#
## Determine the platform.
#if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
# MESSAGE(STATUS "build on macOS...")
# set(OS_MACOS 1)
# set(OS_POSIX 1)
# set(TP_EXTERNAL_RELEASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/macos/release")
#elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
# set(OS_LINUX 1)
# set(OS_POSIX 1)
# MESSAGE(STATUS "build on Linux...")
# add_subdirectory(server/tp_web/src)
# set(TP_EXTERNAL_RELEASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/linux/release")
#elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
# # MESSAGE(FATAL_ERROR "unsupported platform: Windows")
#else ()
# MESSAGE(FATAL_ERROR "unsupported platform: ${CMAKE_SYSTEM_NAME}")
#endif ()
if (OS_LINUX)
add_subdirectory(server/tp_web/src)
endif()
add_subdirectory(server/tp_core/core)
add_subdirectory(server/tp_core/protocol/ssh)
add_subdirectory(server/tp_core/protocol/telnet)
#add_subdirectory(server/testssh/testssh)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/server/tp_core/protocol/rdp")
add_subdirectory(server/tp_core/protocol/rdp)
endif ()

View File

@ -16,14 +16,32 @@ function on_error()
function build_linux
{
if [ `id -u` -eq 0 ]; then
on_error "Do not build as root."
fi
if [ ! -f "/etc/centos-release" ] ; then
on_error "Sorry, build script works on CentOS 7 only."
fi
X=$(yum list installed | grep "libffi-devel")
if [ "$X-x" = "-x" ] ; then
on_error "Need libffi-devel to build Python, try:\r\n sudo yum install libffi-devel"
fi
X=$(yum list installed | grep "zlib-devel")
if [ "$X-x" = "-x" ] ; then
on_error "Need zlib-devel to build Python, try:\r\n sudo yum install zlib-devel"
fi
PYEXEC=${PATH_ROOT}/external/linux/release/bin/python3.7
PYSTATIC=${PATH_ROOT}/external/linux/release/lib/libpython3.7m.a
if [ ! -f "${PYSTATIC}" ]; then
if [ ! -f "${PYSTATIC}" ] ; then
echo "python static not found, now build it..."
"${PATH_ROOT}/build/build-py-static.sh"
if [ ! -f "${PYSTATIC}" ]; then
if [ ! -f "${PYSTATIC}" ] ; then
on_error "can not build python static."
fi
fi

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/builder">
<sourceFolder url="file://$MODULE_DIR$/builder" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="py37" jdkType="Python SDK" />
<content url="file://$MODULE_DIR$/builder" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">

View File

@ -29,7 +29,7 @@ class BuilderWin(BuilderBase):
def build_exe(self):
cc.i('build tp_assist...')
sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2015.sln')
sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp_assist.exe')
if os.path.exists(out_file):
utils.remove(out_file)
@ -74,7 +74,11 @@ class BuilderWin(BuilderBase):
utils.makedirs(tmp_cfg_path)
utils.copy_file(os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe')
utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist_win', 'cfg'), tmp_cfg_path, ('tp-assist.default.json', 'tp-assist.json'))
utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, ('tp-assist.windows.json', 'tp-assist.json'))
utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'cacert.cer')
utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.key')
utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.pem')
utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site')
@ -106,28 +110,23 @@ class BuilderMacOS(BuilderBase):
configuration = ctx.target_path.capitalize()
proj_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'tp_assist.xcodeproj')
out_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', ctx.target_path, 'tp_assist.app')
proj_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'TP-Assist.xcodeproj')
out_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', configuration, 'TP-Assist.app')
if os.path.exists(out_file):
utils.remove(out_file)
utils.xcode_build(proj_file, 'tp_assist', configuration, False)
utils.xcode_build(proj_file, 'TP-Assist', configuration, False)
utils.ensure_file_exists(os.path.join(out_file, 'Contents', 'Info.plist'))
def build_installer(self):
cc.e('assist for macOS does not need an installer, you should make an .DMG file for release...')
cc.i('make tp_assist dmg file...')
# name = 'teleport-assist-{}-{}'.format(ctx.dist, VER_TP_ASSIST)
#
# out_path = os.path.join(env.root_path, 'out', 'installer')
# utils.makedirs(out_path)
#
# out_file = os.path.join(out_path, '{}.exe'.format(name))
# utils.remove(out_file)
#
# self._build_installer()
#
# utils.ensure_file_exists(out_file)
json_file = os.path.join(env.root_path, 'dist', 'client', 'macos', 'dmg.json')
dmg_file = os.path.join(env.root_path, 'out', 'client', 'macos', 'teleport-assist-macos-{}.dmg'.format(VER_TP_ASSIST))
if os.path.exists(dmg_file):
utils.remove(dmg_file)
utils.make_dmg(json_file, dmg_file)
utils.ensure_file_exists(dmg_file)
@staticmethod
def _build_installer():

View File

@ -48,12 +48,12 @@ class BuilderBase:
self._build_openssl(file_name)
def _build_openssl(self, file_name):
_alt_ver = '_'.join(env.ver_openssl.split('.'))
_alt_ver = '_'.join(env.ver_ossl.split('.'))
if not utils.download_file('openssl source tarball', 'https://github.com/openssl/openssl/archive/OpenSSL_{}.zip'.format(_alt_ver), PATH_DOWNLOAD, file_name):
cc.e("can not download openssl source tarball.")
return False
else:
return True
# cc.e("this is a pure-virtual function.")
def build_libuv(self):
file_name = 'libuv-{}.zip'.format(env.ver_libuv)
@ -88,15 +88,6 @@ class BuilderBase:
def _prepare_python(self):
cc.e("this is a pure-virtual function.")
# def build_sqlite(self):
# file_name = 'sqlite-autoconf-{}.tar.gz'.format(env.ver_sqlite)
# if not utils.download_file('sqlite source tarball', 'http://sqlite.org/2017/{}'.format(file_name), PATH_DOWNLOAD, file_name):
# return
# self._build_sqlite(file_name)
#
# def _build_sqlite(self, file_name):
# cc.e("this is a pure-virtual function.")
def fix_output(self):
pass
@ -111,11 +102,8 @@ class BuilderWin(BuilderBase):
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
self.MBEDTLS_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mbedtls')
self.LIBUV_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libuv')
# self.LIBSSH_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libssh-win-static')
self.LIBSSH_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libssh')
# self._prepare_python_header()
def _prepare_python(self):
cc.n('prepare python header files ...', end='')
@ -124,12 +112,6 @@ class BuilderWin(BuilderBase):
return
cc.v('')
# if os.path.exists(os.path.join(env.path_py_inc, 'Python.h')):
# cc.e('can not locate python development include path, make sure miniconda installed.')
# return
# cc.v('')
# utils.copy_ex(env.path_py_inc, os.path.join(PATH_EXTERNAL, 'python', 'include'))
_header_path = None
for p in sys.path:
if os.path.exists(os.path.join(p, 'include', 'Python.h')):
@ -145,8 +127,7 @@ class BuilderWin(BuilderBase):
def _build_openssl(self, file_name):
cc.n('build openssl static library from source code... ')
_alt_ver = '_'.join(env.ver_ossl.split('.'))
if not utils.download_file('openssl source tarball', 'https://github.com/openssl/openssl/archive/OpenSSL_{}.zip'.format(_alt_ver), PATH_DOWNLOAD, file_name):
if not super()._build_openssl(file_name):
return
_chk_output = [
@ -180,7 +161,10 @@ class BuilderWin(BuilderBase):
os.chdir(self.OPENSSL_PATH_SRC)
os.system('""{}" Configure VC-WIN32"'.format(env.perl))
os.system(r'ms\do_nasm')
os.system(r'"{}\VC\bin\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path))
# for vs2015
# utils.sys_exec(r'"{}\VC\bin\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path), direct_output=True)
# for vs2017 community
utils.sys_exec(r'"{}VC\Auxiliary\Build\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path), direct_output=True)
for f in _chk_output:
if not os.path.exists(f):
@ -194,24 +178,28 @@ class BuilderWin(BuilderBase):
utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
os.rename(os.path.join(PATH_EXTERNAL, 'libssh-{}'.format(env.ver_libssh)), self.LIBSSH_PATH_SRC)
# cc.n('fix libssh source code... ', end='')
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src', 'sftp.c'))
# utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'sftp.c')
cc.n('fix libssh source code... ', end='')
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src', 'sftp.c'))
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'sftp.c')
s_name = 'libssh-{}'.format(env.ver_libssh)
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
out_file_lib = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.lib')
out_file_dll = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.dll')
need_build = False
if not (os.path.exists(out_file_lib) and (os.path.exists(out_file_dll))):
need_build = True
if not need_build:
if os.path.exists(out_file_lib) and os.path.exists(out_file_dll):
cc.w('already exists, skip.')
return
cc.v('')
cc.w('On Windows, when build libssh, need you use cmake-gui.exe to generate solution file')
cc.w('for Visual Studio 2015. Visit https://docs.tp4a.com for more details.')
cc.w('for Visual Studio 2017. Visit https://docs.tp4a.com for more details.')
cc.w('\nOnce the libssh.sln generated, press Enter to continue or Q to quit...', end='')
try:
x = env.input()
@ -275,10 +263,6 @@ class BuilderWin(BuilderBase):
else:
cc.w('already exists, skip.')
# def build_sqlite(self):
# cc.w('sqlite not need for Windows, skip.')
# pass
def fix_output(self):
pass
@ -290,11 +274,9 @@ class BuilderLinux(BuilderBase):
def _init_path(self):
self.PATH_TMP = os.path.join(PATH_EXTERNAL, 'linux', 'tmp')
self.PATH_RELEASE = os.path.join(PATH_EXTERNAL, 'linux', 'release')
# self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-{}'.format(env.ver_ossl))
self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(env.ver_libuv))
self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(env.ver_mbedtls))
self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-{}'.format(env.ver_libssh))
# self.SQLITE_PATH_SRC = os.path.join(self.PATH_TMP, 'sqlite-autoconf-{}'.format(env.ver_sqlite))
self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp')
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
@ -309,8 +291,6 @@ class BuilderLinux(BuilderBase):
cc.w(' - header file already exists, skip.')
else:
utils.ensure_file_exists(os.path.join(self.PATH_RELEASE, 'include', 'python{}m'.format(ctx.py_dot_ver), 'Python.h'))
# utils.makedirs(os.path.join(self.PATH_RELEASE, 'include'))
# utils.copy_ex(env.path_py_inc, os.path.join(self.PATH_RELEASE, 'include', 'python'))
utils.sys_exec('ln -s "{}" "{}"'.format(
os.path.join(self.PATH_RELEASE, 'include', 'python{}m'.format(ctx.py_dot_ver)),
os.path.join(self.PATH_RELEASE, 'include', 'python')
@ -318,13 +298,6 @@ class BuilderLinux(BuilderBase):
lib_file = 'libpython{}m.a'.format(env.py_ver_dot)
utils.ensure_file_exists(os.path.join(self.PATH_RELEASE, 'lib', lib_file))
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', lib_file)):
# cc.w(' - lib file already exists, skip.')
# else:
# utils.makedirs(os.path.join(self.PATH_RELEASE, 'lib'))
# utils.copy_file(env.path_py_lib, os.path.join(self.PATH_RELEASE, 'lib'), lib_file)
# utils.copy_file(env.path_py_lib, os.path.join(self.PATH_RELEASE, 'lib'), 'libcrypto.a')
# utils.copy_file(env.path_py_lib, os.path.join(self.PATH_RELEASE, 'lib'), 'libssl.a')
def _build_jsoncpp(self, file_name):
cc.n('prepare jsoncpp source code...', end='')
@ -349,7 +322,6 @@ class BuilderLinux(BuilderBase):
def _build_libuv(self, file_name):
if not os.path.exists(self.LIBUV_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
cc.n('build libuv...', end='')
@ -377,7 +349,6 @@ class BuilderLinux(BuilderBase):
def _build_mbedtls(self, file_name):
if not os.path.exists(self.MBEDTLS_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
cc.n('build mbedtls...', end='')
@ -408,45 +379,6 @@ class BuilderLinux(BuilderBase):
f.writelines(fl)
f.close()
# # fix config.h
# mkfile = os.path.join(self.MBEDTLS_PATH_SRC, 'include', 'mbedtls', 'config.h')
# f = open(mkfile)
# fl = f.readlines()
# f.close()
#
# for i in range(len(fl)):
# if fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED') >= 0:
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED\n'
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED') >= 0:
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED\n'
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED') >= 0:
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED\n'
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED') >= 0:
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED\n'
# elif fl[i].find('#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED') >= 0:
# fl[i] = '//#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED\n'
# elif fl[i].find('#define MBEDTLS_SELF_TEST') >= 0:
# fl[i] = '//#define MBEDTLS_SELF_TEST\n'
# elif fl[i].find('#define MBEDTLS_SSL_RENEGOTIATION') >= 0:
# fl[i] = '//#define MBEDTLS_SSL_RENEGOTIATION\n'
# elif fl[i].find('#define MBEDTLS_ECDH_C') >= 0:
# fl[i] = '//#define MBEDTLS_ECDH_C\n'
# elif fl[i].find('#define MBEDTLS_ECDSA_C') >= 0:
# fl[i] = '//#define MBEDTLS_ECDSA_C\n'
# elif fl[i].find('#define MBEDTLS_ECP_C') >= 0:
# fl[i] = '//#define MBEDTLS_ECP_C\n'
# elif fl[i].find('#define MBEDTLS_NET_C') >= 0:
# fl[i] = '//#define MBEDTLS_NET_C\n'
#
# elif fl[i].find('#define MBEDTLS_RSA_NO_CRT') >= 0:
# fl[i] = '#define MBEDTLS_RSA_NO_CRT\n'
# elif fl[i].find('#define MBEDTLS_SSL_PROTO_SSL3') >= 0:
# fl[i] = '#define MBEDTLS_SSL_PROTO_SSL3\n'
#
# f = open(mkfile, 'w')
# f.writelines(fl)
# f.close()
# fix source file
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'include', 'mbedtls', 'config.h'))
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'include', 'mbedtls'), os.path.join(self.MBEDTLS_PATH_SRC, 'include', 'mbedtls'), 'config.h')
@ -469,6 +401,15 @@ class BuilderLinux(BuilderBase):
return
cc.v('')
cc.n('fix libssh source code... ', end='')
s_name = 'libssh-{}'.format(env.ver_libssh)
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')
cmake_define = ' -DCMAKE_INSTALL_PREFIX={path_release}' \
@ -495,10 +436,6 @@ class BuilderLinux(BuilderBase):
pass
os.chdir(old_p)
# utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'libssh.a'))
# utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh.a')
# utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'), os.path.join(self.PATH_RELEASE, 'include'), 'libssh')
utils.ensure_file_exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a'))
files = os.listdir(os.path.join(self.PATH_RELEASE, 'lib'))
for i in files:
@ -506,32 +443,8 @@ class BuilderLinux(BuilderBase):
# use os.unlink() because some file should be a link.
os.unlink(os.path.join(self.PATH_RELEASE, 'lib', i))
# def _build_sqlite(self, file_name):
# if not os.path.exists(self.SQLITE_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
#
# cc.n('build sqlite static...', end='')
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libsqlite3.a')):
# cc.w('already exists, skip.')
# return
# cc.v('')
#
# old_p = os.getcwd()
# os.chdir(self.SQLITE_PATH_SRC)
# os.system('./configure --prefix={}'.format(self.PATH_RELEASE))
# os.system('make')
# os.system('make install')
# os.chdir(old_p)
def fix_output(self):
pass
# remove .so files, otherwise will link to .so but not .a in default.
# rm = ['libsqlite3.la', 'libsqlite3.so.0', 'libsqlite3.so', 'libsqlite3.so.0.8.6', 'libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
# rm = ['libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
# for i in rm:
# _path = os.path.join(self.PATH_RELEASE, 'lib', i)
# if os.path.exists(_path):
# utils.remove(_path)
class BuilderMacOS(BuilderBase):
@ -541,11 +454,10 @@ class BuilderMacOS(BuilderBase):
def _init_path(self):
self.PATH_TMP = os.path.join(PATH_EXTERNAL, 'macos', 'tmp')
self.PATH_RELEASE = os.path.join(PATH_EXTERNAL, 'macos', 'release')
# self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-OpenSSL_{}'.format(env.ver_openssl.replace('.', '_')))
self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-OpenSSL_{}'.format(env.ver_ossl.replace('.', '_')))
self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(env.ver_libuv))
self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(env.ver_mbedtls))
self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-{}'.format(env.ver_libssh))
# self.SQLITE_PATH_SRC = os.path.join(self.PATH_TMP, 'sqlite-autoconf-{}'.format(env.ver_sqlite))
self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp')
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
@ -572,30 +484,36 @@ class BuilderMacOS(BuilderBase):
cc.w('already exists, skip.')
def _build_openssl(self, file_name):
pass # we do not need build openssl anymore, because first time run build.sh we built Python, it include openssl.
#
# if not os.path.exists(self.OPENSSL_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
#
# cc.n('build openssl static...', end='')
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssl.a')):
# cc.w('already exists, skip.')
# return
#
# old_p = os.getcwd()
# os.chdir(self.OPENSSL_PATH_SRC)
# # os.system('./config --prefix={} --openssldir={}/openssl no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE))
# # os.system('./Configure darwin64-x86_64-cc')
# os.system('./Configure darwin64-x86_64-cc --prefix={} --openssldir={}/openssl -fPIC no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE))
# os.system('make')
# os.system('make install')
# os.chdir(old_p)
if not super()._build_openssl(file_name):
return
cc.n('prepare openssl source code...', end='')
if not os.path.exists(self.OPENSSL_PATH_SRC):
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
if not os.path.exists(self.OPENSSL_PATH_SRC):
raise RuntimeError('can not prepare openssl source code.')
else:
cc.w('already exists, skip.')
cc.n('build openssl static...', end='')
out_file_lib = os.path.join(self.PATH_RELEASE, 'lib', 'libssl.a')
if os.path.exists(out_file_lib):
cc.w('already exists, skip.')
return
cc.v('')
old_p = os.getcwd()
os.chdir(self.OPENSSL_PATH_SRC)
# os.system('./config --prefix={} --openssldir={}/openssl no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE))
# os.system('./Configure darwin64-x86_64-cc')
os.system('./Configure darwin64-x86_64-cc --prefix={} --openssldir={}/openssl -fPIC no-zlib no-shared'.format(self.PATH_RELEASE, self.PATH_RELEASE))
os.system('make')
os.system('make install')
os.chdir(old_p)
def _build_libuv(self, file_name):
cc.n('prepare libuv source code...', end='')
# return
if not os.path.exists(self.LIBUV_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
cc.n('build libuv...', end='')
@ -617,7 +535,6 @@ class BuilderMacOS(BuilderBase):
def _build_mbedtls(self, file_name):
if not os.path.exists(self.MBEDTLS_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
cc.n('build mbedtls...', end='')
@ -662,62 +579,31 @@ class BuilderMacOS(BuilderBase):
def _build_libssh(self, file_name):
if not os.path.exists(self.LIBSSH_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
# os.rename(os.path.join(self.PATH_TMP, 'master'), os.path.join(self.PATH_TMP, 'libssh-{}'.format(LIBSSH_VER)))
cc.n('build libssh...', end='')
if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh_threads.a')):
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')) and os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh_threads.a')):
if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')):
cc.w('already exists, skip.')
return
cc.v('')
build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')
# utils.makedirs(build_path)
# here is a bug in cmake v2.8.11 (default on ubuntu14), in FindOpenSSL.cmake,
# it parse opensslv.h, use regex like this:
# REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# but in openssl-1.0.2h, the version define line is:
# # define OPENSSL_VERSION_NUMBER 0x1000208fL
# notice there is a space char between # and define, so find openssl always fail.
# old_p = os.getcwd()
# os.chdir(build_path)
# cmd = 'cmake' \
# ' -DCMAKE_INSTALL_PREFIX={}' \
# ' -D_OPENSSL_VERSION={}' \
# ' -DOPENSSL_INCLUDE_DIR={}/include' \
# ' -DOPENSSL_LIBRARIES={}/lib' \
# ' -DCMAKE_BUILD_TYPE=Release' \
# ' -DWITH_GSSAPI=OFF' \
# ' -DWITH_ZLIB=OFF' \
# ' -DWITH_STATIC_LIB=ON' \
# ' -DWITH_PCAP=OFF' \
# ' -DWITH_EXAMPLES=OFF' \
# ' -DWITH_NACL=OFF' \
# ' ..'.format(self.PATH_RELEASE, OPENSSL_VER, self.PATH_RELEASE, self.PATH_RELEASE)
# cc.n(cmd)
# os.system(cmd)
# # os.system('make ssh_static ssh_threads_static')
# os.system('make ssh_static')
# # os.system('make install')
# os.chdir(old_p)
cmake_define = ' -DCMAKE_INSTALL_PREFIX={prefix}' \
' -D_OPENSSL_VERSION={oss_ver}' \
' -DOPENSSL_INCLUDE_DIR={ossl_inc}' \
' -DOPENSSL_LIBRARIES={ossl_lib}' \
cmake_define = ' -DCMAKE_INSTALL_PREFIX={path_release}' \
' -DOPENSSL_INCLUDE_DIR={path_release}/include' \
' -DOPENSSL_LIBRARIES={path_release}/lib' \
' -DWITH_SFTP=ON' \
' -DWITH_SERVER=ON' \
' -DWITH_STATIC_LIB=ON' \
' -DWITH_GSSAPI=OFF' \
' -DWITH_ZLIB=OFF' \
' -DWITH_STATIC_LIB=ON' \
' -DWITH_PCAP=OFF' \
' -DWITH_TESTING=OFF' \
' -DWITH_CLIENT_TESTING=OFF' \
' -DUNIT_TESTING=OFF' \
' -DWITH_EXAMPLES=OFF' \
' -DWITH_BENCHMARKS=OFF' \
' -DWITH_NACL=OFF' \
''.format(prefix=self.PATH_RELEASE, oss_ver=env.ver_ossl_number, ossl_inc=env.path_ossl_inc, ossl_lib=env.path_ossl_lib)
''.format(path_release=self.PATH_RELEASE)
try:
utils.cmake(build_path, 'Release', False, cmake_define)
@ -727,32 +613,18 @@ class BuilderMacOS(BuilderBase):
# because make install will fail because we can not disable ssh_shared target,
# so we copy necessary files ourselves.
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'libssh.a'))
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads', 'libssh_threads.a'))
# utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads', 'libssh_threads.a'))
utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh.a')
utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a')
# utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a')
utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'), os.path.join(self.PATH_RELEASE, 'include'), 'libssh')
# def _build_sqlite(self, file_name):
# if not os.path.exists(self.SQLITE_PATH_SRC):
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
#
# cc.n('build sqlite static...', end='')
# if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libsqlite3.a')):
# cc.w('already exists, skip.')
# return
# cc.v('')
#
# old_p = os.getcwd()
# os.chdir(self.SQLITE_PATH_SRC)
# os.system('./configure --prefix={}'.format(self.PATH_RELEASE))
# os.system('make')
# os.system('make install')
# os.chdir(old_p)
def _prepare_python(self):
pass
def fix_output(self):
# remove .so files, otherwise will link to .so but not .a in default.
# rm = ['libsqlite3.la', 'libsqlite3.so.0', 'libsqlite3.so', 'libsqlite3.so.0.8.6', 'libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
rm = ['libuv.la', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
rm = ['libuv.la', 'libuv.dylib', 'libuv.so.1', 'libuv.so', 'libuv.so.1.0.0']
for i in rm:
_path = os.path.join(self.PATH_RELEASE, 'lib', i)
if os.path.exists(_path):
@ -803,9 +675,6 @@ def main():
builder.build_mbedtls()
builder.build_libssh()
# do not need sqlite any more.
# builder.build_sqlite()
builder.fix_output()

View File

@ -46,7 +46,7 @@ class PYSBase:
utils.sys_exec('{} -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip --upgrade'.format(env.py_exec))
pip = self._get_pip()
pypi_modules = ['mako', 'pymysql', 'qrcode', 'tornado', 'wheezy.captcha', 'Pillow', 'psutil']
pypi_modules = ['ldap3', 'mako', 'Pillow', 'psutil', 'pymysql', 'qrcode', 'tornado', 'wheezy.captcha']
for p in pypi_modules:
cc.n('install {} ...'.format(p))
utils.sys_exec('{} install -i https://pypi.tuna.tsinghua.edu.cn/simple {}'.format(pip, p), direct_output=True)

View File

@ -27,7 +27,7 @@ class BuilderWin(BuilderBase):
if ctx.target_path == 'debug':
cc.w('cannot build debug version of tp_web, skip.')
else:
sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_web.exe')
if os.path.exists(out_file):
utils.remove(out_file)
@ -35,7 +35,7 @@ class BuilderWin(BuilderBase):
utils.ensure_file_exists(out_file)
cc.n('build core server ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'core', 'tp_core.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'core', 'tp_core.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_core.exe')
if os.path.exists(out_file):
utils.remove(out_file)
@ -43,7 +43,7 @@ class BuilderWin(BuilderBase):
utils.ensure_file_exists(out_file)
cc.n('build SSH protocol ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'ssh', 'tpssh.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'ssh', 'tpssh.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tpssh.dll')
if os.path.exists(out_file):
utils.remove(out_file)
@ -52,7 +52,7 @@ class BuilderWin(BuilderBase):
utils.copy_file(os.path.join(env.root_path, 'external', 'libssh', 'lib', ctx.target_path), os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path), 'ssh.dll')
cc.n('build TELNET protocol ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'telnet', 'tptelnet.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'telnet', 'tptelnet.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tptelnet.dll')
if os.path.exists(out_file):
utils.remove(out_file)
@ -61,7 +61,7 @@ class BuilderWin(BuilderBase):
if with_rdp:
cc.n('build RDP protocol ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'rdp', 'tprdp.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'rdp', 'tprdp.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tprdp.dll')
if os.path.exists(out_file):
utils.remove(out_file)
@ -91,7 +91,7 @@ class BuilderLinux(BuilderBase):
utils.makedirs(out_path)
utils.cmake(os.path.join(env.root_path, 'server', 'cmake-build'), ctx.target_path, False)
utils.cmake(os.path.join(env.root_path, 'cmake-build'), ctx.target_path, False)
# utils.strip(out_file)
for f in out_files:
@ -121,7 +121,7 @@ class BuilderMacOS(BuilderBase):
utils.makedirs(out_path)
utils.cmake(os.path.join(env.root_path, 'server', 'cmake-build'), ctx.target_path, False)
utils.cmake(os.path.join(env.root_path, 'cmake-build'), ctx.target_path, False)
# utils.strip(out_file)
for f in out_files:

View File

@ -141,7 +141,7 @@ class Builder:
self._update_ver_nsi(nsi_file, self.VER_TP_ASSIST)
def make_assist_macos_ver(self):
plist_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'src', 'tp_assist-Info.plist')
plist_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'src', 'TP-Assist-Info.plist')
self._update_ver_plist(plist_file, self.VER_TP_ASSIST)
ver_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'src', 'csrc', 'ts_ver.h')
@ -299,10 +299,10 @@ class Builder:
def _update_ver_nsi(self, nsiFilePath, ver):
""" update nsis file version info """
t_ver = ver.split('.')
while len(t_ver) < 4:
while len(t_ver) < 3:
t_ver.append('0')
if len(t_ver) > 4:
if len(t_ver) > 3:
raise RuntimeError('Invalid version for nsis file.')
bOK = False
@ -319,40 +319,23 @@ class Builder:
if nsiline.find('\n') != -1:
nsiline = nsiline[:-1]
if nsiline.find(" FILE_VER") != -1 or nsiline.find(" STR_FILE_VER") != -1:
# cc.v('[ver] old ver: %s' % nsiLines[x])
pos1 = nsiline.find('"')
pos2 = nsiline.rfind('"')
_ver = nsiline[pos1 + 1: pos2]
nsiSplitList = _ver.split(".")
if (len(nsiSplitList) != 4):
raise RuntimeError('Invalid .nsi file (1).')
if '.'.join(nsiSplitList) == ver:
continue
# nsiline = '%s\"%d.%d.%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor, self.revision, self.build)
nsiline = '%s\"%s.%s.%s.%s\"\n' % (nsiline[0:pos1], t_ver[0], t_ver[1], t_ver[2], t_ver[3])
if nsiline.startswith("!define FILE_VER"):
nsiline = '!define FILE_VER \"%s.%s.%s.0\"\n' % (t_ver[0], t_ver[1], t_ver[2])
nsiLines[x] = ""
nsiLines[x] = nsiline
# cc.v('[ver] new ver: %s' % nsiLines[x])
bOK = True
elif nsiline.find(" PRODUCT_VER") != -1:
# cc.v('[ver] old ver: %s' % nsiLines[x])
pos1 = nsiline.find('"')
pos2 = nsiline.rfind('"')
_ver = nsiline[pos1 + 1: pos2]
elif nsiline.startswith("!define OUT_VER"):
nsiline = '!define OUT_VER \"%s.%s.%s\"\n' % (t_ver[0], t_ver[1], t_ver[2])
nsiSplitList = _ver.split(".")
if (len(nsiSplitList) != 2):
raise RuntimeError('Invalid .nsi file (2).')
if '.'.join(nsiSplitList) == '%s.%s' % (t_ver[0], t_ver[1]):
continue
# nsiline = '%s\"%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor)
nsiline = '%s\"%s.%s\"\n' % (nsiline[0:pos1], t_ver[0], t_ver[1])
nsiLines[x] = ""
nsiLines[x] = nsiline
# cc.v('[ver] new ver: %s' % nsiLines[x])
bOK = True
elif nsiline.startswith("!define PRODUCT_VER"):
nsiline = '!define PRODUCT_VER \"%s.%s\"\n' % (t_ver[0], t_ver[1])
nsiLines[x] = ""
nsiLines[x] = nsiline
@ -396,24 +379,6 @@ class Builder:
if l.find('<key>CFBundleVersion</key>') != -1:
is_ver = True
continue
# pos1 = rcline.find(' FILEVERSION ')
# pos2 = rcline.rfind('\\0"')
# _ver = rcline[pos1 + 13: pos2].strip()
#
# rcSplitList = _ver.split(",")
# if (len(rcSplitList) < 4):
# rcSplitList = _ver.split(".")
# if (len(rcSplitList) < 4):
# raise RuntimeError('Invalid .rc file.')
# if '.'.join(rcSplitList) == ver:
# continue
#
# rcline = '%s%s,%s,%s,%s\n' % (rcline[0:pos1 + 13], t_ver[0], t_ver[1], t_ver[2], t_ver[3])
#
# rcLines[x] = ""
# rcLines[x] = rcline
# # cc.v('[ver] new ver: %s' % rcLines[x])
# bOK = True
if is_ver:
is_ver = False

View File

@ -111,7 +111,7 @@ class Env(object):
if self.nasm is None or not os.path.exists(self.nasm):
if warn_miss_tool:
cc.w(' - can not locate `nasm`, so I can build openssl.')
cc.w(' - can not locate `nasm`, so I can not build openssl.')
else:
_nasm_path = os.path.abspath(os.path.join(self.nasm, '..'))
os.environ['path'] = os.environ['path'] + ';' + _nasm_path
@ -123,12 +123,12 @@ class Env(object):
if self.perl is None or not os.path.exists(self.perl):
if warn_miss_tool:
cc.w(' - can not locate `perl`, so I can build openssl.')
cc.w(' - can not locate `perl`, so I can not build openssl.')
self.visual_studio_path = self._get_visual_studio_path()
if self.visual_studio_path is None or not os.path.exists(self.visual_studio_path):
if warn_miss_tool:
cc.w(' - can not locate Visual Studio installation, so I can build openssl.')
cc.w(' - can not locate Visual Studio installation, so I can build nothing.')
if 'msbuild' in _tmp:
self.msbuild = _tmp['msbuild']
@ -190,30 +190,40 @@ class Env(object):
return True
def _get_msbuild(self):
# 14.0 = VS2015
# 12.0 = VS2012
# 4.0 = VS2008
chk = ['14.0', '12.0', '4.0']
# def _get_msbuild(self):
# # 14.0 = VS2015
# # 12.0 = VS2012
# # 4.0 = VS2008
# chk = ['14.0', '12.0', '4.0']
p = None
for c in chk:
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\{}'.format(c), r'MSBuildToolsPath')
if p is not None:
break
# p = None
# for c in chk:
# p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\{}'.format(c), r'MSBuildToolsPath')
# if p is not None:
# break
return os.path.join(p[0], 'MSBuild.exe') if p is not None else None
# return os.path.join(p[0], 'MSBuild.exe') if p is not None else None
# def _get_visual_studio_path(self):
# chk = ['14.0', '12.0', '4.0']
# p = None
# for c in chk:
# p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\VisualStudio\{}'.format(c), r'ShellFolder')
# if p is not None:
# break
# return p[0] if p is not None else None
def _get_visual_studio_path(self):
chk = ['14.0', '12.0', '4.0']
p = None
for c in chk:
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\VisualStudio\{}'.format(c), r'ShellFolder')
if p is not None:
break
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7', r'15.0')
return p[0] if p is not None else None
def _get_msbuild(self):
vs2017 = self._get_visual_studio_path()
if vs2017 is None:
return None
return os.path.join(vs2017, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe')
def _get_perl(self):
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\perl', 'BinDir')
return p[0] if p is not None else None

View File

@ -50,29 +50,41 @@ def _check_download_file(file_name):
def download_file(desc, url, target_path, file_name):
cc.n('download {} ... '.format(desc), end='')
local_file_name = os.path.join(target_path, file_name)
if os.path.exists(local_file_name):
if not _check_download_file(local_file_name):
cc.w('already exists but broken, download it again...')
else:
cc.w('already exists, skip.')
return True
_temp_file = os.path.join(target_path, '_dl_{}'.format(file_name))
_real_file = os.path.join(target_path, file_name)
if os.path.exists(_temp_file):
cc.w('already exists but broken, download it again...')
remove(_temp_file)
remove(_real_file)
# if not _check_download_file(local_file_name):
# cc.w('already exists but broken, download it again...')
# else:
# cc.w('already exists, skip.')
# return True
if os.path.exists(_real_file):
cc.w('already exists, skip.')
return True
cc.v('')
# 因为下载过程会在命令行显示进度所以不能使用subprocess.Popen()的方式捕获输出,会很难看!
if env.is_win:
cmd = '""{}" --no-check-certificate {} -O "{}""'.format(env.wget, url, local_file_name)
cmd = '""{}" --no-check-certificate {} -O "{}""'.format(env.wget, url, _temp_file)
os.system(cmd)
elif env.is_linux or env.is_macos:
os.system('wget --no-check-certificate {} -O "{}"'.format(url, local_file_name))
os.system('wget --no-check-certificate {} -O "{}"'.format(url, _temp_file))
else:
cc.e('can not download, no download tool.')
return False
if not os.path.exists(local_file_name) or not _check_download_file(local_file_name):
if not os.path.exists(_temp_file) or not _check_download_file(_temp_file):
cc.e('downloading {} from {} failed.'.format(desc, url))
return False
os.rename(_temp_file, _real_file)
return True
@ -257,6 +269,7 @@ def ensure_file_exists(filename):
def sys_exec(cmd, direct_output=False, output_codec=None):
print(cmd)
if output_codec is None:
if env.is_win:
output_codec = 'gb2312'
@ -308,9 +321,6 @@ def msvc_build(sln_file, proj_name, target, platform, force_rebuild):
def xcode_build(proj_file, proj_name, target, force_rebuild):
# if env.msbuild is None:
# raise RuntimeError('where is `msbuild`?')
if force_rebuild:
cmd = 'xcodebuild -project "{}" -target {} -configuration {} clean'.format(proj_file, proj_name, target)
ret, _ = sys_exec(cmd, direct_output=True)
@ -322,6 +332,19 @@ def xcode_build(proj_file, proj_name, target, force_rebuild):
raise RuntimeError('build XCode project `{}` failed.'.format(proj_name))
def make_dmg(json_file, dmg_file):
out_path = os.path.dirname(dmg_file)
cc.v(out_path)
if not os.path.exists(out_path):
makedirs(out_path)
cmd = 'appdmg "{}" "{}"'.format(json_file, dmg_file)
ret, _ = sys_exec(cmd, direct_output=True)
if ret != 0:
raise RuntimeError('make dmg failed.')
def nsis_build(nsi_file, _define=''):
if env.nsis is None:
raise RuntimeError('where is `nsis`?')

View File

@ -1,3 +1,3 @@
# -*- coding: utf8 -*-
VER_TP_SERVER = "3.1.0"
VER_TP_ASSIST = "3.1.0"
VER_TP_SERVER = "3.2.0"
VER_TP_ASSIST = "3.2.0"

23
client/cfg/cacert.cer Normal file
View File

@ -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-----

28
client/cfg/localhost.key Normal file
View File

@ -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-----

24
client/cfg/localhost.pem Normal file
View File

@ -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-----

View File

@ -0,0 +1,113 @@
{
"file_version": 3,
"ssh": {
"selected": "terminal",
"available": [
{
"name":"terminal",
"display": "终端(系统自带)",
"app": "",
"cmdline": "Basic",
"desc": ["命令参数为终端偏好设置中描述文件的名称"]
},
{
"name": "iterm2",
"display": "iTerm2",
"app": "",
"cmdline": "Default",
"desc": ["命令参数为iTerm偏好设置中描述文件的名称"]
},
{
"name": "securecrt",
"display": "SecureCRT",
"app": "/Applications/SecureCRT.app/Contents/MacOS/SecureCRT",
"cmdline": "/T /N \"TP#ssh://{real_ip}\" /SSH2 /L {user_name} /PASSWORD **** {host_ip}:{host_port}",
"desc": []
},
{
"name": "other",
"display": "自定义",
"app": "",
"cmdline": "",
"desc": []
}
]
},
"sftp": {
"selected": "securefx",
"available": [
{
"name": "securefx",
"display": "SecureFX",
"app": "/Applications/SecureFX.app/Contents/MacOS/SecureFX",
"cmdline": "sftp://{user_name}:****@{host_ip}:{host_port}",
"desc": []
},
{
"name": "filezilla",
"display": "FileZilla",
"app": "/Applications/FileZilla.app/Contents/MacOS/filezilla",
"cmdline": "sftp://{user_name}:****@{host_ip}:{host_port}",
"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": ["命令参数为iTerm偏好设置中描述文件的名称"]
},
{
"name": "securecrt",
"display": "SecureCRT",
"app": "SecureCRT.app",
"cmdline": "/T /N \"TP#telnet://{real_ip}\" /TELNET {user_name}@{host_ip} {host_port}",
"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后需要重新启动计算机"
]
}
]
}
}

View File

@ -3,19 +3,26 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 51;
objects = {
/* Begin PBXBuildFile section */
0ADB3B0C178EF8DB004E9BB9 /* StatusIconAlt.png in Resources */ = {isa = PBXBuildFile; fileRef = 0ADB3B08178EF8DB004E9BB9 /* StatusIconAlt.png */; };
0ADB3B0D178EF8DB004E9BB9 /* StatusIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 0ADB3B09178EF8DB004E9BB9 /* StatusIcon.png */; };
0ADB3B0E178EF8DB004E9BB9 /* StatusIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0ADB3B0A178EF8DB004E9BB9 /* StatusIcon@2x.png */; };
0ADB3B0F178EF8DB004E9BB9 /* StatusIconAlt@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0ADB3B0B178EF8DB004E9BB9 /* StatusIconAlt@2x.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 */; };
7A1818931F815B8A00F3C882 /* Terminal.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 7A1818921F815B8A00F3C882 /* Terminal.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 */; };
@ -30,7 +37,8 @@
7AA2CD541F6AB9F10074C92B /* json_writer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD501F6AB9F10074C92B /* json_writer.cpp */; };
7AA2CD571F6ABA2E0074C92B /* mongoose.c in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD561F6ABA2E0074C92B /* mongoose.c */; };
7AA2CD591F6AC0DA0074C92B /* site in Resources */ = {isa = PBXBuildFile; fileRef = 7AA2CD581F6AC0DA0074C92B /* site */; };
7AD1F1D31F7A55EA0048A496 /* iTerm2.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 7AD1F1D11F7A55EA0048A496 /* iTerm2.scpt */; };
7AF9BF272199E3DE00BE5DBC /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF1F2199E31A00BE5DBC /* libssl.a */; };
7AF9BF292199E3DF00BE5DBC /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF282199E3DF00BE5DBC /* libcrypto.a */; };
A1B7B9DD1DB53ED200809327 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A1B7B9DF1DB53ED200809327 /* Localizable.strings */; };
A1D700071A5DCE8D003563E4 /* AboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A1D700061A5DCE8D003563E4 /* AboutWindowController.m */; };
C149EBFE15D5214600B1F558 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C149EBFD15D5214600B1F558 /* Cocoa.framework */; };
@ -44,17 +52,44 @@
/* Begin PBXFileReference section */
0ADB3B08178EF8DB004E9BB9 /* StatusIconAlt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = StatusIconAlt.png; sourceTree = "<group>"; };
0ADB3B09178EF8DB004E9BB9 /* StatusIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = StatusIcon.png; sourceTree = "<group>"; };
0ADB3B0A178EF8DB004E9BB9 /* StatusIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIcon@2x.png"; sourceTree = "<group>"; };
0ADB3B0B178EF8DB004E9BB9 /* StatusIconAlt@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIconAlt@2x.png"; sourceTree = "<group>"; };
7A18188E1F7D5D7F00F3C882 /* AppDelegate-C-Interface.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "AppDelegate-C-Interface.cpp"; sourceTree = "<group>"; };
7A1818901F7FBBC200F3C882 /* tp-assist.default.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "tp-assist.default.json"; sourceTree = "<group>"; };
7A1818921F815B8A00F3C882 /* Terminal.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = Terminal.scpt; sourceTree = "<group>"; };
7A1818951F8242E900F3C882 /* apple-scripts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "apple-scripts"; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
7A1F8799215D565600B69F88 /* ex_const.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_const.h; path = ../../../../common/libex/include/ex/ex_const.h; sourceTree = "<group>"; };
7A1F879B215D565600B69F88 /* ex_log.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_log.h; path = ../../../../common/libex/include/ex/ex_log.h; sourceTree = "<group>"; };
7A1F879C215D565600B69F88 /* ex_platform.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = ex_platform.h; path = ../../../../common/libex/include/ex/ex_platform.h; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
7A1F87A1215D56B500B69F88 /* writer.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = writer.h; path = ../../../../external/jsoncpp/include/json/writer.h; sourceTree = "<group>"; };
7A1F87A2215D570000B69F88 /* value.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = value.h; path = ../../../../external/jsoncpp/include/json/value.h; sourceTree = "<group>"; };
7A1F87A3215D570000B69F88 /* reader.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = reader.h; path = ../../../../external/jsoncpp/include/json/reader.h; sourceTree = "<group>"; };
7A1F87A4215D570000B69F88 /* json.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = json.h; path = ../../../../external/jsoncpp/include/json/json.h; sourceTree = "<group>"; };
7A1F87A5215D574400B69F88 /* config.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = config.h; path = ../../../../external/jsoncpp/include/json/config.h; sourceTree = "<group>"; };
7A1F87A6215D574500B69F88 /* features.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = features.h; path = ../../../../external/jsoncpp/include/json/features.h; sourceTree = "<group>"; };
7A1F87A7215D574500B69F88 /* forwards.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = forwards.h; path = ../../../../external/jsoncpp/include/json/forwards.h; sourceTree = "<group>"; };
7A1F87A8215D574500B69F88 /* assertions.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = assertions.h; path = ../../../../external/jsoncpp/include/json/assertions.h; sourceTree = "<group>"; };
7A1F87A9215D574500B69F88 /* autolink.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = autolink.h; path = ../../../../external/jsoncpp/include/json/autolink.h; sourceTree = "<group>"; };
7A1F87AA215D574500B69F88 /* version.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = version.h; path = ../../../../external/jsoncpp/include/json/version.h; sourceTree = "<group>"; };
7A1F87AF215D5A1600B69F88 /* StatusIconAlt@2X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIconAlt@2X.png"; sourceTree = "<group>"; };
7A1F87B0215D5A1600B69F88 /* StatusIcon@2X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIcon@2X.png"; sourceTree = "<group>"; };
7A27E4A61F6A899B004FDE5D /* ts_const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ts_const.h; sourceTree = "<group>"; };
7A27E4A71F6A8EEC004FDE5D /* ts_env.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ts_env.cpp; sourceTree = "<group>"; };
7A27E4A81F6A8EEC004FDE5D /* ts_env.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ts_env.h; sourceTree = "<group>"; };
7A40FFE21F7B2A4500F11697 /* AppDelegate-C-Interface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate-C-Interface.h"; sourceTree = "<group>"; };
7AA2CD361F6A92380074C92B /* ts_http_rpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ts_http_rpc.h; sourceTree = "<group>"; };
7A7C6C8F21973C24006869D9 /* StatusIconAlt@3X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIconAlt@3X.png"; sourceTree = "<group>"; };
7A7C6C9021973C24006869D9 /* StatusIcon@3X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIcon@3X.png"; sourceTree = "<group>"; };
7A7C6C9521973C69006869D9 /* tpassist.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tpassist.png; sourceTree = "<group>"; };
7A7C6C9921974094006869D9 /* cacert.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = cacert.cer; path = ../cfg/cacert.cer; sourceTree = SOURCE_ROOT; };
7A7C6C9A21974094006869D9 /* localhost.key */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.key; path = ../cfg/localhost.key; sourceTree = SOURCE_ROOT; };
7A7C6C9B21974094006869D9 /* localhost.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.pem; path = ../cfg/localhost.pem; sourceTree = SOURCE_ROOT; };
7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "tp-assist.macos.json"; path = "../cfg/tp-assist.macos.json"; sourceTree = SOURCE_ROOT; };
7A7C6CA12197786B006869D9 /* ts_ver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ts_ver.h; sourceTree = "<group>"; };
7A7C6CA821977F07006869D9 /* iterm2.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = iterm2.scpt; sourceTree = "<group>"; };
7A7C6CA921977F07006869D9 /* terminal.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = terminal.scpt; sourceTree = "<group>"; };
7AA2CD361F6A92380074C92B /* ts_http_rpc.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 2147486000; path = ts_http_rpc.h; sourceTree = "<group>"; };
7AA2CD371F6A92620074C92B /* ts_http_rpc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ts_http_rpc.cpp; sourceTree = "<group>"; };
7AA2CD391F6A955A0074C92B /* ts_cfg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ts_cfg.cpp; sourceTree = "<group>"; };
7AA2CD3A1F6A955A0074C92B /* ts_cfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ts_cfg.h; sourceTree = "<group>"; };
@ -66,13 +101,17 @@
7AA2CD421F6AB9750074C92B /* ex_util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ex_util.cpp; path = ../../../../common/libex/src/ex_util.cpp; sourceTree = "<group>"; };
7AA2CD431F6AB9750074C92B /* ex_winsrv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ex_winsrv.cpp; path = ../../../../common/libex/src/ex_winsrv.cpp; sourceTree = "<group>"; };
7AA2CD4C1F6AB9F10074C92B /* json_reader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_reader.cpp; path = ../../../../external/jsoncpp/src/lib_json/json_reader.cpp; sourceTree = "<group>"; };
7AA2CD4D1F6AB9F10074C92B /* json_tool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json_tool.h; path = ../../../../external/jsoncpp/src/lib_json/json_tool.h; sourceTree = "<group>"; };
7AA2CD4D1F6AB9F10074C92B /* json_tool.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; name = json_tool.h; path = ../../../../external/jsoncpp/src/lib_json/json_tool.h; sourceTree = "<group>"; };
7AA2CD4E1F6AB9F10074C92B /* json_value.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_value.cpp; path = ../../../../external/jsoncpp/src/lib_json/json_value.cpp; sourceTree = "<group>"; };
7AA2CD4F1F6AB9F10074C92B /* json_valueiterator.inl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_valueiterator.inl; path = ../../../../external/jsoncpp/src/lib_json/json_valueiterator.inl; sourceTree = "<group>"; };
7AA2CD501F6AB9F10074C92B /* json_writer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_writer.cpp; path = ../../../../external/jsoncpp/src/lib_json/json_writer.cpp; sourceTree = "<group>"; };
7AA2CD561F6ABA2E0074C92B /* mongoose.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mongoose.c; path = ../../../../external/mongoose/mongoose.c; sourceTree = "<group>"; };
7AA2CD581F6AC0DA0074C92B /* site */ = {isa = PBXFileReference; lastKnownFileType = folder; path = site; sourceTree = "<group>"; };
7AD1F1D11F7A55EA0048A496 /* iTerm2.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTerm2.scpt; sourceTree = "<group>"; };
7AF9BF1F2199E31A00BE5DBC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = ../../external/macos/release/lib/libssl.a; sourceTree = "<group>"; };
7AF9BF212199E32B00BE5DBC /* libmbedx509.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedx509.a; path = ../../external/macos/release/lib/libmbedx509.a; sourceTree = "<group>"; };
7AF9BF222199E32B00BE5DBC /* libmbedtls.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedtls.a; path = ../../external/macos/release/lib/libmbedtls.a; sourceTree = "<group>"; };
7AF9BF232199E32B00BE5DBC /* libmbedcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedcrypto.a; path = ../../external/macos/release/lib/libmbedcrypto.a; sourceTree = "<group>"; };
7AF9BF282199E3DF00BE5DBC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../../external/macos/release/lib/libcrypto.a; sourceTree = "<group>"; };
A1B7B9D31DB5361700809327 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
A1B7B9DE1DB53ED200809327 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
A1B7B9E01DB53ED700809327 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -84,18 +123,18 @@
A1B7B9F11DB54D8C00809327 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/AboutWindowController.strings"; sourceTree = "<group>"; };
A1D700051A5DCDF4003563E4 /* AboutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutWindowController.h; sourceTree = "<group>"; };
A1D700061A5DCE8D003563E4 /* AboutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AboutWindowController.m; sourceTree = "<group>"; };
C149EBF915D5214600B1F558 /* tp_assist.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = tp_assist.app; sourceTree = BUILT_PRODUCTS_DIR; };
C149EBF915D5214600B1F558 /* TP-Assist.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TP-Assist.app"; sourceTree = BUILT_PRODUCTS_DIR; };
C149EBFD15D5214600B1F558 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
C149EC0015D5214600B1F558 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
C149EC0115D5214600B1F558 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
C149EC0215D5214600B1F558 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
C149EC0515D5214600B1F558 /* tp_assist-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "tp_assist-Info.plist"; sourceTree = "<group>"; };
C149EC0515D5214600B1F558 /* TP-Assist-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TP-Assist-Info.plist"; sourceTree = "<group>"; };
C149EC0715D5214600B1F558 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
C149EC0915D5214600B1F558 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
C149EC0B15D5214600B1F558 /* tp_assist-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tp_assist-Prefix.pch"; sourceTree = "<group>"; };
C149EC0B15D5214600B1F558 /* TP-Assist-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TP-Assist-Prefix.pch"; sourceTree = "<group>"; };
C149EC0F15D5214600B1F558 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
C149EC1015D5214600B1F558 /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
C159DC2715D5DE7F00F5DE24 /* teleport.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = teleport.icns; path = ../teleport.icns; sourceTree = "<group>"; };
C159DC2715D5DE7F00F5DE24 /* teleport.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = teleport.icns; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -104,6 +143,8 @@
buildActionMask = 2147483647;
files = (
C149EBFE15D5214600B1F558 /* Cocoa.framework in Frameworks */,
7AF9BF292199E3DF00BE5DBC /* libcrypto.a in Frameworks */,
7AF9BF272199E3DE00BE5DBC /* libssl.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -113,17 +154,41 @@
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 */,
0ADB3B0A178EF8DB004E9BB9 /* StatusIcon@2x.png */,
0ADB3B08178EF8DB004E9BB9 /* StatusIconAlt.png */,
0ADB3B0B178EF8DB004E9BB9 /* StatusIconAlt@2x.png */,
);
name = Images;
sourceTree = "<group>";
};
7A45423D2196E32800FEB5B4 /* cfg */ = {
isa = PBXGroup;
children = (
7A7C6C9921974094006869D9 /* cacert.cer */,
7A7C6C9A21974094006869D9 /* localhost.key */,
7A7C6C9B21974094006869D9 /* localhost.pem */,
7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */,
);
name = cfg;
path = ../cfg;
sourceTree = SOURCE_ROOT;
};
7AA2CD3C1F6AB9560074C92B /* libex */ = {
isa = PBXGroup;
children = (
7A1F8799215D565600B69F88 /* ex_const.h */,
7A1F8798215D565600B69F88 /* ex_ini.h */,
7A1F879B215D565600B69F88 /* ex_log.h */,
7A1F879F215D565700B69F88 /* ex_path.h */,
7A1F879C215D565600B69F88 /* ex_platform.h */,
7A1F879E215D565700B69F88 /* ex_str.h */,
7A1F87A0215D565700B69F88 /* ex_thread.h */,
7A1F879D215D565600B69F88 /* ex_types.h */,
7A1F8797215D565600B69F88 /* ex_util.h */,
7AA2CD3D1F6AB9750074C92B /* ex_ini.cpp */,
7AA2CD3E1F6AB9750074C92B /* ex_log.cpp */,
7AA2CD3F1F6AB9750074C92B /* ex_path.cpp */,
@ -138,6 +203,16 @@
7AA2CD4B1F6AB9880074C92B /* jsoncpp */ = {
isa = PBXGroup;
children = (
7A1F87A8215D574500B69F88 /* assertions.h */,
7A1F87A9215D574500B69F88 /* autolink.h */,
7A1F87A5215D574400B69F88 /* config.h */,
7A1F87A6215D574500B69F88 /* features.h */,
7A1F87A7215D574500B69F88 /* forwards.h */,
7A1F87AA215D574500B69F88 /* version.h */,
7A1F87A4215D570000B69F88 /* json.h */,
7A1F87A3215D570000B69F88 /* reader.h */,
7A1F87A2215D570000B69F88 /* value.h */,
7A1F87A1215D56B500B69F88 /* writer.h */,
7AA2CD4C1F6AB9F10074C92B /* json_reader.cpp */,
7AA2CD4D1F6AB9F10074C92B /* json_tool.h */,
7AA2CD4E1F6AB9F10074C92B /* json_value.cpp */,
@ -168,15 +243,23 @@
7A27E4A71F6A8EEC004FDE5D /* ts_env.cpp */,
7A27E4A81F6A8EEC004FDE5D /* ts_env.h */,
7A27E4A61F6A899B004FDE5D /* ts_const.h */,
7A7C6CA12197786B006869D9 /* ts_ver.h */,
);
path = csrc;
sourceTree = "<group>";
};
7AF9BF1E2199E0DD00BE5DBC /* mbedtls */ = {
isa = PBXGroup;
children = (
);
name = mbedtls;
sourceTree = "<group>";
};
A12D9BE61BCF2C72004F52A6 /* apple-scpt */ = {
isa = PBXGroup;
children = (
7A1818921F815B8A00F3C882 /* Terminal.scpt */,
7AD1F1D11F7A55EA0048A496 /* iTerm2.scpt */,
7A7C6CA821977F07006869D9 /* iterm2.scpt */,
7A7C6CA921977F07006869D9 /* terminal.scpt */,
);
path = "apple-scpt";
sourceTree = "<group>";
@ -186,16 +269,16 @@
children = (
7A1818951F8242E900F3C882 /* apple-scripts */,
7AA2CD581F6AC0DA0074C92B /* site */,
C149EC0315D5214600B1F558 /* src */,
C149EBFC15D5214600B1F558 /* Frameworks */,
C149EBFA15D5214600B1F558 /* Products */,
C149EC0315D5214600B1F558 /* src */,
);
sourceTree = "<group>";
};
C149EBFA15D5214600B1F558 /* Products */ = {
isa = PBXGroup;
children = (
C149EBF915D5214600B1F558 /* tp_assist.app */,
C149EBF915D5214600B1F558 /* TP-Assist.app */,
);
name = Products;
sourceTree = "<group>";
@ -203,6 +286,11 @@
C149EBFC15D5214600B1F558 /* Frameworks */ = {
isa = PBXGroup;
children = (
7AF9BF282199E3DF00BE5DBC /* libcrypto.a */,
7AF9BF232199E32B00BE5DBC /* libmbedcrypto.a */,
7AF9BF222199E32B00BE5DBC /* libmbedtls.a */,
7AF9BF212199E32B00BE5DBC /* libmbedx509.a */,
7AF9BF1F2199E31A00BE5DBC /* libssl.a */,
C149EBFD15D5214600B1F558 /* Cocoa.framework */,
C149EBFF15D5214600B1F558 /* Other Frameworks */,
);
@ -222,10 +310,11 @@
C149EC0315D5214600B1F558 /* src */ = {
isa = PBXGroup;
children = (
7A1818901F7FBBC200F3C882 /* tp-assist.default.json */,
7AF9BF1E2199E0DD00BE5DBC /* mbedtls */,
7A45423D2196E32800FEB5B4 /* cfg */,
7AD3E8741F6A7CC600D2EB48 /* csrc */,
A12D9BE61BCF2C72004F52A6 /* apple-scpt */,
C159DC2715D5DE7F00F5DE24 /* teleport.icns */,
C149EC0915D5214600B1F558 /* main.m */,
C149EC0F15D5214600B1F558 /* AppDelegate.h */,
C149EC1015D5214600B1F558 /* AppDelegate.mm */,
C149EC1215D5214600B1F558 /* MainMenu.xib */,
@ -243,10 +332,10 @@
C149EC0415D5214600B1F558 /* Supporting Files */ = {
isa = PBXGroup;
children = (
C149EC0515D5214600B1F558 /* tp_assist-Info.plist */,
C159DC2715D5DE7F00F5DE24 /* teleport.icns */,
C149EC0515D5214600B1F558 /* TP-Assist-Info.plist */,
C149EC0615D5214600B1F558 /* InfoPlist.strings */,
C149EC0915D5214600B1F558 /* main.m */,
C149EC0B15D5214600B1F558 /* tp_assist-Prefix.pch */,
C149EC0B15D5214600B1F558 /* TP-Assist-Prefix.pch */,
A1B7B9DF1DB53ED200809327 /* Localizable.strings */,
);
name = "Supporting Files";
@ -255,9 +344,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
C149EBF815D5214600B1F558 /* tp_assist */ = {
C149EBF815D5214600B1F558 /* TP-Assist */ = {
isa = PBXNativeTarget;
buildConfigurationList = C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "tp_assist" */;
buildConfigurationList = C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "TP-Assist" */;
buildPhases = (
C149EBF515D5214600B1F558 /* Sources */,
C149EBF615D5214600B1F558 /* Frameworks */,
@ -267,9 +356,9 @@
);
dependencies = (
);
name = tp_assist;
name = "TP-Assist";
productName = Shuttle;
productReference = C149EBF915D5214600B1F558 /* tp_assist.app */;
productReference = C149EBF915D5214600B1F558 /* TP-Assist.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@ -279,10 +368,19 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = eomsoft;
ORGANIZATIONNAME = TP4A;
TargetAttributes = {
C149EBF815D5214600B1F558 = {
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 0;
};
};
};
};
};
buildConfigurationList = C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "tp_assist" */;
compatibilityVersion = "Xcode 3.2";
buildConfigurationList = C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "TP-Assist" */;
compatibilityVersion = "Xcode 10.0";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
@ -295,7 +393,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
C149EBF815D5214600B1F558 /* tp_assist */,
C149EBF815D5214600B1F558 /* TP-Assist */,
);
};
/* End PBXProject section */
@ -307,17 +405,23 @@
files = (
7AA2CD591F6AC0DA0074C92B /* site in Resources */,
A1B7B9DD1DB53ED200809327 /* Localizable.strings in Resources */,
0ADB3B0D178EF8DB004E9BB9 /* StatusIcon.png in Resources */,
0ADB3B0C178EF8DB004E9BB9 /* StatusIconAlt.png in Resources */,
C149EC0815D5214600B1F558 /* InfoPlist.strings in Resources */,
0ADB3B0F178EF8DB004E9BB9 /* StatusIconAlt@2x.png in Resources */,
7AD1F1D31F7A55EA0048A496 /* iTerm2.scpt in Resources */,
0ADB3B0E178EF8DB004E9BB9 /* StatusIcon@2x.png 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 */,
7A1818931F815B8A00F3C882 /* Terminal.scpt 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;
};
@ -399,6 +503,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -442,9 +547,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;
};
@ -454,6 +560,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -490,8 +597,9 @@
../../external/mongoose,
../../external/jsoncpp/include,
);
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.10;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
};
name = Release;
};
@ -501,11 +609,24 @@
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
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;
GCC_PREFIX_HEADER = "src/TP-Assist-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
MG_ENABLE_SSL,
);
HEADER_SEARCH_PATHS = (
../../common/teleport,
../../common/libex/include,
../../external/mongoose,
../../external/jsoncpp/include,
../../external/macos/release/include,
);
INFOPLIST_FILE = "src/TP-Assist-Info.plist";
LIBRARY_SEARCH_PATHS = ../../external/macos/release/lib;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = "teleport.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = x86_64;
WRAPPER_EXTENSION = app;
};
name = Debug;
@ -516,11 +637,21 @@
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
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;
GCC_PREFIX_HEADER = "src/TP-Assist-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = MG_ENABLE_SSL;
HEADER_SEARCH_PATHS = (
../../common/teleport,
../../common/libex/include,
../../external/mongoose,
../../external/jsoncpp/include,
../../external/macos/release/include,
);
INFOPLIST_FILE = "src/TP-Assist-Info.plist";
LIBRARY_SEARCH_PATHS = ../../external/macos/release/lib;
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = "teleport.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = x86_64;
WRAPPER_EXTENSION = app;
};
name = Release;
@ -528,7 +659,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "tp_assist" */ = {
C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "TP-Assist" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C149EC1515D5214600B1F558 /* Debug */,
@ -537,7 +668,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "tp_assist" */ = {
C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "TP-Assist" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C149EC1815D5214600B1F558 /* Debug */,

8
client/tp_assist_macos/apple-scripts/compile.sh Normal file → Executable file
View File

@ -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

View File

@ -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

View File

@ -10,7 +10,7 @@ on CommandRun(theCmd, theProfile, theTitle)
if it is not running then
tell application "iTerm"
activate
delay 0.2
delay 0.5
try
close first window
end try
@ -24,9 +24,12 @@ on CommandRun(theCmd, theProfile, theTitle)
end try
tell the current window
tell the current session
delay 0.5
set name to theTitle
set profile to theProfile
write text theCmd
delay 0.5
write text ""
end tell
end tell
end tell
@ -43,14 +46,18 @@ on CommandRun(theCmd, theProfile, theTitle)
end try
tell the current tab
tell the current session
delay 0.5
set name to theTitle
write text theCmd
delay 0.5
write text ""
end tell
end tell
end tell
end tell
on error msg
--if all iTerm windows are closed the app stays open. In this scenario iTerm has no "current window" and will give an error when trying to create the new tab.
-- if all iTerm windows are closed the app stays open. In this scenario iTerm has
-- no "current window" and will give an error when trying to create the new tab.
tell application "iTerm"
try
create window with profile theProfile
@ -59,8 +66,11 @@ on CommandRun(theCmd, theProfile, theTitle)
end try
tell the current window
tell the current session
delay 0.5
set name to theTitle
write text theCmd
delay 0.5
write text ""
end tell
end tell
end tell

View File

@ -0,0 +1,76 @@
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
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

View File

@ -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 */
@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}.content .desc{margin-top:5px;color:#6b6b6b}.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}

View File

@ -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"}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -1,105 +1,207 @@
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8"><![endif]-->
<!--[if !IE]><!-->
<html lang="zh_CN">
<!--<![endif]-->
<head>
<meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>TELEPORT助手配置</title>
<link rel="shortcut icon" href="favicon.png">
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="plugins/gritter/css/jquery.gritter.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="header">
<div class="header">
<div class="container">
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport 助手本地配置</span>
<span class="sub-title" id="version"></span>
</div>
</div>
<div class="header-fix"></div>
<div class="footer">
<div class="container">
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | &copy;2015 - 2018保留所有权利。</p>
</div>
</div>
<div class="container">
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport助手本地配置</span>
<span class="sub-title">此处配置保存到本地计算机上,如果更换计算机,需要重新配置!</span>
</div>
</div>
<div class="header-fix"></div>
<div class="footer">
<div class="container">
<p><a href="http://www.tp4a.com/" target="_blank">TELEPORT</a> | &copy;2015 - 2018保留所有权利。</p>
</div>
</div>
<div class="content">
<div class="arg-detail arg-detail-common">
<p><strong>此处配置保存到本地计算机上,如果更换计算机,需要重新配置!</strong></p>
<span><strong>注意:</strong>命令行参数设置中,可以用以下变量替换(注意大小写!):</span>
<ul>
<li><span class="arg-varb">{host_ip}</span> 替换主机IP地址</li>
<li><span class="arg-varb">{host_port}</span> 替换主机端口号</li>
<li><span class="arg-varb">{user_name}</span> 替换用户名</li>
<li><span class="arg-varb">{real_ip}</span> 替换为远程主机真实IP仅用于显示例如客户端的窗口标题或标签页标题等</li>
<li><span class="arg-varb">{assist_tools_path}</span> 替换为助手工具所在的tools目录的绝对路径</li>
</ul>
</div>
<div class="container">
<hr/>
<p class="cfg-title">本地 SSH 客户端配置</p>
<div class="content">
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="ssh-type" class="form-control"></select>
</div>
</div>
<hr/>
<p class="cfg-title">本地终端配置用于SSH</p>
<div class="form-group form-group-sm">
<label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<input id="ssh-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径">
</div>
</div>
<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-3">
<select id="term-type" class="form-control"></select>
<div class="form-group form-group-sm">
<label for="ssh-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="ssh-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
<div id="ssh-desc"></div>
</div>
</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-3">
<input id="term-profile" type="text" class="form-control input-args"/>
<hr/>
<p class="cfg-title">本地 SFTP 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="sftp-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="sftp-type" class="form-control"></select>
</div>
</div>
<div class="form-group form-group-sm">
<label for="sftp-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<input id="sftp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径">
</div>
</div>
<div class="form-group form-group-sm">
<label for="sftp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="sftp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
<div id="sftp-desc"></div>
</div>
</div>
</div>
<!-- <hr/>-->
<!-- <p class="cfg-title">本地 TELNET 客户端配置</p>-->
<!---->
<!-- <div class="form-horizontal">-->
<!-- <div class="form-group form-group-sm">-->
<!-- <label for="telnet-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>-->
<!-- <div class="col-sm-4">-->
<!-- <select id="telnet-type" class="form-control"></select>-->
<!-- </div>-->
<!-- </div>-->
<!---->
<!-- <div class="form-group form-group-sm">-->
<!-- <label for="telnet-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>-->
<!-- <div class="col-sm-9">-->
<!-- <input id="telnet-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径">-->
<!-- </div>-->
<!-- </div>-->
<!---->
<!-- <div class="form-group form-group-sm">-->
<!-- <label for="telnet-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>-->
<!-- <div class="col-sm-9">-->
<!-- <input id="telnet-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />-->
<!--<div id="telnet-desc"></div>-->
<!-- </div>-->
<!-- </div>-->
<!---->
<!-- </div>-->
<hr/>
<p class="cfg-title">本地 RDP 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="rdp-type" class="form-control"></select>
</div>
</div>
<div class="form-group form-group-sm">
<label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<input id="rdp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径">
</div>
</div>
<div class="form-group form-group-sm">
<label for="rdp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="rdp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
<div id="rdp-desc"></div>
<!-- <div class="desc"><i class="fa fa-info-circle"></i> 建议使用homebrew安装freerdp安装后freerdp默认路径在/usr/local/Cellar/freerdp/x.y.z/bin/xfreerdp</div>-->
<!-- <div class="desc"><i class="fa fa-info-circle"></i> 首次安装freerdp后需要重新启动计算机</div>-->
</div>
</div>
</div>
<hr/>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<div class="col-sm-2"></div>
<div class="col-sm-6">
<a id="btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>
</div>
</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-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>
<script type="text/javascript" src="plugins/underscore/underscore-min.js"></script>
<script type="text/javascript" src="plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="plugins/html5shiv/html5shiv.min.js"></script>
<![endif]-->
<!--<script type="text/javascript" src="js/json2.js"></script>-->
<script type="text/javascript" src="plugins/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="plugins/keypress/keypress.min.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="plugins/underscore/underscore-min.js"></script>
<script type="text/javascript" src="plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="plugins/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="plugins/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="plugins/keypress/keypress.min.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript">
</script>
<script type="text/javascript">
</script>
</body>
</html>

View File

@ -5,16 +5,54 @@ 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_desc: $('#ssh-desc'),
sftp_type: $('#sftp-type'),
sftp_app: $('#sftp-app'),
sftp_cmdline: $('#sftp-cmdline'),
sftp_desc: $('#sftp-desc'),
telnet_type: $('#telnet-type'),
telnet_app: $('#telnet-app'),
telnet_cmdline: $('#telnet-cmdline'),
telnet_desc: $('#telnet-desc'),
rdp_type: $('#rdp-type'),
rdp_app: $('#rdp-app'),
rdp_cmdline: $('#rdp-cmdline'),
rdp_desc: $('#rdp-desc'),
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 +62,128 @@ 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('<option id="term-' + item.name + '" value="' + item.name + '">' + item.display + '</option>');
html.push('<option value="' + item.name + '">' + item.display + '</option>');
}
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.ssh_type).trigger('change');
}
}
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('<option value="' + item.name + '">' + item.display + '</option>');
}
dom.sftp_type.html(html.join(''));
dom.sftp_type.val(selected);
dom.sftp_app.val(app);
dom.sftp_cmdline.val(cmdline);
$(dom.sftp_type).trigger('change');
}
}
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('<option value="' + item.name + '">' + item.display + '</option>');
}
dom.telnet_type.html(html.join(''));
dom.telnet_type.val(selected);
dom.telnet_app.val(app);
dom.telnet_cmdline.val(cmdline);
$(dom.telnet_type).trigger('change');
}
}
dom.rdp_type.html('');
if (!_.isUndefined(g_cfg.rdp)) {
if (_.isUndefined(g_cfg.rdp.selected)) {
g_cfg.rdp.selected = '';
@ -77,6 +192,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 +201,57 @@ function update_dom() {
if (selected === '' || item.name === g_cfg.rdp.selected) {
selected = item.name;
app = item.app;
cmdline = item.cmdline;
}
html.push('<option id="rdp-' + item.name + '" value="' + item.name + '">' + item.display + '</option>');
html.push('<option value="' + item.name + '">' + item.display + '</option>');
}
dom.rdp_type.html(html.join(''));
dom.rdp_type.val(selected);
dom.rdp_app.val(app);
dom.rdp_cmdline.val(cmdline);
$(dom.rdp_type).trigger('change');
}
}
}
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 +278,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,16 +325,91 @@ function notify_success(message_, title_) {
});
};
$(document).ready(function () {
get_version();
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);
var html = [];
for(var j = 0; j < item.desc.length; j++) {
html.push('<div class="desc"><i class="fa fa-info-circle"></i> ' + item.desc[j] + '</div>');
}
dom.ssh_desc.html(html.join(''));
return;
}
}
notify_error('所选的配置项不存在!');
});
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);
var html = [];
for(var j = 0; j < item.desc.length; j++) {
html.push('<div class="desc"><i class="fa fa-info-circle"></i> ' + item.desc[j] + '</div>');
}
dom.sftp_desc.html(html.join(''));
return;
}
}
notify_error('所选的配置项不存在!');
});
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);
var html = [];
for(var j = 0; j < item.desc.length; j++) {
html.push('<div class="desc"><i class="fa fa-info-circle"></i> ' + item.desc[j] + '</div>');
}
dom.telnet_desc.html(html.join(''));
return;
}
}
notify_error('所选的配置项不存在!');
});
dom.rdp_type.change(function () {
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);
var html = [];
for(var j = 0; j < item.desc.length; j++) {
html.push('<div class="desc"><i class="fa fa-info-circle"></i> ' + item.desc[j] + '</div>');
}
dom.rdp_desc.html(html.join(''));
return;
}
}
notify_error('所选的配置项不存在!');
});
get_config();
dom.term_type.change(function () {
on_term_change();
});
dom.rdp_type.change(function () {
on_rdp_change();
});
dom.btn_save.click(function () {
on_save();

View File

@ -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;
@ -104,6 +98,12 @@ html, body {
.input-args {
font-family: @font-family-mono;
}
.desc {
// display:inline-block;
margin-top:5px;
color:rgb(107, 107, 107);
}
}
.arg-varb {
@ -111,7 +111,7 @@ html, body {
font-weight: bold;
font-family: @font-family-mono;
display: inline-block;
width: 128px;
width: 164px;
//margin-right:20px;
}

View File

@ -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 {

View File

@ -3,7 +3,6 @@
// tp_assist
//
// Created by ApexLiu on 2017/9/29.
// Copyright © 2017年 eomsoft. All rights reserved.
//
#include "AppDelegate-C-Interface.h"

View File

@ -3,13 +3,13 @@
// tp_assist
//
// Created by ApexLiu on 2017/9/27.
// Copyright © 2017年 eomsoft. All rights reserved.
//
#ifndef wrap_c_objc_h
#define wrap_c_objc_h
int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char* term_type, const char* term_theme, const char* term_title);
int AppDelegate_select_app (void *_self);
// for cpp global object initialize.
int cpp_main(void* _self, const char* cfg_file, const char* res_path);

View File

@ -16,5 +16,6 @@
}
- (int) start_ssh_client:(NSString*)cmd_line termType:(NSString*)term_type termTheme:(NSString*)term_theme termTitle:(NSString*)term_title;
- (int) select_app:(NSString*)ignore;
@end

View File

@ -37,6 +37,11 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char*
return [(__bridge id)_self start_ssh_client:cmdLine termType:termType termTheme:termTheme termTitle:termTitle];
}
int AppDelegate_select_app (void *_self) {
NSString* strIgnore = @"";
return [(__bridge id)_self select_app:strIgnore];
}
- (void) awakeFromNib {
// The path for the configuration file (by default: ~/.tp_assist.ini)
@ -44,59 +49,55 @@ 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];
}
// Define Icons
//only regular icon is needed for 10.10 and higher. OS X changes the icon for us.
regularIcon = [NSImage imageNamed:@"StatusIcon"];
altIcon = [NSImage imageNamed:@"StatusIconAlt"];
[regularIcon setTemplate:YES];
// TODO: 现在statusIcon有两个问题
// 1. 不会响应系统设置“暗色菜单栏和Dock”的事件
// 2. 即使是设置为暗色系,启动本程序也会使用黑色图标,导致在菜单栏中看不到图标。
// 因此,应该响应系统的设置菜单栏颜色的事件,同时启动前先获取菜单栏的色系。
altIcon = [NSImage imageNamed:@"StatusIconAlt"];
// Create the status bar item
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
[statusItem setMenu:menu];
[statusItem setImage: regularIcon];
[statusItem setHighlightMode:YES];
[statusItem setAlternateImage: altIcon];
[statusItem setAlternateImage: altIcon];
// 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];
std::string cpp_cfg_file = [cfgFile cStringUsingEncoding:NSUTF8StringEncoding];
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;
http_rpc_stop();
NSString *msg = Nil;
if(ret == -1)
msg = @"初始化运行环境失败!";
else if(ret == -2)
msg = @"加载配置文件失败!";
msg = @"加载配置文件失败!\n\n请删除 ~/.tp-assist.json 后重试!";
else if(ret == -3)
msg = @"启动本地通讯端口失败请检查本地50022端口是否被占用";
msg = @"启动本地通讯端口失败!\n\n请检查本地50022和50023端口是否被占用";
else
msg = @"发生未知错误!";
NSAlert *alert = [NSAlert alertWithMessageText:@"无法启动Teleport助手"
defaultButton:@"确定"
alternateButton:Nil
otherButton:Nil
informativeTextWithFormat:msg];
[alert runModal];
http_rpc_stop();
NSAlert *alert = [[NSAlert alloc] init];
alert.icon = [NSImage imageNamed:@"tpassist"];
[alert addButtonWithTitle:@"确定"];
[alert setMessageText:@"无法启动Teleport助手"];
[alert setInformativeText:msg];
[alert runModal];
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
[NSApp terminate:NSApp]; }
[NSApp terminate:NSApp];
}
}
- (int) start_ssh_client:(NSString*)cmd_line termType:(NSString*)term_type termTheme:(NSString*)term_theme termTitle:(NSString*)term_title {
@ -122,8 +123,8 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char*
if (handlerName && [handlerName length])
{
/* If we have a handlerName (and potentially parameters), we build
* an NSAppleEvent to execute the script. */
// If we have a handlerName (and potentially parameters), we build
// an NSAppleEvent to execute the script.
//Get a descriptor
int pid = [[NSProcessInfo processInfo] processIdentifier];
@ -133,7 +134,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'
@ -165,9 +167,30 @@ int AppDelegate_start_ssh_client (void *_self, const char* cmd_line, const char*
}
}
- (int) select_app:(NSString*)strIgnore {
// NOT WORK NOW
// this function called by ts_http_rpc.c but it run in worker thread.
// once we call select_app from worker thread, the NSOpenPanel alloc crash.
// so we have had to show UI like "post a event and call callback" stuff.
NSOpenPanel *mySelectPanel = [[NSOpenPanel alloc] init];
[mySelectPanel setCanChooseDirectories:YES];
[mySelectPanel setCanChooseFiles:YES];
[mySelectPanel setCanCreateDirectories:YES];
[mySelectPanel setAllowsMultipleSelection:NO];
[mySelectPanel setResolvesAliases:YES];
if([mySelectPanel runModal] == NSModalResponseOK) {
NSURL *ret = [mySelectPanel URL];
NSLog(@"%@", ret.absoluteString);
}
return 0;
}
- (IBAction)visitWebsite:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://www.tp4a.com/"];
NSURL *url = [NSURL URLWithString:@"https://www.tp4a.com/"];
[[NSWorkspace sharedWorkspace] openURL:url];
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -16,11 +16,11 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="About Teleport Assist" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<window title="About Teleport Assist" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="750" y="574" width="315" height="204"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1129"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="315" height="204"/>
<autoresizingMask key="autoresizingMask"/>
@ -53,7 +53,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Homepage" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="uUM-88-32s">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system" size="11"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<action selector="btnHomepage:" target="-2" id="ZGb-bg-pCR"/>
@ -73,7 +73,7 @@
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="51" y="233"/>
<point key="canvasLocation" x="50.5" y="233"/>
</window>
</objects>
<resources>

View File

@ -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"

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<development version="10000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">

BIN
client/tp_assist_macos/src/StatusIcon.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
client/tp_assist_macos/src/StatusIcon@2X.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
client/tp_assist_macos/src/StatusIconAlt.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
client/tp_assist_macos/src/StatusIconAlt@2X.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.1.0</string>
<string>3.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.1.0</string>
<string>3.2.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
@ -29,12 +29,12 @@
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017~2018 EOMSOFT. All rights reserved.</string>
<string>Copyright © 2017~2018 TP4A. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>Product Homepage</key>
<string>http://teleport.eomsoft.net/</string>
<string>https://www.tp4a.com/</string>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

View File

@ -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,76 @@ 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) {
const Json::Value& jAppDescList = jAppList[i]["desc"];
int j = 0;
for(j = 0; j < jAppDescList.size(); ++j) {
if(!jAppDescList[j].isString())
return false;
cfg.description.push_back(jAppDescList[j].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,6 +130,233 @@ bool TsCfg::_load(const ex_astr& str_json) {
return false;
}
//===================================
// check ssh config
//===================================
if(!_parse_app(m_root, "ssh", ssh))
return false;
if(!_parse_app(m_root, "sftp", sftp))
return false;
// if(!_parse_app(m_root, "telnet", telnet))
// return false;
if(!_parse_app(m_root, "rdp", rdp))
return false;
#if 0
if (!m_root["ssh"].isObject()) {
EXLOGE("invalid config, error 1.\n");
return false;
}
if (!m_root["ssh"]["selected"].isString()) {
EXLOGE("invalid config, error 2.\n");
return false;
}
sel_name = m_root["ssh"]["selected"].asCString();
if (!m_root["ssh"]["available"].isArray() || m_root["ssh"]["available"].size() == 0) {
EXLOGE("invalid config, error 3.\n");
return false;
}
for (i = 0; i < m_root["ssh"]["available"].size(); ++i) {
if (
!m_root["ssh"]["available"][i]["name"].isString()
|| !m_root["ssh"]["available"][i]["app"].isString()
|| !m_root["ssh"]["available"][i]["cmdline"].isString()
) {
EXLOGE("invalid config, error 4.\n");
return false;
}
if (m_root["ssh"]["available"][i]["display"].isNull()) {
m_root["ssh"]["available"][i]["display"] = m_root["ssh"]["available"][i]["name"];
}
if (m_root["ssh"]["available"][i]["name"].asCString() != sel_name)
continue;
ssh_app = m_root["ssh"]["available"][i]["app"].asCString();
ssh_cmdline = m_root["ssh"]["available"][i]["cmdline"].asCString();
break;
}
if (ssh_app.length() == 0 || ssh_cmdline.length() == 0) {
EXLOGE("invalid config, error 6.\n");
return false;
}
//===================================
// check sftp config
//===================================
if (!m_root["scp"].isObject()) {
EXLOGE("invalid config, error 1.\n");
return false;
}
if (!m_root["scp"]["selected"].isString()) {
EXLOGE("invalid config, error 2.\n");
return false;
}
sel_name = m_root["scp"]["selected"].asCString();
if (!m_root["scp"]["available"].isArray() || m_root["scp"]["available"].size() == 0) {
EXLOGE("invalid config, error 3.\n");
return false;
}
for (i = 0; i < m_root["sftp"]["available"].size(); ++i) {
if (
!m_root["sftp"]["available"][i]["name"].isString()
|| !m_root["sftp"]["available"][i]["app"].isString()
|| !m_root["sftp"]["available"][i]["cmdline"].isString()
) {
EXLOGE("invalid config, error 4.\n");
return false;
}
if (m_root["scp"]["available"][i]["display"].isNull()) {
m_root["scp"]["available"][i]["display"] = m_root["scp"]["available"][i]["name"];
}
if (m_root["scp"]["available"][i]["name"].asCString() != sel_name)
continue;
// tmp = m_root["scp"]["available"][i]["app"].asCString();
// ex_astr2wstr(tmp, scp_app, EX_CODEPAGE_UTF8);
scp_app = m_root["scp"]["available"][i]["app"].asCString();
// tmp = m_root["scp"]["available"][i]["cmdline"].asCString();
// ex_astr2wstr(tmp, scp_cmdline, EX_CODEPAGE_UTF8);
scp_cmdline = m_root["scp"]["available"][i]["cmdline"].asCString();
break;
}
if (scp_app.length() == 0 || scp_cmdline.length() == 0) {
EXLOGE("invalid config, error 6.\n");
return false;
}
//===================================
// check telnet config
//===================================
if (!m_root["telnet"].isObject()) {
EXLOGE("invalid config, error 1.\n");
return false;
}
if (!m_root["telnet"]["selected"].isString()) {
EXLOGE("invalid config, error 2.\n");
return false;
}
sel_name = m_root["telnet"]["selected"].asCString();
if (!m_root["telnet"]["available"].isArray() || m_root["telnet"]["available"].size() == 0) {
EXLOGE("invalid config, error 3.\n");
return false;
}
for (i = 0; i < m_root["telnet"]["available"].size(); ++i) {
if (
!m_root["telnet"]["available"][i]["name"].isString()
|| !m_root["telnet"]["available"][i]["app"].isString()
|| !m_root["telnet"]["available"][i]["cmdline"].isString()
) {
EXLOGE("invalid config, error 4.\n");
return false;
}
if (m_root["telnet"]["available"][i]["display"].isNull()) {
m_root["telnet"]["available"][i]["display"] = m_root["telnet"]["available"][i]["name"];
}
if (m_root["telnet"]["available"][i]["name"].asCString() != sel_name)
continue;
// tmp = m_root["telnet"]["available"][i]["app"].asCString();
// ex_astr2wstr(tmp, telnet_app, EX_CODEPAGE_UTF8);
// tmp = m_root["telnet"]["available"][i]["cmdline"].asCString();
// ex_astr2wstr(tmp, telnet_cmdline, EX_CODEPAGE_UTF8);
telnet_app = m_root["telnet"]["available"][i]["app"].asCString();
telnet_cmdline = m_root["telnet"]["available"][i]["cmdline"].asCString();
break;
}
if (telnet_app.length() == 0 || telnet_cmdline.length() == 0) {
EXLOGE("invalid config, error 6.\n");
return false;
}
//===================================
// check rdp config
//===================================
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;
}
sel_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]["cmdline"].isString()
) {
EXLOGE("invalid config, error 4.\n");
return false;
}
if (m_root["rdp"]["available"][i]["display"].isNull()) {
m_root["rdp"]["available"][i]["display"] = m_root["rdp"]["available"][i]["name"];
}
if (m_root["rdp"]["available"][i]["name"].asCString() != sel_name)
continue;
// tmp = m_root["rdp"]["available"][i]["app"].asCString();
// ex_astr2wstr(tmp, rdp_app, EX_CODEPAGE_UTF8);
// tmp = m_root["rdp"]["available"][i]["cmdline"].asCString();
// ex_astr2wstr(tmp, rdp_cmdline, EX_CODEPAGE_UTF8);
// tmp = m_root["rdp"]["available"][i]["name"].asCString();
// ex_astr2wstr(tmp, rdp_name, EX_CODEPAGE_UTF8);
rdp_app = m_root["rdp"]["available"][i]["app"].asCString();
rdp_cmdline = m_root["rdp"]["available"][i]["cmdline"].asCString();
rdp_name = m_root["rdp"]["available"][i]["name"].asCString();
break;
}
if (rdp_app.length() == 0 || rdp_cmdline.length() == 0 || rdp_name.length() == 0) {
EXLOGE("invalid config, error 6.\n");
return false;
}
#endif
#if 0
// ------------ term ---------------------
if (!m_root["term"].isObject()) {
@ -154,6 +465,7 @@ bool TsCfg::_load(const ex_astr& str_json) {
EXLOGE("invalid config, error 6.\n");
return false;
}
#endif
return true;
}

View File

@ -6,6 +6,14 @@
#include <json/json.h>
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,18 +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 rdp_name;
ex_astr rdp_display;
ex_astr rdp_app;
//ex_astr rdp_cmdline;
APP_CONFIG ssh;
APP_CONFIG sftp;
APP_CONFIG telnet;
APP_CONFIG rdp;
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;

View File

@ -1,12 +1,7 @@
#ifndef __TS_CONST_H__
#define __TS_CONST_H__
//#define TS_WEB_URL L"http://teleport.eomsoft.net/"
//#define TS_BBS_URL L"http://bbs.eomsoft.net/"
//#define TS_TRAY_MSG L"Teleport助手正常工作中"
#define TS_HTTP_RPC_PORT 50022
//#define TS_HTTP_RPC_HOST "127.0.0.1"
#define TS_HTTP_RPC_HOST "localhost"
#define TS_HTTP_RPC_PORT 50022
#define TS_HTTPS_RPC_PORT 50023
#endif // __TS_CONST_H__

View File

@ -1,4 +1,3 @@
//#include "stdafx.h"
#include "ts_env.h"
#include <time.h>
@ -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/eomsoft/teleport-dev/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;
}

View File

@ -1,9 +1,3 @@
//#include "stdafx.h"
//#pragma warning(disable:4091)
//#include <commdlg.h>
//#include <ShlObj.h>
#include <unistd.h>
#include <teleport_const.h>
@ -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"
@ -25,33 +18,44 @@
#define RDP_CLIENT_FREERDP
TsHttpRpc g_http_interface;
TsHttpRpc g_https_interface;
void* g_app = NULL;
int http_rpc_start(void* app) {
g_app = app;
// if(!g_env.init())
// return;
EXLOGW("======================================================\n");
if (!g_http_interface.init(TS_HTTP_RPC_HOST, TS_HTTP_RPC_PORT))
if (!g_http_interface.init_http())
{
EXLOGE("[ERROR] can not start HTTP-RPC listener, maybe port %d is already in use.\n", TS_HTTP_RPC_PORT);
return -1;
}
EXLOGW("======================================================\n");
EXLOGW("[rpc] TeleportAssist-HTTP-RPC ready on %s:%d\n", TS_HTTP_RPC_HOST, TS_HTTP_RPC_PORT);
EXLOGW("[rpc] TeleportAssist-HTTP-RPC ready on localhost:%d\n", TS_HTTP_RPC_PORT);
if(!g_http_interface.start())
return -2;
return 0;
if (!g_https_interface.init_https())
{
EXLOGE("[ERROR] can not start HTTPS-RPC listener, maybe port %d is already in use.\n", TS_HTTPS_RPC_PORT);
return -1;
}
EXLOGW("[rpc] TeleportAssist-HTTPS-RPC ready on localhost:%d\n", TS_HTTPS_RPC_PORT);
if(!g_https_interface.start())
return -2;
return 0;
}
void http_rpc_stop(void)
{
g_http_interface.stop();
g_http_interface.stop();
g_https_interface.stop();
}
#define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W')
@ -102,45 +106,79 @@ TsHttpRpc::~TsHttpRpc()
mg_mgr_free(&m_mg_mgr);
}
bool TsHttpRpc::init(const char* ip, int port)
bool TsHttpRpc::init_http()
{
struct mg_connection* nc = NULL;
char addr[128] = { 0 };
if (0 == strcmp(ip, "127.0.0.1") || 0 == strcmp(ip, "localhost"))
ex_strformat(addr, 128, "tcp://127.0.0.1:%d", port);
else
ex_strformat(addr, 128, "tcp://%s:%d", ip, port);
char addr[128] = { 0 };
ex_strformat(addr, 128, "tcp://localhost:%d", TS_HTTP_RPC_PORT);
nc = mg_bind(&m_mg_mgr, addr, _mg_event_handler);
if (nc == NULL)
{
EXLOGE("[rpc] TsHttpRpc::init %s:%d\n", ip, port);
return false;
}
nc->user_data = this;
struct mg_connection* nc = NULL;
nc = mg_bind(&m_mg_mgr, addr, _mg_event_handler);
if (nc == NULL) {
EXLOGE("[rpc] TsHttpRpc::init_http() localhost:%d\n", TS_HTTP_RPC_PORT);
return false;
}
nc->user_data = this;
mg_set_protocol_http_websocket(nc);
mg_set_protocol_http_websocket(nc);
m_content_type_map[".js"] = "application/javascript";
m_content_type_map[".png"] = "image/png";
m_content_type_map[".jpeg"] = "image/jpeg";
m_content_type_map[".jpg"] = "image/jpeg";
m_content_type_map[".gif"] = "image/gif";
m_content_type_map[".ico"] = "image/x-icon";
m_content_type_map[".json"] = "image/json";
m_content_type_map[".html"] = "text/html";
m_content_type_map[".css"] = "text/css";
m_content_type_map[".tif"] = "image/tiff";
m_content_type_map[".tiff"] = "image/tiff";
m_content_type_map[".svg"] = "text/html";
return _on_init();
}
return true;
bool TsHttpRpc::init_https()
{
ex_wstr file_ssl_cert = g_env.m_res_path;
ex_path_join(file_ssl_cert, false, L"localhost.pem", NULL);
ex_wstr file_ssl_key = g_env.m_res_path;
ex_path_join(file_ssl_key, false, L"localhost.key", NULL);
ex_astr _ssl_cert;
ex_wstr2astr(file_ssl_cert, _ssl_cert);
ex_astr _ssl_key;
ex_wstr2astr(file_ssl_key, _ssl_key);
const char *err = NULL;
struct mg_bind_opts bind_opts;
memset(&bind_opts, 0, sizeof(bind_opts));
bind_opts.ssl_cert = _ssl_cert.c_str();
bind_opts.ssl_key = _ssl_key.c_str();
bind_opts.error_string = &err;
char addr[128] = { 0 };
ex_strformat(addr, 128, "tcp://localhost:%d", TS_HTTPS_RPC_PORT);
struct mg_connection* nc = NULL;
nc = mg_bind_opt(&m_mg_mgr, addr, _mg_event_handler, bind_opts);
if (nc == NULL) {
EXLOGE("[rpc] TsHttpRpc::init_https() localhost:%d\n", TS_HTTPS_RPC_PORT);
return false;
}
nc->user_data = this;
mg_set_protocol_http_websocket(nc);
return _on_init();
}
bool TsHttpRpc::_on_init() {
m_content_type_map[".js"] = "application/javascript";
m_content_type_map[".png"] = "image/png";
m_content_type_map[".jpeg"] = "image/jpeg";
m_content_type_map[".jpg"] = "image/jpeg";
m_content_type_map[".gif"] = "image/gif";
m_content_type_map[".ico"] = "image/x-icon";
m_content_type_map[".json"] = "image/json";
m_content_type_map[".html"] = "text/html";
m_content_type_map[".css"] = "text/css";
m_content_type_map[".tif"] = "image/tiff";
m_content_type_map[".tiff"] = "image/tiff";
m_content_type_map[".svg"] = "text/html";
return true;
}
void TsHttpRpc::_thread_loop(void)
{
while (!m_stop_flag)
while (!m_need_stop)
{
mg_mgr_poll(&m_mg_mgr, 500);
}
@ -148,10 +186,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)
{
@ -464,11 +502,15 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
ex_astr teleport_ip = jsRoot["teleport_ip"].asCString();
int teleport_port = jsRoot["teleport_port"].asUInt();
char _port[64] = {0};
ex_strformat(_port, 64, "%d", teleport_port);
ex_astr str_teleport_port = _port;
ex_astr real_host_ip = jsRoot["remote_host_ip"].asCString();
ex_astr sid = jsRoot["session_id"].asCString();
ex_astr s_exec;
ex_astr s_arg;
ex_astrs s_argv;
@ -478,7 +520,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 +588,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,25 +636,49 @@ 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);
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());
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;
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;
}
if(g_cfg.ssh.application.length() == 0) {
_create_json_ret(buf, TPE_NOT_EXISTS);
return;
}
s_exec = g_cfg.ssh.application;
s_argv.push_back(s_exec.c_str());
s_arg = g_cfg.ssh.cmdline;
}
else
{
// sorry, SFTP not supported yet for macOS.
_create_json_ret(buf, TPE_NOT_IMPLEMENT);
return;
}
// _create_json_ret(buf, TPE_NOT_IMPLEMENT);
// return;
if(g_cfg.sftp.application.length() == 0) {
_create_json_ret(buf, TPE_NOT_EXISTS);
return;
}
s_exec = g_cfg.sftp.application;
s_argv.push_back(s_exec.c_str());
s_arg = g_cfg.sftp.cmdline;
}
}
else if (pro_type == TP_PROTOCOL_TYPE_TELNET)
{
@ -621,74 +687,96 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
//==============================================
// sorry, TELNET not supported yet for macOS.
_create_json_ret(buf, TPE_NOT_IMPLEMENT);
return;
}
_create_json_ret(buf, TPE_NOT_IMPLEMENT);
return;
// ex_replace_all(w_exe_path, _T("{host_port}"), w_port);
// ex_replace_all(w_exe_path, _T("{host_ip}"), w_teleport_ip.c_str());
// ex_replace_all(w_exe_path, _T("{user_name}"), w_sid.c_str());
// ex_replace_all(w_exe_path, _T("{real_ip}"), w_real_host_ip.c_str());
//ex_replace_all(w_exe_path, _T("{assist_tools_path}"), g_env.m_tools_path.c_str());
// if(g_cfg.telnet.name == "terminal" || g_cfg.telnet.name == "iterm2") {
// char szCmd[1024] = {0};
// ex_strformat(szCmd, 1023, "telnet -l %s %s %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.telnet.name.c_str(), g_cfg.telnet.cmdline.c_str(), szTitle);
// if(ret == 0)
// _create_json_ret(buf, TPE_OK);
// else
// _create_json_ret(buf, TPE_FAILED);
// return;
// }
//
// if(g_cfg.telnet.application.length() == 0) {
// _create_json_ret(buf, TPE_NOT_EXISTS);
// return;
// }
//
// s_exec = g_cfg.telnet.application;
// s_argv.push_back(s_exec.c_str());
//
// s_arg = g_cfg.telnet.cmdline;
}
//---- split s_arg and push to s_argv ---
ex_astr::size_type p1 = 0;
ex_astr::size_type p2 = 0;
ex_astr tmp = s_arg;
for(;;) {
ex_remove_white_space(tmp, EX_RSC_BEGIN);
if(tmp.empty()) {
break;
}
if(tmp[0] == '"') {
p1 = 1;
p2 = tmp.find('"', p1);
if(p2 == ex_astr::npos) {
_create_json_ret(buf, TPE_PARAM);
return;
}
ex_astr _t;
_t.assign(tmp, p1, p2 - p1);
tmp.erase(0, p2 + 2);
s_argv.push_back(_t);
} else {
p1 = 0;
p2 = tmp.find(' ', p1);
if(p2 == ex_astr::npos) {
s_argv.push_back(tmp);
tmp.clear();
break;
}
ex_astr _t;
_t.assign(tmp, p1, p2 - p1);
tmp.erase(0, p2 + 1);
s_argv.push_back(_t);
}
}
Json::Value root_ret;
ex_astr utf8_path = s_exec;
//ex_wstr2astr(w_exe_path, utf8_path, EX_CODEPAGE_UTF8);
ex_astrs::iterator it = s_argv.begin();
for(; it != s_argv.end(); ++it) {
utf8_path += " ";
utf8_path += (*it);
}
ex_replace_all((*it), "{host_port}", str_teleport_port);
ex_replace_all((*it), "{host_ip}", teleport_ip);
ex_replace_all((*it), "{user_name}", sid);
ex_replace_all((*it), "{real_ip}", real_host_ip);
//ex_replace_all(utf8_path, _T("{assist_tools_path}"), g_env.m_tools_path.c_str());
utf8_path += " ";
utf8_path += (*it);
}
root_ret["path"] = utf8_path;
// if (!CreateProcess(NULL, (wchar_t *)w_exe_path.c_str(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
// {
// EXLOGE(_T("CreateProcess() failed. Error=0x%08X.\n %s\n"), GetLastError(), w_exe_path.c_str());
// root_ret["code"] = TPE_START_CLIENT;
// _create_json_ret(buf, root_ret);
// return;
// }
//system(utf8_path.c_str());
//ex_astr __sid;
//ex_wstr2astr(w_sid, __sid);
//execlp("xfreerdp", "-u", __sid.c_str(), "-g", "800x600", "127.0.0.1:52089", NULL);
// FILE *f = popen(utf8_path.c_str(), "r");
// if(f == NULL) {
// root_ret["code"] = TPE_FAILED;
// } else {
// root_ret["code"] = TPE_OK;
// pclose(f);
// }
// {
// int i = 0;
// char** _argv = (char**)calloc(s_argv.size()+1, sizeof(char*));
// if (!_argv)
// return;
//
// for (i = 0; i < s_argv.size(); ++i)
// {
// _argv[i] = ex_strdup(s_argv[i].c_str());
// }
// _argv[i] = NULL;
//
// execv(s_exec.c_str(), _argv);
//
// for(i = 0; i < s_argv.size(); ++i) {
// if(_argv[i] != NULL) {
// free(_argv[i]);
// }
// }
// free(_argv);
//
// }
// for macOS, Create Process should be fork()/exec()...
pid_t processId;
if ((processId = fork()) == 0) {
@ -704,7 +792,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
}
_argv[i] = NULL;
execv(s_exec.c_str(), _argv);
execv(s_exec.c_str(), _argv);
for(i = 0; i < s_argv.size(); ++i) {
if(_argv[i] != NULL) {
@ -756,8 +844,44 @@ void TsHttpRpc::_rpc_func_set_config(const ex_astr& func_args, ex_astr& buf)
}
void TsHttpRpc::_rpc_func_file_action(const ex_astr& func_args, ex_astr& buf) {
_create_json_ret(buf, TPE_NOT_IMPLEMENT);
_create_json_ret(buf, TPE_FAILED);
#if 0
Json::Reader jreader;
Json::Value jsRoot;
if (!jreader.parse(func_args.c_str(), jsRoot)) {
_create_json_ret(buf, TPE_JSON_FORMAT);
return;
}
// if (!jsRoot["action"].isNumeric()) {
// _create_json_ret(buf, TPE_PARAM);
// return;
// }
// int action = jsRoot["action"].asUInt();
AppDelegate_select_app(g_app);
_create_json_ret(buf, TPE_FAILED);
// if (ret) {
// if (action == 1 || action == 2 || action == 3) {
// ex_astr utf8_path;
// ex_wstr2astr(wszReturnPath, utf8_path, EX_CODEPAGE_UTF8);
// Json::Value root;
// root["code"] = TPE_OK;
// root["path"] = utf8_path;
// _create_json_ret(buf, root);
//
// return;
// } else {
// _create_json_ret(buf, TPE_OK);
// return;
// }
// } else {
// _create_json_ret(buf, TPE_DATA);
// return;
// }
#endif
}
void TsHttpRpc::_rpc_func_get_version(const ex_astr& func_args, ex_astr& buf)

View File

@ -14,28 +14,37 @@
/*
//=================================================================
使
127.0.0.1:50022http
# HTTP-RPC-INTERFACE:
GET
http://127.0.0.1:50022/method/json_param
json_param使url_encodejson
listen on http://localhost:50022 and https://localhost:50023.
POST
http://127.0.0.1:50022/method
postjson_param
----------------
GET method:
http://127.0.0.1:50022/method/json_param
URI
method
json_param
here `json_param` is string in json format and encoded by url_encode().
json
----------------
POST method
http://127.0.0.1:50022/method
{"code":0,"data":varb}
here the data field of POST should be json_param.
code0datadata
## URI detail:
- method the method to request to execute.
- json_param param of the method and it is optional.
## RESULT
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.
*/
@ -50,7 +59,8 @@ public:
TsHttpRpc();
~TsHttpRpc();
bool init(const char* ip, int port);
bool init_http();
bool init_https();
ex_astr get_content_type(ex_astr file_suffix)
{
@ -67,7 +77,10 @@ public:
protected:
void _thread_loop(void);
void _set_stop_flag(void);
// void _set_stop_flag(void);
// void _on_stop();
bool _on_init();
private:
int _parse_request(struct http_message* req, ex_astr& func_cmd, ex_astr& func_args);

View File

@ -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__

View File

@ -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";

View File

@ -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";

Binary file not shown.

View File

@ -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": ""
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -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 网站";

View File

@ -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 网站";

View File

@ -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网站";

Binary file not shown.

View File

@ -1,9 +0,0 @@
[common]
client_list=other
current_client=winscp
[other]
alias_name=自定义
command_line=
desc=desc
name=other
path=

View File

@ -1,21 +0,0 @@
[common]
client_list=securecrt,xshell,other
current_client=putty
[other]
alias_name=自定义
command_line=
desc=desc
name=other
path=
[securecrt]
alias_name=SecureCRT
command_line=/T /N "TP#ssh://{real_ip}" /SSH2 /P {host_port} /PASSWORD **** {user_name}@{host_ip}
desc=SecureCRT是一款支持SSHSSH1和SSH2的终端仿真程序简单地说是Windows下登录UNIX或Linux服务器主机的软件。
name=securecrt
path=
[xshell]
alias_name=Xshell
command_line=-newtab "TP#ssh://{real_ip}" -url ssh://{user_name}:****@{host_ip}:{host_port}
desc=Xshell 是一个强大的安全终端模拟软件它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET 协议。
name=xshell
path=

View File

@ -1,15 +0,0 @@
[common]
client_list=securecrt,other
current_client=putty
[other]
alias_name=自定义
command_line=
desc=
name=other
path=
[securecrt]
alias_name=SecureCRT
command_line=/T /N "TP#telnet://{real_ip}" /ARG {user_name} /SCRIPT "{assist_tools_path}\securecrt-telnet.vbs" /TELNET {host_ip} {host_port}
desc=SecureCRT是一款支持SSHSSH1和SSH2的终端仿真程序简单地说是Windows下登录UNIX或Linux服务器主机的软件。
name=securecrt
path=

View File

@ -18,7 +18,7 @@
extern HINSTANCE g_hInstance;
HWND g_hDlgMain = NULL;
HWND g_hDlgMain = nullptr;
static DWORD g_dwTaskbarRecreateMessage = 0;
static BOOL g_IsTrayIconShowed = FALSE;
@ -90,19 +90,13 @@ INT_PTR CALLBACK eomDlgMainProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARA
case IDM_OPEN_WEB:
{
ShellExecute(NULL, _T("open"), TS_WEB_URL, NULL, NULL, SW_SHOW);
return TRUE;
}break;
case IDM_OPEN_BBS:
{
ShellExecute(NULL, _T("open"), TS_BBS_URL, NULL, NULL, SW_SHOW);
ShellExecute(nullptr, _T("open"), TS_WEB_URL, nullptr, nullptr, SW_SHOW);
return TRUE;
}break;
case IDM_OPEN_CONFIG:
{
ShellExecute(NULL, _T("open"), _T("http://127.0.0.1:50022/config"), NULL, NULL, SW_SHOW);
ShellExecute(nullptr, _T("open"), _T("http://localhost:50022/config"), nullptr, nullptr, SW_SHOW);
return TRUE;
}break;
@ -129,7 +123,7 @@ INT_PTR CALLBACK eomDlgMainProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARA
HMENU hPopup = GetSubMenu(hMenu, 0);
SetMenuDefaultItem(hPopup, IDM_ABOUT, FALSE);
TrackPopupMenu(hPopup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndDlg, NULL);
TrackPopupMenu(hPopup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
}
@ -216,7 +210,7 @@ void center_window(HWND hwndDlg)
rc.top = (cyScreen - (rc.bottom - rc.top)) / 3;
}
SetWindowPos(hwndDlg, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE);
SetWindowPos(hwndDlg, nullptr, rc.left, rc.top, 0, 0, SWP_NOSIZE);
return;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -4,220 +4,223 @@
<!--[if !IE]><!-->
<html lang="zh_CN">
<!--<![endif]-->
<head>
<meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>TELEPORT助手配置</title>
<link rel="shortcut icon" href="favicon.png">
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="plugins/gritter/css/jquery.gritter.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="header">
<div class="container">
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport 助手本地配置</span>
<span class="sub-title" id="version"></span>
<div class="header">
<div class="container">
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport 助手本地配置</span>
<span class="sub-title" id="version"></span>
</div>
</div>
</div>
<div class="header-fix"></div>
<div class="header-fix"></div>
<div class="footer">
<div class="container">
<p><a href="http://teleport.eomsoft.net/" target="_blank">TELEPORT</a> | &copy;2015 - 2018保留所有权利。</p>
<div class="footer">
<div class="container">
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | &copy;2015 - 2018保留所有权利。</p>
</div>
</div>
</div>
<div class="container">
<div class="container">
<div class="content">
<div class="content">
<div class="arg-detail arg-detail-common">
<p><strong>此处配置保存到本地计算机上,如果更换计算机,需要重新配置!</strong></p>
<span><strong>注意:</strong>命令行参数设置中,可以用以下变量替换(注意大小写!):</span>
<ul>
<li><span class="arg-varb">{host_ip}</span> 替换主机IP地址</li>
<li><span class="arg-varb">{host_port}</span> 替换主机端口号</li>
<li><span class="arg-varb">{user_name}</span> 替换用户名</li>
<li><span class="arg-varb">{real_ip}</span> 替换为远程主机真实IP仅用于显示例如客户端的窗口标题或标签页标题等</li>
<li><span class="arg-varb">{assist_tools_path}</span> 替换为助手工具所在的tools目录的绝对路径</li>
</ul>
</div>
<hr/>
<p class="cfg-title">本地 SSH 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="ssh-type" class="form-control"></select>
</div>
<div class="arg-detail arg-detail-common">
<p><strong>此处配置保存到本地计算机上,如果更换计算机,需要重新配置!</strong></p>
<span><strong>注意:</strong>命令行参数设置中,可以用以下变量替换(注意大小写!):</span>
<ul>
<li><span class="arg-varb">{host_ip}</span> 替换主机IP地址</li>
<li><span class="arg-varb">{host_port}</span> 替换主机端口号</li>
<li><span class="arg-varb">{user_name}</span> 替换用户名</li>
<li><span class="arg-varb">{real_ip}</span> 替换为远程主机真实IP仅用于显示例如客户端的窗口标题或标签页标题等</li>
<li><span class="arg-varb">{assist_tools_path}</span> 替换为助手工具所在的tools目录的绝对路径</li>
</ul>
</div>
<div class="form-group form-group-sm">
<label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="ssh-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="ssh-select-app">选择...</button></span>
<hr/>
<p class="cfg-title">本地 SSH 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="ssh-type" class="form-control"></select>
</div>
</div>
<div class="form-group form-group-sm">
<label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="ssh-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="ssh-select-app">选择...</button></span>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="ssh-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="ssh-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="ssh-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="ssh-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
</div>
</div>
</div>
<hr/>
<p class="cfg-title">本地 SFTP 客户端配置</p>
<hr/>
<p class="cfg-title">本地 SFTP 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="scp-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="scp-type" class="form-control"></select>
</div>
</div>
<div class="form-group form-group-sm">
<label for="scp-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="scp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="scp-select-app">选择...</button></span>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="scp-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="scp-type" class="form-control"></select>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="scp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="scp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
</div>
</div>
</div>
<hr/>
<p class="cfg-title">本地 TELNET 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="telnet-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="telnet-type" class="form-control"></select>
</div>
</div>
<div class="form-group form-group-sm">
<label for="telnet-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="telnet-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="telnet-select-app">选择...</button></span>
<div class="form-group form-group-sm">
<label for="scp-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="scp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="scp-select-app">选择...</button></span>
</div>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="telnet-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="telnet-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
<div class="form-group form-group-sm">
<label for="scp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="scp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
</div>
</div>
</div>
</div>
<hr/>
<p class="cfg-title">本地 TELNET 客户端配置</p>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="telnet-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="telnet-type" class="form-control"></select>
</div>
</div>
<div class="form-group form-group-sm">
<label for="telnet-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="telnet-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="telnet-select-app">选择...</button></span>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="telnet-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="telnet-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
</div>
</div>
</div>
<hr/>
<p class="cfg-title">本地 RDP 客户端配置</p>
<hr/>
<p class="cfg-title">本地 RDP 客户端配置</p>
<!--<div class="arg-detail arg-detail-common">-->
<!--<div class="arg-detail arg-detail-common">-->
<!--RDP专用命令行参数-->
<!--<ul>-->
<!--<li><span class="arg-varb">{tmp_rdp_file}</span> 替换为助手工具生成的临时配置文件(.rdp的绝对路径用于支持按.rdp配置文件进行连接的RDP客户端</li>-->
<!--<li><span class="arg-varb">{size}</span> [仅FreeRDP] 替换为屏幕尺寸</li>-->
<!--<li><span class="arg-varb">{console}</span> [仅FreeRDP] 替换为是否以Console模式连接</li>-->
<!--<li><span class="arg-varb">{clipboard}</span> [仅FreeRDP] 替换为是否允许剪贴板</li>-->
<!--<li><span class="arg-varb">{drives}</span> [仅FreeRDP] 替换为是否允许映射本地磁盘</li>-->
<!--<li><span class="arg-varb">{tmp_rdp_file}</span> 替换为助手工具生成的临时配置文件(.rdp的绝对路径用于支持按.rdp配置文件进行连接的RDP客户端</li>-->
<!--<li><span class="arg-varb">{size}</span> [仅FreeRDP] 替换为屏幕尺寸</li>-->
<!--<li><span class="arg-varb">{console}</span> [仅FreeRDP] 替换为是否以Console模式连接</li>-->
<!--<li><span class="arg-varb">{clipboard}</span> [仅FreeRDP] 替换为是否允许剪贴板</li>-->
<!--<li><span class="arg-varb">{drives}</span> [仅FreeRDP] 替换为是否允许映射本地磁盘</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="rdp-type" class="form-control"></select>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-4">
<select id="rdp-type" class="form-control"></select>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="rdp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="rdp-select-app">选择...</button></span>
<div class="form-group form-group-sm">
<label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-9">
<div class="input-group">
<input id="rdp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="rdp-select-app">选择...</button></span>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="rdp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="rdp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数" />
</div>
</div>
</div>
<div class="form-group form-group-sm">
<label for="rdp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-9">
<input id="rdp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
<hr/>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<div class="col-sm-2"></div>
<div class="col-sm-6">
<a id="btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>
</div>
</div>
</div>
</div>
<hr/>
<div class="form-horizontal">
<div class="form-group form-group-sm">
<div class="col-sm-2"></div>
<div class="col-sm-6">
<a id="btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="plugins/underscore/underscore-min.js"></script>
<script type="text/javascript" src="plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="plugins/underscore/underscore-min.js"></script>
<script type="text/javascript" src="plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="plugins/html5shiv/html5shiv.min.js"></script>
<![endif]-->
<!--<script type="text/javascript" src="js/json2.js"></script>-->
<!--<script type="text/javascript" src="js/json2.js"></script>-->
<script type="text/javascript" src="plugins/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="plugins/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="plugins/keypress/keypress.min.js"></script>
<script type="text/javascript" src="plugins/keypress/keypress.min.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript">
</script>
<script type="text/javascript">
</script>
</body>
</html>

View File

@ -1,6 +1,6 @@
"use strict";
var g_url_base = 'http://127.0.0.1:50022';
var g_url_base = 'http://localhost:50022';
var g_cfg = null;

View File

@ -22,210 +22,224 @@ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
void failed(const char* msg);
void failed(const wchar_t* msg);
static HANDLE g_SingleInstanceMutexHandle = NULL;
static HANDLE g_SingleInstanceMutexHandle=NULL;
HINSTANCE g_hInstance = NULL;
ULONG g_ulSingleInstanceMsgId = 0;
static TCHAR szKernalName[MAX_PATH] = { 0 };
HINSTANCE g_hInstance=NULL;
ULONG g_ulSingleInstanceMsgId=0;
static TCHAR szKernalName[MAX_PATH]={ 0 };
HWND g_hwndBase = NULL;
int g_argc = 0;
wchar_t** g_argv = NULL;
HWND g_hwndBase=NULL;
int g_argc=0;
wchar_t** g_argv=NULL;
#define EOM_ASSIST_GUID _T("A6EFE1250C5F4416BFA819FE92CBD4B4")
#define EOM_ASSIST_INSTANCE _T("TS_ASSIST_SINGLE_INSTANCE")
#define EOM_ASSIST_WIN_CLASS _T("TS_ASSIST_WINDOW_CLASS")
#define MAKEDWORD(low, high) ((DWORD)(((WORD)(((DWORD_PTR)(low)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(high)) & 0xffff))) << 16))
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
http_rpc_main_loop();
return 0;
DWORD WINAPI HttpServerThreadProc(LPVOID lpParam) {
http_rpc_main_loop(false);
return 0;
}
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
{
EXLOG_USE_LOGGER(&g_ex_logger);
DWORD WINAPI HttpsServerThreadProc(LPVOID lpParam) {
http_rpc_main_loop(true);
return 0;
}
WORD wVersionRequested;
WSADATA wsaData;
int err;
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) {
EXLOG_USE_LOGGER(&g_ex_logger);
wVersionRequested = MAKEWORD(1, 1);
WORD wVersionRequested;
WSADATA wsaData;
int err;
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
return 0;
}
wVersionRequested=MAKEWORD(1, 1);
if (LOBYTE(wsaData.wVersion) != 1 ||
HIBYTE(wsaData.wVersion) != 1) {
WSACleanup();
return 0;
}
err=WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
return 0;
}
g_env.init();
if (LOBYTE(wsaData.wVersion) != 1 ||
HIBYTE(wsaData.wVersion) != 1) {
WSACleanup();
return 0;
}
g_env.init();
#ifdef EX_DEBUG
EXLOG_LEVEL(EX_LOG_LEVEL_DEBUG);
EXLOG_LEVEL(EX_LOG_LEVEL_DEBUG);
#else
EXLOG_LEVEL(EX_LOG_LEVEL_INFO);
EXLOG_LEVEL(EX_LOG_LEVEL_INFO);
#endif
EXLOG_FILE(L"tp_assist.log", g_env.m_log_path.c_str(), EX_LOG_FILE_MAX_SIZE, EX_LOG_FILE_MAX_COUNT);
EXLOG_FILE(L"tp_assist.log", g_env.m_log_path.c_str(), EX_LOG_FILE_MAX_SIZE, EX_LOG_FILE_MAX_COUNT);
// g_cfgSSH.init();
// g_cfgScp.init();
// g_cfgTelnet.init();
g_cfg.init();
// g_cfgSSH.init();
// g_cfgScp.init();
// g_cfgTelnet.init();
g_cfg.init();
g_hInstance = hInstance;
_stprintf_s(szKernalName, MAX_PATH, _T("%s_%s"), EOM_ASSIST_GUID, EOM_ASSIST_INSTANCE);
g_ulSingleInstanceMsgId = RegisterWindowMessage(szKernalName);
if (0 == g_ulSingleInstanceMsgId)
return FALSE;
g_hInstance=hInstance;
_stprintf_s(szKernalName, MAX_PATH, _T("%s_%s"), EOM_ASSIST_GUID, EOM_ASSIST_INSTANCE);
g_ulSingleInstanceMsgId=RegisterWindowMessage(szKernalName);
if (0 == g_ulSingleInstanceMsgId)
return FALSE;
LPWSTR szCmdLine = (LPWSTR)::GetCommandLineW(); //获取命令行参数;
g_argv = CommandLineToArgvW(szCmdLine, &g_argc); //拆分命令行参数字符串;
LPWSTR szCmdLine=(LPWSTR)::GetCommandLineW(); //获取命令行参数;
g_argv=CommandLineToArgvW(szCmdLine, &g_argc); //拆分命令行参数字符串;
std::wstring arg;
for (int i=0; i < g_argc; ++i) {
arg = g_argv[i];
if (0 == lstrcmp(g_argv[i], _T("--stop"))) {
PostMessage(HWND_BROADCAST, g_ulSingleInstanceMsgId, WMU_INSTANCE_EXIT, 0);
LocalFree(g_argv);
g_argv=NULL;
return -1;
}else if (arg.find(L"teleport_ip",0) !=std::wstring::npos && arg.find(L"teleport_port") != std::wstring::npos && arg.find(L"remote_host_ip") != std::wstring::npos && arg.find(L"session_id") != std::wstring::npos) {
//把wchar_t **转换为std::string
size_t len = wcslen(g_argv[i]) + 1;
size_t converted = 0;
char *CStr;
CStr = (char*)malloc(len * sizeof(char));
wcstombs_s(&converted, CStr, len, g_argv[i], _TRUNCATE);
std::string func_args = CStr;
for (int i = 0; i < g_argc; ++i)
{
if(0 == lstrcmp(g_argv[i], _T("--stop")))
{
PostMessage(HWND_BROADCAST, g_ulSingleInstanceMsgId, WMU_INSTANCE_EXIT, 0);
//调用TsHttpRpc类里的_rpc_func_run_client启动客户端
TsHttpRpc ts_http_rpc;
ex_astr buf;
ts_http_rpc._rpc_func_url_protocol(func_args, buf);
free(CStr);
LocalFree(g_argv);
g_argv = NULL;
return -1;
}
}
// make sure run single instance.
_stprintf_s(szKernalName, MAX_PATH, _T("%s_%s"), EOM_ASSIST_GUID, EOM_ASSIST_INSTANCE);
g_SingleInstanceMutexHandle = CreateMutex(NULL, FALSE, szKernalName);
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
PostMessage(HWND_BROADCAST, g_ulSingleInstanceMsgId, WMU_SHOW_EXIST_DLGUI, 0);
CloseHandle(g_SingleInstanceMutexHandle);
LocalFree(g_argv);
g_argv = NULL;
return 0;
}
// create dialog-box window.
MyRegisterClass();
// Perform application initialization:
if (!InitInstance())
{
CloseHandle(g_SingleInstanceMutexHandle);
LocalFree(g_argv);
g_argv = NULL;
return FALSE;
}
HANDLE hThread = NULL;
DWORD dwThreadId;
hThread = CreateThread(NULL, 0, ThreadProc, NULL, 0, &dwThreadId);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
http_rpc_stop();
WaitForSingleObject(hThread, INFINITE);
CloseHandle(g_SingleInstanceMutexHandle);
LocalFree(g_argv);
g_argv = NULL;
return 0;
}
void failed(const char* msg)
{
OutputDebugStringA(msg);
}
void failed(const wchar_t* msg)
{
OutputDebugStringW(msg);
}
ATOM MyRegisterClass()
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = g_hInstance;
wcex.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_NORMAL_BIG));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDR_ASSIST);
wcex.lpszClassName = EOM_ASSIST_WIN_CLASS;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_NORMAL_SMALL));
return RegisterClassEx(&wcex);
}
BOOL InitInstance(void)
{
g_hwndBase = CreateWindow(EOM_ASSIST_WIN_CLASS, _T(""), WS_OVERLAPPEDWINDOW, 8, 0, 8, 0, NULL, NULL, g_hInstance, NULL);
if (!g_hwndBase)
return FALSE;
ShowWindow(g_hwndBase, SW_HIDE);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (g_ulSingleInstanceMsgId == message)
{
if (WMU_INSTANCE_EXIT == wParam)
{
PostMessage(g_hDlgMain, WM_COMMAND, MAKEDWORD(IDCANCEL, 0), NULL);
return 0;
}
else if (WMU_SHOW_EXIST_DLGUI == wParam)
{
ShowWindow(g_hDlgMain, SW_SHOW);
SetWindowPos(g_hDlgMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
SetActiveWindow(g_hDlgMain);
BringWindowToTop(g_hDlgMain);
SetWindowPos(g_hDlgMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
return 0;
}
}
}
switch (message)
{
case WM_CREATE:
PostMessage(hWnd, WM_COMMAND, MAKEDWORD(IDM_MAIN, 0), NULL);
return DefWindowProc(hWnd, message, wParam, lParam);
break;
case WM_COMMAND:
// make sure run single instance.
_stprintf_s(szKernalName, MAX_PATH, _T("%s_%s"), EOM_ASSIST_GUID, EOM_ASSIST_INSTANCE);
g_SingleInstanceMutexHandle=CreateMutex(NULL, FALSE, szKernalName);
if (GetLastError() == ERROR_ALREADY_EXISTS) {
PostMessage(HWND_BROADCAST, g_ulSingleInstanceMsgId, WMU_SHOW_EXIST_DLGUI, 0);
CloseHandle(g_SingleInstanceMutexHandle);
LocalFree(g_argv);
g_argv=NULL;
return 0;
}
if (IDM_MAIN == LOWORD(wParam))
{
CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_DLG_MAIN), hWnd, eomDlgMainProc);
ShowWindow(g_hDlgMain, SW_HIDE);
}
break;
case WM_DESTROY:
SendMessage(g_hDlgMain, WMU_DLG_MAIN_EXIT, NULL, NULL);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
// create dialog-box window.
MyRegisterClass();
// Perform application initialization:
if (!InitInstance()) {
CloseHandle(g_SingleInstanceMutexHandle);
LocalFree(g_argv);
g_argv=NULL;
return FALSE;
}
HANDLE hThreadHttpServer=NULL;
DWORD dwThreadId=0;
hThreadHttpServer=CreateThread(NULL, 0, HttpServerThreadProc, NULL, 0, &dwThreadId);
HANDLE hThreadHttpsServer=NULL;
dwThreadId=0;
hThreadHttpsServer=CreateThread(NULL, 0, HttpsServerThreadProc, NULL, 0, &dwThreadId);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
http_rpc_stop(false);
WaitForSingleObject(hThreadHttpServer, INFINITE);
http_rpc_stop(true);
WaitForSingleObject(hThreadHttpsServer, INFINITE);
CloseHandle(g_SingleInstanceMutexHandle);
LocalFree(g_argv);
g_argv=NULL;
return 0;
}
void failed(const char* msg) {
OutputDebugStringA(msg);
}
void failed(const wchar_t* msg) {
OutputDebugStringW(msg);
}
ATOM MyRegisterClass() {
WNDCLASSEX wcex;
wcex.cbSize=sizeof(WNDCLASSEX);
wcex.style=CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc=WndProc;
wcex.cbClsExtra=0;
wcex.cbWndExtra=0;
wcex.hInstance=g_hInstance;
wcex.hIcon=LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_NORMAL_BIG));
wcex.hCursor=LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName=MAKEINTRESOURCE(IDR_ASSIST);
wcex.lpszClassName=EOM_ASSIST_WIN_CLASS;
wcex.hIconSm=LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_NORMAL_SMALL));
return RegisterClassEx(&wcex);
}
BOOL InitInstance(void) {
g_hwndBase=CreateWindow(EOM_ASSIST_WIN_CLASS, _T(""), WS_OVERLAPPEDWINDOW, 8, 0, 8, 0, NULL, NULL, g_hInstance, NULL);
if (!g_hwndBase)
return FALSE;
ShowWindow(g_hwndBase, SW_HIDE);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
if (g_ulSingleInstanceMsgId == message) {
if (WMU_INSTANCE_EXIT == wParam) {
PostMessage(g_hDlgMain, WM_COMMAND, MAKEDWORD(IDCANCEL, 0), NULL);
return 0;
} else if (WMU_SHOW_EXIST_DLGUI == wParam) {
ShowWindow(g_hDlgMain, SW_SHOW);
SetWindowPos(g_hDlgMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
SetActiveWindow(g_hDlgMain);
BringWindowToTop(g_hDlgMain);
SetWindowPos(g_hDlgMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
return 0;
}
}
switch (message) {
case WM_CREATE:
PostMessage(hWnd, WM_COMMAND, MAKEDWORD(IDM_MAIN, 0), NULL);
return DefWindowProc(hWnd, message, wParam, lParam);
break;
case WM_COMMAND:
if (IDM_MAIN == LOWORD(wParam)) {
CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_DLG_MAIN), hWnd, eomDlgMainProc);
ShowWindow(g_hDlgMain, SW_HIDE);
}
break;
case WM_DESTROY:
SendMessage(g_hDlgMain, WMU_DLG_MAIN_EXIT, NULL, NULL);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

Binary file not shown.

View File

@ -59,7 +59,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;MG_ENABLE_SSL;_DEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\inc32</AdditionalIncludeDirectories>
</ClCompile>
@ -76,7 +76,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;MG_ENABLE_SSL;NDEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\inc32</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tp_assist", "tp_assist.vs2017.vcxproj", "{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Debug|x86.ActiveCfg = Debug|Win32
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Debug|x86.Build.0 = Debug|Win32
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Release|x86.ActiveCfg = Release|Win32
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,185 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tp_assist</RootNamespace>
<ProjectName>tp_assist</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\..\out\client\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>..\..\out\client\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;MG_ENABLE_SSL;_DEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\inc32</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\..\external\openssl\out32\ssleay32.lib;..\..\external\openssl\out32\libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;MG_ENABLE_SSL;NDEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\inc32</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>..\..\external\openssl\out32\ssleay32.lib;..\..\external\openssl\out32\libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\common\libex\include\ex.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_const.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_ini.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_log.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_path.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_platform.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_str.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_thread.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_types.h" />
<ClInclude Include="..\..\common\libex\include\ex\ex_util.h" />
<ClInclude Include="..\..\common\teleport\teleport_const.h" />
<ClInclude Include="..\..\external\mongoose\mongoose.h" />
<ClInclude Include="dlg_main.h" />
<ClInclude Include="msocketx.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="tp_assist.h" />
<ClInclude Include="ts_cfg.h" />
<ClInclude Include="ts_const.h" />
<ClInclude Include="ts_env.h" />
<ClInclude Include="ts_http_rpc.h" />
<ClInclude Include="ts_network.h" />
<ClInclude Include="ts_ver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\common\libex\src\ex_ini.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_log.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_path.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_str.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_thread.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_util.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_reader.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_value.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_writer.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\external\mongoose\mongoose.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="dlg_main.cpp" />
<ClCompile Include="msocketx.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="tp_assist.cpp" />
<ClCompile Include="ts_cfg.cpp" />
<ClCompile Include="ts_env.cpp" />
<ClCompile Include="ts_http_rpc.cpp" />
<ClCompile Include="ts_network.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="tp_assist.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="res\tp.ico" />
<Image Include="res\tp_small.ico" />
<Image Include="res\tray_normal.ico" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\external\jsoncpp\src\lib_json\json_valueiterator.inl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="dlg_main.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="tp_assist.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="ts_http_rpc.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="ts_network.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="msocketx.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="ts_env.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="ts_cfg.cpp">
<Filter>main app</Filter>
</ClCompile>
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_reader.cpp">
<Filter>jsoncpp</Filter>
</ClCompile>
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_value.cpp">
<Filter>jsoncpp</Filter>
</ClCompile>
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_writer.cpp">
<Filter>jsoncpp</Filter>
</ClCompile>
<ClCompile Include="..\..\external\mongoose\mongoose.c">
<Filter>mongoose</Filter>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_str.cpp">
<Filter>libex\src</Filter>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_util.cpp">
<Filter>libex\src</Filter>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_path.cpp">
<Filter>libex\src</Filter>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_ini.cpp">
<Filter>libex\src</Filter>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_log.cpp">
<Filter>libex\src</Filter>
</ClCompile>
<ClCompile Include="..\..\common\libex\src\ex_thread.cpp">
<Filter>libex\src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Resource.h">
<Filter>resource</Filter>
</ClInclude>
<ClInclude Include="dlg_main.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="tp_assist.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="ts_http_rpc.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="ts_network.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="ts_env.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="ts_cfg.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="..\..\external\mongoose\mongoose.h">
<Filter>mongoose</Filter>
</ClInclude>
<ClInclude Include="msocketx.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_const.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_path.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_platform.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_str.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_types.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_util.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="ts_const.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="ts_ver.h">
<Filter>main app</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_ini.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_log.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\libex\include\ex\ex_thread.h">
<Filter>libex\header</Filter>
</ClInclude>
<ClInclude Include="..\..\common\teleport\teleport_const.h">
<Filter>teleport</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="res\tp.ico">
<Filter>resource</Filter>
</Image>
<Image Include="res\tp_small.ico">
<Filter>resource</Filter>
</Image>
<Image Include="res\tray_normal.ico">
<Filter>resource</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<Filter Include="resource">
<UniqueIdentifier>{52b425b1-8aa9-4e08-acbd-c88387350530}</UniqueIdentifier>
</Filter>
<Filter Include="jsoncpp">
<UniqueIdentifier>{adabe93d-3938-4b11-9352-5b67a1efd7e3}</UniqueIdentifier>
</Filter>
<Filter Include="mongoose">
<UniqueIdentifier>{35a345a0-6147-4c87-97c9-3b0b2a57e348}</UniqueIdentifier>
</Filter>
<Filter Include="main app">
<UniqueIdentifier>{0942cec3-67df-4d19-bbc1-e962145e496f}</UniqueIdentifier>
</Filter>
<Filter Include="libex">
<UniqueIdentifier>{a88e05d3-51f4-463f-84cc-c3bc86f07aac}</UniqueIdentifier>
</Filter>
<Filter Include="libex\header">
<UniqueIdentifier>{e3e7a811-5905-4ad5-86a7-9721af5d015a}</UniqueIdentifier>
</Filter>
<Filter Include="libex\src">
<UniqueIdentifier>{d7d49fa4-5192-42c5-bc70-5584d9d646c6}</UniqueIdentifier>
</Filter>
<Filter Include="teleport">
<UniqueIdentifier>{1291a5cf-cb08-4ad6-8a86-8a0486297c63}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="tp_assist.rc">
<Filter>resource</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\external\jsoncpp\src\lib_json\json_valueiterator.inl">
<Filter>jsoncpp</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -105,7 +105,7 @@ bool TsCfg::_load(const ex_astr& str_json) {
}
//===================================
// check scp config
// check sftp config
//===================================
if (!m_root["scp"].isObject()) {

View File

@ -1,12 +1,10 @@
#ifndef __TS_CONST_H__
#define __TS_CONST_H__
#define TS_WEB_URL L"http://teleport.eomsoft.net/"
#define TS_BBS_URL L"http://bbs.eomsoft.net/"
#define TS_TRAY_MSG L"Teleport助手正常工作中"
#define TS_WEB_URL L"https://tp4a.com/"
#define TS_TRAY_MSG L"Teleport助手正常工作中"
#define TS_HTTP_RPC_PORT 50022
//#define TS_HTTP_RPC_HOST "127.0.0.1"
#define TS_HTTP_RPC_HOST "localhost"
#define TS_HTTP_RPC_PORT 50022
#define TS_HTTPS_RPC_PORT 50023
#endif // __TS_CONST_H__

File diff suppressed because it is too large Load Diff

View File

@ -17,14 +17,14 @@
//=================================================================
使
127.0.0.1:50022http
localhost:50022http
GET
http://127.0.0.1:50022/method/json_param
http://localhost:50022/method/json_param
json_param使url_encodejson
POST
http://127.0.0.1:50022/method
http://localhost:50022/method
postjson_param
URI
@ -40,54 +40,55 @@ json_param
*/
void http_rpc_main_loop(void);
void http_rpc_stop(void);
void http_rpc_main_loop(bool is_https);
void http_rpc_stop(bool is_https);
typedef std::map<ex_astr, ex_astr> content_type_map;
class TsHttpRpc
{
// for https server, see
// http://www.xiaovdiy.cn/?post=284
class TsHttpRpc {
public:
TsHttpRpc();
~TsHttpRpc();
TsHttpRpc();
~TsHttpRpc();
bool init(const char* ip, int port);
void run(void);
void stop(void);
bool init_http();
bool init_https();
void run(void);
void stop(void);
void _rpc_func_url_protocol(const ex_astr& func_args, ex_astr& buf);
ex_astr get_content_type(ex_astr file_suffix)
{
content_type_map::iterator it = m_content_type_map.find(file_suffix);
if (it != m_content_type_map.end())
{
return it->second;
}
else
{
return "application/octet-stream";
}
};
ex_astr get_content_type(ex_astr file_suffix) {
content_type_map::iterator it=m_content_type_map.find(file_suffix);
if (it != m_content_type_map.end()) {
return it->second;
} else {
return "application/octet-stream";
}
};
private:
int _parse_request(struct http_message* req, ex_astr& func_cmd, ex_astr& func_args);
void _process_js_request(const ex_astr& func_cmd, const ex_astr& func_args, ex_astr& buf);
void _create_json_ret(ex_astr& buf, int errcode);
void _create_json_ret(ex_astr& buf, Json::Value& jr_root);
bool _on_init();
int _parse_request(struct http_message* req, ex_astr& func_cmd, ex_astr& func_args);
void _process_js_request(const ex_astr& func_cmd, const ex_astr& func_args, ex_astr& buf);
void _create_json_ret(ex_astr& buf, int errcode);
void _create_json_ret(ex_astr& buf, Json::Value& jr_root);
void _rpc_func_run_client(const ex_astr& func_args, ex_astr& buf);
// void _rpc_func_check(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_rdp_play(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_get_config(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_set_config(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_file_action(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_get_version(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_run_client(const ex_astr& func_args, ex_astr& buf);
// void _rpc_func_check(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_rdp_play(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_get_config(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_set_config(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_file_action(const ex_astr& func_args, ex_astr& buf);
void _rpc_func_get_version(const ex_astr& func_args, ex_astr& buf);
static void _mg_event_handler(struct mg_connection *nc, int ev, void *ev_data);
static void _mg_event_handler(struct mg_connection *nc, int ev, void *ev_data);
private:
content_type_map m_content_type_map;
struct mg_mgr m_mg_mgr;
bool m_stop;
content_type_map m_content_type_map;
struct mg_mgr m_mg_mgr;
bool m_stop;
};
#endif // __TS_HTTP_RPC_H__

View File

@ -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__

View File

@ -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

View File

@ -35,7 +35,7 @@ wchar_t* ex_abspath_to(const wchar_t* base_abs_path, const wchar_t* relate_path)
bool ex_exec_file(ex_wstr& out_filename);
bool ex_abspath(ex_wstr& inout_path);
bool ex_dirname(ex_wstr& inout_filename);
bool ex_path_join(ex_wstr& inout_path, bool auto_abspath, ...);
bool ex_path_join(ex_wstr& inout_path, EX_BOOL auto_abspath, ...);
bool ex_abspath_to(const ex_wstr& base_abs_path, const ex_wstr& relate_path, ex_wstr& out_path);
bool ex_mkdirs(const ex_wstr& in_path);

View File

@ -31,10 +31,12 @@ public:
bool terminate(void);
protected:
// 线程循环
// main loop of this thread.
virtual void _thread_loop(void) = 0;
// 设置停止标志,让线程能够正常结束
virtual void _set_stop_flag(void) = 0;
// called by another thread when thread ready to stop.
virtual void _on_stop(void) {};
// called inside thread when thread fully stopped.
virtual void _on_stopped(void) {};
#ifdef EX_OS_WIN32
static unsigned int WINAPI _thread_func(LPVOID lpParam);
@ -46,7 +48,7 @@ protected:
ex_astr m_thread_name;
EX_THREAD_HANDLE m_handle;
bool m_is_running;
bool m_stop_flag;
bool m_need_stop;
};

View File

@ -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';
@ -182,9 +182,9 @@ EX_BOOL ex_copy_file(const wchar_t* from_file, const wchar_t* to_file) {
return EX_FALSE;
}
else if (S_ISREG(src_stat.st_mode)) {
int src, dst;
int rsize;
char buf[1024];
int src = -1, dst = -1;
ssize_t rsize = 0;
char buf[1024] = {0};
if ((src = open(source.c_str(), O_RDONLY)) == -1) {
close(dst);
return EX_FALSE;
@ -409,7 +409,7 @@ bool ex_abspath(ex_wstr& inout_path)
return true;
}
bool ex_path_join(ex_wstr& inout_path, bool auto_abspath, ...)
bool ex_path_join(ex_wstr& inout_path, EX_BOOL auto_abspath, ...)
{
wchar_t* tmp;

View File

@ -9,90 +9,90 @@
#ifdef EX_OS_WIN32
unsigned int WINAPI ExThreadBase::_thread_func(LPVOID pParam)
#else
void* ExThreadBase::_thread_func(void* pParam)
void *ExThreadBase::_thread_func(void *pParam)
#endif
{
ExThreadBase* p = (ExThreadBase*)pParam;
ex_astr thread_name = p->m_thread_name;
p->m_is_running = true;
p->_thread_loop();
p->m_is_running = false;
// if(!p->m_stop_by_request)
// p->m_thread_manager->_remove_thread(p);
ExThreadBase *_this = (ExThreadBase *) pParam;
EXLOGV(" # thread [%s] end.\n", thread_name.c_str());
_this->m_is_running = true;
_this->_thread_loop();
_this->m_is_running = false;
_this->m_handle = 0;
return 0;
EXLOGV(" # thread [%s] exit.\n", _this->m_thread_name.c_str());
_this->_on_stopped();
return 0;
}
ExThreadBase::ExThreadBase(const char* thread_name) :
m_handle(0),
m_is_running(false),
m_stop_flag(false)
{
m_thread_name = thread_name;
ExThreadBase::ExThreadBase(const char *thread_name) :
m_handle(0),
m_is_running(false),
m_need_stop(false) {
m_thread_name = thread_name;
}
ExThreadBase::~ExThreadBase()
{
ExThreadBase::~ExThreadBase() {
if(m_is_running) {
EXLOGE(" # thread [%s] not stop before destroy.\n", m_thread_name.c_str());
}
}
bool ExThreadBase::start(void)
{
EXLOGV(" . thread [%s] starting.\n", m_thread_name.c_str());
bool ExThreadBase::start(void) {
m_need_stop = false;
EXLOGV(" . thread [%s] starting.\n", m_thread_name.c_str());
#ifdef WIN32
HANDLE h = (HANDLE)_beginthreadex(NULL, 0, _thread_func, (void*)this, 0, NULL);
HANDLE h = (HANDLE)_beginthreadex(NULL, 0, _thread_func, (void*)this, 0, NULL);
if (NULL == h)
{
return false;
}
m_handle = h;
if (NULL == h)
{
return false;
}
m_handle = h;
#else
pthread_t ptid = 0;
int ret = pthread_create(&ptid, NULL, _thread_func, (void*)this);
if (ret != 0)
{
return false;
}
m_handle = ptid;
pthread_t ptid = 0;
int ret = pthread_create(&ptid, NULL, _thread_func, (void *) this);
if (ret != 0) {
return false;
}
m_handle = ptid;
#endif
return true;
return true;
}
bool ExThreadBase::stop(void)
{
EXLOGV("[thread] try to stop thread [%s].\n", m_thread_name.c_str());
_set_stop_flag();
bool ExThreadBase::stop(void) {
if (m_handle == 0) {
EXLOGW("[thread] thread [%s] already stopped.\n", m_thread_name.c_str());
return true;
}
EXLOGV("[thread] wait thread [%s] end.\n", m_thread_name.c_str());
EXLOGV("[thread] try to stop thread [%s].\n", m_thread_name.c_str());
m_need_stop = true;
_on_stop();
if(m_handle == 0)
return true;
EXLOGV("[thread] wait thread [%s] exit.\n", m_thread_name.c_str());
#ifdef EX_OS_WIN32
if (WaitForSingleObject(m_handle, INFINITE) != WAIT_OBJECT_0)
{
return false;
}
if (WaitForSingleObject(m_handle, INFINITE) != WAIT_OBJECT_0)
{
return false;
}
#else
if (pthread_join(m_handle, NULL) != 0)
{
return false;
}
if (pthread_join(m_handle, NULL) != 0) {
return false;
}
#endif
return true;
return true;
}
bool ExThreadBase::terminate(void)
{
bool ExThreadBase::terminate(void) {
#ifdef EX_OS_WIN32
return TerminateThread(m_handle, 1) ? true : false;
return (TerminateThread(m_handle, 1) == TRUE);
#else
return pthread_cancel(m_handle) == 0 ? true : false;
return (pthread_cancel(m_handle) == 0);
#endif
}
@ -100,105 +100,89 @@ bool ExThreadBase::terminate(void)
//
//=========================================================
ExThreadManager::ExThreadManager()
{}
ExThreadManager::ExThreadManager() {}
ExThreadManager::~ExThreadManager()
{
if (m_threads.size() > 0)
{
EXLOGE("when destroy thread manager, there are %d thread not exit.\n", m_threads.size());
stop_all();
}
ExThreadManager::~ExThreadManager() {
if (!m_threads.empty()) {
EXLOGE("when destroy thread manager, there are %d thread not exit.\n", m_threads.size());
stop_all();
}
}
void ExThreadManager::stop_all(void)
{
ExThreadSmartLock locker(m_lock);
void ExThreadManager::stop_all(void) {
ExThreadSmartLock locker(m_lock);
ex_threads::iterator it = m_threads.begin();
for (; it != m_threads.end(); ++it)
{
(*it)->stop();
}
m_threads.clear();
ex_threads::iterator it = m_threads.begin();
for (; it != m_threads.end(); ++it) {
(*it)->stop();
}
m_threads.clear();
}
void ExThreadManager::add(ExThreadBase* tb)
{
ExThreadSmartLock locker(m_lock);
void ExThreadManager::add(ExThreadBase *tb) {
ExThreadSmartLock locker(m_lock);
ex_threads::iterator it = m_threads.begin();
for (; it != m_threads.end(); ++it)
{
if ((*it) == tb)
{
EXLOGE("when add thread to manager, it already exist.\n");
return;
}
}
ex_threads::iterator it = m_threads.begin();
for (; it != m_threads.end(); ++it) {
if ((*it) == tb) {
EXLOGE("when add thread to manager, it already exist.\n");
return;
}
}
m_threads.push_back(tb);
m_threads.push_back(tb);
}
void ExThreadManager::remove(ExThreadBase* tb)
{
ExThreadSmartLock locker(m_lock);
void ExThreadManager::remove(ExThreadBase *tb) {
ExThreadSmartLock locker(m_lock);
ex_threads::iterator it = m_threads.begin();
for (; it != m_threads.end(); ++it)
{
if ((*it) == tb)
{
//delete (*it);
m_threads.erase(it);
return;
}
}
EXLOGE("when remove thread from manager, it not exist.\n");
ex_threads::iterator it = m_threads.begin();
for (; it != m_threads.end(); ++it) {
if ((*it) == tb) {
m_threads.erase(it);
return;
}
}
EXLOGE("thread not hold by thread-manager while remove it.\n");
}
//=========================================================
//
//=========================================================
ExThreadLock::ExThreadLock()
{
ExThreadLock::ExThreadLock() {
#ifdef EX_OS_WIN32
InitializeCriticalSection(&m_locker);
InitializeCriticalSection(&m_locker);
#else
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&m_locker, &attr);
pthread_mutexattr_destroy(&attr);
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&m_locker, &attr);
pthread_mutexattr_destroy(&attr);
#endif
}
ExThreadLock::~ExThreadLock()
{
ExThreadLock::~ExThreadLock() {
#ifdef EX_OS_WIN32
DeleteCriticalSection(&m_locker);
DeleteCriticalSection(&m_locker);
#else
pthread_mutex_destroy(&m_locker);
pthread_mutex_destroy(&m_locker);
#endif
}
void ExThreadLock::lock(void)
{
void ExThreadLock::lock(void) {
#ifdef EX_OS_WIN32
EnterCriticalSection(&m_locker);
EnterCriticalSection(&m_locker);
#else
pthread_mutex_lock(&m_locker);
pthread_mutex_lock(&m_locker);
#endif
}
void ExThreadLock::unlock(void)
{
void ExThreadLock::unlock(void) {
#ifdef EX_OS_WIN32
LeaveCriticalSection(&m_locker);
LeaveCriticalSection(&m_locker);
#else
pthread_mutex_unlock(&m_locker);
pthread_mutex_unlock(&m_locker);
#endif
}
@ -206,39 +190,35 @@ void ExThreadLock::unlock(void)
//
//=========================================================
int ex_atomic_add(volatile int* pt, int t)
{
int ex_atomic_add(volatile int *pt, int t) {
#ifdef EX_OS_WIN32
return (int)InterlockedExchangeAdd((long*)pt, (long)t);
return (int)InterlockedExchangeAdd((long*)pt, (long)t);
#else
return __sync_add_and_fetch(pt, t);
return __sync_add_and_fetch(pt, t);
#endif
}
int ex_atomic_inc(volatile int* pt)
{
int ex_atomic_inc(volatile int *pt) {
#ifdef EX_OS_WIN32
return (int)InterlockedIncrement((long*)pt);
return (int)InterlockedIncrement((long*)pt);
#else
return __sync_add_and_fetch(pt, 1);
return __sync_add_and_fetch(pt, 1);
#endif
}
int ex_atomic_dec(volatile int* pt)
{
int ex_atomic_dec(volatile int *pt) {
#ifdef EX_OS_WIN32
return (int)InterlockedDecrement((long*)pt);
return (int)InterlockedDecrement((long*)pt);
#else
return __sync_add_and_fetch(pt, -1);
return __sync_add_and_fetch(pt, -1);
#endif
}
ex_u64 ex_get_thread_id(void)
{
ex_u64 ex_get_thread_id(void) {
#ifdef EX_OS_WIN32
return GetCurrentThreadId();
return GetCurrentThreadId();
#else
return (ex_u64)pthread_self();
return (ex_u64) pthread_self();
#endif
}

View File

@ -376,9 +376,13 @@ static const char * _inet_ntop_v6(const ex_u8 *src, char *dst, size_t size)
{
if (words[i] == 0)
{
if (cur.base == -1)
cur.base = i, cur.len = 1;
else cur.len++;
if (cur.base == -1) {
cur.base = i;
cur.len = 1;
}
else{
cur.len++;
}
}
else if (cur.base != -1)
{

View File

@ -8,6 +8,11 @@
// - WEB界面与WEB后台
// - WEB后台与CORE核心服务
//=======================================================
// UrlprotocolÏà¹Ø
//=======================================================
#define TP_URLPROTO_APP_NAME "teleport"
//=======================================================
// 远程连接认证方式
//=======================================================

10
dist/client/macos/dmg.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"title": "Teleport助手安装",
"icon": "dmg_icon.icns",
"background": "dmg_bg.png",
"icon-size": 108,
"contents": [
{ "x": 140, "y": 320, "type": "file", "path": "../../../client/tp_assist_macos/build//Release/TP-Assist.app" },
{ "x": 498, "y": 320, "type": "link", "path": "/Applications" }
]
}

BIN
dist/client/macos/dmg_bg.png vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

BIN
dist/client/macos/dmg_bg@2x.png vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 KiB

BIN
dist/client/macos/dmg_icon.icns vendored Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More