From 8ad46d8534a3989cbe10456ac1cd61ca69f20d7f Mon Sep 17 00:00:00 2001 From: Joshua Judson Rosen Date: Sun, 30 Nov 2014 21:48:04 -0500 Subject: [PATCH 1/4] 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). --- actions/qvitter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actions/qvitter.php b/actions/qvitter.php index 6af0a2b..4141de0 100644 --- a/actions/qvitter.php +++ b/actions/qvitter.php @@ -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 = ; - window.apiRoot = ''; - window.avatarRoot = ''; + window.apiRoot = ''; + window.avatarRoot = ''; window.fullUrlToThisQvitterApp = ''; window.siteRootDomain = ''; window.siteInstanceURL = ''; From 96867c8983ca6b878fc4fc237a8e44fd351af2f3 Mon Sep 17 00:00:00 2001 From: Joshua Judson Rosen Date: Fri, 28 Nov 2014 22:29:18 -0500 Subject: [PATCH 2/4] Don't insert extra whitespace in queetbox. --- js/dom-functions.js | 2 +- js/qvitter.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/dom-functions.js b/js/dom-functions.js index 58e39fd..ba77564 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -1090,7 +1090,7 @@ function replyFormHtml(q,qid) { }); var startText = encodeURIComponent(window.sL.replyTo + ' ' + user_screen_name_html + reply_to_screen_name_html + more_reply_tos + ' 
'); - var repliesText = encodeURIComponent(user_screen_name_text + reply_to_screen_name_text + more_reply_tos_text + '  '); + var repliesText = encodeURIComponent(user_screen_name_text + reply_to_screen_name_text + more_reply_tos_text + ' '); return '
' + decodeURIComponent(startText) + '
'; } diff --git a/js/qvitter.js b/js/qvitter.js index 3619d50..bf87b45 100644 --- a/js/qvitter.js +++ b/js/qvitter.js @@ -1641,11 +1641,11 @@ $('body').on('click contextmenu','.queet-box-syntax',function () { $(this)[0].addEventListener("paste", stripHtmlFromPaste); if(typeof $(this).attr('data-replies-text') != 'undefined') { $(this).html(decodeURIComponent($(this).attr('data-replies-text'))); - var repliesLen = decodeURIComponent($(this).attr('data-replies-text')).length-11; + var repliesLen = decodeURIComponent($(this).attr('data-replies-text')).length-5; setSelectionRange($(this)[0], repliesLen, repliesLen); } else { - $(this).html(' '); + $(this).html(''); } $(this).trigger('input'); } @@ -2536,4 +2536,4 @@ $('body').on('click','#mini-edit-profile-button, #edit-profile-header-link',func $('.edit-profile-button').trigger('click'); },true); } - }); \ No newline at end of file + }); From 6de248fe04546ee46ec7e609c1ab2fac4c79262d Mon Sep 17 00:00:00 2001 From: Joshua Judson Rosen Date: Mon, 24 Nov 2014 22:46:57 -0500 Subject: [PATCH 3/4] autocompletion: use avatar URLs, not filenames. Not all avatar-providing plugins generate a local filename; just using a pregenerated URL is safer. --- actions/apiqvitterallfollowing.php | 4 ++-- actions/qvitter.php | 1 - js/qvitter.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/actions/apiqvitterallfollowing.php b/actions/apiqvitterallfollowing.php index 8b84182..b85e0ae 100644 --- a/actions/apiqvitterallfollowing.php +++ b/actions/apiqvitterallfollowing.php @@ -73,11 +73,11 @@ class ApiQvitterAllFollowingAction extends ApiBareAuthAction $this->profiles = $this->getProfiles(); - // only keep id, name, nickname and avatar filename + // only keep id, name, nickname and avatar URL foreach($this->profiles as $p) { try { $avatar = Avatar::byProfile($p, AVATAR_STREAM_SIZE); - $avatar = $avatar->filename; + $avatar = $avatar->url; } catch (Exception $e) { $avatar = false; } diff --git a/actions/qvitter.php b/actions/qvitter.php index 4141de0..1aebd17 100644 --- a/actions/qvitter.php +++ b/actions/qvitter.php @@ -176,7 +176,6 @@ class QvitterAction extends ApiAction ?>; window.timeBetweenPolling = ; window.apiRoot = ''; - window.avatarRoot = ''; window.fullUrlToThisQvitterApp = ''; window.siteRootDomain = ''; window.siteInstanceURL = ''; diff --git a/js/qvitter.js b/js/qvitter.js index bf87b45..48d60ef 100644 --- a/js/qvitter.js +++ b/js/qvitter.js @@ -324,7 +324,7 @@ function doLogin(streamToSet) { var i=0; $.each(data,function(k,v){ if(v[2] === false) { var avatar = window.defaultAvatarStreamSize; } - else { var avatar = window.avatarRoot + v[2]; } + else { var avatar = v[2]; } v[0] = v[0] || v[1]; // if name is null we go with username there too window.following[i] = { 'id': k,'name': v[0], 'username': v[1],'avatar': avatar }; i++; From 4d16fd0010abf6a5ff682e213d366c4122c4e1a3 Mon Sep 17 00:00:00 2001 From: Joshua Judson Rosen Date: Fri, 28 Nov 2014 22:26:12 -0500 Subject: [PATCH 4/4] Fix autocomplete overflow on condensed view --- css/qvitter.css | 1 - 1 file changed, 1 deletion(-) diff --git a/css/qvitter.css b/css/qvitter.css index 129ae4a..7597133 100644 --- a/css/qvitter.css +++ b/css/qvitter.css @@ -3442,7 +3442,6 @@ background:rgba(0,0,0,0.2); border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.5) inset; position: relative; - overflow:hidden; } .modal-close { margin: 0;