delivery optimisations

This commit is contained in:
zotlabs 2018-09-06 21:24:56 -07:00
parent 4bfc438d9f
commit a403852d89
2 changed files with 20 additions and 34 deletions

View file

@ -29,7 +29,8 @@ class Inbox extends Controller {
logger('inbox_activity: ' . jindent($data), LOGGER_DATA);
HTTPSig::verify($data);
$hsig = HTTPSig::verify($data);
$AS = new ActivityStreams($data);
@ -38,7 +39,13 @@ class Inbox extends Controller {
if(! $AS->is_valid())
return;
if($hsig['header_valid'] && $hsig['content_valid']) {
$observer_hash = $hsig['signer'];
}
else {
$observer_hash = $AS->actor['id'];
}
if(! $observer_hash)
return;

View file

@ -557,25 +557,14 @@ function alt_pager($i, $more = '', $less = '') {
*/
function item_message_id() {
do {
$dups = false;
try {
$hash = Uuid::uuid4(Uuid::NAMESPACE_DNS, App::get_hostname())->toString();
$hash = Uuid::uuid4()->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = random_string(48);
}
$mid = z_root() . '/item/' . $hash;
$r = q("SELECT id FROM item WHERE mid = '%s' LIMIT 1",
dbesc($mid));
if ($r) {
$dups = true;
}
} while ($dups === true);
return $mid;
}
@ -587,23 +576,13 @@ function item_message_id() {
* @return string a unique hash
*/
function photo_new_resource() {
do {
$found = false;
try {
$hash = Uuid::uuid4(Uuid::NAMESPACE_DNS, App::get_hostname())->toString();
$hash = Uuid::uuid4()->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = random_string(48);
}
$r = q("SELECT id FROM photo WHERE resource_id = '%s' LIMIT 1",
dbesc($hash)
);
if ($r) {
$found = true;
}
} while ($found === true);
return $hash;
}