disable ssl in curl on android, implement interactive permission for android 23+

This commit is contained in:
2018-09-30 23:51:15 +02:00
parent 74a901364d
commit daf3484426
9 changed files with 175 additions and 11 deletions

View File

@@ -202,9 +202,13 @@ void App::download(std::string filename, std::function<void(float)> progress)
auto dest = data_path + "/" + filename;
FILE* fp = fopen(dest.c_str(), "wb");
std::string url = "https://panopainter.com/cloud/cloud-dwl.php?file=" + filename;
LOG("download %s to %s", url.c_str(), dest.c_str());
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_write);
#ifdef __ANDROID__
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
if (progress)
{
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback_download);
@@ -237,6 +241,9 @@ bool App::check_license()
//curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 2L);
#ifdef __ANDROID__
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
auto err = curl_easy_perform(curl);
curl_easy_cleanup(curl);
@@ -274,6 +281,9 @@ void App::upload(std::string filename, std::string name, std::function<void(floa
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &res);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
#ifdef __ANDROID__
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
if (progress)
{
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback_upload);

View File

@@ -898,7 +898,7 @@ void ui::Canvas::resize(int width, int height)
m_height = height;
for (int i = 0; i < 6; i++)
{
#if __IOS__
#if defined(__IOS__) || defined(__ANDROID__)
m_tmp[i].create(width, height, -1, GL_RGBA8);
m_tex[i].create(width, height, GL_RGBA8);
#else
@@ -918,7 +918,7 @@ bool ui::Canvas::create(int width, int height)
m_height = height;
for (int i = 0; i < 6; i++)
{
#if __IOS__
#if defined(__IOS__) || defined(__ANDROID__)
m_tmp[i].create(width, height, -1, GL_RGBA8);
m_tex[i].create(width, height, GL_RGBA8);
#else

View File

@@ -162,7 +162,7 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const glm::mat4& camera)
{
#ifndef __IOS__
#if !(defined(__IOS__) || defined(__ANDROID__))
//if (!m_dragging)
{
auto pos = m_resizing ? m_size_pos_start : m_cur_pos;

View File

@@ -47,6 +47,9 @@ void LogRemote::net_init()
//curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L);
#ifdef __ANDROID__
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
}
std::string LogRemote::net_request(std::string cmd, std::string data /*= ""*/)
{

View File

@@ -346,7 +346,7 @@ void NodeCanvas::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
{
if (new_size.x != m_canvas->m_width || new_size.y != m_canvas->m_height)
{
#if __IOS__
#if defined(__IOS__) || defined(__ANDROID__)
m_canvas->m_mixer.create((int)new_size.x * m_canvas->m_mixer_scale,
(int)new_size.y * m_canvas->m_mixer_scale, -1, GL_RGBA16F);
#else

View File

@@ -69,10 +69,14 @@ void NodeDialogCloud::load_thumbs_thread()
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");
#ifdef __ANDROID__
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
auto err = curl_easy_perform(curl);
if (err != CURLE_OK)
{
LOG("connection error: %d", err);
async_start();
text->set_text("Could not connect to the server");
async_update();