Merge branch 'master_fix_remoteProfilStaticAvatar' into 'master'
FixLocal profil are not detected with static avatar server See merge request !90
This commit is contained in:
commit
35b3e67480
|
@ -98,17 +98,27 @@ class QvitterAction extends ApiAction
|
|||
$siterootdomain = common_config('site','server');
|
||||
$qvitterpath = Plugin::staticPath('Qvitter', '');
|
||||
$apiroot = common_path('api/', StatusNet::isHTTPS());
|
||||
|
||||
$instanceurl = common_path('', StatusNet::isHTTPS());
|
||||
$favicon_path = QvitterPlugin::settings("favicon_path");
|
||||
$attachmentconfig=common_config('attachments');
|
||||
if(StatusNet::isHTTPS() && $attachmentconfig['sslserver']){
|
||||
$attachmentroot ='https://'.$attachmentconfig['sslserver'].$attachmentconfig['path'];
|
||||
} elseif(!StatusNet::isHTTPS() && $attachmentconfig['server']) {
|
||||
$attachmentroot ='http://'.$attachmentconfig['server'].$attachmentconfig['path'];
|
||||
} else {
|
||||
$attachmentroot = common_path('attachment/', StatusNet::isHTTPS());
|
||||
$attachmentroot = $instanceurl.$attachmentconfig['path'];
|
||||
}
|
||||
$instanceurl = common_path('', StatusNet::isHTTPS());
|
||||
$favicon_path = QvitterPlugin::settings("favicon_path");
|
||||
$avatarconfig=common_config('avatar');
|
||||
if($avatarconfig['server']) {
|
||||
if(StatusNet::isHTTPS() ){
|
||||
$avatarroot ='https://'.$avatarconfig['server'].$avatarconfig['path'];
|
||||
} else {
|
||||
$avatarroot ='http://'.$avatarconfig['server'].$avatarconfig['path'];
|
||||
}
|
||||
} else {
|
||||
$avatarroot = $instanceurl.$avatarconfig['path'];
|
||||
}
|
||||
|
||||
|
||||
// user's browser's language setting
|
||||
$user_browser_language = 'en'; // use english if we can't find the browser language
|
||||
|
@ -302,10 +312,8 @@ class QvitterAction extends ApiAction
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<script>
|
||||
|
||||
/*
|
||||
@licstart The following is the entire license notice for the
|
||||
JavaScript code in this page.
|
||||
|
@ -373,6 +381,7 @@ class QvitterAction extends ApiAction
|
|||
window.fullUrlToThisQvitterApp = '<?php print $qvitterpath; ?>';
|
||||
window.siteRootDomain = '<?php print $siterootdomain; ?>';
|
||||
window.siteInstanceURL = '<?php print $instanceurl; ?>';
|
||||
window.avatarServer= <?php print json_encode(common_config('avatar', 'server')) ?>;
|
||||
window.defaultLinkColor = '<?php print QvitterPlugin::settings("defaultlinkcolor"); ?>';
|
||||
window.defaultBackgroundColor = '<?php print QvitterPlugin::settings("defaultbackgroundcolor"); ?>';
|
||||
window.siteBackground = '<?php print QvitterPlugin::settings("sitebackground"); ?>';
|
||||
|
@ -384,6 +393,7 @@ class QvitterAction extends ApiAction
|
|||
window.commonSessionToken = '<?php print common_session_token(); ?>';
|
||||
window.siteMaxThumbnailSize = <?php print common_config('thumbnail', 'maxsize'); ?>;
|
||||
window.siteAttachmentURLBase = '<?php print $attachmentroot; ?>';
|
||||
window.siteAvatarURLBase = '<?php print $avatarroot; ?>';
|
||||
window.siteEmail = '<?php print common_config('site', 'email'); ?>';
|
||||
window.siteLicenseTitle = '<?php print common_config('license', 'title'); ?>';
|
||||
window.siteLicenseURL = '<?php print common_config('license', 'url'); ?>';
|
||||
|
|
|
@ -726,18 +726,14 @@ function updateAllQueetsTimes() {
|
|||
· · · · · · · · · */
|
||||
|
||||
function isLocalURL(url) {
|
||||
if(url.substring(0,window.siteInstanceURL.length) == window.siteInstanceURL) {
|
||||
if(url.substring(0,window.siteInstanceURL.length) == window.siteInstanceURL // site url
|
||||
|| url.substring(0,window.siteAttachmentURLBase.length) == window.siteAttachmentURLBase // attachment url
|
||||
|| url.substring(0,window.siteAvatarURLBase.length) == window.siteAvatarURLBase // avatar url
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if(url.substring(0,window.siteAttachmentURLBase.length) == window.siteAttachmentURLBase) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ·
|
||||
|
@ -1052,12 +1048,10 @@ function userArrayCacheGetUserNicknameById(id) {
|
|||
· · · · · · · · · */
|
||||
|
||||
function detectLocalOrExternalUserObject(userObject) {
|
||||
var dataProfileImageUrlWithoutProtocol = removeProtocolFromUrl(userObject.profile_image_url);
|
||||
var siteInstanceURLWithoutProtocol = removeProtocolFromUrl(window.siteInstanceURL);
|
||||
if(dataProfileImageUrlWithoutProtocol.substring(0,siteInstanceURLWithoutProtocol.length) == siteInstanceURLWithoutProtocol){
|
||||
|
||||
if(isLocalURL(userObject.profile_image_url) ) {
|
||||
return 'local';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return 'external';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user