mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update MediaStorageService, fix reremote avatar bug
This commit is contained in:
parent
350585d316
commit
1c20d6960a
3 changed files with 27 additions and 26 deletions
|
@ -61,16 +61,12 @@ class StatusDelete implements ShouldQueue
|
||||||
$status = $this->status;
|
$status = $this->status;
|
||||||
$profile = $this->status->profile;
|
$profile = $this->status->profile;
|
||||||
|
|
||||||
StatusService::del($status->id);
|
StatusService::del($status->id, true);
|
||||||
$count = $profile->statuses()
|
|
||||||
->getQuery()
|
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
|
||||||
->whereNull('in_reply_to_id')
|
|
||||||
->whereNull('reblog_of_id')
|
|
||||||
->count();
|
|
||||||
|
|
||||||
$profile->status_count = ($count - 1);
|
if(in_array($status->type, ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])) {
|
||||||
$profile->save();
|
$profile->status_count = $profile->status_count - 1;
|
||||||
|
$profile->save();
|
||||||
|
}
|
||||||
|
|
||||||
if(config_cache('federation.activitypub.enabled') == true) {
|
if(config_cache('federation.activitypub.enabled') == true) {
|
||||||
$this->fanoutDelete($status);
|
$this->fanoutDelete($status);
|
||||||
|
|
|
@ -52,16 +52,12 @@ class StatusEntityLexer implements ShouldQueue
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$profile = $this->status->profile;
|
$profile = $this->status->profile;
|
||||||
|
$status = $this->status;
|
||||||
|
|
||||||
$count = $profile->statuses()
|
if(in_array($status->type, ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])) {
|
||||||
->getQuery()
|
$profile->status_count = $profile->status_count + 1;
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
$profile->save();
|
||||||
->whereNull('in_reply_to_id')
|
}
|
||||||
->whereNull('reblog_of_id')
|
|
||||||
->count();
|
|
||||||
|
|
||||||
$profile->status_count = $count;
|
|
||||||
$profile->save();
|
|
||||||
|
|
||||||
if($profile->no_autolink == false) {
|
if($profile->no_autolink == false) {
|
||||||
$this->parseEntities();
|
$this->parseEntities();
|
||||||
|
|
|
@ -43,16 +43,25 @@ class MediaStorageService {
|
||||||
|
|
||||||
$h = $r->getHeaders();
|
$h = $r->getHeaders();
|
||||||
|
|
||||||
if (isset($h['Content-Length'], $h['Content-Type']) == false) {
|
if (isset($h['content-length']) && isset($h['content-type'])) {
|
||||||
return false;
|
if(empty($h['content-length']) || empty($h['content-type'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$len = is_array($h['content-length']) ? $h['content-length'][0] : $h['content-length'];
|
||||||
|
$mime = is_array($h['content-type']) ? $h['content-type'][0] : $h['content-type'];
|
||||||
|
} else {
|
||||||
|
if (isset($h['Content-Length'], $h['Content-Type']) == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($h['Content-Length']) || empty($h['Content-Type']) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$len = is_array($h['Content-Length']) ? $h['Content-Length'][0] : $h['Content-Length'];
|
||||||
|
$mime = is_array($h['Content-Type']) ? $h['Content-Type'][0] : $h['Content-Type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($h['Content-Length']) || empty($h['Content-Type']) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$len = is_array($h['Content-Length']) ? $h['Content-Length'][0] : $h['Content-Length'];
|
|
||||||
$mime = is_array($h['Content-Type']) ? $h['Content-Type'][0] : $h['Content-Type'];
|
|
||||||
|
|
||||||
if($len < 10 || $len > ((config_cache('pixelfed.max_photo_size') * 1000))) {
|
if($len < 10 || $len > ((config_cache('pixelfed.max_photo_size') * 1000))) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue