mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-06-03 13:15:17 -06:00
Clans: HTTP/S support
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
This commit is contained in:
parent
f467a15e83
commit
53cd84300d
@ -180,7 +180,8 @@ namespace clan
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string host = g_cfg_clans.get_host();
|
std::string host = g_cfg_clans.get_host();
|
||||||
std::string url = std::format("https://{}/clan_manager_{}/{}/{}", host, opType, reqType, action);
|
std::string protocol = g_cfg_clans.get_use_https() ? "https" : "http";
|
||||||
|
std::string url = std::format("{}://{}/clan_manager_{}/{}/{}", protocol, host, opType, reqType, action);
|
||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
xmlBody->save(oss, "\t", 8U);
|
xmlBody->save(oss, "\t", 8U);
|
||||||
@ -969,8 +970,8 @@ namespace clan
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
strncpy(entry.message.subject, subject_str.c_str(), subject_str.size());
|
snprintf(entry.message.subject, sizeof(entry.message.subject), "%s", subject_str.c_str());
|
||||||
strncpy(entry.message.body, msg_str.c_str(), msg_str.size());
|
snprintf(entry.message.body, sizeof(entry.message.body), "%s", msg_str.c_str());
|
||||||
|
|
||||||
announcements[i] = entry;
|
announcements[i] = entry;
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@ -51,6 +51,11 @@ std::string cfg_clans::get_host() const
|
|||||||
return host.to_string();
|
return host.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cfg_clans::get_use_https() const
|
||||||
|
{
|
||||||
|
return use_https.get();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> cfg_clans::get_hosts()
|
std::vector<std::pair<std::string, std::string>> cfg_clans::get_hosts()
|
||||||
{
|
{
|
||||||
std::vector<std::pair<std::string, std::string>> vec_hosts;
|
std::vector<std::pair<std::string, std::string>> vec_hosts;
|
||||||
@ -82,6 +87,11 @@ void cfg_clans::set_host(std::string_view host)
|
|||||||
this->host.from_string(host);
|
this->host.from_string(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cfg_clans::set_use_https(bool use_https)
|
||||||
|
{
|
||||||
|
this->use_https.set(use_https);
|
||||||
|
}
|
||||||
|
|
||||||
void cfg_clans::set_hosts(const std::vector<std::pair<std::string, std::string>>& vec_hosts)
|
void cfg_clans::set_hosts(const std::vector<std::pair<std::string, std::string>>& vec_hosts)
|
||||||
{
|
{
|
||||||
std::string final_string;
|
std::string final_string;
|
||||||
|
|||||||
@ -7,14 +7,17 @@ struct cfg_clans : cfg::node
|
|||||||
cfg::uint32 version{this, "Version", 1};
|
cfg::uint32 version{this, "Version", 1};
|
||||||
cfg::string host{this, "Host", "clans.rpcs3.net"};
|
cfg::string host{this, "Host", "clans.rpcs3.net"};
|
||||||
cfg::string hosts{this, "Hosts", "Official Clans Server|clans.rpcs3.net"};
|
cfg::string hosts{this, "Hosts", "Official Clans Server|clans.rpcs3.net"};
|
||||||
|
cfg::_bool use_https{this, "Use HTTPS", true};
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save() const;
|
void save() const;
|
||||||
|
|
||||||
std::string get_host() const;
|
std::string get_host() const;
|
||||||
|
bool get_use_https() const;
|
||||||
std::vector<std::pair<std::string, std::string>> get_hosts();
|
std::vector<std::pair<std::string, std::string>> get_hosts();
|
||||||
|
|
||||||
void set_host(std::string_view host);
|
void set_host(std::string_view host);
|
||||||
|
void set_use_https(bool use_https);
|
||||||
bool add_host(std::string_view description, std::string_view host);
|
bool add_host(std::string_view description, std::string_view host);
|
||||||
bool del_host(std::string_view description, std::string_view host);
|
bool del_host(std::string_view description, std::string_view host);
|
||||||
|
|
||||||
|
|||||||
@ -25,11 +25,17 @@ clans_settings_dialog::clans_settings_dialog(QWidget* parent)
|
|||||||
QHBoxLayout* hbox_lbl_combo = new QHBoxLayout();
|
QHBoxLayout* hbox_lbl_combo = new QHBoxLayout();
|
||||||
QLabel* lbl_server = new QLabel(tr("Server:"));
|
QLabel* lbl_server = new QLabel(tr("Server:"));
|
||||||
cbx_servers = new QComboBox();
|
cbx_servers = new QComboBox();
|
||||||
|
cbx_protocol = new QComboBox();
|
||||||
|
|
||||||
|
cbx_protocol->addItem("HTTPS");
|
||||||
|
cbx_protocol->addItem("HTTP");
|
||||||
|
cbx_protocol->setCurrentIndex(g_cfg_clans.get_use_https() ? 0 : 1);
|
||||||
|
|
||||||
refresh_combobox();
|
refresh_combobox();
|
||||||
|
|
||||||
hbox_lbl_combo->addWidget(lbl_server);
|
hbox_lbl_combo->addWidget(lbl_server);
|
||||||
hbox_lbl_combo->addWidget(cbx_servers);
|
hbox_lbl_combo->addWidget(cbx_servers);
|
||||||
|
hbox_lbl_combo->addWidget(cbx_protocol);
|
||||||
|
|
||||||
QHBoxLayout* hbox_buttons = new QHBoxLayout();
|
QHBoxLayout* hbox_buttons = new QHBoxLayout();
|
||||||
QPushButton* btn_add_server = new QPushButton(tr("Add"));
|
QPushButton* btn_add_server = new QPushButton(tr("Add"));
|
||||||
@ -60,6 +66,15 @@ clans_settings_dialog::clans_settings_dialog(QWidget* parent)
|
|||||||
g_cfg_clans.save();
|
g_cfg_clans.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(cbx_protocol, &QComboBox::currentIndexChanged, this, [this](int index)
|
||||||
|
{
|
||||||
|
if (index < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_cfg_clans.set_use_https(index == 0);
|
||||||
|
g_cfg_clans.save();
|
||||||
|
});
|
||||||
|
|
||||||
connect(btn_add_server, &QAbstractButton::clicked, this, [this]()
|
connect(btn_add_server, &QAbstractButton::clicked, this, [this]()
|
||||||
{
|
{
|
||||||
clans_add_server_dialog dlg(this);
|
clans_add_server_dialog dlg(this);
|
||||||
|
|||||||
@ -15,6 +15,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QComboBox* cbx_servers = nullptr;
|
QComboBox* cbx_servers = nullptr;
|
||||||
|
QComboBox* cbx_protocol = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class clans_add_server_dialog : public QDialog
|
class clans_add_server_dialog : public QDialog
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user