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:
hannes 2017-05-29 09:46:22 +00:00
commit 35b3e67480
2 changed files with 31 additions and 27 deletions

View File

@ -98,23 +98,33 @@ 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'];
}
$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'];
}
$instanceurl = common_path('', StatusNet::isHTTPS());
$favicon_path = QvitterPlugin::settings("favicon_path");
// user's browser's language setting
$user_browser_language = 'en'; // use english if we can't find the browser language
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$user_browser_language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
}
// user's browser's language setting
$user_browser_language = 'en'; // use english if we can't find the browser language
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$user_browser_language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
}
common_set_returnto(''); // forget this
@ -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"); ?>';
@ -380,15 +389,16 @@ 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.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; ?>';
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'); ?>';
window.customTermsOfUse = <?php print json_encode(QvitterPlugin::settings("customtermsofuse")); ?>;
window.siteLocalOnlyDefaultPath = <?php print (common_config('public', 'localonly') ? 'true' : 'false'); ?>;
window.siteLocalOnlyDefaultPath = <?php print (common_config('public', 'localonly') ? 'true' : 'false'); ?>;
<?php
// Get all topics in Qvitter's namespace in Profile_prefs

View File

@ -726,17 +726,13 @@ 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;
}
}
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';
}
}