Track file uploads on Wings, not the panel
This commit is contained in:
parent
6a11c32bb2
commit
f8c48214a5
5 changed files with 11 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Http\Controllers\Api\Client;
|
||||
|
||||
use Pterodactyl\Models\ActivityLog;
|
||||
use Spatie\QueryBuilder\QueryBuilder;
|
||||
use Spatie\QueryBuilder\AllowedFilter;
|
||||
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||
|
@ -18,6 +19,7 @@ class ActivityLogController extends ClientApiController
|
|||
->with('actor')
|
||||
->allowedFilters([AllowedFilter::partial('event')])
|
||||
->allowedSorts(['timestamp'])
|
||||
->whereNotIn('activity_logs.event', ActivityLog::DISABLED_EVENTS)
|
||||
->paginate(min($request->query('per_page', 25), 100))
|
||||
->appends($request->query());
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
|
|||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Permission;
|
||||
use Pterodactyl\Models\ActivityLog;
|
||||
use Spatie\QueryBuilder\QueryBuilder;
|
||||
use Spatie\QueryBuilder\AllowedFilter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
@ -26,6 +27,7 @@ class ActivityLogController extends ClientApiController
|
|||
->with('actor')
|
||||
->allowedSorts(['timestamp'])
|
||||
->allowedFilters([AllowedFilter::partial('event')])
|
||||
->whereNotIn('activity_logs.event', ActivityLog::DISABLED_EVENTS)
|
||||
->when(config('activity.hide_admin_activity'), function (Builder $builder) use ($server) {
|
||||
// We could do this with a query and a lot of joins, but that gets pretty
|
||||
// painful so for now we'll execute a simpler query.
|
||||
|
|
|
@ -6,7 +6,6 @@ use Carbon\CarbonImmutable;
|
|||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Pterodactyl\Facades\Activity;
|
||||
use Pterodactyl\Services\Nodes\NodeJWTService;
|
||||
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
|
||||
use Pterodactyl\Http\Requests\Api\Client\Servers\Files\UploadFileRequest;
|
||||
|
@ -36,8 +35,6 @@ class FileUploadController extends ClientApiController
|
|||
*/
|
||||
public function __invoke(UploadFileRequest $request, Server $server)
|
||||
{
|
||||
Activity::event('server:file.upload')->log();
|
||||
|
||||
return new JsonResponse([
|
||||
'object' => 'signed_url',
|
||||
'attributes' => [
|
||||
|
|
|
@ -53,6 +53,12 @@ class ActivityLog extends Model
|
|||
|
||||
public const RESOURCE_NAME = 'activity_log';
|
||||
|
||||
/**
|
||||
* Tracks all of the events we no longer wish to display to users. These are either legacy
|
||||
* events or just events where we never ended up using the associated data.
|
||||
*/
|
||||
public const DISABLED_EVENTS = ['server:file.upload'];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $guarded = [
|
||||
|
|
|
@ -81,6 +81,7 @@ return [
|
|||
'rename_other' => 'Renamed :count files in :directory',
|
||||
'write' => 'Wrote new content to :file',
|
||||
'upload' => 'Began a file upload',
|
||||
'uploaded' => 'Uploaded :file in :directory',
|
||||
],
|
||||
'sftp' => [
|
||||
'denied' => 'Blocked SFTP access due to permissions',
|
||||
|
|
Loading…
Reference in a new issue