Make Qvitter work when `SSL sometimes' sites load it w/out SSL

Using HTTPS URLs from a non-HTTPS site can make browsers think
that there's a cross-site issue, for example when loading JSON data
via qvitter HTTP API calls (which makes the browsers block the data,
which breaks Qvitter).

So let the site config decide whether to use HTTPS or not;
on `ssl = sometimes' sites, generally try to use HTTPS only when
it's consistent with how the current page is being loaded
(which is consistent with what the main GNU Social code does).
This commit is contained in:
Joshua Judson Rosen 2014-11-30 21:48:04 -05:00
parent 179a49cfa1
commit 8ad46d8534

View File

@ -78,8 +78,8 @@ class QvitterAction extends ApiAction
$sitetitle = common_config('site','name');
$siterootdomain = common_config('site','server');
$qvitterpath = Plugin::staticPath('Qvitter', '');
$apiroot = common_path('api/', true);
$instanceurl = common_path('', true);
$apiroot = common_path('api/', StatusNet::isHTTPS());
$instanceurl = common_path('', StatusNet::isHTTPS());
common_set_returnto(''); // forget this
@ -175,8 +175,8 @@ class QvitterAction extends ApiAction
?>;
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
window.apiRoot = '<?php print common_path("api/", true); ?>';
window.avatarRoot = '<?php print common_path("avatar/", true); ?>';
window.apiRoot = '<?php print common_path("api/", StatusNet::isHTTPS()); ?>';
window.avatarRoot = '<?php print common_path("avatar/", StatusNet::isHTTPS()); ?>';
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
window.siteRootDomain = '<?php print $siterootdomain; ?>';
window.siteInstanceURL = '<?php print $instanceurl; ?>';