Extract cloud browser file-list request helper

This commit is contained in:
2026-06-15 20:42:26 +02:00
parent 9d54dbc8c7
commit b06211faa0
5 changed files with 70 additions and 11 deletions

View File

@@ -59,6 +59,25 @@ NodeText* NodeDialogCloud::create_loading_status_text()
return text;
}
bool NodeDialogCloud::load_cloud_file_list(CURL* curl, std::string& response, NodeText& status_text)
{
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
curl_easy_setopt(curl, CURLOPT_URL, "https://panopainter.com/cloud/cloud-list.php");
if (pp::platform::default_disables_network_tls_verification())
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
const auto err = curl_easy_perform(curl);
if (err != CURLE_OK)
{
LOG("connection error: %d", err);
status_text.set_text("Could not connect to the server");
return false;
}
return true;
}
void NodeDialogCloud::load_thumbs_thread()
{
#if WITH_CURL
@@ -70,17 +89,8 @@ void NodeDialogCloud::load_thumbs_thread()
auto* text = create_loading_status_text();
auto* align = text->m_parent;
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &res);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
curl_easy_setopt(curl, CURLOPT_URL, "https://panopainter.com/cloud/cloud-list.php");
if (pp::platform::default_disables_network_tls_verification())
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
auto err = curl_easy_perform(curl);
if (err != CURLE_OK)
if (!load_cloud_file_list(curl, res, *text))
{
LOG("connection error: %d", err);
text->set_text("Could not connect to the server");
return;
}