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