Merge pull request #3603 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-08-03 22:52:43 -06:00 committed by GitHub
commit 9ad9d74f45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 69 additions and 12 deletions

View file

@ -47,6 +47,8 @@
- Hydrate `favourited` and `reblogged` state on v1 context endpoint ([abb4f7e1](https://github.com/pixelfed/pixelfed/commit/abb4f7e1))
- Improve admin dashboard by moving expensive stats to its page and loading stats and recent data async on the dashboard home page ([9d52b9c2](https://github.com/pixelfed/pixelfed/commit/9d52b9c2))
- Update unfollow api endpoint to only decrement when appropriate, fixes #3539 ([44de1ad7](https://github.com/pixelfed/pixelfed/commit/44de1ad7))
- Improve cache invalidation after processing VideoThumbnail to eliminate "No Preview Available" on grid feeds ([47571887](https://github.com/pixelfed/pixelfed/commit/47571887))
- Use poster in VideoPresenter component ([a3cc90b0](https://github.com/pixelfed/pixelfed/commit/a3cc90b0))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api;
use Cache;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use League\Fractal;
@ -10,6 +11,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use App\Status;
use App\Report;
use App\Profile;
use App\Services\AccountService;
class ApiV1Dot1Controller extends Controller
{
@ -128,4 +130,40 @@ class ApiV1Dot1Controller extends Controller
];
return $this->json($res);
}
/**
* DELETE /api/v1.1/accounts/avatar
*
* @return \App\Transformer\Api\AccountTransformer
*/
public function deleteAvatar(Request $request)
{
$user = $request->user();
abort_if(!$user, 403);
abort_if($user->status != null, 403);
$avatar = $user->profile->avatar;
if( $avatar->media_path == 'public/avatars/default.png' ||
$avatar->media_path == 'public/avatars/default.jpg'
) {
return AccountService::get($user->profile_id);
}
if(is_file(storage_path('app/' . $avatar->media_path))) {
@unlink(storage_path('app/' . $avatar->media_path));
}
$avatar->media_path = 'public/avatars/default.jpg';
$avatar->change_count = $avatar->change_count + 1;
$avatar->save();
Cache::forget('avatar:' . $user->profile_id);
Cache::forget("avatar:{$user->profile_id}");
Cache::forget('user:account:id:'.$user->id);
AccountService::del($user->profile_id);
return AccountService::get($user->profile_id);
}
}

View file

@ -24,8 +24,9 @@ class DeleteWorker implements ShouldQueue
protected $headers;
protected $payload;
public $timeout = 60;
public $tries = 1;
public $timeout = 120;
public $tries = 3;
public $maxExceptions = 1;
/**
* Create a new job instance.
@ -72,7 +73,7 @@ class DeleteWorker implements ShouldQueue
'h:' . hash('sha256', $actor);
$lockKey = 'ap:inbox:actor-delete-exists:lock:' . $hash;
Cache::lock($lockKey, 10)->block(5, function () use(
Cache::lock($lockKey, 30)->block(15, function () use(
$headers,
$payload,
$actor,
@ -94,30 +95,30 @@ class DeleteWorker implements ShouldQueue
if($profile) {
DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('delete');
}
return;
return 1;
} else {
// Signature verification failed, exit.
return;
return 1;
}
} else {
// Remote user doesn't exist, exit early.
return;
return 1;
}
});
return;
return 1;
}
$profile = null;
if($this->verifySignature($headers, $payload) == true) {
(new Inbox($headers, $profile, $payload))->handle();
return;
return 1;
} else if($this->blindKeyRotation($headers, $payload) == true) {
(new Inbox($headers, $profile, $payload))->handle();
return;
return 1;
} else {
return;
return 1;
}
}

View file

@ -14,6 +14,8 @@ use Storage;
use App\Media;
use App\Jobs\MediaPipeline\MediaStoragePipeline;
use App\Util\Media\Blurhash;
use App\Services\MediaService;
use App\Services\StatusService;
class VideoThumbnail implements ShouldQueue
{
@ -72,6 +74,11 @@ class VideoThumbnail implements ShouldQueue
if($media->status_id) {
Cache::forget('status:transformer:media:attachments:' . $media->status_id);
MediaService::del($media->status_id);
Cache::forget('status:thumb:nsfw0' . $media->status_id);
Cache::forget('status:thumb:nsfw1' . $media->status_id);
Cache::forget('pf:services:sh:id:' . $media->status_id);
StatusService::del($media->status_id);
}
MediaStoragePipeline::dispatch($media);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/js/profile.js vendored

Binary file not shown.

BIN
public/js/rempos.js vendored

Binary file not shown.

BIN
public/js/rempro.js vendored

Binary file not shown.

BIN
public/js/spa.js vendored

Binary file not shown.

BIN
public/js/status.js vendored

Binary file not shown.

BIN
public/js/timeline.js vendored

Binary file not shown.

Binary file not shown.

View file

@ -22,7 +22,7 @@
:alt="altText(status)"/>
</div>
<div v-else class="embed-responsive embed-responsive-16by9">
<video class="video" controls playsinline preload="metadata" loop :data-id="status.id">
<video class="video" controls playsinline preload="metadata" loop :data-id="status.id" :poster="poster()">
<source :src="status.media_attachments[0].url" :type="status.media_attachments[0].mime">
</video>
</div>
@ -76,6 +76,14 @@
toggleContentWarning(status) {
this.$emit('togglecw');
},
poster() {
let url = this.status.media_attachments[0].preview_url;
if(url.endsWith('no-preview.jpg') || url.endsWith('no-preview.png')) {
return;
}
return url;
}
}
}

View file

@ -99,6 +99,7 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
Route::group(['prefix' => 'v1.1'], function() use($middleware) {
Route::post('report', 'Api\ApiV1Dot1Controller@report')->middleware($middleware);
Route::delete('accounts/avatar', 'Api\ApiV1Dot1Controller@deleteAvatar')->middleware($middleware);
});
Route::group(['prefix' => 'live'], function() use($middleware) {