aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/nodeinfo.php
blob: 93f103c710053b96ea77dc90a089a527e7f4686b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

use Digitigrade\Router;

Router::getInstance()->mount('/.well-known/nodeinfo', function (array $args) {
    json_response([
        'links' => [
            [
                'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.1',
                'href' => path_to_uri('/nodeinfo/2.1')
            ]
        ]
    ], 'application/jrd+json');
});

Router::getInstance()->mount('/nodeinfo/2.1', function (array $args) {
    json_response([
        'version' => '2.1',
        'software' => [
            'name' => 'Digitigrade',
            'version' => '0.1.0'
        ],
        'protocols' => ['pawpub'],
        'services' => [
            'inbound' => [],
            'outbound' => []
        ],
        'openRegistrations' => false,
        'usage' => [
            'users' => [
                'total' => 1
            ]
        ],
        'metadata' => [
            'nodeName' => 'A Digitigrade server',
            'nodeDescription' => 'nodeinfo is hardcoded for now',
            'pawpub' => [
                'extensions' => [
                    // 'https://whatever.example/ext/meow',
                ]
            ]
        ]
    ], 'application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"');
});

Router::getInstance()->mount('/.well-known/pawpub-instance', function (array $args) {
    json_response([
        'name' => 'A Digitigrade server',
        'description' => 'metadata is hardcoded for now',
        'softwareName' => 'Digitigrade',
        'softwareVersion' => '0.1.0',
        'softwareDescription' => 'An experimental PawPub server',
        'endpoints' => [

        ]
    ]);
});