uint32_t imagecache_enabled;
uint32_t imagecache_ok_period;
uint32_t imagecache_fail_period;
+uint32_t imagecache_ignore_sslcert;
static pthread_cond_t _imagecache_cond;
static TAILQ_HEAD(, imagecache_image) _imagecache_queue;
uint32_t id;
/* Init vars */
- _imagecache_id = 0;
+ _imagecache_id = 0;
#if ENABLE_IMAGECACHE
- imagecache_enabled = 0;
- imagecache_ok_period = 24 * 7; // weekly
- imagecache_fail_period = 24; // daily
+ imagecache_enabled = 0;
+ imagecache_ok_period = 24 * 7; // weekly
+ imagecache_fail_period = 24; // daily
+ imagecache_ignore_sslcert = 0;
#endif
/* Create threads */
htsmsg_get_u32(m, "enabled", &imagecache_enabled);
htsmsg_get_u32(m, "ok_period", &imagecache_ok_period);
htsmsg_get_u32(m, "fail_period", &imagecache_fail_period);
+ htsmsg_get_u32(m, "ignore_sslcert", &imagecache_ignore_sslcert);
htsmsg_destroy(m);
}
#endif
void imagecache_save ( void )
{
htsmsg_t *m = htsmsg_create_map();
- htsmsg_add_u32(m, "enabled", imagecache_enabled);
- htsmsg_add_u32(m, "ok_period", imagecache_ok_period);
- htsmsg_add_u32(m, "fail_period", imagecache_fail_period);
+ htsmsg_add_u32(m, "enabled", imagecache_enabled);
+ htsmsg_add_u32(m, "ok_period", imagecache_ok_period);
+ htsmsg_add_u32(m, "fail_period", imagecache_fail_period);
+ htsmsg_add_u32(m, "ignore_sslcert", imagecache_ignore_sslcert);
hts_settings_save(m, "imagecache/config");
}
imagecache_fail_period = p;
return 1;
}
+
+/*
+ * Set ignore SSL cert
+ */
+int imagecache_set_ignore_sslcert ( uint32_t p )
+{
+ if (p == imagecache_ignore_sslcert)
+ return 0;
+ imagecache_ignore_sslcert = p;
+ return 1;
+}
#endif
/*
if (!(fp = fopen(tmp, "wb")))
return 1;
- /* Fetch file */
+ /* Build command */
+ pthread_mutex_lock(&imagecache_mutex);
tvhlog(LOG_DEBUG, "imagecache", "fetch %s", img->url);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, img->url);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 120);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
+ if (imagecache_ignore_sslcert)
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
+ pthread_mutex_unlock(&imagecache_mutex);
+
+ /* Fetch */
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fp);
extern uint32_t imagecache_enabled;
extern uint32_t imagecache_ok_period;
extern uint32_t imagecache_fail_period;
+extern uint32_t imagecache_ignore_sslcert;
extern pthread_mutex_t imagecache_mutex;
__attribute__((warn_unused_result));
int imagecache_set_fail_period ( uint32_t e )
__attribute__((warn_unused_result));
+int imagecache_set_ignore_sslcert ( uint32_t e )
+ __attribute__((warn_unused_result));
// Note: will return 0 if invalid (must serve original URL)
uint32_t imagecache_get_id ( const char *url );
htsmsg_add_u32(m, "imagecache_enabled", imagecache_enabled);
htsmsg_add_u32(m, "imagecache_ok_period", imagecache_ok_period);
htsmsg_add_u32(m, "imagecache_fail_period", imagecache_fail_period);
+ htsmsg_add_u32(m, "imagecache_ignore_sslcert", imagecache_ignore_sslcert);
pthread_mutex_unlock(&imagecache_mutex);
#endif
save |= imagecache_set_ok_period(atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "imagecache_fail_period")))
save |= imagecache_set_fail_period(atoi(str));
+ str = http_arg_get(&hc->hc_req_args, "imagecache_ignore_sslcert");
+ save |= imagecache_set_ignore_sslcert(!!str);
if (save)
imagecache_save();
pthread_mutex_unlock(&imagecache_mutex);
root : 'config'
}, [ 'muxconfpath', 'language',
'imagecache_enabled', 'imagecache_ok_period',
- 'imagecache_fail_period']);
+ 'imagecache_fail_period', 'imagecache_ignore_sslcert']);
/* ****************************************************************
* Form Fields
fieldLabel: 'Re-try period (hours)',
});
+ var imagecacheIgnoreSSLCert = new Ext.form.Checkbox({
+ name: 'imagecache_ignore_sslcert',
+ fieldLabel: 'Ignore invalid SSL certificate'
+ });
+
var imagecachePanel = new Ext.form.FieldSet({
title: 'Image Caching',
width: 700,
autoHeight: true,
collapsible: true,
- items : [ imagecacheEnabled, imagecacheOkPeriod, imagecacheFailPeriod ]
+ items : [ imagecacheEnabled, imagecacheOkPeriod, imagecacheFailPeriod,
+ imagecacheIgnoreSSLCert ]
});
if (tvheadend.capabilities.indexOf('imagecache') == -1)
imagecachePanel.hide();