1
0
mirror of synced 2024-11-24 07:40:17 +01:00

fix: Do not connect to api on startup when server contact setting is disabled (#1823)

### Problem description

ImHex asks users whether they wish to opt-in to network connections on
start (excellent!), then ignores that and tries to connect to the
network anyway when the welcome screen loads (less excellent!).

### Implementation description

Also don’t connect to the network on the welcome screen if it is
supposed to not do that.
This commit is contained in:
Colin Snover 2024-07-21 13:14:02 -05:00 committed by GitHub
parent b6f0ee90af
commit 13fd956039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -664,7 +664,9 @@ namespace hex::plugin::builtin {
}
}
if (!s_infoBannerTexture.isValid()) {
auto allowNetworking = ContentRegistry::Settings::read<bool>("hex.builtin.setting.general", "hex.builtin.setting.general.network_interface", false)
&& ContentRegistry::Settings::read<int>("hex.builtin.setting.general", "hex.builtin.setting.general.server_contact", 0) != 0;
if (!s_infoBannerTexture.isValid() && allowNetworking) {
TaskManager::createBackgroundTask("Load banner", [](auto&) {
HttpRequest request("GET",
ImHexApiURL + hex::format("/info/{}/image", hex::toLower(ImHexApi::System::getOSName())));