move the Link header initialisation from Router (where it does not really belong) to Webserver, where we do similar module specific initialisations prior to calling Router->Dispatch()
This commit is contained in:
parent
be8061b64b
commit
9d7a88b40d
@ -24,18 +24,13 @@ class Post extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
function post() {
|
||||
if(array_key_exists('data',$_REQUEST)) {
|
||||
$z = new \Zotlabs\Zot\Receiver($_REQUEST['data'], get_config('system', 'prvkey'), new \Zotlabs\Zot\ZotHandler());
|
||||
|
||||
|
||||
// notreached;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$z = new \Zotlabs\Zot\Receiver($_REQUEST['data'], get_config('system', 'prvkey'), new \Zotlabs\Zot\ZotHandler());
|
||||
|
||||
// notreached;
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -178,24 +178,6 @@ class Router {
|
||||
*/
|
||||
|
||||
if(\App::$module_loaded) {
|
||||
if (( \App::$module === 'channel' ) && argc() > 1) {
|
||||
\App::$channel_links = [
|
||||
[
|
||||
'rel' => 'lrdd',
|
||||
'type' => 'application/xrd+xml',
|
||||
'url' => z_root() . '/xrd?f=&uri=acct%3A' . argv(1) . '%40' . \App::get_hostname()
|
||||
],
|
||||
[
|
||||
'rel' => 'jrd',
|
||||
'type' => 'application/jrd+json',
|
||||
'url' => z_root() . '/.well-known/webfinger?f=&resource=acct%3A' . argv(1) . '%40' . \App::get_hostname()
|
||||
],
|
||||
];
|
||||
$x = [ 'channel_address' => argv(1), 'channel_links' => \App::$channel_links ];
|
||||
call_hooks('channel_links', $x );
|
||||
\App::$channel_links = $x['channel_links'];
|
||||
header('Link: ' . \App::get_channel_links());
|
||||
}
|
||||
|
||||
\App::$page['page_title'] = \App::$module;
|
||||
$placeholder = '';
|
||||
|
@ -107,6 +107,34 @@ class WebServer {
|
||||
|
||||
$Router = new Router($a);
|
||||
|
||||
/* Initialise the Link: response header if this is a channel page.
|
||||
* This cannot be done inside the channel module because some protocol
|
||||
* addons over-ride the module functions and these links are common
|
||||
* to all protocol drivers; thus doing it here avoids duplication.
|
||||
*/
|
||||
|
||||
if (( \App::$module === 'channel' ) && argc() > 1) {
|
||||
\App::$channel_links = [
|
||||
[
|
||||
'rel' => 'lrdd',
|
||||
'type' => 'application/xrd+xml',
|
||||
'url' => z_root() . '/xrd?f=&uri=acct%3A' . argv(1) . '%40' . \App::get_hostname()
|
||||
],
|
||||
[
|
||||
'rel' => 'jrd',
|
||||
'type' => 'application/jrd+json',
|
||||
'url' => z_root() . '/.well-known/webfinger?f=&resource=acct%3A' . argv(1) . '%40' . \App::get_hostname()
|
||||
],
|
||||
];
|
||||
$x = [ 'channel_address' => argv(1), 'channel_links' => \App::$channel_links ];
|
||||
call_hooks('channel_links', $x );
|
||||
\App::$channel_links = $x['channel_links'];
|
||||
header('Link: ' . \App::get_channel_links());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* initialise content region */
|
||||
|
||||
if(! x(\App::$page, 'content'))
|
||||
|
3
boot.php
3
boot.php
@ -921,6 +921,9 @@ class App {
|
||||
*
|
||||
* There will always be one argument. If provided a naked domain
|
||||
* URL, self::$argv[0] is set to "home".
|
||||
*
|
||||
* If $argv[0] has a period in it, for example foo.json; rewrite
|
||||
* to module = 'foo' and set $_REQUEST['module_format'] = 'json';
|
||||
*/
|
||||
|
||||
self::$argv = explode('/', self::$cmd);
|
||||
|
Reference in New Issue
Block a user