mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-28 20:06:14 +08:00
Compare commits
1 Commits
self-hoste
...
v1.0.2-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
495d179fae |
@@ -164,9 +164,9 @@ sudo docker run -d \
|
|||||||
|
|
||||||
- CROSSDESK_SERVER_PORT:自托管服务使用的端口,对应 CrossDesk 客户端**自托管服务器配置**中填写的**服务器端口**
|
- CROSSDESK_SERVER_PORT:自托管服务使用的端口,对应 CrossDesk 客户端**自托管服务器配置**中填写的**服务器端口**
|
||||||
|
|
||||||
- COTURN_PORT: COTURN 服务使用的端口, 对应 CrossDesk 客户端**自托管服务器配置**中填写的**COTURN 服务端口**
|
- COTURN_PORT: COTURN 服务使用的端口, 对应 CrossDesk 客户端**自托管服务器配置**中填写的**中继服务端口**
|
||||||
|
|
||||||
- MIN_PORT/MAX_PORT:COTURN 服务使用的端口范围
|
- MIN_PORT/MAX_PORT:COTURN 服务使用的端口范围,例如:MIN_PORT=50000, MAX_PORT=60000,范围可根据客户端数量调整。
|
||||||
|
|
||||||
- /path/to/your/certs:证书文件目录
|
- /path/to/your/certs:证书文件目录
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ sudo docker run -d \
|
|||||||
|
|
||||||
**注意**:
|
**注意**:
|
||||||
- **/path/to/your/ 是示例路径,请替换为你自己的实际路径。挂载的目录必须事先创建好,否则容器会报错。**
|
- **/path/to/your/ 是示例路径,请替换为你自己的实际路径。挂载的目录必须事先创建好,否则容器会报错。**
|
||||||
- **服务器需开放端口:3478/udp,3478/tcp,30000-60000/udp,CROSSDESK_SERVER_PORT/tcp,443/tcp。**
|
- **服务器需开放端口:3478/udp,3478/tcp,MIN_PORT-MAX_PORT/udp,CROSSDESK_SERVER_PORT/tcp。**
|
||||||
|
|
||||||
## 证书文件
|
## 证书文件
|
||||||
客户端需加载根证书文件,服务端需加载服务器私钥和服务器证书文件。
|
客户端需加载根证书文件,服务端需加载服务器私钥和服务器证书文件。
|
||||||
|
|||||||
@@ -169,9 +169,9 @@ The parameters you need to pay attention to are as follows:
|
|||||||
|
|
||||||
- **CROSSDESK_SERVER_PORT**: The port used by the self-hosted server, corresponding to the **Server Port** in the CrossDesk client **Self-Hosted Server Configuration**.
|
- **CROSSDESK_SERVER_PORT**: The port used by the self-hosted server, corresponding to the **Server Port** in the CrossDesk client **Self-Hosted Server Configuration**.
|
||||||
|
|
||||||
- **COTURN_PORT**: The port used by Coturn, corresponding to the **Coturn Port** in the CrossDesk client **Self-Hosted Server Configuration**.
|
- **COTURN_PORT**: The port used by Coturn, corresponding to the **Relay Server Port** in the CrossDesk client **Self-Hosted Server Configuration**.
|
||||||
|
|
||||||
- **MIN_PORT** and **MAX_PORT**: The range of ports used by the self-hosted server, corresponding to the **Minimum Port** and **Maximum Port** in the CrossDesk client **Self-Hosted Server Configuration**.
|
- **MIN_PORT** and **MAX_PORT**: The range of ports used by the self-hosted server, corresponding to the **Minimum Port** and **Maximum Port** in the CrossDesk client **Self-Hosted Server Configuration**. Example: 50000-60000. It depends on the number of devices connected to the server.
|
||||||
|
|
||||||
- **/path/to/your/certs**: Directory for certificate files.
|
- **/path/to/your/certs**: Directory for certificate files.
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ The parameters you need to pay attention to are as follows:
|
|||||||
|
|
||||||
**Note**:
|
**Note**:
|
||||||
- **/path/to/your/ is an example path; please replace it with your actual path. The mounted directories must be created in advance, otherwise the container will fail.**
|
- **/path/to/your/ is an example path; please replace it with your actual path. The mounted directories must be created in advance, otherwise the container will fail.**
|
||||||
- **The server must open the following ports: 3478/udp, 3478/tcp, 30000-60000/udp, CROSSDESK_SERVER_PORT/tcp, 443/tcp.**
|
- **The server must open the following ports: 3478/udp, 3478/tcp, 30000-60000/udp, CROSSDESK_SERVER_PORT/tcp.**
|
||||||
|
|
||||||
## Certificate Files
|
## Certificate Files
|
||||||
The client needs to load the root certificate, and the server needs to load the server private key and server certificate.
|
The client needs to load the root certificate, and the server needs to load the server private key and server certificate.
|
||||||
|
|||||||
@@ -36,9 +36,12 @@ int ConfigCenter::Load() {
|
|||||||
|
|
||||||
enable_turn_ = ini_.GetBoolValue(section_, "enable_turn", enable_turn_);
|
enable_turn_ = ini_.GetBoolValue(section_, "enable_turn", enable_turn_);
|
||||||
enable_srtp_ = ini_.GetBoolValue(section_, "enable_srtp", enable_srtp_);
|
enable_srtp_ = ini_.GetBoolValue(section_, "enable_srtp", enable_srtp_);
|
||||||
server_host_ = ini_.GetValue(section_, "server_host", server_host_.c_str());
|
signal_server_host_ = ini_.GetValue(section_, "signal_server_host",
|
||||||
server_port_ = static_cast<int>(
|
signal_server_host_.c_str());
|
||||||
ini_.GetLongValue(section_, "server_port", server_port_));
|
signal_server_port_ = static_cast<int>(
|
||||||
|
ini_.GetLongValue(section_, "signal_server_port", signal_server_port_));
|
||||||
|
coturn_server_port_ = static_cast<int>(
|
||||||
|
ini_.GetLongValue(section_, "coturn_server_port", coturn_server_port_));
|
||||||
cert_file_path_ =
|
cert_file_path_ =
|
||||||
ini_.GetValue(section_, "cert_file_path", cert_file_path_.c_str());
|
ini_.GetValue(section_, "cert_file_path", cert_file_path_.c_str());
|
||||||
enable_self_hosted_ =
|
enable_self_hosted_ =
|
||||||
@@ -61,8 +64,9 @@ int ConfigCenter::Save() {
|
|||||||
ini_.SetBoolValue(section_, "hardware_video_codec", hardware_video_codec_);
|
ini_.SetBoolValue(section_, "hardware_video_codec", hardware_video_codec_);
|
||||||
ini_.SetBoolValue(section_, "enable_turn", enable_turn_);
|
ini_.SetBoolValue(section_, "enable_turn", enable_turn_);
|
||||||
ini_.SetBoolValue(section_, "enable_srtp", enable_srtp_);
|
ini_.SetBoolValue(section_, "enable_srtp", enable_srtp_);
|
||||||
ini_.SetValue(section_, "server_host", server_host_.c_str());
|
ini_.SetValue(section_, "signal_server_host", signal_server_host_.c_str());
|
||||||
ini_.SetLongValue(section_, "server_port", static_cast<long>(server_port_));
|
ini_.SetLongValue(section_, "signal_server_port",
|
||||||
|
static_cast<long>(signal_server_port_));
|
||||||
ini_.SetValue(section_, "cert_file_path", cert_file_path_.c_str());
|
ini_.SetValue(section_, "cert_file_path", cert_file_path_.c_str());
|
||||||
ini_.SetBoolValue(section_, "enable_self_hosted", enable_self_hosted_);
|
ini_.SetBoolValue(section_, "enable_self_hosted", enable_self_hosted_);
|
||||||
ini_.SetBoolValue(section_, "enable_minimize_to_tray",
|
ini_.SetBoolValue(section_, "enable_minimize_to_tray",
|
||||||
@@ -152,9 +156,9 @@ int ConfigCenter::SetSrtp(bool enable_srtp) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigCenter::SetServerHost(const std::string& server_host) {
|
int ConfigCenter::SetServerHost(const std::string& signal_server_host) {
|
||||||
server_host_ = server_host;
|
signal_server_host_ = signal_server_host;
|
||||||
ini_.SetValue(section_, "server_host", server_host_.c_str());
|
ini_.SetValue(section_, "signal_server_host", signal_server_host_.c_str());
|
||||||
SI_Error rc = ini_.SaveFile(config_path_.c_str());
|
SI_Error rc = ini_.SaveFile(config_path_.c_str());
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -162,9 +166,10 @@ int ConfigCenter::SetServerHost(const std::string& server_host) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigCenter::SetServerPort(int server_port) {
|
int ConfigCenter::SetServerPort(int signal_server_port) {
|
||||||
server_port_ = server_port;
|
signal_server_port_ = signal_server_port;
|
||||||
ini_.SetLongValue(section_, "server_port", static_cast<long>(server_port_));
|
ini_.SetLongValue(section_, "signal_server_port",
|
||||||
|
static_cast<long>(signal_server_port_));
|
||||||
SI_Error rc = ini_.SaveFile(config_path_.c_str());
|
SI_Error rc = ini_.SaveFile(config_path_.c_str());
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -172,6 +177,16 @@ int ConfigCenter::SetServerPort(int server_port) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ConfigCenter::SetCoturnServerPort(int coturn_server_port) {
|
||||||
|
coturn_server_port_ = coturn_server_port;
|
||||||
|
SI_Error rc = ini_.SetLongValue(section_, "coturn_server_port",
|
||||||
|
static_cast<long>(coturn_server_port_));
|
||||||
|
if (rc < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ConfigCenter::SetCertFilePath(const std::string& cert_file_path) {
|
int ConfigCenter::SetCertFilePath(const std::string& cert_file_path) {
|
||||||
cert_file_path_ = cert_file_path;
|
cert_file_path_ = cert_file_path;
|
||||||
ini_.SetValue(section_, "cert_file_path", cert_file_path_.c_str());
|
ini_.SetValue(section_, "cert_file_path", cert_file_path_.c_str());
|
||||||
@@ -220,17 +235,27 @@ bool ConfigCenter::IsEnableTurn() const { return enable_turn_; }
|
|||||||
|
|
||||||
bool ConfigCenter::IsEnableSrtp() const { return enable_srtp_; }
|
bool ConfigCenter::IsEnableSrtp() const { return enable_srtp_; }
|
||||||
|
|
||||||
std::string ConfigCenter::GetServerHost() const { return server_host_; }
|
std::string ConfigCenter::GetSignalServerHost() const {
|
||||||
|
return signal_server_host_;
|
||||||
|
}
|
||||||
|
|
||||||
int ConfigCenter::GetServerPort() const { return server_port_; }
|
int ConfigCenter::GetSignalServerPort() const { return signal_server_port_; }
|
||||||
|
|
||||||
|
int ConfigCenter::GetCoturnServerPort() const { return coturn_server_port_; }
|
||||||
|
|
||||||
std::string ConfigCenter::GetCertFilePath() const { return cert_file_path_; }
|
std::string ConfigCenter::GetCertFilePath() const { return cert_file_path_; }
|
||||||
|
|
||||||
std::string ConfigCenter::GetDefaultServerHost() const {
|
std::string ConfigCenter::GetDefaultServerHost() const {
|
||||||
return server_host_default_;
|
return signal_server_host_default_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConfigCenter::GetDefaultServerPort() const { return server_port_default_; }
|
int ConfigCenter::GetDefaultSignalServerPort() const {
|
||||||
|
return server_port_default_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ConfigCenter::GetDefaultCoturnServerPort() const {
|
||||||
|
return coturn_server_port_default_;
|
||||||
|
}
|
||||||
|
|
||||||
std::string ConfigCenter::GetDefaultCertFilePath() const {
|
std::string ConfigCenter::GetDefaultCertFilePath() const {
|
||||||
return cert_file_path_default_;
|
return cert_file_path_default_;
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ class ConfigCenter {
|
|||||||
int SetHardwareVideoCodec(bool hardware_video_codec);
|
int SetHardwareVideoCodec(bool hardware_video_codec);
|
||||||
int SetTurn(bool enable_turn);
|
int SetTurn(bool enable_turn);
|
||||||
int SetSrtp(bool enable_srtp);
|
int SetSrtp(bool enable_srtp);
|
||||||
int SetServerHost(const std::string& server_host);
|
int SetServerHost(const std::string& signal_server_host);
|
||||||
int SetServerPort(int server_port);
|
int SetServerPort(int signal_server_port);
|
||||||
|
int SetCoturnServerPort(int coturn_server_port);
|
||||||
int SetCertFilePath(const std::string& cert_file_path);
|
int SetCertFilePath(const std::string& cert_file_path);
|
||||||
int SetSelfHosted(bool enable_self_hosted);
|
int SetSelfHosted(bool enable_self_hosted);
|
||||||
int SetMinimizeToTray(bool enable_minimize_to_tray);
|
int SetMinimizeToTray(bool enable_minimize_to_tray);
|
||||||
@@ -47,11 +48,13 @@ class ConfigCenter {
|
|||||||
bool IsHardwareVideoCodec() const;
|
bool IsHardwareVideoCodec() const;
|
||||||
bool IsEnableTurn() const;
|
bool IsEnableTurn() const;
|
||||||
bool IsEnableSrtp() const;
|
bool IsEnableSrtp() const;
|
||||||
std::string GetServerHost() const;
|
std::string GetSignalServerHost() const;
|
||||||
int GetServerPort() const;
|
int GetSignalServerPort() const;
|
||||||
|
int GetCoturnServerPort() const;
|
||||||
std::string GetCertFilePath() const;
|
std::string GetCertFilePath() const;
|
||||||
std::string GetDefaultServerHost() const;
|
std::string GetDefaultServerHost() const;
|
||||||
int GetDefaultServerPort() const;
|
int GetDefaultSignalServerPort() const;
|
||||||
|
int GetDefaultCoturnServerPort() const;
|
||||||
std::string GetDefaultCertFilePath() const;
|
std::string GetDefaultCertFilePath() const;
|
||||||
bool IsSelfHosted() const;
|
bool IsSelfHosted() const;
|
||||||
bool IsMinimizeToTray() const;
|
bool IsMinimizeToTray() const;
|
||||||
@@ -72,10 +75,12 @@ class ConfigCenter {
|
|||||||
bool hardware_video_codec_ = false;
|
bool hardware_video_codec_ = false;
|
||||||
bool enable_turn_ = false;
|
bool enable_turn_ = false;
|
||||||
bool enable_srtp_ = false;
|
bool enable_srtp_ = false;
|
||||||
std::string server_host_ = "api.crossdesk.cn";
|
std::string signal_server_host_ = "api.crossdesk.cn";
|
||||||
int server_port_ = 9099;
|
std::string signal_server_host_default_ = "api.crossdesk.cn";
|
||||||
std::string server_host_default_ = "api.crossdesk.cn";
|
int signal_server_port_ = 9099;
|
||||||
int server_port_default_ = 9099;
|
int server_port_default_ = 9099;
|
||||||
|
int coturn_server_port_ = 3478;
|
||||||
|
int coturn_server_port_default_ = 3478;
|
||||||
std::string cert_file_path_default_ = "";
|
std::string cert_file_path_default_ = "";
|
||||||
bool enable_self_hosted_ = false;
|
bool enable_self_hosted_ = false;
|
||||||
bool enable_minimize_to_tray_ = false;
|
bool enable_minimize_to_tray_ = false;
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_CN 228
|
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_CN 228
|
||||||
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_EN 275
|
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_WIDTH_EN 275
|
||||||
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_CN 165
|
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_CN 195
|
||||||
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_EN 165
|
#define SELF_HOSTED_SERVER_CONFIG_WINDOW_HEIGHT_EN 195
|
||||||
#define LANGUAGE_SELECT_WINDOW_PADDING_CN 120
|
#define LANGUAGE_SELECT_WINDOW_PADDING_CN 120
|
||||||
#define LANGUAGE_SELECT_WINDOW_PADDING_EN 167
|
#define LANGUAGE_SELECT_WINDOW_PADDING_EN 167
|
||||||
#define VIDEO_QUALITY_SELECT_WINDOW_PADDING_CN 120
|
#define VIDEO_QUALITY_SELECT_WINDOW_PADDING_CN 120
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ static std::vector<std::string> self_hosted_server_address = {
|
|||||||
reinterpret_cast<const char*>(u8"服务器地址:"), "Server Address:"};
|
reinterpret_cast<const char*>(u8"服务器地址:"), "Server Address:"};
|
||||||
static std::vector<std::string> self_hosted_server_port = {
|
static std::vector<std::string> self_hosted_server_port = {
|
||||||
reinterpret_cast<const char*>(u8"服务器端口:"), "Server Port:"};
|
reinterpret_cast<const char*>(u8"服务器端口:"), "Server Port:"};
|
||||||
|
static std::vector<std::string> self_hosted_server_coturn_server_port = {
|
||||||
|
reinterpret_cast<const char*>(u8"中继服务器端口:"), "Relay Server Port:"};
|
||||||
static std::vector<std::string> self_hosted_server_certificate_path = {
|
static std::vector<std::string> self_hosted_server_certificate_path = {
|
||||||
reinterpret_cast<const char*>(u8"证书文件路径:"), "Certificate File Path:"};
|
reinterpret_cast<const char*>(u8"证书文件路径:"), "Certificate File Path:"};
|
||||||
static std::vector<std::string> select_a_file = {
|
static std::vector<std::string> select_a_file = {
|
||||||
|
|||||||
@@ -427,39 +427,57 @@ int Render::StopKeyboardCapturer() {
|
|||||||
int Render::CreateConnectionPeer() {
|
int Render::CreateConnectionPeer() {
|
||||||
params_.use_cfg_file = false;
|
params_.use_cfg_file = false;
|
||||||
|
|
||||||
std::string server_ip;
|
std::string signal_server_ip;
|
||||||
int server_port;
|
int signal_server_port;
|
||||||
std::string server_cert_path;
|
int coturn_server_port;
|
||||||
|
std::string tls_cert_path;
|
||||||
|
|
||||||
if (config_center_->IsSelfHosted()) {
|
if (config_center_->IsSelfHosted()) {
|
||||||
server_ip = config_center_->GetServerHost();
|
signal_server_ip = config_center_->GetSignalServerHost();
|
||||||
server_port = config_center_->GetServerPort();
|
signal_server_port = config_center_->GetSignalServerPort();
|
||||||
server_cert_path = config_center_->GetCertFilePath();
|
coturn_server_port = config_center_->GetCoturnServerPort();
|
||||||
|
tls_cert_path = config_center_->GetCertFilePath();
|
||||||
} else {
|
} else {
|
||||||
server_ip = config_center_->GetDefaultServerHost();
|
signal_server_ip = config_center_->GetDefaultServerHost();
|
||||||
server_port = config_center_->GetDefaultServerPort();
|
signal_server_port = config_center_->GetDefaultSignalServerPort();
|
||||||
server_cert_path = config_center_->GetDefaultCertFilePath();
|
coturn_server_port = config_center_->GetDefaultCoturnServerPort();
|
||||||
|
tls_cert_path = config_center_->GetDefaultCertFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy((char*)params_.signal_server_ip, server_ip.c_str(),
|
// self hosted server config
|
||||||
|
strncpy(signal_server_ip_self_, config_center_->GetSignalServerHost().c_str(),
|
||||||
|
sizeof(signal_server_ip_self_) - 1);
|
||||||
|
signal_server_ip_self_[sizeof(signal_server_ip_self_) - 1] = '\0';
|
||||||
|
strncpy(signal_server_port_self_,
|
||||||
|
std::to_string(config_center_->GetSignalServerPort()).c_str(),
|
||||||
|
sizeof(signal_server_port_self_) - 1);
|
||||||
|
signal_server_port_self_[sizeof(signal_server_port_self_) - 1] = '\0';
|
||||||
|
strncpy(coturn_server_port_self_,
|
||||||
|
std::to_string(config_center_->GetCoturnServerPort()).c_str(),
|
||||||
|
sizeof(coturn_server_port_self_) - 1);
|
||||||
|
coturn_server_port_self_[sizeof(coturn_server_port_self_) - 1] = '\0';
|
||||||
|
tls_cert_path_self_ = config_center_->GetCertFilePath();
|
||||||
|
|
||||||
|
// peer config
|
||||||
|
strncpy((char*)params_.signal_server_ip, signal_server_ip.c_str(),
|
||||||
sizeof(params_.signal_server_ip) - 1);
|
sizeof(params_.signal_server_ip) - 1);
|
||||||
params_.signal_server_ip[sizeof(params_.signal_server_ip) - 1] = '\0';
|
params_.signal_server_ip[sizeof(params_.signal_server_ip) - 1] = '\0';
|
||||||
params_.signal_server_port = server_port;
|
params_.signal_server_port = signal_server_port;
|
||||||
strncpy((char*)params_.stun_server_ip, server_ip.c_str(),
|
strncpy((char*)params_.stun_server_ip, signal_server_ip.c_str(),
|
||||||
sizeof(params_.stun_server_ip) - 1);
|
sizeof(params_.stun_server_ip) - 1);
|
||||||
params_.stun_server_ip[sizeof(params_.stun_server_ip) - 1] = '\0';
|
params_.stun_server_ip[sizeof(params_.stun_server_ip) - 1] = '\0';
|
||||||
params_.stun_server_port = 3478;
|
params_.stun_server_port = coturn_server_port;
|
||||||
strncpy((char*)params_.turn_server_ip, server_ip.c_str(),
|
strncpy((char*)params_.turn_server_ip, signal_server_ip.c_str(),
|
||||||
sizeof(params_.turn_server_ip) - 1);
|
sizeof(params_.turn_server_ip) - 1);
|
||||||
params_.turn_server_ip[sizeof(params_.turn_server_ip) - 1] = '\0';
|
params_.turn_server_ip[sizeof(params_.turn_server_ip) - 1] = '\0';
|
||||||
params_.turn_server_port = 3478;
|
params_.turn_server_port = coturn_server_port;
|
||||||
strncpy((char*)params_.turn_server_username, "crossdesk",
|
strncpy((char*)params_.turn_server_username, "crossdesk",
|
||||||
sizeof(params_.turn_server_username) - 1);
|
sizeof(params_.turn_server_username) - 1);
|
||||||
params_.turn_server_username[sizeof(params_.turn_server_username) - 1] = '\0';
|
params_.turn_server_username[sizeof(params_.turn_server_username) - 1] = '\0';
|
||||||
strncpy((char*)params_.turn_server_password, "crossdeskpw",
|
strncpy((char*)params_.turn_server_password, "crossdeskpw",
|
||||||
sizeof(params_.turn_server_password) - 1);
|
sizeof(params_.turn_server_password) - 1);
|
||||||
params_.turn_server_password[sizeof(params_.turn_server_password) - 1] = '\0';
|
params_.turn_server_password[sizeof(params_.turn_server_password) - 1] = '\0';
|
||||||
strncpy(params_.tls_cert_path, server_cert_path.c_str(),
|
strncpy(params_.tls_cert_path, tls_cert_path.c_str(),
|
||||||
sizeof(params_.tls_cert_path) - 1);
|
sizeof(params_.tls_cert_path) - 1);
|
||||||
params_.tls_cert_path[sizeof(params_.tls_cert_path) - 1] = '\0';
|
params_.tls_cert_path[sizeof(params_.tls_cert_path) - 1] = '\0';
|
||||||
|
|
||||||
@@ -883,13 +901,14 @@ int Render::Run() {
|
|||||||
cache_path_ = path_manager_->GetCachePath().string();
|
cache_path_ = path_manager_->GetCachePath().string();
|
||||||
config_center_ =
|
config_center_ =
|
||||||
std::make_unique<ConfigCenter>(cache_path_ + "/config.ini", cert_path_);
|
std::make_unique<ConfigCenter>(cache_path_ + "/config.ini", cert_path_);
|
||||||
strncpy(signal_server_ip_tmp_, config_center_->GetServerHost().c_str(),
|
strncpy(signal_server_ip_self_,
|
||||||
sizeof(signal_server_ip_tmp_) - 1);
|
config_center_->GetSignalServerHost().c_str(),
|
||||||
signal_server_ip_tmp_[sizeof(signal_server_ip_tmp_) - 1] = '\0';
|
sizeof(signal_server_ip_self_) - 1);
|
||||||
strncpy(signal_server_port_tmp_,
|
signal_server_ip_self_[sizeof(signal_server_ip_self_) - 1] = '\0';
|
||||||
std::to_string(config_center_->GetServerPort()).c_str(),
|
strncpy(signal_server_port_self_,
|
||||||
sizeof(signal_server_port_tmp_) - 1);
|
std::to_string(config_center_->GetSignalServerPort()).c_str(),
|
||||||
signal_server_port_tmp_[sizeof(signal_server_port_tmp_) - 1] = '\0';
|
sizeof(signal_server_port_self_) - 1);
|
||||||
|
signal_server_port_self_[sizeof(signal_server_port_self_) - 1] = '\0';
|
||||||
strncpy(cert_file_path_, cert_path_.c_str(), sizeof(cert_file_path_) - 1);
|
strncpy(cert_file_path_, cert_path_.c_str(), sizeof(cert_file_path_) - 1);
|
||||||
cert_file_path_[sizeof(cert_file_path_) - 1] = '\0';
|
cert_file_path_[sizeof(cert_file_path_) - 1] = '\0';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ class Render {
|
|||||||
bool enable_srtp_ = false;
|
bool enable_srtp_ = false;
|
||||||
char signal_server_ip_[256] = "api.crossdesk.cn";
|
char signal_server_ip_[256] = "api.crossdesk.cn";
|
||||||
char signal_server_port_[6] = "9099";
|
char signal_server_port_[6] = "9099";
|
||||||
|
char coturn_server_port_[6] = "3478";
|
||||||
char cert_file_path_[256] = "";
|
char cert_file_path_[256] = "";
|
||||||
bool enable_self_hosted_server_ = false;
|
bool enable_self_hosted_server_ = false;
|
||||||
int language_button_value_last_ = 0;
|
int language_button_value_last_ = 0;
|
||||||
@@ -452,12 +453,13 @@ class Render {
|
|||||||
bool enable_srtp_last_ = false;
|
bool enable_srtp_last_ = false;
|
||||||
bool enable_minimize_to_tray_ = false;
|
bool enable_minimize_to_tray_ = false;
|
||||||
bool enable_minimize_to_tray_last_ = false;
|
bool enable_minimize_to_tray_last_ = false;
|
||||||
char signal_server_ip_tmp_[256] = "api.crossdesk.cn";
|
char signal_server_ip_self_[256] = "";
|
||||||
char signal_server_port_tmp_[6] = "9099";
|
char signal_server_port_self_[6] = "";
|
||||||
|
char coturn_server_port_self_[6] = "";
|
||||||
|
std::string tls_cert_path_self_ = "";
|
||||||
bool settings_window_pos_reset_ = true;
|
bool settings_window_pos_reset_ = true;
|
||||||
bool self_hosted_server_config_window_pos_reset_ = true;
|
bool self_hosted_server_config_window_pos_reset_ = true;
|
||||||
std::string selected_current_file_path_ = "";
|
std::string selected_current_file_path_ = "";
|
||||||
std::string selected_file_ = "";
|
|
||||||
bool show_file_browser_ = true;
|
bool show_file_browser_ = true;
|
||||||
/* ------ main window property end ------ */
|
/* ------ main window property end ------ */
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ int Render::ShowSimpleFileBrowser() {
|
|||||||
selected_current_file_path_ = std::filesystem::current_path().string();
|
selected_current_file_path_ = std::filesystem::current_path().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!selected_file_.empty()) {
|
if (!tls_cert_path_self_.empty()) {
|
||||||
display_text = std::filesystem::path(selected_file_).filename().string();
|
display_text =
|
||||||
|
std::filesystem::path(tls_cert_path_self_).filename().string();
|
||||||
} else if (selected_current_file_path_ != "Root") {
|
} else if (selected_current_file_path_ != "Root") {
|
||||||
display_text =
|
display_text =
|
||||||
std::filesystem::path(selected_current_file_path_).filename().string();
|
std::filesystem::path(selected_current_file_path_).filename().string();
|
||||||
@@ -66,7 +67,7 @@ int Render::ShowSimpleFileBrowser() {
|
|||||||
for (const auto& root : roots) {
|
for (const auto& root : roots) {
|
||||||
if (ImGui::Selectable(root.c_str())) {
|
if (ImGui::Selectable(root.c_str())) {
|
||||||
selected_current_file_path_ = root;
|
selected_current_file_path_ = root;
|
||||||
selected_file_.clear();
|
tls_cert_path_self_.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -81,7 +82,7 @@ int Render::ShowSimpleFileBrowser() {
|
|||||||
} else {
|
} else {
|
||||||
selected_current_file_path_ = "Root";
|
selected_current_file_path_ = "Root";
|
||||||
}
|
}
|
||||||
selected_file_.clear();
|
tls_cert_path_self_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -91,11 +92,11 @@ int Render::ShowSimpleFileBrowser() {
|
|||||||
if (entry.is_directory()) {
|
if (entry.is_directory()) {
|
||||||
if (ImGui::Selectable(name.c_str())) {
|
if (ImGui::Selectable(name.c_str())) {
|
||||||
selected_current_file_path_ = entry.path().string();
|
selected_current_file_path_ = entry.path().string();
|
||||||
selected_file_.clear();
|
tls_cert_path_self_.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ImGui::Selectable(name.c_str())) {
|
if (ImGui::Selectable(name.c_str())) {
|
||||||
selected_file_ = entry.path().string();
|
tls_cert_path_self_ = entry.path().string();
|
||||||
file_selected = true;
|
file_selected = true;
|
||||||
show_file_browser_ = false;
|
show_file_browser_ = false;
|
||||||
}
|
}
|
||||||
@@ -182,8 +183,8 @@ int Render::SelfHostedServerWindow() {
|
|||||||
ImGui::SetCursorPosY(settings_items_offset);
|
ImGui::SetCursorPosY(settings_items_offset);
|
||||||
ImGui::SetNextItemWidth(SELF_HOSTED_SERVER_INPUT_WINDOW_WIDTH);
|
ImGui::SetNextItemWidth(SELF_HOSTED_SERVER_INPUT_WINDOW_WIDTH);
|
||||||
|
|
||||||
ImGui::InputText("##signal_server_ip_tmp_", signal_server_ip_tmp_,
|
ImGui::InputText("##signal_server_ip_self_", signal_server_ip_self_,
|
||||||
IM_ARRAYSIZE(signal_server_ip_tmp_),
|
IM_ARRAYSIZE(signal_server_ip_self_),
|
||||||
ImGuiInputTextFlags_AlwaysOverwrite);
|
ImGuiInputTextFlags_AlwaysOverwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,8 +206,29 @@ int Render::SelfHostedServerWindow() {
|
|||||||
ImGui::SetCursorPosY(settings_items_offset);
|
ImGui::SetCursorPosY(settings_items_offset);
|
||||||
ImGui::SetNextItemWidth(SELF_HOSTED_SERVER_INPUT_WINDOW_WIDTH);
|
ImGui::SetNextItemWidth(SELF_HOSTED_SERVER_INPUT_WINDOW_WIDTH);
|
||||||
|
|
||||||
ImGui::InputText("##signal_server_port_tmp_", signal_server_port_tmp_,
|
ImGui::InputText("##signal_server_port_self_", signal_server_port_self_,
|
||||||
IM_ARRAYSIZE(signal_server_port_tmp_));
|
IM_ARRAYSIZE(signal_server_port_self_));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
{
|
||||||
|
settings_items_offset += settings_items_padding;
|
||||||
|
ImGui::SetCursorPosY(settings_items_offset + 2);
|
||||||
|
ImGui::Text("%s", localization::self_hosted_server_coturn_server_port
|
||||||
|
[localization_language_index_]
|
||||||
|
.c_str());
|
||||||
|
|
||||||
|
if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) {
|
||||||
|
ImGui::SetCursorPosX(SELF_HOSTED_SERVER_PORT_INPUT_BOX_PADDING_CN);
|
||||||
|
} else {
|
||||||
|
ImGui::SetCursorPosX(SELF_HOSTED_SERVER_PORT_INPUT_BOX_PADDING_EN);
|
||||||
|
}
|
||||||
|
ImGui::SetCursorPosY(settings_items_offset);
|
||||||
|
ImGui::SetNextItemWidth(SELF_HOSTED_SERVER_INPUT_WINDOW_WIDTH);
|
||||||
|
|
||||||
|
ImGui::InputText("##coturn_server_port_self_", coturn_server_port_self_,
|
||||||
|
IM_ARRAYSIZE(coturn_server_port_self_));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
@@ -248,16 +270,20 @@ int Render::SelfHostedServerWindow() {
|
|||||||
localization::ok[localization_language_index_].c_str())) {
|
localization::ok[localization_language_index_].c_str())) {
|
||||||
show_self_hosted_server_config_window_ = false;
|
show_self_hosted_server_config_window_ = false;
|
||||||
|
|
||||||
config_center_->SetServerHost(signal_server_ip_tmp_);
|
config_center_->SetServerHost(signal_server_ip_self_);
|
||||||
config_center_->SetServerPort(atoi(signal_server_port_tmp_));
|
config_center_->SetServerPort(atoi(signal_server_port_self_));
|
||||||
config_center_->SetCertFilePath(selected_file_);
|
config_center_->SetCoturnServerPort(atoi(coturn_server_port_self_));
|
||||||
strncpy(signal_server_ip_, signal_server_ip_tmp_,
|
config_center_->SetCertFilePath(tls_cert_path_self_);
|
||||||
|
strncpy(signal_server_ip_, signal_server_ip_self_,
|
||||||
sizeof(signal_server_ip_) - 1);
|
sizeof(signal_server_ip_) - 1);
|
||||||
signal_server_ip_[sizeof(signal_server_ip_) - 1] = '\0';
|
signal_server_ip_[sizeof(signal_server_ip_) - 1] = '\0';
|
||||||
strncpy(signal_server_port_, signal_server_port_tmp_,
|
strncpy(signal_server_port_, signal_server_port_self_,
|
||||||
sizeof(signal_server_port_) - 1);
|
sizeof(signal_server_port_) - 1);
|
||||||
signal_server_port_[sizeof(signal_server_port_) - 1] = '\0';
|
signal_server_port_[sizeof(signal_server_port_) - 1] = '\0';
|
||||||
strncpy(cert_file_path_, selected_file_.c_str(),
|
strncpy(coturn_server_port_, coturn_server_port_self_,
|
||||||
|
sizeof(coturn_server_port_) - 1);
|
||||||
|
coturn_server_port_[sizeof(coturn_server_port_) - 1] = '\0';
|
||||||
|
strncpy(cert_file_path_, tls_cert_path_self_.c_str(),
|
||||||
sizeof(cert_file_path_) - 1);
|
sizeof(cert_file_path_) - 1);
|
||||||
cert_file_path_[sizeof(cert_file_path_) - 1] = '\0';
|
cert_file_path_[sizeof(cert_file_path_) - 1] = '\0';
|
||||||
|
|
||||||
@@ -271,15 +297,15 @@ int Render::SelfHostedServerWindow() {
|
|||||||
show_self_hosted_server_config_window_ = false;
|
show_self_hosted_server_config_window_ = false;
|
||||||
self_hosted_server_config_window_pos_reset_ = true;
|
self_hosted_server_config_window_pos_reset_ = true;
|
||||||
|
|
||||||
strncpy(signal_server_ip_tmp_, signal_server_ip_,
|
strncpy(signal_server_ip_self_, signal_server_ip_,
|
||||||
sizeof(signal_server_ip_tmp_) - 1);
|
sizeof(signal_server_ip_self_) - 1);
|
||||||
signal_server_ip_tmp_[sizeof(signal_server_ip_tmp_) - 1] = '\0';
|
signal_server_ip_self_[sizeof(signal_server_ip_self_) - 1] = '\0';
|
||||||
strncpy(signal_server_port_tmp_, signal_server_port_,
|
strncpy(signal_server_port_self_, signal_server_port_,
|
||||||
sizeof(signal_server_port_tmp_) - 1);
|
sizeof(signal_server_port_self_) - 1);
|
||||||
signal_server_port_tmp_[sizeof(signal_server_port_tmp_) - 1] = '\0';
|
signal_server_port_self_[sizeof(signal_server_port_self_) - 1] = '\0';
|
||||||
config_center_->SetServerHost(signal_server_ip_tmp_);
|
config_center_->SetServerHost(signal_server_ip_self_);
|
||||||
config_center_->SetServerPort(atoi(signal_server_port_tmp_));
|
config_center_->SetServerPort(atoi(signal_server_port_self_));
|
||||||
selected_file_.clear();
|
tls_cert_path_self_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user