mirror of https://github.com/tp4a/teleport
修正:当TP服务器配置为 `https`方式访问时,RDP录像播放器不能正确获取录像文件。
parent
5353008364
commit
90d67e9ef2
|
@ -172,6 +172,20 @@ class BuilderWin(BuilderBase):
|
||||||
if x == 'q':
|
if x == 'q':
|
||||||
return
|
return
|
||||||
|
|
||||||
|
_chk_output = [
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'include', 'openssl', 'aes.h'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'include', 'openssl', 'opensslv.h'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'lib', 'VC', 'libcrypto32MT.lib'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'lib', 'VC', 'libeay32MT.lib'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'lib', 'VC', 'ssleay32MT.lib'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'lib', 'VC', 'static', 'libcrypto32MT.lib'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'lib', 'VC', 'static', 'libeay32MT.lib'),
|
||||||
|
os.path.join(self.OPENSSL_PATH_SRC, 'lib', 'VC', 'static', 'ssleay32MT.lib'),
|
||||||
|
]
|
||||||
|
|
||||||
|
for f in _chk_output:
|
||||||
|
if not os.path.exists(f):
|
||||||
|
raise RuntimeError('build openssl static library from source code failed.')
|
||||||
|
|
||||||
# cc.n('build openssl static library from source code... ')
|
# cc.n('build openssl static library from source code... ')
|
||||||
|
|
||||||
|
@ -245,15 +259,57 @@ class BuilderWin(BuilderBase):
|
||||||
return
|
return
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
||||||
cc.w('On Windows, when build libssh, 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 libssh.sln generated, press Enter to continue or Q to quit...', end='')
|
build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')
|
||||||
|
if not os.path.exists(build_path):
|
||||||
|
utils.makedirs(build_path)
|
||||||
|
|
||||||
|
openssl_path = os.path.join(PATH_EXTERNAL, 'OpenSSL')
|
||||||
|
|
||||||
|
cmake_define = ' -DOPENSSL_INCLUDE_DIR={path_release}\include' \
|
||||||
|
' -DOPENSSL_LIBRARIES={path_release}\lib\VC\static' \
|
||||||
|
' -DWITH_SFTP=ON' \
|
||||||
|
' -DWITH_SERVER=ON' \
|
||||||
|
' -DWITH_GSSAPI=OFF' \
|
||||||
|
' -DWITH_ZLIB=OFF' \
|
||||||
|
' -DWITH_PCAP=OFF' \
|
||||||
|
' -DWITH_STATIC_LIB=ON' \
|
||||||
|
' -DUNIT_TESTING=OFF' \
|
||||||
|
' -DWITH_EXAMPLES=OFF' \
|
||||||
|
' -DWITH_BENCHMARKS=OFF' \
|
||||||
|
' -DWITH_NACL=OFF' \
|
||||||
|
''.format(path_release=openssl_path)
|
||||||
|
|
||||||
|
# ' -DCMAKE_INSTALL_PREFIX={path_release}'
|
||||||
|
# ' -DWITH_STATIC_LIB=ON'
|
||||||
|
# ' -DBUILD_SHARED_LIBS=OFF'
|
||||||
|
|
||||||
|
|
||||||
|
old_p = os.getcwd()
|
||||||
try:
|
try:
|
||||||
x = env.input()
|
os.chdir(build_path)
|
||||||
except EOFError:
|
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define)
|
||||||
x = 'q'
|
os.chdir(build_path)
|
||||||
if x == 'q':
|
# utils.sys_exec('make install')
|
||||||
return
|
except:
|
||||||
|
cc.e('can not make')
|
||||||
|
raise
|
||||||
|
os.chdir(old_p)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# cc.w('On Windows, when build libssh, 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 libssh.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 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')
|
||||||
|
@ -544,6 +600,7 @@ class BuilderLinux(BuilderBase):
|
||||||
try:
|
try:
|
||||||
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"')
|
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"')
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
|
utils.sys_exec('make')
|
||||||
utils.sys_exec('make install')
|
utils.sys_exec('make install')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -579,6 +636,7 @@ class BuilderLinux(BuilderBase):
|
||||||
try:
|
try:
|
||||||
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"')
|
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"')
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
|
utils.sys_exec('make')
|
||||||
utils.sys_exec('make install')
|
utils.sys_exec('make install')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -814,6 +872,7 @@ class BuilderMacOS(BuilderBase):
|
||||||
try:
|
try:
|
||||||
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"')
|
utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"')
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
|
utils.sys_exec('make')
|
||||||
utils.sys_exec('make install')
|
utils.sys_exec('make install')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
import json
|
||||||
import configparser
|
import configparser
|
||||||
|
|
||||||
from . import colorconsole as cc
|
from . import colorconsole as cc
|
||||||
|
@ -74,14 +75,27 @@ class Env(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _load_config(self, warn_miss_tool):
|
def _load_config(self, warn_miss_tool):
|
||||||
_cfg_file = os.path.join(self.root_path, 'config.ini')
|
# _cfg_file = os.path.join(self.root_path, 'config.ini')
|
||||||
|
_cfg_file = os.path.join(self.root_path, 'config.json')
|
||||||
if not os.path.exists(_cfg_file):
|
if not os.path.exists(_cfg_file):
|
||||||
cc.e('can not load configuration.\n\nplease copy `config.ini.in` to `config.ini` and modify it to fit your condition and try again.')
|
# cc.e('can not load configuration.\n\nplease copy `config.ini.in` to `config.ini` and modify it to fit your condition and try again.')
|
||||||
|
cc.e('can not load configuration.\n\nplease copy `config.json.in` to `config.json` and modify it to fit your condition and try again.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
_cfg = configparser.ConfigParser()
|
try:
|
||||||
_cfg.read(_cfg_file)
|
with open(_cfg_file, 'r') as f:
|
||||||
if 'toolchain' not in _cfg.sections():
|
_cfg = json.loads(f.read())
|
||||||
|
except:
|
||||||
|
cc.e('can ot load configuration file, not in JSON format.')
|
||||||
|
return False
|
||||||
|
|
||||||
|
# _cfg = configparser.ConfigParser()
|
||||||
|
# _cfg.read(_cfg_file)
|
||||||
|
# if 'toolchain' not in _cfg.sections():
|
||||||
|
# cc.e('invalid configuration file: need `toolchain` section.')
|
||||||
|
# return False
|
||||||
|
|
||||||
|
if 'toolchain' not in _cfg:
|
||||||
cc.e('invalid configuration file: need `toolchain` section.')
|
cc.e('invalid configuration file: need `toolchain` section.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -148,14 +162,19 @@ 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:
|
if 'cmake' in _tmp:
|
||||||
self.qt = _tmp['qt']
|
self.cmake = _tmp['cmake']
|
||||||
|
else:
|
||||||
|
self.cmake = 'c:\\cmake\\bin\\cmake.exe'
|
||||||
|
|
||||||
|
if 'qt_path' in _tmp:
|
||||||
|
self.qt = _tmp['qt_path']
|
||||||
else:
|
else:
|
||||||
self.qt = None
|
self.qt = None
|
||||||
|
|
||||||
if self.qt is None or not os.path.exists(self.qt):
|
if self.qt is None or not os.path.exists(self.qt):
|
||||||
if warn_miss_tool:
|
if warn_miss_tool:
|
||||||
cc.w(' - can not locate `qt`, so I can not build tp-player.')
|
cc.w(' - can not locate `qt_path`, so I can not build tp-player.')
|
||||||
|
|
||||||
elif self.is_linux:
|
elif self.is_linux:
|
||||||
if 'cmake' in _tmp:
|
if 'cmake' in _tmp:
|
||||||
|
|
|
@ -413,9 +413,16 @@ def cmake(work_path, target, force_rebuild, cmake_define='', cmake_pre_define=''
|
||||||
target = 'Debug'
|
target = 'Debug'
|
||||||
else:
|
else:
|
||||||
target = 'Release'
|
target = 'Release'
|
||||||
cmd = '{} "{}" -DCMAKE_BUILD_TYPE={} {} ..;make'.format(cmake_pre_define, env.cmake, target, cmake_define)
|
cmd = '{} "{}" -DCMAKE_BUILD_TYPE={} {} ..'.format(cmake_pre_define, env.cmake, target, cmake_define)
|
||||||
cc.o(cmd)
|
cc.o(cmd)
|
||||||
ret, _ = sys_exec(cmd, direct_output=True)
|
ret, _ = sys_exec(cmd, direct_output=True)
|
||||||
|
# if ret != 0:
|
||||||
|
# raise RuntimeError('build with cmake failed, ret={}. [{}]'.format(ret, target))
|
||||||
|
|
||||||
|
# cmd = 'make'
|
||||||
|
# cc.o(cmd)
|
||||||
|
# ret, _ = sys_exec(cmd, direct_output=True)
|
||||||
|
|
||||||
os.chdir(old_p)
|
os.chdir(old_p)
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
raise RuntimeError('build with cmake failed, ret={}. [{}]'.format(ret, target))
|
raise RuntimeError('build with cmake failed, ret={}. [{}]'.format(ret, target))
|
||||||
|
|
|
@ -9,6 +9,8 @@ Downloader::Downloader() : QObject () {
|
||||||
m_data = nullptr;
|
m_data = nullptr;
|
||||||
m_reply = nullptr;
|
m_reply = nullptr;
|
||||||
m_result = false;
|
m_result = false;
|
||||||
|
|
||||||
|
connect(&m_nam, &QNetworkAccessManager::sslErrors, this, &Downloader::_on_ssl_errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
Downloader::~Downloader() {
|
Downloader::~Downloader() {
|
||||||
|
@ -44,9 +46,10 @@ bool Downloader::_request(const QString& url, const QString& sid, const QString&
|
||||||
req.setUrl(QUrl(url));
|
req.setUrl(QUrl(url));
|
||||||
req.setRawHeader("Cookie", cookie.toLatin1());
|
req.setRawHeader("Cookie", cookie.toLatin1());
|
||||||
|
|
||||||
QNetworkAccessManager* nam = new QNetworkAccessManager();
|
//QNetworkAccessManager* nam = new QNetworkAccessManager();
|
||||||
QEventLoop eloop;
|
QEventLoop eloop;
|
||||||
m_reply = nam->get(req);
|
//m_reply = nam->get(req);
|
||||||
|
m_reply = m_nam.get(req);
|
||||||
|
|
||||||
connect(m_reply, &QNetworkReply::finished, &eloop, &QEventLoop::quit);
|
connect(m_reply, &QNetworkReply::finished, &eloop, &QEventLoop::quit);
|
||||||
connect(m_reply, &QNetworkReply::finished, this, &Downloader::_on_finished);
|
connect(m_reply, &QNetworkReply::finished, this, &Downloader::_on_finished);
|
||||||
|
@ -62,7 +65,7 @@ bool Downloader::_request(const QString& url, const QString& sid, const QString&
|
||||||
|
|
||||||
delete m_reply;
|
delete m_reply;
|
||||||
m_reply = nullptr;
|
m_reply = nullptr;
|
||||||
delete nam;
|
//delete nam;
|
||||||
|
|
||||||
qDebug("Downloader::_request() end.");
|
qDebug("Downloader::_request() end.");
|
||||||
return m_result;
|
return m_result;
|
||||||
|
@ -118,3 +121,19 @@ void Downloader::_on_finished() {
|
||||||
|
|
||||||
m_result = true;
|
m_result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Downloader::_on_ssl_errors(QNetworkReply *reply, const QList<QSslError> &errors) {
|
||||||
|
QString errorString;
|
||||||
|
foreach (const QSslError &error, errors) {
|
||||||
|
if (!errorString.isEmpty())
|
||||||
|
errorString += '\n';
|
||||||
|
errorString += error.errorString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (QMessageBox::warning(this, tr("SSL Errors"),
|
||||||
|
// tr("One or more SSL errors has occurred:\n%1").arg(errorString),
|
||||||
|
// QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
|
||||||
|
// reply->ignoreSslErrors();
|
||||||
|
// }
|
||||||
|
reply->ignoreSslErrors();
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define DOWNLOADER_H
|
#define DOWNLOADER_H
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QSslError>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
class Downloader : public QObject {
|
class Downloader : public QObject {
|
||||||
|
@ -19,6 +20,8 @@ public:
|
||||||
private:
|
private:
|
||||||
bool _request(const QString& url, const QString& sid, const QString& filename, QByteArray* data);
|
bool _request(const QString& url, const QString& sid, const QString& filename, QByteArray* data);
|
||||||
|
|
||||||
|
void _on_ssl_errors(QNetworkReply *, const QList<QSslError> &errors);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void _on_data_ready(); // 有数据可读了,读取并写入文件
|
void _on_data_ready(); // 有数据可读了,读取并写入文件
|
||||||
void _on_finished(); // 下载结束了
|
void _on_finished(); // 下载结束了
|
||||||
|
@ -28,6 +31,7 @@ private:
|
||||||
QByteArray* m_data;
|
QByteArray* m_data;
|
||||||
|
|
||||||
bool m_result;
|
bool m_result;
|
||||||
|
QNetworkAccessManager m_nam;
|
||||||
QNetworkReply* m_reply;
|
QNetworkReply* m_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ class WebApp:
|
||||||
_app = tornado.web.Application(controllers, **settings)
|
_app = tornado.web.Application(controllers, **settings)
|
||||||
|
|
||||||
server = tornado.httpserver.HTTPServer(_app, xheaders=True)
|
server = tornado.httpserver.HTTPServer(_app, xheaders=True)
|
||||||
# server = tornado.httpserver.HTTPServer(_app, ssl_options={
|
# server = tornado.httpserver.HTTPServer(_app, xheaders=True, ssl_options={
|
||||||
# "certfile": os.path.join(cfg.data_path, 'cert', "server.pem"),
|
# "certfile": os.path.join(cfg.data_path, 'cert', "server.pem"),
|
||||||
# "keyfile": os.path.join(cfg.data_path, 'cert', "server.key"),
|
# "keyfile": os.path.join(cfg.data_path, 'cert', "server.key"),
|
||||||
# })
|
# })
|
||||||
|
|
Loading…
Reference in New Issue