[ActivityPub] New URI system
This commit is contained in:
parent
4dbc8d1233
commit
fd68965255
|
@ -36,7 +36,6 @@ foreach (glob(__DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'mod
|
||||||
}
|
}
|
||||||
|
|
||||||
// So that this isn't hardcoded everywhere
|
// So that this isn't hardcoded everywhere
|
||||||
define('ACTIVITYPUB_BASE_ACTOR_URI', common_root_url().'index.php/user/');
|
|
||||||
const ACTIVITYPUB_PUBLIC_TO = ['https://www.w3.org/ns/activitystreams#Public',
|
const ACTIVITYPUB_PUBLIC_TO = ['https://www.w3.org/ns/activitystreams#Public',
|
||||||
'Public',
|
'Public',
|
||||||
'as:Public'
|
'as:Public'
|
||||||
|
@ -67,11 +66,7 @@ class ActivityPubPlugin extends Plugin
|
||||||
*/
|
*/
|
||||||
public static function actor_uri($profile)
|
public static function actor_uri($profile)
|
||||||
{
|
{
|
||||||
if ($profile->isLocal()) {
|
return common_profile_uri($profile);
|
||||||
return ACTIVITYPUB_BASE_ACTOR_URI.$profile->getID();
|
|
||||||
} else {
|
|
||||||
return $profile->getUri();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -180,8 +180,9 @@ class Activitypub_explorer
|
||||||
common_debug('ActivityPub Explorer: Unable to find a local Aprofile for ' . $uri . ' - looking for a Profile instead.');
|
common_debug('ActivityPub Explorer: Unable to find a local Aprofile for ' . $uri . ' - looking for a Profile instead.');
|
||||||
// Well, maybe it is a pure blood?
|
// Well, maybe it is a pure blood?
|
||||||
// Iff, we are in the same instance:
|
// Iff, we are in the same instance:
|
||||||
$ACTIVITYPUB_BASE_ACTOR_URI_length = strlen(ACTIVITYPUB_BASE_ACTOR_URI);
|
$ACTIVITYPUB_BASE_ACTOR_URI = common_local_url('userbyid', ['id' => null], null, null, false, true); // @FIXME: Could this be too hardcoded?
|
||||||
if (substr($uri, 0, $ACTIVITYPUB_BASE_ACTOR_URI_length) == ACTIVITYPUB_BASE_ACTOR_URI) {
|
$ACTIVITYPUB_BASE_ACTOR_URI_length = strlen($ACTIVITYPUB_BASE_ACTOR_URI);
|
||||||
|
if (substr($uri, 0, $ACTIVITYPUB_BASE_ACTOR_URI_length) === $ACTIVITYPUB_BASE_ACTOR_URI) {
|
||||||
try {
|
try {
|
||||||
$profile = Profile::getByID((int)substr($uri, $ACTIVITYPUB_BASE_ACTOR_URI_length));
|
$profile = Profile::getByID((int)substr($uri, $ACTIVITYPUB_BASE_ACTOR_URI_length));
|
||||||
common_debug('ActivityPub Explorer: Found a Profile for ' . $uri);
|
common_debug('ActivityPub Explorer: Found a Profile for ' . $uri);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user