modernise chanview, which has a renewed purpose - to provide a connect link to foreign network members. The iframe no longer works due to content security policies, and people hated this with a passion anyway; so just provide a URL to visit.

This commit is contained in:
zotlabs 2016-10-26 21:50:30 -07:00
parent d42da529ec
commit d46fe20986
2 changed files with 33 additions and 17 deletions

View File

@ -86,6 +86,7 @@ class Chanview extends \Zotlabs\Web\Controller {
} }
if(! \App::$poi) { if(! \App::$poi) {
// We don't know who this is, and we can't figure it out from the URL // We don't know who this is, and we can't figure it out from the URL
// On the plus side, there's a good chance we know somebody else at that // On the plus side, there's a good chance we know somebody else at that
// hub so sending them there with a Zid will probably work anyway. // hub so sending them there with a Zid will probably work anyway.
@ -99,26 +100,42 @@ class Chanview extends \Zotlabs\Web\Controller {
$url = zid($url); $url = zid($url);
} }
$is_zot = false;
if (\App::$poi) { if (\App::$poi) {
$url = \App::$poi['xchan_url']; $url = \App::$poi['xchan_url'];
if($observer) if(\App::$poi['xchan_network'] === 'zot') {
$url = zid($url); $is_zot = true;
}
} }
// let somebody over-ride the iframed viewport presentation
// or let's just declare this a failed experiment. // We will load the chanview template if it's a foreign network,
// just so that we can provide a connect button along with a profile
// photo. Chances are we can't load the remote profile into an iframe
// because of cross-domain security headers. So provide a link to
// the remote profile.
// Zot channels will usually have a connect link.
// If it isn't zot, 'pro' members won't be able to use the connect
// button as it is a foreign network so just send them to the remote
// profile.
// if((! local_channel()) || (get_pconfig(local_channel(),'system','chanview_full'))) if($is_zot || \Zotlabs\Lib\System::get_server_role() === 'pro') {
if($is_zot && $observer) {
goaway($url); $url = zid($url);
}
// $o = replace_macros(get_markup_template('chanview.tpl'),array( goaway($url);
// '$url' => $url, }
// '$full' => t('toggle full screen mode') else {
// )); $o = replace_macros(get_markup_template('chanview.tpl'),array(
'$url' => $url,
// return $o; '$full' => t('toggle full screen mode')
));
return $o;
}
} }
} }

View File

@ -1,2 +1 @@
<div id="chanview-iframe-border" class="fakelink" onclick="chanviewFull(); return true;" title="{{$full}}" ><i class="fa fa-arrows-alt"></i></div> <a href="{{$url}}">{{$url}}</a>
<iframe id="remote-channel" width="100%" src="{{$url}}" onload="resize_iframe()"></iframe>