mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Updates for protected download route
This commit is contained in:
parent
bc5f9c1b8a
commit
7d61b33966
@ -56,11 +56,14 @@ class ExportController extends BaseController
|
||||
*/
|
||||
public function index(StoreExportRequest $request)
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
$hash = Str::uuid();
|
||||
$url = \Illuminate\Support\Facades\URL::temporarySignedRoute('protected_download', now()->addHour(), ['hash' => $hash]);
|
||||
Cache::put($hash, $url, now()->addHour());
|
||||
|
||||
CompanyExport::dispatch(auth()->user()->getCompany(), auth()->user(), $hash);
|
||||
CompanyExport::dispatch($user->getCompany(), $user, $hash);
|
||||
|
||||
return response()->json(['message' => 'Processing', 'url' => $url], 200);
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ use Illuminate\Support\Facades\Storage;
|
||||
class ProtectedDownloadController extends BaseController
|
||||
{
|
||||
|
||||
public function index(Request $request)
|
||||
public function index(Request $request, string $hash)
|
||||
{
|
||||
/** @var string $hashed_path */
|
||||
$hashed_path = Cache::pull($request->hash);
|
||||
$hashed_path = Cache::pull($hash);
|
||||
|
||||
if (!$hashed_path) {
|
||||
throw new SystemError('File no longer available', 404);
|
||||
|
@ -492,7 +492,7 @@ class CompanyExport implements ShouldQueue
|
||||
$nmo->company = $company_reference;
|
||||
$nmo->settings = $this->company->settings;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo, true);
|
||||
(new NinjaMailerJob($nmo, true))->handle();
|
||||
|
||||
UnlinkFile::dispatch(config('filesystems.default'), $storage_path)->delay(now()->addHours(1));
|
||||
|
||||
|
@ -301,6 +301,9 @@ class Task extends BaseModel
|
||||
$logged['end_date_raw'] = 0;
|
||||
$logged['end_date'] = ctrans('texts.running');
|
||||
}
|
||||
|
||||
$logged['description'] = $log[2];
|
||||
$logged['billable'] = $log[3];
|
||||
$logged['duration'] = $duration;
|
||||
|
||||
return $logged;
|
||||
|
File diff suppressed because one or more lines are too long
@ -849,7 +849,7 @@ class TemplateService
|
||||
return [
|
||||
'number' => (string) $task->number ?: '',
|
||||
'description' => (string) $task->description ?: '',
|
||||
'duration' => $task->duration ?: 0,
|
||||
'duration' => $task->calcDuration() ?: 0,
|
||||
'rate' => Number::formatMoney($task->rate ?? 0, $task->client ?? $task->company),
|
||||
'rate_raw' => $task->rate ?? 0,
|
||||
'created_at' => $this->translateDate($task->created_at, $task->client ? $task->client->date_format() : $task->company->date_format(), $task->client ? $task->client->locale() : $task->company->locale()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user