A lot of things

This commit is contained in:
2026-06-16 16:21:43 +02:00
parent 4f9f6c63b3
commit 7e1e26f20b
126 changed files with 7917 additions and 204 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Helpers\EntryHelpers;
use App\Models\EntryFile;
use App\Models\LogXfUser;
use App\Services\FileServersService;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Http\JsonResponse;
@@ -45,7 +46,7 @@ class FileServerController extends Controller {
return response()->json($data);
}
\Cache::put("uploaded_file_{$fileUuid}", [
$fileData = [
'uuid' => $fileUuid,
'type' => $type,
'filename' => $filename,
@@ -54,7 +55,16 @@ class FileServerController extends Controller {
'favorite_server' => $data['favorite_server'],
'favorite_at' => time(),
'state' => 'public',
], now()->addHours(2) );
];
activity('entry-file')
->causedBy(LogXfUser::find(\Auth::user()->getAuthIdentifier()))
->withProperties($fileData)
->event('file_upload')
->log("File uploaded")
;
\Cache::put("uploaded_file_{$fileUuid}", $fileData, now()->addHours(2) );
$data['finished'] = true;
return response()->json($data);
@@ -67,7 +77,11 @@ class FileServerController extends Controller {
abort(404);
}
// TODO: DL Count.
if( !EntryHelpers::fileAlreadyDownloaded($file) ) {
EntryHelpers::markFileAsDownloaded($file);
$file->increaseDownloadCount();
}
return redirect( $this->fs->getDownloadFileUrl( $file) );
}
}