全面升级第三方库:openssl/libuv/mbedtls/jsoncpp/mongoose/zlib/libssh;加入播放器的一键构建(Qt命令行构建);调整助手安装包构建脚本,使之能够发布基于Qt的软件。
parent
50b6eddb36
commit
eae1db3edc
|
|
@ -105,3 +105,4 @@ profile
|
||||||
/server/tp_core/testssh/Debug
|
/server/tp_core/testssh/Debug
|
||||||
/server/tp_core/testssh/Release
|
/server/tp_core/testssh/Release
|
||||||
/external/zlib
|
/external/zlib
|
||||||
|
/client/tools/qt-redist
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,24 @@ class BuilderBase:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.out_dir = ''
|
self.out_dir = ''
|
||||||
|
|
||||||
def build_exe(self):
|
def build_assist(self):
|
||||||
pass
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
def build_player(self):
|
||||||
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_rdp(self):
|
def build_rdp(self):
|
||||||
pass
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_installer(self):
|
def build_installer(self):
|
||||||
pass
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
|
||||||
class BuilderWin(BuilderBase):
|
class BuilderWin(BuilderBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def build_exe(self):
|
def build_assist(self):
|
||||||
cc.i('build tp_assist...')
|
cc.i('build tp_assist...')
|
||||||
sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2017.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')
|
out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp_assist.exe')
|
||||||
|
|
@ -36,6 +39,15 @@ class BuilderWin(BuilderBase):
|
||||||
utils.msvc_build(sln_file, 'tp_assist', ctx.target_path, ctx.bits_path, False)
|
utils.msvc_build(sln_file, 'tp_assist', ctx.target_path, ctx.bits_path, False)
|
||||||
utils.ensure_file_exists(out_file)
|
utils.ensure_file_exists(out_file)
|
||||||
|
|
||||||
|
def build_player(self):
|
||||||
|
cc.i('build tp-player...')
|
||||||
|
prj_path = os.path.join(env.root_path, 'client', 'tp-player')
|
||||||
|
out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp-player.exe')
|
||||||
|
if os.path.exists(out_file):
|
||||||
|
utils.remove(out_file)
|
||||||
|
utils.qt_build_win(prj_path, 'tp-player', ctx.bits_path, ctx.target_path)
|
||||||
|
utils.ensure_file_exists(out_file)
|
||||||
|
|
||||||
# def build_rdp(self):
|
# def build_rdp(self):
|
||||||
# cc.n('build tp_rdp...')
|
# cc.n('build tp_rdp...')
|
||||||
# sln_file = os.path.join(ROOT_PATH, 'client', 'tp_rdp', 'tp_rdp.2015.sln')
|
# sln_file = os.path.join(ROOT_PATH, 'client', 'tp_rdp', 'tp_rdp.2015.sln')
|
||||||
|
|
@ -74,12 +86,13 @@ class BuilderWin(BuilderBase):
|
||||||
utils.makedirs(tmp_cfg_path)
|
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, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe')
|
||||||
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, ('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, '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.key')
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.pem')
|
utils.copy_file(os.path.join(env.root_path, 'client', 'cfg'), tmp_cfg_path, 'localhost.pem')
|
||||||
|
|
||||||
|
# assist configuration web page
|
||||||
utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site')
|
utils.copy_ex(os.path.join(env.root_path, 'client', 'tp_assist_win'), tmp_app_path, 'site')
|
||||||
|
|
||||||
utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty'))
|
utils.makedirs(os.path.join(tmp_app_path, 'tools', 'putty'))
|
||||||
|
|
@ -91,13 +104,35 @@ class BuilderWin(BuilderBase):
|
||||||
|
|
||||||
utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp'))
|
utils.makedirs(os.path.join(tmp_app_path, 'tools', 'tprdp'))
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe')
|
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-client.exe')
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe')
|
# utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'tprdp-replay.exe')
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll')
|
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'libeay32.dll')
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll')
|
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'ssleay32.dll')
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll')
|
utils.copy_file(os.path.join(env.root_path, 'client', 'tools', 'tprdp'), os.path.join(tmp_app_path, 'tools', 'tprdp'), 'msvcr120.dll')
|
||||||
|
|
||||||
utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs')
|
utils.copy_file(os.path.join(env.root_path, 'client', 'tools'), os.path.join(tmp_app_path, 'tools'), 'securecrt-telnet.vbs')
|
||||||
|
|
||||||
|
# tp-player
|
||||||
|
utils.copy_file(os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp-player.exe')
|
||||||
|
|
||||||
|
# qt-redist
|
||||||
|
qt_redist_path = os.path.join(env.root_path, 'client', 'tools', 'qt-redist')
|
||||||
|
utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Core.dll')
|
||||||
|
utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Gui.dll')
|
||||||
|
utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Network.dll')
|
||||||
|
utils.copy_file(qt_redist_path, tmp_app_path, 'Qt5Widgets.dll')
|
||||||
|
utils.copy_ex(os.path.join(qt_redist_path, 'platforms'), os.path.join(tmp_app_path, 'platforms'))
|
||||||
|
utils.copy_ex(os.path.join(qt_redist_path, 'styles'), os.path.join(tmp_app_path, 'styles'))
|
||||||
|
utils.copy_ex(os.path.join(qt_redist_path, 'translations'), os.path.join(tmp_app_path, 'translations'))
|
||||||
|
|
||||||
|
# zlib
|
||||||
|
suffix = 'd' if ctx.target_path == 'debug' else ''
|
||||||
|
utils.copy_file(os.path.join(env.root_path, 'external', 'zlib', 'build', ctx.target_path), tmp_app_path, 'zlib{}.dll'.format(suffix))
|
||||||
|
|
||||||
|
# openssl
|
||||||
|
utils.copy_file(os.path.join(env.root_path, 'external', 'openssl', 'bin'), tmp_app_path, 'libcrypto-1_1.dll')
|
||||||
|
utils.copy_file(os.path.join(env.root_path, 'external', 'openssl', 'bin'), tmp_app_path, 'libssl-1_1.dll')
|
||||||
|
|
||||||
|
# final build
|
||||||
utils.nsis_build(os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))
|
utils.nsis_build(os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist', 'installer.nsi'))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -105,7 +140,7 @@ class BuilderMacOS(BuilderBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def build_exe(self):
|
def build_assist(self):
|
||||||
cc.i('build tp_assist...')
|
cc.i('build tp_assist...')
|
||||||
|
|
||||||
configuration = ctx.target_path.capitalize()
|
configuration = ctx.target_path.capitalize()
|
||||||
|
|
@ -169,7 +204,7 @@ class BuilderLinux(BuilderBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def build_exe(self):
|
def build_assist(self):
|
||||||
cc.e('not support linux.')
|
cc.e('not support linux.')
|
||||||
|
|
||||||
# def build_rdp(self):
|
# def build_rdp(self):
|
||||||
|
|
@ -215,7 +250,8 @@ def main():
|
||||||
builder = gen_builder(ctx.host_os)
|
builder = gen_builder(ctx.host_os)
|
||||||
|
|
||||||
if 'exe' in argv:
|
if 'exe' in argv:
|
||||||
builder.build_exe()
|
builder.build_assist()
|
||||||
|
builder.build_player()
|
||||||
# elif 'rdp' in argv:
|
# elif 'rdp' in argv:
|
||||||
# builder.build_rdp()
|
# builder.build_rdp()
|
||||||
elif 'installer' in argv:
|
elif 'installer' in argv:
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,25 @@ class BuilderBase:
|
||||||
|
|
||||||
def build_jsoncpp(self):
|
def build_jsoncpp(self):
|
||||||
file_name = 'jsoncpp-{}.zip'.format(env.ver_jsoncpp)
|
file_name = 'jsoncpp-{}.zip'.format(env.ver_jsoncpp)
|
||||||
if not utils.download_file('jsoncpp source tarball', 'https://github.com/open-source-parsers/jsoncpp/archive/{}.zip'.format(env.ver_jsoncpp), PATH_DOWNLOAD, file_name):
|
# if not utils.download_file('jsoncpp source tarball', 'https://github.com/open-source-parsers/jsoncpp/archive/{}.zip'.format(env.ver_jsoncpp), PATH_DOWNLOAD, file_name):
|
||||||
return
|
# return
|
||||||
self._build_jsoncpp(file_name)
|
self._build_jsoncpp(file_name)
|
||||||
|
|
||||||
|
def _download_jsoncpp(self, file_name):
|
||||||
|
return utils.download_file('jsoncpp source tarball', 'https://github.com/open-source-parsers/jsoncpp/archive/{}.zip'.format(env.ver_jsoncpp), PATH_DOWNLOAD, file_name)
|
||||||
|
|
||||||
def _build_jsoncpp(self, file_name):
|
def _build_jsoncpp(self, file_name):
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_mongoose(self):
|
def build_mongoose(self):
|
||||||
file_name = 'mongoose-{}.zip'.format(env.ver_mongoose)
|
file_name = 'mongoose-{}.zip'.format(env.ver_mongoose)
|
||||||
if not utils.download_file('mongoose source tarball', 'https://github.com/cesanta/mongoose/archive/{}.zip'.format(env.ver_mongoose), PATH_DOWNLOAD, file_name):
|
# if not utils.download_file('mongoose source tarball', 'https://github.com/cesanta/mongoose/archive/{}.zip'.format(env.ver_mongoose), PATH_DOWNLOAD, file_name):
|
||||||
return
|
# return
|
||||||
self._build_mongoose(file_name)
|
self._build_mongoose(file_name)
|
||||||
|
|
||||||
|
def _download_mongoose(self, file_name):
|
||||||
|
return utils.download_file('mongoose source tarball', 'https://github.com/cesanta/mongoose/archive/{}.zip'.format(env.ver_mongoose), PATH_DOWNLOAD, file_name)
|
||||||
|
|
||||||
def _build_mongoose(self, file_name):
|
def _build_mongoose(self, file_name):
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
|
@ -47,38 +53,64 @@ class BuilderBase:
|
||||||
file_name = 'openssl-{}.zip'.format(env.ver_ossl)
|
file_name = 'openssl-{}.zip'.format(env.ver_ossl)
|
||||||
self._build_openssl(file_name)
|
self._build_openssl(file_name)
|
||||||
|
|
||||||
def _build_openssl(self, file_name):
|
def _download_openssl(self, file_name):
|
||||||
_alt_ver = '_'.join(env.ver_ossl.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):
|
return 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
|
def _build_openssl(self, file_name):
|
||||||
else:
|
cc.e("this is a pure-virtual function.")
|
||||||
return True
|
# _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
|
||||||
|
|
||||||
def build_libuv(self):
|
def build_libuv(self):
|
||||||
file_name = 'libuv-{}.zip'.format(env.ver_libuv)
|
file_name = 'libuv-{}.zip'.format(env.ver_libuv)
|
||||||
if not utils.download_file('libuv source tarball', 'https://github.com/libuv/libuv/archive/v{}.zip'.format(env.ver_libuv), PATH_DOWNLOAD, file_name):
|
# if not utils.download_file('libuv source tarball', 'https://github.com/libuv/libuv/archive/v{}.zip'.format(env.ver_libuv), PATH_DOWNLOAD, file_name):
|
||||||
return
|
# return
|
||||||
self._build_libuv(file_name)
|
self._build_libuv(file_name)
|
||||||
|
|
||||||
|
def _download_libuv(self, file_name):
|
||||||
|
return utils.download_file('libuv source tarball', 'https://github.com/libuv/libuv/archive/v{}.zip'.format(env.ver_libuv), PATH_DOWNLOAD, file_name)
|
||||||
|
|
||||||
def _build_libuv(self, file_name):
|
def _build_libuv(self, file_name):
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_mbedtls(self):
|
def build_mbedtls(self):
|
||||||
file_name = 'mbedtls-mbedtls-{}.zip'.format(env.ver_mbedtls)
|
file_name = 'mbedtls-mbedtls-{}.zip'.format(env.ver_mbedtls)
|
||||||
if not utils.download_file('mbedtls source tarball', 'https://github.com/ARMmbed/mbedtls/archive/mbedtls-{}.zip'.format(env.ver_mbedtls), PATH_DOWNLOAD, file_name):
|
# if not utils.download_file('mbedtls source tarball', 'https://github.com/ARMmbed/mbedtls/archive/mbedtls-{}.zip'.format(env.ver_mbedtls), PATH_DOWNLOAD, file_name):
|
||||||
return
|
# return
|
||||||
self._build_mbedtls(file_name)
|
self._build_mbedtls(file_name)
|
||||||
|
|
||||||
|
def _download_mbedtls(self, file_name):
|
||||||
|
return utils.download_file('mbedtls source tarball', 'https://github.com/ARMmbed/mbedtls/archive/mbedtls-{}.zip'.format(env.ver_mbedtls), PATH_DOWNLOAD, file_name)
|
||||||
|
|
||||||
def _build_mbedtls(self, file_name):
|
def _build_mbedtls(self, file_name):
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
def build_zlib(self):
|
||||||
|
file_name = 'zlilb{}.zip'.format(env.ver_zlib_number)
|
||||||
|
# if not utils.download_file('mbedtls source tarball', 'https://www.zlib.net/zlib{}.zip'.format(env.ver_zlib_number), PATH_DOWNLOAD, file_name):
|
||||||
|
# return
|
||||||
|
self._build_zlib(file_name)
|
||||||
|
|
||||||
|
def _download_zlib(self, file_name):
|
||||||
|
return utils.download_file('mbedtls source tarball', 'https://www.zlib.net/zlib{}.zip'.format(env.ver_zlib_number), PATH_DOWNLOAD, file_name)
|
||||||
|
|
||||||
|
def _build_zlib(self, file_name):
|
||||||
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_libssh(self):
|
def build_libssh(self):
|
||||||
file_name = 'libssh-{}.zip'.format(env.ver_libssh)
|
file_name = 'libssh-{}.zip'.format(env.ver_libssh)
|
||||||
if not utils.download_file('libssh source tarball', 'https://git.libssh.org/projects/libssh.git/snapshot/libssh-{}.zip'.format(env.ver_libssh), PATH_DOWNLOAD, file_name):
|
# if not utils.download_file('libssh source tarball', 'https://git.libssh.org/projects/libssh.git/snapshot/libssh-{}.zip'.format(env.ver_libssh), PATH_DOWNLOAD, file_name):
|
||||||
return
|
# return
|
||||||
self._build_libssh(file_name)
|
self._build_libssh(file_name)
|
||||||
|
|
||||||
|
def _download_libssh(self, file_name):
|
||||||
|
return utils.download_file('libssh source tarball', 'https://git.libssh.org/projects/libssh.git/snapshot/libssh-{}.zip'.format(env.ver_libssh), PATH_DOWNLOAD, file_name)
|
||||||
|
|
||||||
def _build_libssh(self, file_name):
|
def _build_libssh(self, file_name):
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
|
@ -103,9 +135,10 @@ class BuilderWin(BuilderBase):
|
||||||
self.MBEDTLS_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mbedtls')
|
self.MBEDTLS_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mbedtls')
|
||||||
self.LIBUV_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libuv')
|
self.LIBUV_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libuv')
|
||||||
self.LIBSSH_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libssh')
|
self.LIBSSH_PATH_SRC = os.path.join(PATH_EXTERNAL, 'libssh')
|
||||||
|
self.ZLIB_PATH_SRC = os.path.join(PATH_EXTERNAL, 'zlib')
|
||||||
|
|
||||||
def _prepare_python(self):
|
def _prepare_python(self):
|
||||||
cc.n('prepare python header files ...', end='')
|
cc.n('prepare python header files ... ', end='')
|
||||||
|
|
||||||
if os.path.exists(os.path.join(PATH_EXTERNAL, 'python', 'include', 'Python.h')):
|
if os.path.exists(os.path.join(PATH_EXTERNAL, 'python', 'include', 'Python.h')):
|
||||||
cc.w('already exists, skip.')
|
cc.w('already exists, skip.')
|
||||||
|
|
@ -125,53 +158,85 @@ class BuilderWin(BuilderBase):
|
||||||
utils.copy_ex(_header_path, os.path.join(PATH_EXTERNAL, 'python', 'include'))
|
utils.copy_ex(_header_path, os.path.join(PATH_EXTERNAL, 'python', 'include'))
|
||||||
|
|
||||||
def _build_openssl(self, file_name):
|
def _build_openssl(self, file_name):
|
||||||
cc.n('build openssl static library from source code... ')
|
cc.n('prepare OpenSSL pre-built package ... ', end='')
|
||||||
|
if os.path.exists(self.OPENSSL_PATH_SRC):
|
||||||
if not super()._build_openssl(file_name):
|
|
||||||
return
|
|
||||||
|
|
||||||
_chk_output = [
|
|
||||||
os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'libeay32.lib'),
|
|
||||||
os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'ssleay32.lib'),
|
|
||||||
os.path.join(self.OPENSSL_PATH_SRC, 'inc32', 'openssl', 'opensslconf.h'),
|
|
||||||
]
|
|
||||||
|
|
||||||
need_build = False
|
|
||||||
for f in _chk_output:
|
|
||||||
if not os.path.exists(f):
|
|
||||||
need_build = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if not need_build:
|
|
||||||
cc.n('build openssl static library from source code... ', end='')
|
|
||||||
cc.w('already exists, skip.')
|
cc.w('already exists, skip.')
|
||||||
return
|
return
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
||||||
cc.n('prepare openssl source code...')
|
|
||||||
_alt_ver = '_'.join(env.ver_ossl.split('.'))
|
_alt_ver = '_'.join(env.ver_ossl.split('.'))
|
||||||
if not os.path.exists(self.OPENSSL_PATH_SRC):
|
|
||||||
utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
|
|
||||||
os.rename(os.path.join(PATH_EXTERNAL, 'openssl-OpenSSL_{}'.format(_alt_ver)), self.OPENSSL_PATH_SRC)
|
|
||||||
if not os.path.exists(self.OPENSSL_PATH_SRC):
|
|
||||||
raise RuntimeError('can not prepare openssl source code.')
|
|
||||||
else:
|
|
||||||
cc.w('already exists, skip.')
|
|
||||||
|
|
||||||
os.chdir(self.OPENSSL_PATH_SRC)
|
file_name = 'Win32OpenSSL-{}.msi'.format(_alt_ver)
|
||||||
os.system('""{}" Configure VC-WIN32"'.format(env.perl))
|
installer = os.path.join(PATH_DOWNLOAD, file_name)
|
||||||
os.system(r'ms\do_nasm')
|
|
||||||
# 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(installer):
|
||||||
if not os.path.exists(f):
|
if not utils.download_file('openssl installer', 'http://slproweb.com/download/{}'.format(filename), PATH_DOWNLOAD, file_name):
|
||||||
raise RuntimeError('build openssl static library from source code failed.')
|
cc.e('can not download pre-built installer of OpenSSL.')
|
||||||
|
return
|
||||||
|
|
||||||
|
utils.ensure_file_exists(installer)
|
||||||
|
|
||||||
|
cc.w('On Windows, we use pre-built package of OpenSSL.')
|
||||||
|
cc.w('The installer have been downloaded at "{}".'.format(installer))
|
||||||
|
cc.w('please install OpenSSL into "{}".'.format(self.OPENSSL_PATH_SRC))
|
||||||
|
cc.w('\nOnce the OpenSSL installed, press Enter to continue or Q to quit...', end='')
|
||||||
|
try:
|
||||||
|
x = env.input()
|
||||||
|
except EOFError:
|
||||||
|
x = 'q'
|
||||||
|
if x == 'q':
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
# cc.n('build openssl static library from source code... ')
|
||||||
|
|
||||||
|
# if not super()._build_openssl(file_name):
|
||||||
|
# return
|
||||||
|
|
||||||
|
# _chk_output = [
|
||||||
|
# os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'libeay32.lib'),
|
||||||
|
# os.path.join(self.OPENSSL_PATH_SRC, 'out32', 'ssleay32.lib'),
|
||||||
|
# os.path.join(self.OPENSSL_PATH_SRC, 'inc32', 'openssl', 'opensslconf.h'),
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# need_build = False
|
||||||
|
# for f in _chk_output:
|
||||||
|
# if not os.path.exists(f):
|
||||||
|
# need_build = True
|
||||||
|
# break
|
||||||
|
|
||||||
|
# if not need_build:
|
||||||
|
# cc.n('build openssl static library from source code... ', end='')
|
||||||
|
# cc.w('already exists, skip.')
|
||||||
|
# return
|
||||||
|
# cc.v('')
|
||||||
|
|
||||||
|
# cc.n('prepare openssl source code...')
|
||||||
|
# _alt_ver = '_'.join(env.ver_ossl.split('.'))
|
||||||
|
# if not os.path.exists(self.OPENSSL_PATH_SRC):
|
||||||
|
# utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
|
||||||
|
# os.rename(os.path.join(PATH_EXTERNAL, 'openssl-OpenSSL_{}'.format(_alt_ver)), self.OPENSSL_PATH_SRC)
|
||||||
|
# if not os.path.exists(self.OPENSSL_PATH_SRC):
|
||||||
|
# raise RuntimeError('can not prepare openssl source code.')
|
||||||
|
# else:
|
||||||
|
# cc.w('already exists, skip.')
|
||||||
|
|
||||||
|
# os.chdir(self.OPENSSL_PATH_SRC)
|
||||||
|
# os.system('""{}" Configure VC-WIN32"'.format(env.perl))
|
||||||
|
# os.system(r'ms\do_nasm')
|
||||||
|
# # 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):
|
||||||
|
# raise RuntimeError('build openssl static library from source code failed.')
|
||||||
|
|
||||||
def _build_libssh(self, file_name):
|
def _build_libssh(self, file_name):
|
||||||
cc.n('build libssh static library from source code... ', end='')
|
if not self._download_libssh(file_name):
|
||||||
|
return
|
||||||
|
cc.n('build libssh library from source code... ', end='')
|
||||||
|
|
||||||
if not os.path.exists(self.LIBSSH_PATH_SRC):
|
if not os.path.exists(self.LIBSSH_PATH_SRC):
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
@ -210,7 +275,7 @@ class BuilderWin(BuilderBase):
|
||||||
|
|
||||||
cc.i('build libssh...')
|
cc.i('build libssh...')
|
||||||
sln_file = os.path.join(self.LIBSSH_PATH_SRC, 'build', 'libssh.sln')
|
sln_file = os.path.join(self.LIBSSH_PATH_SRC, 'build', 'libssh.sln')
|
||||||
utils.msvc_build(sln_file, 'ssh_shared', ctx.target_path, 'win32', False)
|
utils.msvc_build(sln_file, 'ssh', ctx.target_path, 'win32', False)
|
||||||
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.lib'))
|
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.lib'))
|
||||||
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.dll'))
|
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.dll'))
|
||||||
utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path), os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path), 'ssh.lib')
|
utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path), os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path), 'ssh.lib')
|
||||||
|
|
@ -218,7 +283,53 @@ class BuilderWin(BuilderBase):
|
||||||
utils.ensure_file_exists(out_file_lib)
|
utils.ensure_file_exists(out_file_lib)
|
||||||
utils.ensure_file_exists(out_file_dll)
|
utils.ensure_file_exists(out_file_dll)
|
||||||
|
|
||||||
|
def _build_zlib(self, file_name):
|
||||||
|
if not self._download_zlib(file_name):
|
||||||
|
return
|
||||||
|
cc.n('build zlib library from source code... ', end='')
|
||||||
|
|
||||||
|
if not os.path.exists(self.ZLIB_PATH_SRC):
|
||||||
|
cc.v('')
|
||||||
|
utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
|
||||||
|
os.rename(os.path.join(PATH_EXTERNAL, 'zlib-{}'.format(env.ver_zlib)), self.ZLIB_PATH_SRC)
|
||||||
|
|
||||||
|
if ctx.target_path == 'debug':
|
||||||
|
olib = 'zlibd.lib'
|
||||||
|
odll = 'zlibd.dll'
|
||||||
|
else:
|
||||||
|
olib = 'zlib.lib'
|
||||||
|
odll = 'zlib.dll'
|
||||||
|
out_file_lib = os.path.join(self.ZLIB_PATH_SRC, 'build', ctx.target_path, olib)
|
||||||
|
out_file_dll = os.path.join(self.ZLIB_PATH_SRC, 'build', ctx.target_path, odll)
|
||||||
|
|
||||||
|
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 zlib, need you use cmake-gui.exe to generate solution file')
|
||||||
|
cc.w('for Visual Studio 2017. Visit https://docs.tp4a.com for more details.')
|
||||||
|
cc.w('\nOnce the zlib.sln generated, press Enter to continue or Q to quit...', end='')
|
||||||
|
try:
|
||||||
|
x = env.input()
|
||||||
|
except EOFError:
|
||||||
|
x = 'q'
|
||||||
|
if x == 'q':
|
||||||
|
return
|
||||||
|
|
||||||
|
cc.i('build zlib...')
|
||||||
|
sln_file = os.path.join(self.ZLIB_PATH_SRC, 'build', 'zlib.sln')
|
||||||
|
utils.msvc_build(sln_file, 'zlib', ctx.target_path, 'win32', False)
|
||||||
|
# utils.ensure_file_exists(os.path.join(self.ZLIB_PATH_SRC, 'build', ctx.target_path, 'zlib.lib'))
|
||||||
|
# utils.ensure_file_exists(os.path.join(self.ZLIB_PATH_SRC, 'build', ctx.target_path, 'zlib.dll'))
|
||||||
|
# utils.copy_file(os.path.join(self.ZLIB_PATH_SRC, 'build', ctx.target_path), os.path.join(self.ZLIB_PATH_SRC, 'lib', ctx.target_path), 'zlib.lib')
|
||||||
|
# utils.copy_file(os.path.join(self.ZLIB_PATH_SRC, 'build', ctx.target_path), os.path.join(self.ZLIB_PATH_SRC, 'lib', ctx.target_path), 'zlib.dll')
|
||||||
|
utils.ensure_file_exists(out_file_lib)
|
||||||
|
utils.ensure_file_exists(out_file_dll)
|
||||||
|
|
||||||
def _build_jsoncpp(self, file_name):
|
def _build_jsoncpp(self, file_name):
|
||||||
|
if not self._download_jsoncpp(file_name):
|
||||||
|
return
|
||||||
cc.n('prepare jsoncpp source code... ', end='')
|
cc.n('prepare jsoncpp source code... ', end='')
|
||||||
if not os.path.exists(self.JSONCPP_PATH_SRC):
|
if not os.path.exists(self.JSONCPP_PATH_SRC):
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
@ -228,6 +339,8 @@ class BuilderWin(BuilderBase):
|
||||||
cc.w('already exists, skip.')
|
cc.w('already exists, skip.')
|
||||||
|
|
||||||
def _build_mongoose(self, file_name):
|
def _build_mongoose(self, file_name):
|
||||||
|
if not self._download_mongoose(file_name):
|
||||||
|
return
|
||||||
cc.n('prepare mongoose source code... ', end='')
|
cc.n('prepare mongoose source code... ', end='')
|
||||||
if not os.path.exists(self.MONGOOSE_PATH_SRC):
|
if not os.path.exists(self.MONGOOSE_PATH_SRC):
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
@ -237,6 +350,8 @@ class BuilderWin(BuilderBase):
|
||||||
cc.w('already exists, skip.')
|
cc.w('already exists, skip.')
|
||||||
|
|
||||||
def _build_mbedtls(self, file_name):
|
def _build_mbedtls(self, file_name):
|
||||||
|
if not self._download_mbedtls(file_name):
|
||||||
|
return
|
||||||
cc.n('prepare mbedtls source code... ', end='')
|
cc.n('prepare mbedtls source code... ', end='')
|
||||||
if not os.path.exists(self.MBEDTLS_PATH_SRC):
|
if not os.path.exists(self.MBEDTLS_PATH_SRC):
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
@ -254,6 +369,8 @@ class BuilderWin(BuilderBase):
|
||||||
# utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library'), os.path.join(self.MBEDTLS_PATH_SRC, 'library'), 'rsa.c')
|
# utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'mbedtls', 'library'), os.path.join(self.MBEDTLS_PATH_SRC, 'library'), 'rsa.c')
|
||||||
|
|
||||||
def _build_libuv(self, file_name):
|
def _build_libuv(self, file_name):
|
||||||
|
if not self._download_libuv(file_name):
|
||||||
|
return
|
||||||
cc.n('prepare libuv source code... ', end='')
|
cc.n('prepare libuv source code... ', end='')
|
||||||
if not os.path.exists(self.LIBUV_PATH_SRC):
|
if not os.path.exists(self.LIBUV_PATH_SRC):
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
@ -674,6 +791,7 @@ def main():
|
||||||
builder.build_openssl()
|
builder.build_openssl()
|
||||||
builder.build_libuv()
|
builder.build_libuv()
|
||||||
builder.build_mbedtls()
|
builder.build_mbedtls()
|
||||||
|
builder.build_zlib()
|
||||||
builder.build_libssh()
|
builder.build_libssh()
|
||||||
|
|
||||||
builder.fix_output()
|
builder.fix_output()
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,11 @@ class Env(object):
|
||||||
if warn_miss_tool:
|
if warn_miss_tool:
|
||||||
cc.w(' - can not locate `nsis`, so I can not make installer.')
|
cc.w(' - can not locate `nsis`, so I can not make installer.')
|
||||||
|
|
||||||
|
if 'qt' in _tmp:
|
||||||
|
self.qt = _tmp['qt']
|
||||||
|
else:
|
||||||
|
self.qt = None
|
||||||
|
|
||||||
elif self.is_linux or self.is_macos:
|
elif self.is_linux or self.is_macos:
|
||||||
if 'cmake' in _tmp:
|
if 'cmake' in _tmp:
|
||||||
self.cmake = _tmp['cmake']
|
self.cmake = _tmp['cmake']
|
||||||
|
|
@ -178,6 +183,10 @@ class Env(object):
|
||||||
self.ver_ossl = _v_openssl[0].strip()
|
self.ver_ossl = _v_openssl[0].strip()
|
||||||
self.ver_ossl_number = _v_openssl[1].strip()
|
self.ver_ossl_number = _v_openssl[1].strip()
|
||||||
|
|
||||||
|
_v_zlib = _tmp['zlib'].split(',')
|
||||||
|
self.ver_zlib = _v_zlib[0].strip()
|
||||||
|
self.ver_zlib_number = _v_zlib[1].strip()
|
||||||
|
|
||||||
self.ver_libuv = _tmp['libuv']
|
self.ver_libuv = _tmp['libuv']
|
||||||
self.ver_mbedtls = _tmp['mbedtls']
|
self.ver_mbedtls = _tmp['mbedtls']
|
||||||
# self.ver_sqlite = _tmp['sqlite']
|
# self.ver_sqlite = _tmp['sqlite']
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,21 @@ def msvc_build(sln_file, proj_name, target, platform, force_rebuild):
|
||||||
raise RuntimeError('build MSVC project `{}` failed.'.format(proj_name))
|
raise RuntimeError('build MSVC project `{}` failed.'.format(proj_name))
|
||||||
|
|
||||||
|
|
||||||
|
def qt_build_win(prj_path, prj_name, bit_path, target_path):
|
||||||
|
cc.n(env.visual_studio_path)
|
||||||
|
if env.qt is None:
|
||||||
|
raise RuntimeError('where is `qt`?')
|
||||||
|
|
||||||
|
if env.is_win:
|
||||||
|
tmp_path = os.path.join(env.root_path, 'out', '_tmp_', prj_name, bit_path)
|
||||||
|
# C:\Windows\System32\cmd.exe /A /Q /K C:\Qt\Qt5.12.0\5.12.0\msvc2017\bin\qtenv2.bat
|
||||||
|
cmd = 'C:\\Windows\\System32\\cmd.exe /A /Q /C ""{}\qt-helper.bat" "{}\\bin\\qtenv2.bat" "{}VC\\Auxiliary\\Build\\vcvarsall.bat" {} "{}" "{}" {}"'.format(env.build_path, env.qt, env.visual_studio_path, bit_path, tmp_path, prj_path, target_path)
|
||||||
|
ret, _ = sys_exec(cmd, direct_output=True)
|
||||||
|
if ret != 0:
|
||||||
|
raise RuntimeError('build XCode project `{}` failed.'.format(proj_name))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def xcode_build(proj_file, proj_name, target, force_rebuild):
|
def xcode_build(proj_file, proj_name, target, force_rebuild):
|
||||||
if force_rebuild:
|
if force_rebuild:
|
||||||
cmd = 'xcodebuild -project "{}" -target {} -configuration {} clean'.format(proj_file, proj_name, target)
|
cmd = 'xcodebuild -project "{}" -target {} -configuration {} clean'.format(proj_file, proj_name, target)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- coding: utf8 -*-
|
# -*- coding: utf8 -*-
|
||||||
VER_TP_SERVER = "3.3.1"
|
VER_TP_SERVER = "3.5.1"
|
||||||
VER_TP_ASSIST = "3.3.1"
|
VER_TP_ASSIST = "3.5.1"
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,10 @@
|
||||||
// tp-player.exe path/contains/tp-rdp.tpr 包含 .tpr 文件的路径
|
// tp-player.exe path/contains/tp-rdp.tpr 包含 .tpr 文件的路径
|
||||||
//
|
//
|
||||||
// ## 从TP服务器上下载
|
// ## 从TP服务器上下载
|
||||||
// (废弃) tp-player.exe "http://127.0.0.1:7190" 1234 "tp_1491560510_ca67fceb75a78c9d" "000000256-admin-administrator-218.244.140.14-20171209-020047"
|
|
||||||
// (废弃) TP服务器地址 记录编号 session-id(仅授权用户可下载) 合成的名称,用于本地生成路径来存放下载的文件
|
|
||||||
//
|
|
||||||
// ## 从TP服务器上下载
|
|
||||||
// tp-player.exe http://teleport.domain.com:7190/{sub/path/}tp_1491560510_ca67fceb75a78c9d/1234 (注意,并不直接访问此URI,实际上其并不存在)
|
// tp-player.exe http://teleport.domain.com:7190/{sub/path/}tp_1491560510_ca67fceb75a78c9d/1234 (注意,并不直接访问此URI,实际上其并不存在)
|
||||||
// TP服务器地址(可能包含子路径哦,例如上例中的{sub/path}部分)/session-id(用于判断当前授权用户)/录像会话编号
|
// TP服务器地址(可能包含子路径,例如上例中的{sub/path}部分)/session-id(用于判断当前授权用户)/录像会话编号
|
||||||
// 按 “/” 进行分割后,去掉最后两个项,剩下部分是TP服务器的WEB地址,用于合成后续的文件下载URL。
|
// 按 “/” 进行分割后,去掉最后两个项,剩下部分是TP服务器的WEB地址,用于合成后续的文件下载URL。
|
||||||
// 根据下载的.tpr文件内容,本地合成类似于 "000000256-admin-administrator-218.244.140.14-20171209-020047" 的路径来存放下载的文件
|
// 根据下载的.tpr文件内容,本地合成类似于 "000000256-admin-administrator-123.45.77.88-20191109-020047" 的路径来存放下载的文件
|
||||||
// 特别注意,如果账号是 domain\user 这种形式,需要将 "\" 替换为下划线,否则此符号作为路径分隔符,会导致路径不存在而无法保存下载的文件。
|
// 特别注意,如果账号是 domain\user 这种形式,需要将 "\" 替换为下划线,否则此符号作为路径分隔符,会导致路径不存在而无法保存下载的文件。
|
||||||
// - 获取文件大小: http://127.0.0.1:7190/audit/get-file?act=size&type=rdp&rid=yyyyy&f=file-name
|
// - 获取文件大小: http://127.0.0.1:7190/audit/get-file?act=size&type=rdp&rid=yyyyy&f=file-name
|
||||||
// - 'act'为`size`表示获取文件大小(返回一个数字字符串,就是指定的文件大小)
|
// - 'act'为`size`表示获取文件大小(返回一个数字字符串,就是指定的文件大小)
|
||||||
|
|
@ -41,9 +37,9 @@ void show_usage(QCommandLineParser& parser) {
|
||||||
+ parser.helpText()
|
+ parser.helpText()
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ "RESOURCE could be:\n"
|
+ "RESOURCE could be:\n"
|
||||||
+ " teleport record file (.tpr).\n"
|
+ " - teleport record file (.tpr).\n"
|
||||||
+ " a directory contains .tpr file.\n"
|
+ " - a directory contains .tpr file.\n"
|
||||||
+ " an URL to download teleport record file."
|
+ " - an URL to download teleport record file."
|
||||||
+ "</pre></body></html>");
|
+ "</pre></body></html>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,15 +78,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if(parser.isSet(opt_help)) {
|
if(parser.isSet(opt_help)) {
|
||||||
show_usage(parser);
|
show_usage(parser);
|
||||||
// QMessageBox::warning(nullptr, QGuiApplication::applicationDisplayName(),
|
|
||||||
// "<html><head/><body><pre>"
|
|
||||||
// + parser.helpText()
|
|
||||||
// + "\n\n"
|
|
||||||
// + "RESOURCE could be:\n"
|
|
||||||
// + " teleport record file (.tpr).\n"
|
|
||||||
// + " a directory contains .tpr file.\n"
|
|
||||||
// + " an URL for download teleport record file."
|
|
||||||
// + "</pre></body></html>");
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,10 +91,6 @@ int main(int argc, char *argv[])
|
||||||
qDebug() << resource;
|
qDebug() << resource;
|
||||||
|
|
||||||
|
|
||||||
// QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));
|
|
||||||
// QTextCodec::setCodecForLocale(QTextCodec::codecForName("GBK"));
|
|
||||||
// QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));
|
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.set_resource(resource);
|
w.set_resource(resource);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ TARGET = tp-player
|
||||||
|
|
||||||
QT += core gui widgets network
|
QT += core gui widgets network
|
||||||
|
|
||||||
#DEFINES += QT_NO_DEBUG_OUTPUT
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
bar.h \
|
bar.h \
|
||||||
|
|
@ -40,12 +38,13 @@ FORMS += \
|
||||||
|
|
||||||
|
|
||||||
win32:CONFIG(release, debug|release): {
|
win32:CONFIG(release, debug|release): {
|
||||||
LIBS += -L$$PWD/../../external/zlib/build/release/ -lzlibstatic
|
DEFINES += QT_NO_DEBUG_OUTPUT
|
||||||
DESTDIR = $$PWD/../../out/client/x86/Release/tools/player
|
LIBS += -L$$PWD/../../external/zlib/build/release/ -lzlib
|
||||||
|
DESTDIR = $$PWD/../../out/client/x86/Release
|
||||||
}
|
}
|
||||||
else:win32:CONFIG(debug, debug|release): {
|
else:win32:CONFIG(debug, debug|release): {
|
||||||
LIBS += -L$$PWD/../../external/zlib/build/debug/ -lzlibstaticd
|
LIBS += -L$$PWD/../../external/zlib/build/debug/ -lzlibd
|
||||||
DESTDIR = $$PWD/../../out/client/x86/Debug/tools/player
|
DESTDIR = $$PWD/../../out/client/x86/Debug
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../../external/zlib
|
INCLUDEPATH += $$PWD/../../external/zlib
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,11 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.3.1</string>
|
<string>3.5.1</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>3.3.1</string>
|
<string>3.5.1</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.productivity</string>
|
<string>public.app-category.productivity</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __TS_ASSIST_VER_H__
|
#ifndef __TS_ASSIST_VER_H__
|
||||||
#define __TS_ASSIST_VER_H__
|
#define __TS_ASSIST_VER_H__
|
||||||
|
|
||||||
#define TP_ASSIST_VER L"3.3.1"
|
#define TP_ASSIST_VER L"3.5.1"
|
||||||
|
|
||||||
#endif // __TS_ASSIST_VER_H__
|
#endif // __TS_ASSIST_VER_H__
|
||||||
|
|
|
||||||
|
|
@ -1 +1,14 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
#include <ex.h>
|
||||||
|
|
||||||
|
// #ifdef EX_DEBUG
|
||||||
|
// // # pragma comment(lib, "libssl32MTd.lib")
|
||||||
|
// // # pragma comment(lib, "libcrypto32MTd.lib")
|
||||||
|
// #else
|
||||||
|
// # pragma comment(lib, "libssl32MT.lib")
|
||||||
|
// # pragma comment(lib, "libcrypto32MT.lib")
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
# pragma comment(lib, "libssl.lib")
|
||||||
|
# pragma comment(lib, "libcrypto.lib")
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -61,13 +61,14 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<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>
|
<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>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\inc32</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\include</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>..\..\external\openssl\out32\ssleay32.lib;..\..\external\openssl\out32\libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>..\..\external\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
|
@ -79,7 +80,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<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>
|
<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>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\inc32</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\include</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
|
@ -87,7 +88,8 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>..\..\external\openssl\out32\ssleay32.lib;..\..\external\openssl\out32\libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>..\..\external\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,266 +1,274 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "ts_cfg.h"
|
#include "ts_cfg.h"
|
||||||
#include "ts_env.h"
|
#include "ts_env.h"
|
||||||
|
|
||||||
|
|
||||||
TsCfg g_cfg;
|
TsCfg g_cfg;
|
||||||
|
|
||||||
TsCfg::TsCfg()
|
TsCfg::TsCfg()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TsCfg::~TsCfg()
|
TsCfg::~TsCfg()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool TsCfg::init(void) {
|
bool TsCfg::init(void) {
|
||||||
ex_astr file_content;
|
ex_astr file_content;
|
||||||
if (!ex_read_text_file(g_env.m_cfg_file, file_content)) {
|
if (!ex_read_text_file(g_env.m_cfg_file, file_content)) {
|
||||||
EXLOGE("can not load config file.\n");
|
EXLOGE("can not load config file.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_load(file_content))
|
if (!_load(file_content))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TsCfg::save(const ex_astr& new_value)
|
bool TsCfg::save(const ex_astr& new_value)
|
||||||
{
|
{
|
||||||
if (!_load(new_value))
|
if (!_load(new_value))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Json::StyledWriter jwriter;
|
//Json::StyledWriter jwriter;
|
||||||
ex_astr val = jwriter.write(m_root);
|
Json::StreamWriterBuilder jwb;
|
||||||
|
std::unique_ptr<Json::StreamWriter> jwriter(jwb.newStreamWriter());
|
||||||
if (!ex_write_text_file(g_env.m_cfg_file, val)) {
|
ex_aoss os;
|
||||||
EXLOGE("can not save config file.\n");
|
jwriter->write(m_root, &os);
|
||||||
return false;
|
ex_astr val = os.str();
|
||||||
}
|
|
||||||
|
if (!ex_write_text_file(g_env.m_cfg_file, val)) {
|
||||||
return true;
|
EXLOGE("can not save config file.\n");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
bool TsCfg::_load(const ex_astr& str_json) {
|
|
||||||
Json::Reader jreader;
|
return true;
|
||||||
|
}
|
||||||
if (!jreader.parse(str_json.c_str(), m_root)) {
|
|
||||||
EXLOGE("can not parse new config data, not in json format? %s\n", jreader.getFormattedErrorMessages().c_str());
|
bool TsCfg::_load(const ex_astr& str_json) {
|
||||||
return false;
|
//Json::Reader jreader;
|
||||||
}
|
Json::CharReaderBuilder jcrb;
|
||||||
|
std::unique_ptr<Json::CharReader> const jreader(jcrb.newCharReader());
|
||||||
ex_astr sel_name;
|
const char *str_json_begin = str_json.c_str();
|
||||||
size_t i = 0;
|
|
||||||
ex_astr tmp;
|
ex_astr err;
|
||||||
|
if (!jreader->parse(str_json_begin, str_json_begin + str_json.length(), &m_root, &err)) {
|
||||||
//===================================
|
EXLOGE("can not parse new config data, not in json format? %s\n", err.c_str());
|
||||||
// check ssh config
|
return false;
|
||||||
//===================================
|
}
|
||||||
|
|
||||||
if (!m_root["ssh"].isObject()) {
|
ex_astr sel_name;
|
||||||
EXLOGE("invalid config, error 1.\n");
|
size_t i = 0;
|
||||||
return false;
|
ex_astr tmp;
|
||||||
}
|
|
||||||
|
//===================================
|
||||||
if (!m_root["ssh"]["selected"].isString()) {
|
// check ssh config
|
||||||
EXLOGE("invalid config, error 2.\n");
|
//===================================
|
||||||
return false;
|
|
||||||
}
|
if (!m_root["ssh"].isObject()) {
|
||||||
|
EXLOGE("invalid config, error 1.\n");
|
||||||
sel_name = m_root["ssh"]["selected"].asCString();
|
return false;
|
||||||
|
}
|
||||||
if (!m_root["ssh"]["available"].isArray() || m_root["ssh"]["available"].size() == 0) {
|
|
||||||
EXLOGE("invalid config, error 3.\n");
|
if (!m_root["ssh"]["selected"].isString()) {
|
||||||
return false;
|
EXLOGE("invalid config, error 2.\n");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
for (i = 0; i < m_root["ssh"]["available"].size(); ++i) {
|
|
||||||
|
sel_name = m_root["ssh"]["selected"].asCString();
|
||||||
if (
|
|
||||||
!m_root["ssh"]["available"][i]["name"].isString()
|
if (!m_root["ssh"]["available"].isArray() || m_root["ssh"]["available"].size() == 0) {
|
||||||
|| !m_root["ssh"]["available"][i]["app"].isString()
|
EXLOGE("invalid config, error 3.\n");
|
||||||
|| !m_root["ssh"]["available"][i]["cmdline"].isString()
|
return false;
|
||||||
) {
|
}
|
||||||
EXLOGE("invalid config, error 4.\n");
|
|
||||||
return false;
|
for (i = 0; i < m_root["ssh"]["available"].size(); ++i) {
|
||||||
}
|
|
||||||
|
if (
|
||||||
if (m_root["ssh"]["available"][i]["display"].isNull()) {
|
!m_root["ssh"]["available"][i]["name"].isString()
|
||||||
m_root["ssh"]["available"][i]["display"] = m_root["ssh"]["available"][i]["name"];
|
|| !m_root["ssh"]["available"][i]["app"].isString()
|
||||||
}
|
|| !m_root["ssh"]["available"][i]["cmdline"].isString()
|
||||||
|
) {
|
||||||
if (m_root["ssh"]["available"][i]["name"].asCString() != sel_name)
|
EXLOGE("invalid config, error 4.\n");
|
||||||
continue;
|
return false;
|
||||||
|
}
|
||||||
tmp = m_root["ssh"]["available"][i]["app"].asCString();
|
|
||||||
ex_astr2wstr(tmp, ssh_app, EX_CODEPAGE_UTF8);
|
if (m_root["ssh"]["available"][i]["display"].isNull()) {
|
||||||
tmp = m_root["ssh"]["available"][i]["cmdline"].asCString();
|
m_root["ssh"]["available"][i]["display"] = m_root["ssh"]["available"][i]["name"];
|
||||||
ex_astr2wstr(tmp, ssh_cmdline, EX_CODEPAGE_UTF8);
|
}
|
||||||
|
|
||||||
break;
|
if (m_root["ssh"]["available"][i]["name"].asCString() != sel_name)
|
||||||
}
|
continue;
|
||||||
|
|
||||||
if (ssh_app.length() == 0 || ssh_cmdline.length() == 0) {
|
tmp = m_root["ssh"]["available"][i]["app"].asCString();
|
||||||
EXLOGE("invalid config, error 6.\n");
|
ex_astr2wstr(tmp, ssh_app, EX_CODEPAGE_UTF8);
|
||||||
return false;
|
tmp = m_root["ssh"]["available"][i]["cmdline"].asCString();
|
||||||
}
|
ex_astr2wstr(tmp, ssh_cmdline, EX_CODEPAGE_UTF8);
|
||||||
|
|
||||||
//===================================
|
break;
|
||||||
// check sftp config
|
}
|
||||||
//===================================
|
|
||||||
|
if (ssh_app.length() == 0 || ssh_cmdline.length() == 0) {
|
||||||
if (!m_root["scp"].isObject()) {
|
EXLOGE("invalid config, error 6.\n");
|
||||||
EXLOGE("invalid config, error 1.\n");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
//===================================
|
||||||
if (!m_root["scp"]["selected"].isString()) {
|
// check sftp config
|
||||||
EXLOGE("invalid config, error 2.\n");
|
//===================================
|
||||||
return false;
|
|
||||||
}
|
if (!m_root["scp"].isObject()) {
|
||||||
|
EXLOGE("invalid config, error 1.\n");
|
||||||
sel_name = m_root["scp"]["selected"].asCString();
|
return false;
|
||||||
|
}
|
||||||
if (!m_root["scp"]["available"].isArray() || m_root["scp"]["available"].size() == 0) {
|
|
||||||
EXLOGE("invalid config, error 3.\n");
|
if (!m_root["scp"]["selected"].isString()) {
|
||||||
return false;
|
EXLOGE("invalid config, error 2.\n");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
for (i = 0; i < m_root["scp"]["available"].size(); ++i) {
|
|
||||||
|
sel_name = m_root["scp"]["selected"].asCString();
|
||||||
if (
|
|
||||||
!m_root["scp"]["available"][i]["name"].isString()
|
if (!m_root["scp"]["available"].isArray() || m_root["scp"]["available"].size() == 0) {
|
||||||
|| !m_root["scp"]["available"][i]["app"].isString()
|
EXLOGE("invalid config, error 3.\n");
|
||||||
|| !m_root["scp"]["available"][i]["cmdline"].isString()
|
return false;
|
||||||
) {
|
}
|
||||||
EXLOGE("invalid config, error 4.\n");
|
|
||||||
return false;
|
for (i = 0; i < m_root["scp"]["available"].size(); ++i) {
|
||||||
}
|
|
||||||
|
if (
|
||||||
if (m_root["scp"]["available"][i]["display"].isNull()) {
|
!m_root["scp"]["available"][i]["name"].isString()
|
||||||
m_root["scp"]["available"][i]["display"] = m_root["scp"]["available"][i]["name"];
|
|| !m_root["scp"]["available"][i]["app"].isString()
|
||||||
}
|
|| !m_root["scp"]["available"][i]["cmdline"].isString()
|
||||||
|
) {
|
||||||
if (m_root["scp"]["available"][i]["name"].asCString() != sel_name)
|
EXLOGE("invalid config, error 4.\n");
|
||||||
continue;
|
return false;
|
||||||
|
}
|
||||||
tmp = m_root["scp"]["available"][i]["app"].asCString();
|
|
||||||
ex_astr2wstr(tmp, scp_app, EX_CODEPAGE_UTF8);
|
if (m_root["scp"]["available"][i]["display"].isNull()) {
|
||||||
tmp = m_root["scp"]["available"][i]["cmdline"].asCString();
|
m_root["scp"]["available"][i]["display"] = m_root["scp"]["available"][i]["name"];
|
||||||
ex_astr2wstr(tmp, scp_cmdline, EX_CODEPAGE_UTF8);
|
}
|
||||||
|
|
||||||
break;
|
if (m_root["scp"]["available"][i]["name"].asCString() != sel_name)
|
||||||
}
|
continue;
|
||||||
|
|
||||||
if (scp_app.length() == 0 || scp_cmdline.length() == 0) {
|
tmp = m_root["scp"]["available"][i]["app"].asCString();
|
||||||
EXLOGE("invalid config, error 6.\n");
|
ex_astr2wstr(tmp, scp_app, EX_CODEPAGE_UTF8);
|
||||||
return false;
|
tmp = m_root["scp"]["available"][i]["cmdline"].asCString();
|
||||||
}
|
ex_astr2wstr(tmp, scp_cmdline, EX_CODEPAGE_UTF8);
|
||||||
|
|
||||||
//===================================
|
break;
|
||||||
// check telnet config
|
}
|
||||||
//===================================
|
|
||||||
|
if (scp_app.length() == 0 || scp_cmdline.length() == 0) {
|
||||||
if (!m_root["telnet"].isObject()) {
|
EXLOGE("invalid config, error 6.\n");
|
||||||
EXLOGE("invalid config, error 1.\n");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
//===================================
|
||||||
if (!m_root["telnet"]["selected"].isString()) {
|
// check telnet config
|
||||||
EXLOGE("invalid config, error 2.\n");
|
//===================================
|
||||||
return false;
|
|
||||||
}
|
if (!m_root["telnet"].isObject()) {
|
||||||
|
EXLOGE("invalid config, error 1.\n");
|
||||||
sel_name = m_root["telnet"]["selected"].asCString();
|
return false;
|
||||||
|
}
|
||||||
if (!m_root["telnet"]["available"].isArray() || m_root["telnet"]["available"].size() == 0) {
|
|
||||||
EXLOGE("invalid config, error 3.\n");
|
if (!m_root["telnet"]["selected"].isString()) {
|
||||||
return false;
|
EXLOGE("invalid config, error 2.\n");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
for (i = 0; i < m_root["telnet"]["available"].size(); ++i) {
|
|
||||||
|
sel_name = m_root["telnet"]["selected"].asCString();
|
||||||
if (
|
|
||||||
!m_root["telnet"]["available"][i]["name"].isString()
|
if (!m_root["telnet"]["available"].isArray() || m_root["telnet"]["available"].size() == 0) {
|
||||||
|| !m_root["telnet"]["available"][i]["app"].isString()
|
EXLOGE("invalid config, error 3.\n");
|
||||||
|| !m_root["telnet"]["available"][i]["cmdline"].isString()
|
return false;
|
||||||
) {
|
}
|
||||||
EXLOGE("invalid config, error 4.\n");
|
|
||||||
return false;
|
for (i = 0; i < m_root["telnet"]["available"].size(); ++i) {
|
||||||
}
|
|
||||||
|
if (
|
||||||
if (m_root["telnet"]["available"][i]["display"].isNull()) {
|
!m_root["telnet"]["available"][i]["name"].isString()
|
||||||
m_root["telnet"]["available"][i]["display"] = m_root["telnet"]["available"][i]["name"];
|
|| !m_root["telnet"]["available"][i]["app"].isString()
|
||||||
}
|
|| !m_root["telnet"]["available"][i]["cmdline"].isString()
|
||||||
|
) {
|
||||||
if (m_root["telnet"]["available"][i]["name"].asCString() != sel_name)
|
EXLOGE("invalid config, error 4.\n");
|
||||||
continue;
|
return false;
|
||||||
|
}
|
||||||
tmp = m_root["telnet"]["available"][i]["app"].asCString();
|
|
||||||
ex_astr2wstr(tmp, telnet_app, EX_CODEPAGE_UTF8);
|
if (m_root["telnet"]["available"][i]["display"].isNull()) {
|
||||||
tmp = m_root["telnet"]["available"][i]["cmdline"].asCString();
|
m_root["telnet"]["available"][i]["display"] = m_root["telnet"]["available"][i]["name"];
|
||||||
ex_astr2wstr(tmp, telnet_cmdline, EX_CODEPAGE_UTF8);
|
}
|
||||||
|
|
||||||
break;
|
if (m_root["telnet"]["available"][i]["name"].asCString() != sel_name)
|
||||||
}
|
continue;
|
||||||
|
|
||||||
if (telnet_app.length() == 0 || telnet_cmdline.length() == 0) {
|
tmp = m_root["telnet"]["available"][i]["app"].asCString();
|
||||||
EXLOGE("invalid config, error 6.\n");
|
ex_astr2wstr(tmp, telnet_app, EX_CODEPAGE_UTF8);
|
||||||
return false;
|
tmp = m_root["telnet"]["available"][i]["cmdline"].asCString();
|
||||||
}
|
ex_astr2wstr(tmp, telnet_cmdline, EX_CODEPAGE_UTF8);
|
||||||
|
|
||||||
//===================================
|
break;
|
||||||
// check rdp config
|
}
|
||||||
//===================================
|
|
||||||
|
if (telnet_app.length() == 0 || telnet_cmdline.length() == 0) {
|
||||||
if (!m_root["rdp"].isObject()) {
|
EXLOGE("invalid config, error 6.\n");
|
||||||
EXLOGE("invalid config, error 1.\n");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
//===================================
|
||||||
if (!m_root["rdp"]["selected"].isString()) {
|
// check rdp config
|
||||||
EXLOGE("invalid config, error 2.\n");
|
//===================================
|
||||||
return false;
|
|
||||||
}
|
if (!m_root["rdp"].isObject()) {
|
||||||
|
EXLOGE("invalid config, error 1.\n");
|
||||||
sel_name = m_root["rdp"]["selected"].asCString();
|
return false;
|
||||||
|
}
|
||||||
if (!m_root["rdp"]["available"].isArray() || m_root["rdp"]["available"].size() == 0) {
|
|
||||||
EXLOGE("invalid config, error 3.\n");
|
if (!m_root["rdp"]["selected"].isString()) {
|
||||||
return false;
|
EXLOGE("invalid config, error 2.\n");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
for (i = 0; i < m_root["rdp"]["available"].size(); ++i) {
|
|
||||||
|
sel_name = m_root["rdp"]["selected"].asCString();
|
||||||
if (
|
|
||||||
!m_root["rdp"]["available"][i]["name"].isString()
|
if (!m_root["rdp"]["available"].isArray() || m_root["rdp"]["available"].size() == 0) {
|
||||||
|| !m_root["rdp"]["available"][i]["app"].isString()
|
EXLOGE("invalid config, error 3.\n");
|
||||||
|| !m_root["rdp"]["available"][i]["cmdline"].isString()
|
return false;
|
||||||
) {
|
}
|
||||||
EXLOGE("invalid config, error 4.\n");
|
|
||||||
return false;
|
for (i = 0; i < m_root["rdp"]["available"].size(); ++i) {
|
||||||
}
|
|
||||||
|
if (
|
||||||
if (m_root["rdp"]["available"][i]["display"].isNull()) {
|
!m_root["rdp"]["available"][i]["name"].isString()
|
||||||
m_root["rdp"]["available"][i]["display"] = m_root["rdp"]["available"][i]["name"];
|
|| !m_root["rdp"]["available"][i]["app"].isString()
|
||||||
}
|
|| !m_root["rdp"]["available"][i]["cmdline"].isString()
|
||||||
|
) {
|
||||||
if (m_root["rdp"]["available"][i]["name"].asCString() != sel_name)
|
EXLOGE("invalid config, error 4.\n");
|
||||||
continue;
|
return false;
|
||||||
|
}
|
||||||
tmp = m_root["rdp"]["available"][i]["app"].asCString();
|
|
||||||
ex_astr2wstr(tmp, rdp_app, EX_CODEPAGE_UTF8);
|
if (m_root["rdp"]["available"][i]["display"].isNull()) {
|
||||||
tmp = m_root["rdp"]["available"][i]["cmdline"].asCString();
|
m_root["rdp"]["available"][i]["display"] = m_root["rdp"]["available"][i]["name"];
|
||||||
ex_astr2wstr(tmp, rdp_cmdline, EX_CODEPAGE_UTF8);
|
}
|
||||||
tmp = m_root["rdp"]["available"][i]["name"].asCString();
|
|
||||||
ex_astr2wstr(tmp, rdp_name, EX_CODEPAGE_UTF8);
|
if (m_root["rdp"]["available"][i]["name"].asCString() != sel_name)
|
||||||
|
continue;
|
||||||
break;
|
|
||||||
}
|
tmp = m_root["rdp"]["available"][i]["app"].asCString();
|
||||||
|
ex_astr2wstr(tmp, rdp_app, EX_CODEPAGE_UTF8);
|
||||||
if (rdp_app.length() == 0 || rdp_cmdline.length() == 0 || rdp_name.length() == 0) {
|
tmp = m_root["rdp"]["available"][i]["cmdline"].asCString();
|
||||||
EXLOGE("invalid config, error 6.\n");
|
ex_astr2wstr(tmp, rdp_cmdline, EX_CODEPAGE_UTF8);
|
||||||
return false;
|
tmp = m_root["rdp"]["available"][i]["name"].asCString();
|
||||||
}
|
ex_astr2wstr(tmp, rdp_name, EX_CODEPAGE_UTF8);
|
||||||
|
|
||||||
return true;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rdp_app.length() == 0 || rdp_cmdline.length() == 0 || rdp_name.length() == 0) {
|
||||||
|
EXLOGE("invalid config, error 6.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,71 +1,74 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "ts_env.h"
|
#include "ts_env.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef EX_OS_WIN32
|
#ifdef EX_OS_WIN32
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
//# include <ShlObj.h>
|
//# include <ShlObj.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TsEnv g_env;
|
TsEnv g_env;
|
||||||
|
|
||||||
//=======================================================
|
//=======================================================
|
||||||
//
|
//
|
||||||
//=======================================================
|
//=======================================================
|
||||||
|
|
||||||
TsEnv::TsEnv()
|
TsEnv::TsEnv()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TsEnv::~TsEnv()
|
TsEnv::~TsEnv()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool TsEnv::init(void)
|
bool TsEnv::init(void)
|
||||||
{
|
{
|
||||||
if (!ex_exec_file(m_exec_file))
|
if (!ex_exec_file(m_exec_file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_exec_path = m_exec_file;
|
m_exec_path = m_exec_file;
|
||||||
if (!ex_dirname(m_exec_path))
|
if (!ex_dirname(m_exec_path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_cfg_file = m_exec_path;
|
m_cfg_file = m_exec_path;
|
||||||
ex_path_join(m_cfg_file, false, L"cfg", L"tp-assist.json", NULL);
|
ex_path_join(m_cfg_file, false, L"cfg", L"tp-assist.json", NULL);
|
||||||
|
|
||||||
m_log_path = m_exec_path;
|
m_log_path = m_exec_path;
|
||||||
ex_path_join(m_log_path, false, L"log", NULL);
|
ex_path_join(m_log_path, false, L"log", NULL);
|
||||||
|
|
||||||
ex_wstr cfg_default;
|
ex_wstr cfg_default;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
m_site_path = m_exec_path;
|
m_site_path = m_exec_path;
|
||||||
ex_path_join(m_site_path, true, L"..", L"..", L"..", L"..", L"client", L"tp_assist_win", L"site", NULL);
|
ex_path_join(m_site_path, true, L"..", L"..", L"..", L"..", L"client", L"tp_assist_win", L"site", NULL);
|
||||||
|
|
||||||
m_tools_path = m_exec_path;
|
// m_tools_path = m_exec_path;
|
||||||
ex_path_join(m_tools_path, true, L"..", L"..", L"..", L"..", L"client", L"tools", NULL);
|
// ex_path_join(m_tools_path, true, L"..", L"..", L"..", L"..", L"client", L"tools", NULL);
|
||||||
|
|
||||||
cfg_default = m_exec_path;
|
cfg_default = m_exec_path;
|
||||||
ex_path_join(cfg_default, true, L"..", L"..", L"..", L"..", L"client", L"tp_assist_win", L"cfg", L"tp-assist.default.json", NULL);
|
ex_path_join(cfg_default, true, L"..", L"..", L"..", L"..", L"client", L"tp_assist_win", L"cfg", L"tp-assist.default.json", NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
m_site_path = m_exec_path;
|
m_site_path = m_exec_path;
|
||||||
ex_path_join(m_site_path, false, L"site", NULL);
|
ex_path_join(m_site_path, false, L"site", NULL);
|
||||||
|
|
||||||
m_tools_path = m_exec_path;
|
// m_tools_path = m_exec_path;
|
||||||
ex_path_join(m_tools_path, false, L"tools", NULL);
|
// ex_path_join(m_tools_path, false, L"tools", NULL);
|
||||||
|
|
||||||
cfg_default = m_exec_path;
|
cfg_default = m_exec_path;
|
||||||
ex_path_join(cfg_default, false, L"tp-assist.default.json", NULL);
|
ex_path_join(cfg_default, false, L"tp-assist.default.json", NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ex_is_file_exists(m_cfg_file.c_str())) {
|
m_tools_path = m_exec_path;
|
||||||
ex_wstr cfg_path = m_exec_path;
|
ex_path_join(m_tools_path, false, L"tools", NULL);
|
||||||
ex_path_join(cfg_path, false, L"cfg", NULL);
|
|
||||||
|
if (!ex_is_file_exists(m_cfg_file.c_str())) {
|
||||||
ex_mkdirs(cfg_path);
|
ex_wstr cfg_path = m_exec_path;
|
||||||
|
ex_path_join(cfg_path, false, L"cfg", NULL);
|
||||||
if (!ex_copy_file(cfg_default.c_str(), m_cfg_file.c_str()))
|
|
||||||
return false;
|
ex_mkdirs(cfg_path);
|
||||||
}
|
|
||||||
|
if (!ex_copy_file(cfg_default.c_str(), m_cfg_file.c_str()))
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __TS_ASSIST_VER_H__
|
#ifndef __TS_ASSIST_VER_H__
|
||||||
#define __TS_ASSIST_VER_H__
|
#define __TS_ASSIST_VER_H__
|
||||||
|
|
||||||
#define TP_ASSIST_VER L"3.3.1"
|
#define TP_ASSIST_VER L"3.5.1"
|
||||||
|
|
||||||
#endif // __TS_ASSIST_VER_H__
|
#endif // __TS_ASSIST_VER_H__
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,12 @@ int ex_wcsformat(wchar_t* out_buf, size_t buf_size, const wchar_t* fmt, ...);
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
typedef std::string ex_astr;
|
typedef std::string ex_astr;
|
||||||
typedef std::wstring ex_wstr;
|
typedef std::wstring ex_wstr;
|
||||||
|
typedef std::ostringstream ex_aoss;
|
||||||
|
typedef std::wostringstream ex_woss;
|
||||||
|
|
||||||
typedef std::vector<ex_astr> ex_astrs;
|
typedef std::vector<ex_astr> ex_astrs;
|
||||||
typedef std::vector<ex_wstr> ex_wstrs;
|
typedef std::vector<ex_wstr> ex_wstrs;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ wget = C:\Program Files (x86)\wget\wget.exe
|
||||||
# if not set msbuild path, default to get it by register.
|
# if not set msbuild path, default to get it by register.
|
||||||
#msbuild = C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
|
#msbuild = C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
|
||||||
|
|
||||||
|
# need qt to build tp-player.
|
||||||
|
qt = C:\Qt\Qt5.12.0\5.12.0\msvc2017
|
||||||
|
|
||||||
# ============================================
|
# ============================================
|
||||||
# for Linux and macOS
|
# for Linux and macOS
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,9 +1,16 @@
|
||||||
[external_ver]
|
[external_ver]
|
||||||
openssl = 1.0.2s,1000210f
|
; https://github.com/openssl/openssl/releases
|
||||||
libuv = 1.28.0
|
; http://slproweb.com/download/Win32OpenSSL-1_1_1d.exe
|
||||||
mbedtls = 2.12.0
|
openssl = 1.1.1d,1010104f
|
||||||
libssh = 0.9.0
|
; https://github.com/libuv/libuv/releases
|
||||||
jsoncpp = 0.10.6
|
libuv = 1.33.1
|
||||||
mongoose = 6.12
|
; https://github.com/ARMmbed/mbedtls/releases
|
||||||
|
mbedtls = 2.16.3
|
||||||
|
; https://github.com/open-source-parsers/jsoncpp/releases
|
||||||
|
jsoncpp = 1.9.2
|
||||||
|
; https://github.com/cesanta/mongoose/releases
|
||||||
|
mongoose = 6.16
|
||||||
; https://www.zlib.net/zlib1211.zip
|
; https://www.zlib.net/zlib1211.zip
|
||||||
zlilb = 1211,1.2.11
|
zlib = 1.2.11,1211
|
||||||
|
; https://git.libssh.org/projects/libssh.git/
|
||||||
|
libssh = 0.9.2
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __TS_SERVER_VER_H__
|
#ifndef __TS_SERVER_VER_H__
|
||||||
#define __TS_SERVER_VER_H__
|
#define __TS_SERVER_VER_H__
|
||||||
|
|
||||||
#define TP_SERVER_VER L"3.3.0"
|
#define TP_SERVER_VER L"3.5.0"
|
||||||
|
|
||||||
#endif // __TS_SERVER_VER_H__
|
#endif // __TS_SERVER_VER_H__
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ $app.on_table_host_cell_created = function (tbl, row_id, col_key, cell_obj) {
|
||||||
cell_obj.find('[data-action]').click(function () {
|
cell_obj.find('[data-action]').click(function () {
|
||||||
|
|
||||||
var row_data = tbl.get_row(row_id);
|
var row_data = tbl.get_row(row_id);
|
||||||
console.log('---', row_data);
|
// console.log('---', row_data);
|
||||||
var action = $(this).attr('data-action');
|
var action = $(this).attr('data-action');
|
||||||
|
|
||||||
if (action === 'replay') {
|
if (action === 'replay') {
|
||||||
|
|
@ -363,83 +363,26 @@ $app.on_table_host_render_created = function (render) {
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.do_replay_rdp = function (record_id, user_username, acc_username, host_ip, time_begin) {
|
$app.do_replay_rdp = function (record_id, user_username, acc_username, host_ip, time_begin) {
|
||||||
|
if(!$app.options.core_running) {
|
||||||
|
$tp.notify_error(tp_error_msg(TPE_NO_CORE_SERVER), '无法播放。');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$assist.check())
|
||||||
|
return;
|
||||||
|
|
||||||
$assist.do_rdp_replay(
|
$assist.do_rdp_replay(
|
||||||
{
|
record_id
|
||||||
rid: record_id
|
|
||||||
// , web: $tp.web_server // + '/audit/get_rdp_record/' + record_id // 'http://' + ip + ':' + port + '/log/replay/rdp/' + record_id;
|
|
||||||
// , sid: Cookies.get('_sid')
|
|
||||||
, user: user_username
|
|
||||||
, acc: acc_username
|
|
||||||
, host: host_ip
|
|
||||||
, start: time_begin//tp_format_datetime(tp_utc2local(time_begin), 'yyyyMMdd-HHmmss')
|
|
||||||
}
|
|
||||||
, function () {
|
, function () {
|
||||||
// func_success
|
// func_success
|
||||||
}
|
}
|
||||||
, function (code, message) {
|
, function (code, message) {
|
||||||
if (code === TPE_NO_ASSIST)
|
if (code === TPE_NO_ASSIST) {
|
||||||
|
$assist.errcode = TPE_NO_ASSIST;
|
||||||
$assist.alert_assist_not_found();
|
$assist.alert_assist_not_found();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$tp.notify_error('播放RDP操作录像失败:' + tp_error_msg(code, message));
|
$tp.notify_error('播放RDP操作录像失败:' + tp_error_msg(code, message));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// $app.on_table_host_header_created = function (header) {
|
|
||||||
// $('#' + header._table_ctrl.dom_id + ' a[data-reset-filter]').click(function () {
|
|
||||||
// CALLBACK_STACK.create()
|
|
||||||
// .add(header._table_ctrl.load_data)
|
|
||||||
// .add(header._table_ctrl.reset_filters)
|
|
||||||
// .exec();
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // 表格内嵌过滤器的事件绑定在这时进行(也可以延期到整个表格创建完成时进行)
|
|
||||||
// header._table_ctrl.get_filter_ctrl('search').on_created();
|
|
||||||
// };
|
|
||||||
|
|
||||||
// $app.get_selected_record = function (tbl) {
|
|
||||||
// var records = [];
|
|
||||||
// var _objs = $('#' + $app.table_record.dom_id + ' tbody tr td input[data-check-box]');
|
|
||||||
// $.each(_objs, function (i, _obj) {
|
|
||||||
// if ($(_obj).is(':checked')) {
|
|
||||||
// var _row_data = tbl.get_row(_obj);
|
|
||||||
// records.push(_row_data.id);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// return records;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// $app.on_btn_remove_record_click = function () {
|
|
||||||
// var records = $app.get_selected_record($app.table_record);
|
|
||||||
// if (records.length === 0) {
|
|
||||||
// $tp.notify_error('请选择要删除的会话记录!');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// var _fn_sure = function (cb_stack, cb_args) {
|
|
||||||
// $tp.ajax_post_json('/user/remove-user', {users: users},
|
|
||||||
// function (ret) {
|
|
||||||
// if (ret.code === TPE_OK) {
|
|
||||||
// cb_stack.add($app.check_host_all_selected);
|
|
||||||
// cb_stack.add($app.table_record.load_data);
|
|
||||||
// $tp.notify_success('删除用户账号操作成功!');
|
|
||||||
// } else {
|
|
||||||
// $tp.notify_error('删除用户账号操作失败:' + tp_error_msg(ret.code, ret.message));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// cb_stack.exec();
|
|
||||||
// },
|
|
||||||
// function () {
|
|
||||||
// $tp.notify_error('网络故障,删除用户账号操作失败!');
|
|
||||||
// cb_stack.exec();
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// var cb_stack = CALLBACK_STACK.create();
|
|
||||||
// $tp.dlg_confirm(cb_stack, {
|
|
||||||
// msg: '<div class="alert alert-danger"><p><strong>注意:删除操作不可恢复!!</strong></p><p>删除用户账号将同时将其从所在用户组中移除,并且删除所有分配给此用户的授权!</p></div><p>如果您希望禁止某个用户登录本系统,可对其进行“禁用”操作!</p><p>您确定要移除所有选定的 <strong>' + user_list.length + '个</strong> 用户账号吗?</p>',
|
|
||||||
// fn_yes: _fn_sure
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
|
||||||
|
|
@ -66,16 +66,29 @@ $assist.init = function (cb_stack) {
|
||||||
cb_stack.exec();
|
cb_stack.exec();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$assist.check = function() {
|
||||||
|
if (!$assist.running) {
|
||||||
|
$assist.errcode = TPE_NO_ASSIST;
|
||||||
|
$assist.alert_assist_not_found();
|
||||||
|
return false;
|
||||||
|
} else if (!$assist._version_compare()) {
|
||||||
|
$assist.errcode = TPE_OLD_ASSIST;
|
||||||
|
$assist.alert_assist_not_found();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
$assist.alert_assist_not_found = function () {
|
$assist.alert_assist_not_found = function () {
|
||||||
console.log($assist.errcode);
|
|
||||||
if($assist.errcode === TPE_NO_ASSIST) {
|
if($assist.errcode === TPE_NO_ASSIST) {
|
||||||
$assist.dom.msg_box_title.html('未检测到TELEPORT助手');
|
$assist.dom.msg_box_title.html('未检测到TELEPORT助手');
|
||||||
$assist.dom.msg_box_info.html('需要TELEPORT助手来辅助远程连接,请确认本机运行了TELEPORT助手!');
|
$assist.dom.msg_box_info.html('需要TELEPORT助手来辅助远程连接,请确认本机运行了TELEPORT助手!');
|
||||||
$assist.dom.msg_box_desc.html('如果您尚未运行TELEPORT助手,请 <a href="http://tp4a.com/download" target="_blank"><strong>下载最新版TELEPORT助手安装包</strong></a> 并安装。一旦运行了TELEPORT助手,即可重新进行远程连接。');
|
$assist.dom.msg_box_desc.html('如果您尚未运行TELEPORT助手,请 <a href="http://tp4a.com/download" target="_blank"><strong>下载最新版TELEPORT助手安装包</strong></a> 并安装。一旦运行了TELEPORT助手,即可刷新页面,重新进行远程连接。');
|
||||||
} else if($assist.errcode === TPE_OLD_ASSIST) {
|
} else if($assist.errcode === TPE_OLD_ASSIST) {
|
||||||
$assist.dom.msg_box_title.html('TELEPORT助手需要升级');
|
$assist.dom.msg_box_title.html('TELEPORT助手需要升级');
|
||||||
$assist.dom.msg_box_info.html('检测到TELEPORT助手版本 v'+ $assist.version +',但需要最低版本 v'+ $assist.ver_require+'。');
|
$assist.dom.msg_box_info.html('检测到TELEPORT助手版本 v'+ $assist.version +',但需要最低版本 v'+ $assist.ver_require+'。');
|
||||||
$assist.dom.msg_box_desc.html('请 <a href="http://tp4a.com/download" target="_blank"><strong>下载最新版TELEPORT助手安装包</strong></a> 并安装。一旦升级了TELEPORT助手,即可重新进行远程连接。');
|
$assist.dom.msg_box_desc.html('请 <a href="http://tp4a.com/download" target="_blank"><strong>下载最新版TELEPORT助手安装包</strong></a> 并安装。一旦升级了TELEPORT助手,即可刷新页面,重新进行远程连接。');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#dialog-need-assist').modal();
|
$('#dialog-need-assist').modal();
|
||||||
|
|
@ -134,15 +147,8 @@ $assist._make_message_box = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
$assist.do_teleport = function (args, func_success, func_error) {
|
$assist.do_teleport = function (args, func_success, func_error) {
|
||||||
if(!$assist.running) {
|
if(!$assist.check())
|
||||||
$assist.errcode = TPE_NO_ASSIST;
|
|
||||||
func_error(TPE_NO_ASSIST, '');
|
|
||||||
return;
|
return;
|
||||||
} else if(!$assist._version_compare()) {
|
|
||||||
$assist.errcode = TPE_OLD_ASSIST;
|
|
||||||
func_error(TPE_NO_ASSIST, '');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第一步:将参数传递给web服务,准备获取一个远程连接会话ID
|
// 第一步:将参数传递给web服务,准备获取一个远程连接会话ID
|
||||||
var args_ = JSON.stringify(args);
|
var args_ = JSON.stringify(args);
|
||||||
|
|
@ -226,7 +232,7 @@ $assist.do_teleport = function (args, func_success, func_error) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$assist.do_rdp_replay = function (args, func_success, func_error) {
|
$assist.do_rdp_replay = function (rid, func_success, func_error) {
|
||||||
// ==================================================
|
// ==================================================
|
||||||
// args is dict with fields shown below:
|
// args is dict with fields shown below:
|
||||||
// rid: (int) - record-id in database.
|
// rid: (int) - record-id in database.
|
||||||
|
|
@ -236,10 +242,11 @@ $assist.do_rdp_replay = function (args, func_success, func_error) {
|
||||||
// start: (string) - when start the RDP connection, should be a UTC timestamp.
|
// start: (string) - when start the RDP connection, should be a UTC timestamp.
|
||||||
// ==================================================
|
// ==================================================
|
||||||
|
|
||||||
// now fix the args.
|
// now make the args.
|
||||||
|
var args = {rid: rid};
|
||||||
args.web = $tp.web_server; // (string) - teleport server base address, like "http://127.0.0.1:7190", without end-slash.
|
args.web = $tp.web_server; // (string) - teleport server base address, like "http://127.0.0.1:7190", without end-slash.
|
||||||
args.sid = Cookies.get('_sid'); // (string) - current login user's session-id.
|
args.sid = Cookies.get('_sid'); // (string) - current login user's session-id.
|
||||||
args.start = tp_format_datetime(tp_utc2local(args.start), 'yyyyMMdd-HHmmss'); // (string) - convert UTC timestamp to local human-readable string.
|
// args.start = tp_format_datetime(tp_utc2local(args.start), 'yyyyMMdd-HHmmss'); // (string) - convert UTC timestamp to local human-readable string.
|
||||||
|
|
||||||
console.log('do-rdp-replay:', args);
|
console.log('do-rdp-replay:', args);
|
||||||
|
|
||||||
|
|
@ -264,34 +271,3 @@ $assist.do_rdp_replay = function (args, func_success, func_error) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
var version_compare = function () {
|
|
||||||
var cur_version = parseInt(g_current_version.split(".")[2]);
|
|
||||||
var req_version = parseInt(g_req_version.split(".")[2]);
|
|
||||||
return cur_version >= req_version;
|
|
||||||
};
|
|
||||||
|
|
||||||
var start_rdp_replay = function (args, func_success, func_error) {
|
|
||||||
var args_ = encodeURIComponent(JSON.stringify(args));
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
timeout: 6000,
|
|
||||||
url: $assist.api_url + '/rdp_play/' + args_,
|
|
||||||
jsonp: 'callback',
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (ret) {
|
|
||||||
if (ret.code === TPE_OK) {
|
|
||||||
error_process(ret, func_success, func_error);
|
|
||||||
} else {
|
|
||||||
func_error(ret.code, '查看录像失败!');
|
|
||||||
}
|
|
||||||
console.log('ret', ret);
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
func_error(TPE_NETWORK, '与助手的络通讯失败!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- coding: utf8 -*-
|
# -*- coding: utf8 -*-
|
||||||
TP_SERVER_VER = "3.3.1"
|
TP_SERVER_VER = "3.5.1"
|
||||||
TP_ASSIST_REQUIRE_VER = "3.3.1"
|
TP_ASSIST_REQUIRE_VER = "3.5.1"
|
||||||
|
|
|
||||||
|
|
@ -411,12 +411,15 @@ class RecordHandler(TPBaseHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not tp_cfg().core.detected:
|
if not tp_cfg().core.detected:
|
||||||
|
core_running = False
|
||||||
total_size = 0
|
total_size = 0
|
||||||
free_size = 0
|
free_size = 0
|
||||||
else:
|
else:
|
||||||
|
core_running = True
|
||||||
total_size, free_size = get_free_space_bytes(tp_cfg().core.replay_path)
|
total_size, free_size = get_free_space_bytes(tp_cfg().core.replay_path)
|
||||||
|
|
||||||
param = {
|
param = {
|
||||||
|
'core_running': core_running,
|
||||||
'total_size': total_size,
|
'total_size': total_size,
|
||||||
'free_size': free_size,
|
'free_size': free_size,
|
||||||
}
|
}
|
||||||
|
|
@ -659,25 +662,12 @@ class DoGetFileHandler(TPBaseHandler):
|
||||||
|
|
||||||
require_privilege = TP_PRIVILEGE_OPS_AUZ | TP_PRIVILEGE_AUDIT_AUZ | TP_PRIVILEGE_AUDIT
|
require_privilege = TP_PRIVILEGE_OPS_AUZ | TP_PRIVILEGE_AUDIT_AUZ | TP_PRIVILEGE_AUDIT
|
||||||
|
|
||||||
# sid = self.get_argument('sid', None)
|
if not self._user['_is_login']:
|
||||||
# if sid is None:
|
self.set_status(401) # 401=未授权, 要求身份验证
|
||||||
# self.set_status(403)
|
return self.write('need login first.')
|
||||||
# return self.write('need login first.')
|
if (self._user['privilege'] & require_privilege) == 0:
|
||||||
#
|
self.set_status(403) # 403=禁止
|
||||||
# self._s_id = sid
|
return self.write('you have no such privilege.')
|
||||||
# _user = self.get_session('user')
|
|
||||||
# if _user is None:
|
|
||||||
# self.set_status(403)
|
|
||||||
# return self.write('need login first.')
|
|
||||||
# self._user = _user
|
|
||||||
|
|
||||||
# when test, disable auth.
|
|
||||||
# if not self._user['_is_login']:
|
|
||||||
# self.set_status(401) # 401=未授权, 要求身份验证
|
|
||||||
# return self.write('need login first.')
|
|
||||||
# if (self._user['privilege'] & require_privilege) == 0:
|
|
||||||
# self.set_status(403) # 403=禁止
|
|
||||||
# return self.write('you have no such privilege.')
|
|
||||||
|
|
||||||
act = self.get_argument('act', None)
|
act = self.get_argument('act', None)
|
||||||
_type = self.get_argument('type', None)
|
_type = self.get_argument('type', None)
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ Minor: 次版本号。如果两个程序集的名称和主版本号相同,而
|
||||||
Revision: 修订号。主版本号和次版本号都相同但修订号不同的程序集应是完全可互换的。
|
Revision: 修订号。主版本号和次版本号都相同但修订号不同的程序集应是完全可互换的。
|
||||||
这适用于修复以前发布的程序集中的错误或安全漏洞。
|
这适用于修复以前发布的程序集中的错误或安全漏洞。
|
||||||
|
|
||||||
TP_SERVER 3.3.1 # 整个服务端打包的版本
|
TP_SERVER 3.5.1 # 整个服务端打包的版本
|
||||||
TP_TPCORE 3.3.0 # 核心服务 tp_core 的版本
|
TP_TPCORE 3.5.0 # 核心服务 tp_core 的版本
|
||||||
TP_TPWEB 3.1.0 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化)
|
TP_TPWEB 3.1.0 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化)
|
||||||
TP_ASSIST 3.3.1 # 助手版本
|
TP_ASSIST 3.5.1 # 助手版本
|
||||||
TP_ASSIST_REQUIRE 3.3.1 # 适配的助手最低版本
|
TP_ASSIST_REQUIRE 3.5.1 # 适配的助手最低版本
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue