aboutsummaryrefslogtreecommitdiff
path: root/lib/activitypub-webfinger.php
blob: 2ad44fb1f199862e9b23f697c83751f0140e74f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

	// todo: handle empty usernames

	$actor = ltrim($config['microblog_account'], '@');
	$url = parse_url($config['url']);
	$domain = $url['host'];
	if(!empty($url['path'])) $domain .= rtrim($url['path'], '/');

	$data = [
		'subject' => 'acct:'.$actor.'@'.$domain,
		'links' => [
			[
				'rel' => 'self',
				'type' => 'application/activity+json',
				'href' => $config['url'].'/actor'
			]
		]
	];

	header('Content-Type: application/ld+json');
	echo(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));