mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 06:23:18 +00:00
Update InstagramImport Controller
This commit is contained in:
parent
ac4eea6c85
commit
527b8eb594
1 changed files with 15 additions and 7 deletions
|
@ -82,9 +82,10 @@ trait Instagram
|
||||||
->whereStage(1)
|
->whereStage(1)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
|
$limit = config('pixelfed.import.instagram.limits.posts');
|
||||||
foreach ($media as $k => $v) {
|
foreach ($media as $k => $v) {
|
||||||
$original = $v->getClientOriginalName();
|
$original = $v->getClientOriginalName();
|
||||||
if(strlen($original) < 32 || $k > 100) {
|
if(strlen($original) < 32 || $k > $limit) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$storagePath = "import/{$job->uuid}";
|
$storagePath = "import/{$job->uuid}";
|
||||||
|
@ -105,7 +106,6 @@ trait Instagram
|
||||||
$job->save();
|
$job->save();
|
||||||
});
|
});
|
||||||
return redirect($job->url());
|
return redirect($job->url());
|
||||||
return view('settings.import.instagram.step-one', compact('profile', 'job'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instagramStepTwo(Request $request, $uuid)
|
public function instagramStepTwo(Request $request, $uuid)
|
||||||
|
@ -148,6 +148,7 @@ trait Instagram
|
||||||
{
|
{
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
$job = ImportJob::whereProfileId($profile->id)
|
$job = ImportJob::whereProfileId($profile->id)
|
||||||
|
->whereService('instagram')
|
||||||
->whereNull('completed_at')
|
->whereNull('completed_at')
|
||||||
->whereUuid($uuid)
|
->whereUuid($uuid)
|
||||||
->whereStage(3)
|
->whereStage(3)
|
||||||
|
@ -159,14 +160,21 @@ trait Instagram
|
||||||
{
|
{
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
|
|
||||||
$job = ImportJob::whereProfileId($profile->id)
|
|
||||||
|
try {
|
||||||
|
$import = ImportJob::whereProfileId($profile->id)
|
||||||
|
->where('uuid', $uuid)
|
||||||
|
->whereNotNull('media_json')
|
||||||
->whereNull('completed_at')
|
->whereNull('completed_at')
|
||||||
->whereUuid($uuid)
|
|
||||||
->whereStage(3)
|
->whereStage(3)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
ImportInstagram::dispatch($import);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
\Log::info($e);
|
||||||
|
}
|
||||||
|
|
||||||
ImportInstagram::dispatchNow($job);
|
return redirect(route('settings'))->with(['status' => [
|
||||||
|
'Import successful! It may take a few minutes to finish.'
|
||||||
return redirect($profile->url());
|
]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue