make possible using older versions of YOURLS when using the shortener.php proxy

This commit is contained in:
Hannes Mannerheim 2017-01-30 23:50:42 +01:00
parent ba8b242f46
commit 174d76b89d
3 changed files with 3 additions and 1 deletions

View File

@ -87,6 +87,7 @@ class QvitterPlugin extends Plugin {
// URL SHORTENER
$settings['urlshortenerapiurl'] = 'http://qttr.at/yourls-api.php';
$settings['urlshortenersignature'] = 'b6afeec983';
$settings['urlshortenerformat'] = 'jsonp'; // if you're using shortener.php you can set this to 'json', which enables you to use YOURLS versions below 1.5.1
// CUSTOM TERMS OF USE
$settings['customtermsofuse'] = false;

View File

@ -354,6 +354,7 @@ class QvitterAction extends ApiAction
window.customWelcomeText = <?php print json_encode(QvitterPlugin::settings("customwelcometext")); ?>;
window.urlShortenerAPIURL = '<?php print QvitterPlugin::settings("urlshortenerapiurl"); ?>';
window.urlShortenerSignature = '<?php print QvitterPlugin::settings("urlshortenersignature"); ?>';
window.urlshortenerFormat = '<?php print QvitterPlugin::settings("urlshortenerformat"); ?>';
window.commonSessionToken = '<?php print common_session_token(); ?>';
window.siteMaxThumbnailSize = <?php print common_config('thumbnail', 'maxsize'); ?>;
window.siteAttachmentURLBase = '<?php print $attachmentroot; ?>';

View File

@ -2651,7 +2651,7 @@ function shortenUrlsInBox(shortenButton) {
display_spinner();
$.ajax({ url: window.urlShortenerAPIURL + '?format=jsonp&action=shorturl&signature=' + window.urlShortenerSignature + '&url=' + encodeURIComponent(url), type: "GET", dataType: "jsonp",
$.ajax({ url: window.urlShortenerAPIURL + '?format=' + window.urlshortenerFormat + '&action=shorturl&signature=' + window.urlShortenerSignature + '&url=' + encodeURIComponent(url), type: "GET", dataType: window.urlshortenerFormat,
success: function(data) {
if(typeof data.shorturl != 'undefined') {