Skip to content

Commit 2f5450c

Browse files
committed
Windows doesn't like https, so don't use https on windows
1 parent ded5dd9 commit 2f5450c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

News.qml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ Card {
1212
anchors.verticalCenter: parent.verticalCenter
1313
anchors.margins: parent.width * 0.1
1414

15+
function stripHttpsIfWin(url) {
16+
17+
var httpsPrefix = 'https://'
18+
if (Qt.platform.os === 'windows' && url.startsWith(httpsPrefix)) {
19+
return 'http://' + url.substring(httpsPrefix.length);
20+
}
21+
return url;
22+
}
23+
1524
function fetchNews() {
1625
var news = new XMLHttpRequest();
1726
news.onreadystatechange = function() {
@@ -22,7 +31,7 @@ Card {
2231
var object = component.createObject(swipe);
2332
var post = newsObj['posts'][i];
2433
if (post['thumbnail_images']) {
25-
object.source = Qt.resolvedUrl(post['thumbnail_images']['medium']['url']);
34+
object.source = Qt.resolvedUrl(stripHttpsIfWin(post['thumbnail_images']['medium']['url']));
2635
}
2736
object.cardTitle = post['title_plain'];
2837
object.summary = post['excerpt'];

0 commit comments

Comments
 (0)