Skip to content

Commit

Permalink
Windows doesn't like https, so don't use https on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed May 31, 2017
1 parent ded5dd9 commit 2f5450c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion News.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Card {
anchors.verticalCenter: parent.verticalCenter
anchors.margins: parent.width * 0.1

function stripHttpsIfWin(url) {

var httpsPrefix = 'https://'
if (Qt.platform.os === 'windows' && url.startsWith(httpsPrefix)) {
return 'http://' + url.substring(httpsPrefix.length);
}
return url;
}

function fetchNews() {
var news = new XMLHttpRequest();
news.onreadystatechange = function() {
Expand All @@ -22,7 +31,7 @@ Card {
var object = component.createObject(swipe);
var post = newsObj['posts'][i];
if (post['thumbnail_images']) {
object.source = Qt.resolvedUrl(post['thumbnail_images']['medium']['url']);
object.source = Qt.resolvedUrl(stripHttpsIfWin(post['thumbnail_images']['medium']['url']));
}
object.cardTitle = post['title_plain'];
object.summary = post['excerpt'];
Expand Down

0 comments on commit 2f5450c

Please sign in to comment.