diff options
-rw-r--r-- | Zotlabs/Lib/System.php | 7 | ||||
-rw-r--r-- | Zotlabs/Module/Post.php | 15 | ||||
-rw-r--r-- | Zotlabs/Web/Router.php | 18 | ||||
-rw-r--r-- | Zotlabs/Web/WebServer.php | 28 | ||||
-rwxr-xr-x | boot.php | 5 | ||||
-rw-r--r-- | include/zot.php | 22 |
6 files changed, 51 insertions, 44 deletions
diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index a5790fb07..c3e11eb6a 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -61,6 +61,13 @@ class System { return 'pro'; } + + static public function get_zot_revision() { + $x = [ 'revision' => ZOT_REVISION ]; + call_hooks('zot_revision',$x); + return $x['revision']; + } + static public function get_std_version() { if(defined('STD_VERSION')) return STD_VERSION; diff --git a/Zotlabs/Module/Post.php b/Zotlabs/Module/Post.php index dba26075f..f67cbf020 100644 --- a/Zotlabs/Module/Post.php +++ b/Zotlabs/Module/Post.php @@ -24,18 +24,11 @@ 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()); + exit; + } - - - - - - - - $z = new \Zotlabs\Zot\Receiver($_REQUEST['data'], get_config('system', 'prvkey'), new \Zotlabs\Zot\ZotHandler()); - - // notreached; - exit; } } diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php index b0193652b..9486130cb 100644 --- a/Zotlabs/Web/Router.php +++ b/Zotlabs/Web/Router.php @@ -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 = ''; diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php index 8431a2e0e..65b772fee 100644 --- a/Zotlabs/Web/WebServer.php +++ b/Zotlabs/Web/WebServer.php @@ -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')) @@ -72,8 +72,6 @@ define ( 'DIRECTORY_MODE_PRIMARY', 0x0001); // There can only be *one* prima define ( 'DIRECTORY_MODE_SECONDARY', 0x0002); // All other mirror directory servers define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); // A detached (off the grid) hub with itself as directory server. -define ( 'ZOT6_COMPLIANT', 0x1000); - // We will look for upstream directories whenever me make contact // with other sites, but if this is a new installation and isn't // a standalone hub, we need to seed the service with a starting @@ -923,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); diff --git a/include/zot.php b/include/zot.php index 1a9692ae9..af7fbf8fd 100644 --- a/include/zot.php +++ b/include/zot.php @@ -124,7 +124,7 @@ function zot_build_packet($channel, $type = 'notify', $recipients = null, $remot 'sitekey' => get_config('system','pubkey') ], 'callback' => '/post', - 'version' => ZOT_REVISION, + 'version' => Zotlabs\Lib\System::get_zot_revision(), 'encryption' => crypto_methods(), 'signing' => signing_methods() ]; @@ -2894,8 +2894,9 @@ function import_site($arr, $pubkey) { $site_flags = $site_directory; - if(array_key_exists('zot',$arr) && ((float) $arr['zot']) >= 6.0) - $site_flags = ($site_flags & ZOT6_COMPLIANT); + if(array_key_exists('zot',$arr)) { + set_sconfig($arr['url'],'system','zot_version',$arr['zot']); + } if($exists) { if(($siterecord['site_flags'] != $site_flags) @@ -4183,7 +4184,7 @@ function zotinfo($arr) { if($x) $ret['locations'] = $x; - $ret['site'] = zot_site_info($e); + $ret['site'] = zot_site_info(); check_zotinfo($e,$x,$ret); @@ -4195,10 +4196,10 @@ function zotinfo($arr) { } -function zot_site_info($channel = null) { +function zot_site_info() { - $signing_key = (($channel) ? $channel['channel_prvkey'] : get_config('system','prvkey')); - $sig_method = get_config('system','signature_algorithm','sha256'); + $signing_key = get_config('system','prvkey'); + $sig_method = get_config('system','signature_algorithm','sha256'); $ret = []; $ret['site'] = []; @@ -4225,12 +4226,7 @@ function zot_site_info($channel = null) { $ret['site']['encryption'] = crypto_methods(); $ret['site']['signing'] = signing_methods(); - if(function_exists('zotvi_load')) { - $ret['site']['zot'] = '6.0'; - } - else { - $ret['site']['zot'] = ZOT_REVISION; - } + $ret['site']['zot'] = Zotlabs\Lib\System::get_zot_revision(); // hide detailed site information if you're off the grid |