Upgrade to Laravel 13 #90
117 changed files with 1878 additions and 2215 deletions
Upgrade to Laravel 13
commit
9f012b01e4
|
|
@ -70,11 +70,6 @@ ADMIN_USER=admin# pick something better, this is used for `/admin`
|
||||||
ADMIN_PASS=password
|
ADMIN_PASS=password
|
||||||
DISPLAY_NAME='Joe Bloggs'# This is used for example in the header and titles
|
DISPLAY_NAME='Joe Bloggs'# This is used for example in the header and titles
|
||||||
|
|
||||||
TWITTER_CONSUMER_KEY=
|
|
||||||
TWITTER_CONSUMER_SECRET=
|
|
||||||
TWITTER_ACCESS_TOKEN=
|
|
||||||
TWITTER_ACCESS_TOKEN_SECRET=
|
|
||||||
|
|
||||||
SCOUT_DRIVER=database
|
SCOUT_DRIVER=database
|
||||||
SCOUT_QUEUE=false
|
SCOUT_QUEUE=false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ namespace App\Http\Controllers\Admin;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
use GuzzleHttp\Exception\BadResponseException;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
@ -103,7 +104,7 @@ class ContactsController extends Controller
|
||||||
* This method attempts to find the microformat marked-up profile image
|
* This method attempts to find the microformat marked-up profile image
|
||||||
* from a given homepage and save it accordingly
|
* from a given homepage and save it accordingly
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
* @return RedirectResponse|View
|
||||||
*/
|
*/
|
||||||
public function getAvatar(int $contactId)
|
public function getAvatar(int $contactId)
|
||||||
{
|
{
|
||||||
|
|
@ -115,7 +116,7 @@ class ContactsController extends Controller
|
||||||
$client = resolve(Client::class);
|
$client = resolve(Client::class);
|
||||||
try {
|
try {
|
||||||
$response = $client->get($contact->homepage);
|
$response = $client->get($contact->homepage);
|
||||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
} catch (BadResponseException $e) {
|
||||||
return redirect('/admin/contacts/'.$contactId.'/edit')
|
return redirect('/admin/contacts/'.$contactId.'/edit')
|
||||||
->with('error', 'Bad resposne from contact’s homepage');
|
->with('error', 'Bad resposne from contact’s homepage');
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +130,7 @@ class ContactsController extends Controller
|
||||||
if ($avatarURL !== null) {
|
if ($avatarURL !== null) {
|
||||||
try {
|
try {
|
||||||
$avatar = $client->get($avatarURL);
|
$avatar = $client->get($avatarURL);
|
||||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
} catch (BadResponseException $e) {
|
||||||
return redirect('/admin/contacts/'.$contactId.'/edit')
|
return redirect('/admin/contacts/'.$contactId.'/edit')
|
||||||
->with('error', 'Unable to download avatar');
|
->with('error', 'Unable to download avatar');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ class PasskeysController extends Controller
|
||||||
// Unset session data to mitigate replay attacks
|
// Unset session data to mitigate replay attacks
|
||||||
$request->session()->forget('create_options');
|
$request->session()->forget('create_options');
|
||||||
if (empty($publicKeyCredentialCreationOptionsData)) {
|
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;
|
$attestationStatementSupportManager = new AttestationStatementSupportManager;
|
||||||
|
|
@ -145,7 +145,7 @@ class PasskeysController extends Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! $publicKeyCredential->response instanceof AuthenticatorAttestationResponse) {
|
if (! $publicKeyCredential->response instanceof AuthenticatorAttestationResponse) {
|
||||||
throw new WebAuthnException('Invalid response type');
|
throw new WebauthnException('Invalid response type');
|
||||||
}
|
}
|
||||||
|
|
||||||
$algorithmManager = new Manager;
|
$algorithmManager = new Manager;
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ class PlacesController extends Controller
|
||||||
foreach ($place1->notes as $note) {
|
foreach ($place1->notes as $note) {
|
||||||
$note->place()->dissociate();
|
$note->place()->dissociate();
|
||||||
$note->place()->associate($place2->id);
|
$note->place()->associate($place2->id);
|
||||||
|
$note->save();
|
||||||
}
|
}
|
||||||
$place1->delete();
|
$place1->delete();
|
||||||
}
|
}
|
||||||
|
|
@ -127,6 +128,7 @@ class PlacesController extends Controller
|
||||||
foreach ($place2->notes as $note) {
|
foreach ($place2->notes as $note) {
|
||||||
$note->place()->dissociate();
|
$note->place()->dissociate();
|
||||||
$note->place()->associate($place1->id);
|
$note->place()->associate($place1->id);
|
||||||
|
$note->save();
|
||||||
}
|
}
|
||||||
$place2->delete();
|
$place2->delete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class RedirectIfAuthenticated
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Models\Like;
|
use App\Models\Like;
|
||||||
use Codebird\Codebird;
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
|
@ -39,35 +37,6 @@ class ProcessLike implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function handle(Client $client, Authorship $authorship): int
|
public function handle(Client $client, Authorship $authorship): int
|
||||||
{
|
{
|
||||||
if ($this->isTweet($this->like->url)) {
|
|
||||||
$codebird = resolve(Codebird::class);
|
|
||||||
|
|
||||||
$tweet = $codebird->statuses_oembed(['url' => $this->like->url]);
|
|
||||||
|
|
||||||
$this->like->author_name = $tweet->author_name;
|
|
||||||
$this->like->author_url = $tweet->author_url;
|
|
||||||
$this->like->content = $tweet->html;
|
|
||||||
$this->like->save();
|
|
||||||
|
|
||||||
// POSSE like
|
|
||||||
try {
|
|
||||||
$client->request(
|
|
||||||
'POST',
|
|
||||||
'https://brid.gy/publish/webmention',
|
|
||||||
[
|
|
||||||
'form_params' => [
|
|
||||||
'source' => $this->like->url,
|
|
||||||
'target' => 'https://brid.gy/publish/twitter',
|
|
||||||
],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} catch (RequestException) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = $client->request('GET', $this->like->url);
|
$response = $client->request('GET', $this->like->url);
|
||||||
$mf2 = \Mf2\parse((string) $response->getBody(), $this->like->url);
|
$mf2 = \Mf2\parse((string) $response->getBody(), $this->like->url);
|
||||||
if (Arr::has($mf2, 'items.0.properties.content')) {
|
if (Arr::has($mf2, 'items.0.properties.content')) {
|
||||||
|
|
@ -91,15 +60,4 @@ class ProcessLike implements ShouldQueue
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if a given URL is that of a Tweet.
|
|
||||||
*/
|
|
||||||
private function isTweet(string $url): bool
|
|
||||||
{
|
|
||||||
$host = parse_url($url, PHP_URL_HOST);
|
|
||||||
$parts = array_reverse(explode('.', $host));
|
|
||||||
|
|
||||||
return $parts[0] === 'com' && $parts[1] === 'twitter';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue