Upgrade to Laravel 13
This commit is contained in:
parent
e8e2bff5e4
commit
9f012b01e4
117 changed files with 1878 additions and 2215 deletions
|
|
@ -7,6 +7,7 @@ namespace App\Http\Controllers\Admin;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Contact;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Arr;
|
||||
|
|
@ -75,7 +76,7 @@ class ContactsController extends Controller
|
|||
|
||||
if (request()->hasFile('avatar') && (request()->input('homepage') != '')) {
|
||||
$dir = parse_url(request()->input('homepage'), PHP_URL_HOST);
|
||||
$destination = public_path() . '/assets/profile-images/' . $dir;
|
||||
$destination = public_path().'/assets/profile-images/'.$dir;
|
||||
$filesystem = new Filesystem;
|
||||
if ($filesystem->isDirectory($destination) === false) {
|
||||
$filesystem->makeDirectory($destination);
|
||||
|
|
@ -103,7 +104,7 @@ class ContactsController extends Controller
|
|||
* This method attempts to find the microformat marked-up profile image
|
||||
* from a given homepage and save it accordingly
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
* @return RedirectResponse|View
|
||||
*/
|
||||
public function getAvatar(int $contactId)
|
||||
{
|
||||
|
|
@ -115,8 +116,8 @@ class ContactsController extends Controller
|
|||
$client = resolve(Client::class);
|
||||
try {
|
||||
$response = $client->get($contact->homepage);
|
||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||
return redirect('/admin/contacts/' . $contactId . '/edit')
|
||||
} catch (BadResponseException $e) {
|
||||
return redirect('/admin/contacts/'.$contactId.'/edit')
|
||||
->with('error', 'Bad resposne from contact’s homepage');
|
||||
}
|
||||
$mf2 = \Mf2\parse((string) $response->getBody(), $contact->homepage);
|
||||
|
|
@ -129,18 +130,18 @@ class ContactsController extends Controller
|
|||
if ($avatarURL !== null) {
|
||||
try {
|
||||
$avatar = $client->get($avatarURL);
|
||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||
return redirect('/admin/contacts/' . $contactId . '/edit')
|
||||
} catch (BadResponseException $e) {
|
||||
return redirect('/admin/contacts/'.$contactId.'/edit')
|
||||
->with('error', 'Unable to download avatar');
|
||||
}
|
||||
}
|
||||
if ($avatar !== null) {
|
||||
$directory = public_path() . '/assets/profile-images/' . parse_url($contact->homepage, PHP_URL_HOST);
|
||||
$directory = public_path().'/assets/profile-images/'.parse_url($contact->homepage, PHP_URL_HOST);
|
||||
$filesystem = new Filesystem;
|
||||
if ($filesystem->isDirectory($directory) === false) {
|
||||
$filesystem->makeDirectory($directory);
|
||||
}
|
||||
$filesystem->put($directory . '/image', $avatar->getBody());
|
||||
$filesystem->put($directory.'/image', $avatar->getBody());
|
||||
|
||||
return view('admin.contacts.getavatarsuccess', [
|
||||
'homepage' => parse_url($contact->homepage, PHP_URL_HOST),
|
||||
|
|
@ -148,6 +149,6 @@ class ContactsController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
return redirect('/admin/contacts/' . $contactId . '/edit');
|
||||
return redirect('/admin/contacts/'.$contactId.'/edit');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class PasskeysController extends Controller
|
|||
// Unset session data to mitigate replay attacks
|
||||
$request->session()->forget('create_options');
|
||||
if (empty($publicKeyCredentialCreationOptionsData)) {
|
||||
throw new WebAuthnException('No public key credential request options found');
|
||||
throw new WebauthnException('No public key credential request options found');
|
||||
}
|
||||
|
||||
$attestationStatementSupportManager = new AttestationStatementSupportManager;
|
||||
|
|
@ -145,7 +145,7 @@ class PasskeysController extends Controller
|
|||
);
|
||||
|
||||
if (! $publicKeyCredential->response instanceof AuthenticatorAttestationResponse) {
|
||||
throw new WebAuthnException('Invalid response type');
|
||||
throw new WebauthnException('Invalid response type');
|
||||
}
|
||||
|
||||
$algorithmManager = new Manager;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ class PlacesController extends Controller
|
|||
foreach ($place1->notes as $note) {
|
||||
$note->place()->dissociate();
|
||||
$note->place()->associate($place2->id);
|
||||
$note->save();
|
||||
}
|
||||
$place1->delete();
|
||||
}
|
||||
|
|
@ -127,6 +128,7 @@ class PlacesController extends Controller
|
|||
foreach ($place2->notes as $note) {
|
||||
$note->place()->dissociate();
|
||||
$note->place()->associate($place1->id);
|
||||
$note->save();
|
||||
}
|
||||
$place2->delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ class ArticlesController extends Controller
|
|||
|
||||
if ($article->updated_at->year != $year || $article->updated_at->month != $month) {
|
||||
return redirect('/blog/'
|
||||
. $article->updated_at->year
|
||||
. '/' . $article->updated_at->format('m')
|
||||
. '/' . $slug);
|
||||
.$article->updated_at->year
|
||||
.'/'.$article->updated_at->format('m')
|
||||
.'/'.$slug);
|
||||
}
|
||||
|
||||
return view('articles.show', compact('article'));
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ class ContactsController extends Controller
|
|||
$contacts = Contact::all();
|
||||
foreach ($contacts as $contact) {
|
||||
$contact->homepageHost = parse_url($contact->homepage, PHP_URL_HOST);
|
||||
$file = public_path() . '/assets/profile-images/' . $contact->homepageHost . '/image';
|
||||
$file = public_path().'/assets/profile-images/'.$contact->homepageHost.'/image';
|
||||
$contact->image = ($filesystem->exists($file)) ?
|
||||
'/assets/profile-images/' . $contact->homepageHost . '/image'
|
||||
'/assets/profile-images/'.$contact->homepageHost.'/image'
|
||||
:
|
||||
'/assets/profile-images/default-image';
|
||||
}
|
||||
|
|
@ -35,11 +35,11 @@ class ContactsController extends Controller
|
|||
public function show(Contact $contact): View
|
||||
{
|
||||
$contact->homepageHost = parse_url($contact->homepage, PHP_URL_HOST);
|
||||
$file = public_path() . '/assets/profile-images/' . $contact->homepageHost . '/image';
|
||||
$file = public_path().'/assets/profile-images/'.$contact->homepageHost.'/image';
|
||||
|
||||
$filesystem = new Filesystem;
|
||||
$image = ($filesystem->exists($file)) ?
|
||||
'/assets/profile-images/' . $contact->homepageHost . '/image'
|
||||
'/assets/profile-images/'.$contact->homepageHost.'/image'
|
||||
:
|
||||
'/assets/profile-images/default-image';
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ class FeedsController extends Controller
|
|||
$articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
|
||||
$data = [
|
||||
'version' => 'https://jsonfeed.org/version/1.1',
|
||||
'title' => 'The JSON Feed for ' . config('user.display_name') . '’s blog',
|
||||
'home_page_url' => config('app.url') . '/blog',
|
||||
'feed_url' => config('app.url') . '/blog/feed.json',
|
||||
'title' => 'The JSON Feed for '.config('user.display_name').'’s blog',
|
||||
'home_page_url' => config('app.url').'/blog',
|
||||
'feed_url' => config('app.url').'/blog/feed.json',
|
||||
'authors' => [
|
||||
[
|
||||
'name' => config('user.display_name'),
|
||||
|
|
@ -85,9 +85,9 @@ class FeedsController extends Controller
|
|||
|
||||
foreach ($articles as $key => $article) {
|
||||
$data['items'][$key] = [
|
||||
'id' => config('app.url') . $article->link,
|
||||
'id' => config('app.url').$article->link,
|
||||
'title' => $article->title,
|
||||
'url' => config('app.url') . $article->link,
|
||||
'url' => config('app.url').$article->link,
|
||||
'content_html' => $article->main,
|
||||
'date_published' => $article->created_at->tz('UTC')->toRfc3339String(),
|
||||
'date_modified' => $article->updated_at->tz('UTC')->toRfc3339String(),
|
||||
|
|
@ -105,9 +105,9 @@ class FeedsController extends Controller
|
|||
$notes = Note::latest()->with('media', 'place', 'tags')->take(20)->get();
|
||||
$data = [
|
||||
'version' => 'https://jsonfeed.org/version/1.1',
|
||||
'title' => 'The JSON Feed for ' . config('user.display_name') . '’s notes',
|
||||
'home_page_url' => config('app.url') . '/notes',
|
||||
'feed_url' => config('app.url') . '/notes/feed.json',
|
||||
'title' => 'The JSON Feed for '.config('user.display_name').'’s notes',
|
||||
'home_page_url' => config('app.url').'/notes',
|
||||
'feed_url' => config('app.url').'/notes/feed.json',
|
||||
'authors' => [
|
||||
[
|
||||
'name' => config('user.display_name'),
|
||||
|
|
@ -144,8 +144,8 @@ class FeedsController extends Controller
|
|||
$items[] = [
|
||||
'type' => 'entry',
|
||||
'published' => $article->created_at,
|
||||
'uid' => config('app.url') . $article->link,
|
||||
'url' => config('app.url') . $article->link,
|
||||
'uid' => config('app.url').$article->link,
|
||||
'url' => config('app.url').$article->link,
|
||||
'content' => [
|
||||
'text' => $article->main,
|
||||
'html' => $article->html,
|
||||
|
|
@ -156,7 +156,7 @@ class FeedsController extends Controller
|
|||
|
||||
return response()->json([
|
||||
'type' => 'feed',
|
||||
'name' => 'Blog feed for ' . config('app.name'),
|
||||
'name' => 'Blog feed for '.config('app.name'),
|
||||
'url' => url('/blog'),
|
||||
'author' => [
|
||||
'type' => 'card',
|
||||
|
|
@ -192,7 +192,7 @@ class FeedsController extends Controller
|
|||
|
||||
return response()->json([
|
||||
'type' => 'feed',
|
||||
'name' => 'Notes feed for ' . config('app.name'),
|
||||
'name' => 'Notes feed for '.config('app.name'),
|
||||
'url' => url('/notes'),
|
||||
'author' => [
|
||||
'type' => 'card',
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class MicropubMediaController extends Controller
|
|||
*/
|
||||
private function saveFileToLocal(UploadedFile $file): string
|
||||
{
|
||||
$filename = Uuid::uuid4()->toString() . '.' . $file->extension();
|
||||
$filename = Uuid::uuid4()->toString().'.'.$file->extension();
|
||||
Storage::disk('local')->putFileAs('', $file, $filename);
|
||||
|
||||
return $filename;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class NotesController extends Controller
|
|||
*/
|
||||
public function redirect(int $decId): RedirectResponse
|
||||
{
|
||||
return redirect(config('app.url') . '/notes/' . (new Numbers)->numto60($decId));
|
||||
return redirect(config('app.url').'/notes/'.(new Numbers)->numto60($decId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue