Bill Meet streaming hourly and storage per GB like Transfer.
Deploy Ladill Meet / deploy (push) Successful in 54s
Deploy Ladill Meet / deploy (push) Successful in 54s
Wallet debits at session end, on recording/file storage, and via daily renewals with grace period before asset deletion. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,11 +23,16 @@ class FileSharingService
|
||||
?int $expiresInDays = null,
|
||||
): SessionFile {
|
||||
$expiresInDays ??= config('meet.files.default_expiry_days');
|
||||
$room->loadMissing('organization');
|
||||
|
||||
$bytes = (int) $file->getSize();
|
||||
$billing = app(MeetBillingService::class);
|
||||
|
||||
$disk = Storage::disk(config('meet.files.disk', 'local'));
|
||||
$path = 'meet-files/'.$room->uuid.'/'.Str::uuid().'_'.$file->getClientOriginalName();
|
||||
$disk->put($path, $file->get());
|
||||
|
||||
return SessionFile::create([
|
||||
$sessionFile = SessionFile::create([
|
||||
'owner_ref' => $room->owner_ref,
|
||||
'room_id' => $room->id,
|
||||
'session_id' => $session?->id,
|
||||
@@ -36,9 +41,19 @@ class FileSharingService
|
||||
'original_name' => $file->getClientOriginalName(),
|
||||
'storage_path' => $path,
|
||||
'mime_type' => $file->getMimeType(),
|
||||
'file_size' => $file->getSize(),
|
||||
'file_size' => $bytes,
|
||||
'expires_at' => $expiresInDays ? now()->addDays($expiresInDays) : null,
|
||||
]);
|
||||
|
||||
try {
|
||||
$billing->chargeFileStorageInitial($sessionFile);
|
||||
} catch (\Throwable $e) {
|
||||
$disk->delete($path);
|
||||
$sessionFile->delete();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $sessionFile;
|
||||
}
|
||||
|
||||
public function linkFromDrive(Room $room, string $driveFileId, string $name, string $uploadedByRef, string $uploadedByName): SessionFile
|
||||
@@ -58,6 +73,7 @@ class FileSharingService
|
||||
public function download(SessionFile $file, ?Participant $participant = null): string
|
||||
{
|
||||
abort_if($file->isExpired(), 410, 'File has expired.');
|
||||
abort_unless(app(MeetBillingService::class)->storageIsAccessible($file), 402, 'File storage billing is overdue. Top up your Ladill wallet to access this file.');
|
||||
|
||||
FileDownload::create([
|
||||
'session_file_id' => $file->id,
|
||||
|
||||
Reference in New Issue
Block a user