Host images locally
We don’t need the complexity of S3. Sepcifically the complexity of managing my own AWS account, flysystem made the Laravel side easy. A command is added to copy the the S3 files over to local storage.
This commit is contained in:
parent
d80e8164c8
commit
d7da42b626
47 changed files with 295 additions and 214 deletions
|
@ -30,7 +30,7 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function publishedAttributeUsesUpdatedAtWhenNoRelevantMf2Data(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$updated_at = Carbon::now();
|
||||
$webmention->updated_at = $updated_at;
|
||||
$this->assertEquals($updated_at->toDayDateTimeString(), $webmention->published);
|
||||
|
@ -39,7 +39,7 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function publishedAttributeUsesUpdatedAtWhenErrorParsingMf2Data(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$updated_at = Carbon::now();
|
||||
$webmention->updated_at = $updated_at;
|
||||
$webmention->mf2 = json_encode([
|
||||
|
@ -57,7 +57,7 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function createPhotoLinkDoesNothingWithGenericUrlAndNoLocallySavedImage(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$homepage = 'https://example.org/profile.png';
|
||||
$expected = 'https://example.org/profile.png';
|
||||
$this->assertEquals($expected, $webmention->createPhotoLink($homepage));
|
||||
|
@ -66,7 +66,7 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function createPhotoLinkReturnsLocallySavedImageUrlIfItExists(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$homepage = 'https://aaronparecki.com/profile.png';
|
||||
$expected = '/assets/profile-images/aaronparecki.com/image';
|
||||
$this->assertEquals($expected, $webmention->createPhotoLink($homepage));
|
||||
|
@ -75,7 +75,7 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function createPhotoLinkDealsWithSpecialCaseOfDirectTwitterPhotoLinks(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$twitterProfileImage = 'http://pbs.twimg.com/1234';
|
||||
$expected = 'https://pbs.twimg.com/1234';
|
||||
$this->assertEquals($expected, $webmention->createPhotoLink($twitterProfileImage));
|
||||
|
@ -84,7 +84,7 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function createPhotoLinkReturnsCachedTwitterPhotoLinks(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$twitterURL = 'https://twitter.com/example';
|
||||
$expected = 'https://pbs.twimg.com/static_profile_link.jpg';
|
||||
Cache::put($twitterURL, $expected, 1);
|
||||
|
@ -111,7 +111,7 @@ class WebMentionTest extends TestCase
|
|||
->once()
|
||||
->andReturn(true);
|
||||
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$twitterURL = 'https://twitter.com/example';
|
||||
$expected = 'https://pbs.twimg.com/static_profile_link.jpg';
|
||||
$this->assertEquals($expected, $webmention->createPhotoLink($twitterURL));
|
||||
|
@ -120,14 +120,14 @@ class WebMentionTest extends TestCase
|
|||
/** @test */
|
||||
public function getReplyAttributeDefaultsToNull(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$this->assertNull($webmention->reply);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function getReplyAttributeWithMf2WithoutHtmlReturnsNull(): void
|
||||
{
|
||||
$webmention = new WebMention();
|
||||
$webmention = new WebMention;
|
||||
$webmention->mf2 = json_encode(['no_html' => 'found_here']);
|
||||
$this->assertNull($webmention->reply);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue