mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 13:15:14 +00:00
delivery optimisations
This commit is contained in:
parent
4bfc438d9f
commit
a403852d89
2 changed files with 20 additions and 34 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue