feat(Settings): disable force relays by default (#2104)

* feat(ForceRelayCxnCmd): move label and desc to translations
* fix(TranslationService): Force updating languages wouldn't regenerate cache
This commit is contained in:
Andreas Maerten 2023-09-09 00:04:08 +02:00 committed by GitHub
parent a3532a6436
commit 3385a0d7fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 6 deletions

View File

@ -18,6 +18,6 @@ namespace big
}
};
force_relay_connections g_force_relay_connections("forcerelays", "Force Relay Connections", "Hides your IP address by rerouting your connection through dedicated servers and other players",
force_relay_connections g_force_relay_connections("forcerelays", "FORCE_RELAY_CXN", "FORCE_RELAY_CXN_DESC",
g.protections.force_relay_connections);
}

View File

@ -282,7 +282,7 @@ namespace big
bool receive_pickup = false;
bool admin_check = true;
bool kick_rejoin = true;
bool force_relay_connections = true;
bool force_relay_connections = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, receive_pickup, admin_check, kick_rejoin, force_relay_connections)
} protections{};

View File

@ -114,6 +114,12 @@ namespace big
}
}
void translation_service::update_n_reload_language_packs()
{
update_language_packs();
load_translations();
}
void translation_service::load_translations()
{
m_translations.clear();

View File

@ -28,7 +28,12 @@ namespace big
std::map<std::string, translation_entry>& available_translations();
const std::string& current_language_pack();
void select_language_pack(const std::string& pack_id);
void update_language_packs();
/**
* @brief Updates the language packs and reloads the language cache
*
*/
void update_n_reload_language_packs();
private:
void load_translations();
@ -36,6 +41,7 @@ namespace big
nlohmann::json load_translation(const std::string_view pack_id);
bool download_language_pack(const std::string_view pack_id);
void update_language_packs();
/**
* @brief Downloads the remote index to compare with our local index

View File

@ -52,7 +52,7 @@ namespace big
if (components::button("Force Update Languages"))
{
g_thread_pool->push([] {
g_translation_service.update_language_packs();
g_translation_service.update_n_reload_language_packs();
g_notification_service->push_success("Translations", "Finished updating translations.");
});
@ -66,7 +66,5 @@ namespace big
g.write_default_config();
g.load();
}
}
}