aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-29 17:48:31 -0700
committerfriendica <info@friendica.com>2013-08-29 17:48:31 -0700
commitbe289a96ad3abe1f373517920c89613cf80076a9 (patch)
tree8c960f1390667c2138d5c6a31254e67282eb653d /mod
parent70c0beb857d879b8c2c74ac0922f82b37717c989 (diff)
downloadvolse-hubzilla-be289a96ad3abe1f373517920c89613cf80076a9.tar.gz
volse-hubzilla-be289a96ad3abe1f373517920c89613cf80076a9.tar.bz2
volse-hubzilla-be289a96ad3abe1f373517920c89613cf80076a9.zip
implement a 'ping' message type to respond if we're still here and whether our URL or keys have changed.
Diffstat (limited to 'mod')
-rw-r--r--mod/post.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/mod/post.php b/mod/post.php
index 847af0fe9..70dd4dc19 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -175,6 +175,19 @@ function post_post(&$a) {
$msgtype = ((array_key_exists('type',$data)) ? $data['type'] : '');
+ if($msgtype === 'ping') {
+
+ // Useful to get a health check on a remote site.
+ // This will let us know if any important communication details
+ // that we may have stored are no longer valid, regardless of xchan details.
+
+ $ret['success'] = true;
+ $ret['site'] = array();
+ $ret['site']['url'] = z_root();
+ $ret['site']['url_sig'] = base64url_encode(rsa_sign(z_root(),get_config('system','prvkey')));
+ $ret['site']['sitekey'] = get_config('system','pubkey');
+ json_return_and_die($ret);
+ }
if($msgtype === 'pickup') {