network: Make citra mods optional and disabled by default
To avoid extra legal responsibility, this should actually only be used on our self-hosted rooms.
This commit is contained in:
parent
9d062d63da
commit
13ec2abbf6
3 changed files with 24 additions and 7 deletions
|
@ -589,8 +589,6 @@ bool Room::RoomImpl::IsValidConsoleId(const std::string& console_id_hash) const
|
|||
}
|
||||
|
||||
bool Room::RoomImpl::HasModPermission(const ENetPeer* client) const {
|
||||
if (room_information.host_username.empty())
|
||||
return false; // This room does not support moderation
|
||||
std::lock_guard<std::mutex> lock(member_mutex);
|
||||
const auto sending_member =
|
||||
std::find_if(members.begin(), members.end(),
|
||||
|
@ -598,10 +596,16 @@ bool Room::RoomImpl::HasModPermission(const ENetPeer* client) const {
|
|||
if (sending_member == members.end()) {
|
||||
return false;
|
||||
}
|
||||
if (sending_member->user_data.moderator) // Community moderator
|
||||
if (room_information.enable_citra_mods &&
|
||||
sending_member->user_data.moderator) { // Community moderator
|
||||
|
||||
return true;
|
||||
if (sending_member->user_data.username == room_information.host_username) // Room host
|
||||
}
|
||||
if (!room_information.host_username.empty() &&
|
||||
sending_member->user_data.username == room_information.host_username) { // Room host
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -963,7 +967,7 @@ bool Room::Create(const std::string& name, const std::string& description,
|
|||
const u32 max_connections, const std::string& host_username,
|
||||
const std::string& preferred_game, u64 preferred_game_id,
|
||||
std::unique_ptr<VerifyUser::Backend> verify_backend,
|
||||
const Room::BanList& ban_list) {
|
||||
const Room::BanList& ban_list, bool enable_citra_mods) {
|
||||
ENetAddress address;
|
||||
address.host = ENET_HOST_ANY;
|
||||
if (!server_address.empty()) {
|
||||
|
@ -986,6 +990,7 @@ bool Room::Create(const std::string& name, const std::string& description,
|
|||
room_impl->room_information.preferred_game = preferred_game;
|
||||
room_impl->room_information.preferred_game_id = preferred_game_id;
|
||||
room_impl->room_information.host_username = host_username;
|
||||
room_impl->room_information.enable_citra_mods = enable_citra_mods;
|
||||
room_impl->password = password;
|
||||
room_impl->verify_backend = std::move(verify_backend);
|
||||
room_impl->username_ban_list = ban_list.first;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue