Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2017-09-26 19:55:18 +02:00
commit cee41bb1e5
6 changed files with 51 additions and 44 deletions

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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 = '';

View file

@ -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'))

View file

@ -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);

View file

@ -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