Squashed commit of the following:

commit 63912e4c20fc9b3d49670a0f547137d59aaa2ef4
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Oct 12 19:18:21 2018 +0100

    Remove facebook syndication code
This commit is contained in:
Jonny Barnes 2018-10-12 19:38:08 +01:00
parent 7c559860dc
commit 151072cd1b
10 changed files with 1 additions and 314 deletions

View file

@ -1,59 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Jobs;
use GuzzleHttp\Client;
use App\Models\Bookmark;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class SyndicateBookmarkToFacebook implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $bookmark;
/**
* Create a new job instance.
*
* @param \App\Models\Bookmark $bookmark
*/
public function __construct(Bookmark $bookmark)
{
$this->bookmark = $bookmark;
}
/**
* Execute the job.
*
* @param \GuzzleHttp\Client $guzzle
*/
public function handle(Client $guzzle)
{
//send webmention
$response = $guzzle->request(
'POST',
'https://brid.gy/publish/webmention',
[
'form_params' => [
'source' => $this->bookmark->longurl,
'target' => 'https://brid.gy/publish/facebook',
'bridgy_omit_link' => 'maybe',
],
]
);
//parse for syndication URL
if ($response->getStatusCode() == 201) {
$json = json_decode((string) $response->getBody());
$syndicates = $this->bookmark->syndicates;
$syndicates['facebook'] = $json->url;
$this->bookmark->syndicates = $syndicates;
$this->bookmark->save();
}
}
}

View file

@ -1,56 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Jobs;
use App\Models\Note;
use GuzzleHttp\Client;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class SyndicateNoteToFacebook implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
protected $note;
/**
* Create a new job instance.
*
* @param \App\Models\Note $note
*/
public function __construct(Note $note)
{
$this->note = $note;
}
/**
* Execute the job.
*
* @param \GuzzleHttp\Client $guzzle
*/
public function handle(Client $guzzle)
{
//send webmention
$response = $guzzle->request(
'POST',
'https://brid.gy/publish/webmention',
[
'form_params' => [
'source' => $this->note->longurl,
'target' => 'https://brid.gy/publish/facebook',
'bridgy_omit_link' => 'maybe',
],
]
);
//parse for syndication URL
if ($response->getStatusCode() == 201) {
$json = json_decode((string) $response->getBody());
$this->note->facebook_url = $json->url;
$this->note->save();
}
}
}