diff --git a/.travis.yml b/.travis.yml index f2524158..5ff96d49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,10 +32,6 @@ env: php: - 7.1 - - nightly -matrix: - allow_failures: - - php: nightly before_install: - cp .env.travis .env @@ -66,3 +62,8 @@ script: - php vendor/bin/phpunit --coverage-text - php artisan dusk - php vendor/bin/security-checker security:check ./composer.lock --end-point=http://security.sensiolabs.org/check_lock + +after_script: + - killall -9 postgresql + - killall -9 php-fpm + - killall -9 nginx \ No newline at end of file diff --git a/app/Http/Controllers/MicropubController.php b/app/Http/Controllers/MicropubController.php index cf47451f..1afeb2db 100644 --- a/app/Http/Controllers/MicropubController.php +++ b/app/Http/Controllers/MicropubController.php @@ -375,6 +375,9 @@ class MicropubController extends Controller ], 400); } + $logger = new Logger('micropub'); + $logger->pushHandler(new StreamHandler(storage_path('logs/micropub.log')), Logger::DEBUG); + $logger->debug('MicropubMediaLog', $request->all()); //check post scope if ($tokenData->hasClaim('scope')) { if (stristr($tokenData->getClaim('scope'), 'create') === false) { diff --git a/app/Note.php b/app/Note.php index afa66b0e..390ee906 100644 --- a/app/Note.php +++ b/app/Note.php @@ -7,11 +7,15 @@ use Twitter; use Normalizer; use GuzzleHttp\Client; use Laravel\Scout\Searchable; +use League\CommonMark\Converter; +use League\CommonMark\DocParser; use Jonnybarnes\IndieWeb\Numbers; +use League\CommonMark\Environment; +use League\CommonMark\HtmlRenderer; use Illuminate\Database\Eloquent\Model; use Jonnybarnes\EmojiA11y\EmojiModifier; -use League\CommonMark\CommonMarkConverter; use Illuminate\Database\Eloquent\SoftDeletes; +use Jonnybarnes\CommonmarkLinkify\LinkifyExtension; use Illuminate\Database\Eloquent\ModelNotFoundException; class Note extends Model @@ -128,9 +132,12 @@ class Note extends Model */ public function getNoteAttribute($value) { - $markdown = new CommonMarkConverter(); + $environment = Environment::createCommonMarkEnvironment(); + $environment->addExtension(new LinkifyExtension()); + $converter = new Converter(new DocParser($environment), new HtmlRenderer($environment)); $emoji = new EmojiModifier(); - $html = $markdown->convertToHtml($value); + + $html = $converter->convertToHtml($value); $hcards = $this->makeHCards($html); $hashtags = $this->autoLinkHashtag($hcards); $modified = $emoji->makeEmojiAccessible($hashtags); @@ -262,8 +269,7 @@ class Note extends Model return; } - $arr = explode('/', $url); - $tweetId = end($arr); + $tweetId = basename($this->in_reply_to); if (Cache::has($tweetId)) { return Cache::get($tweetId); } diff --git a/changelog.md b/changelog.md index 121e1a0a..4d95f3ce 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.5.24 (2017-07-13) + - Add my `commonmark-linkify` extension + - Some minor tweaks, including logging of micropub media requests + ## Version 0.5.23 (2017-07-07) - Add emoji 5.0 support with newer `emoji-a11y` package - Places can be “added” to a note in the mp-client again, (issue#47) diff --git a/composer.json b/composer.json index 2cb222d3..bc7ca4e3 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "ezyang/htmlpurifier": "~4.6", "guzzlehttp/guzzle": "~6.0", "indieauth/client": "~0.1", + "jonnybarnes/commonmark-linkify": "^0.2", "jonnybarnes/emoji-a11y": "^0.3", "jonnybarnes/indieweb": "dev-master", "jonnybarnes/webmentions-parser": "0.4.*", diff --git a/composer.lock b/composer.lock index 32dca7d4..964cc1a4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0f8de1d2b229308f3862ff61f5468fcf", + "content-hash": "747517e009c9d23ea87f46b70fd7d80b", "packages": [ { "name": "aws/aws-sdk-php", - "version": "3.31.1", + "version": "3.31.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "551865464a2779b9038aa871094a24bb9e254e24" + "reference": "582e7764e0fa389c3248450cd6db2564dd656d99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/551865464a2779b9038aa871094a24bb9e254e24", - "reference": "551865464a2779b9038aa871094a24bb9e254e24", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/582e7764e0fa389c3248450cd6db2564dd656d99", + "reference": "582e7764e0fa389c3248450cd6db2564dd656d99", "shasum": "" }, "require": { @@ -84,7 +84,7 @@ "s3", "sdk" ], - "time": "2017-07-05T17:26:26+00:00" + "time": "2017-07-06T21:11:49+00:00" }, { "name": "barnabywalters/mf-cleaner", @@ -1453,6 +1453,51 @@ ], "time": "2015-09-27T15:35:21+00:00" }, + { + "name": "jonnybarnes/commonmark-linkify", + "version": "v0.2", + "source": { + "type": "git", + "url": "https://github.com/jonnybarnes/commonmark-linkify.git", + "reference": "e41c51abdc2ccc9b71f719be0198cb78371574b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jonnybarnes/commonmark-linkify/zipball/e41c51abdc2ccc9b71f719be0198cb78371574b4", + "reference": "e41c51abdc2ccc9b71f719be0198cb78371574b4", + "shasum": "" + }, + "require": { + "league/commonmark": "^0.15.4", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Jonnybarnes\\CommonmarkLinkify\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "CC0-1.0" + ], + "authors": [ + { + "name": "Jonny Barnes", + "email": "jonny@jonnybarnes.uk" + } + ], + "description": "Turn plaintext urls into clickable links", + "homepage": "https://github.com/jonnybarnes/commonmark-linkify", + "keywords": [ + "commonmark", + "markdown" + ], + "time": "2017-07-10T16:12:15+00:00" + }, { "name": "jonnybarnes/emoji-a11y", "version": "v0.3", @@ -1719,16 +1764,16 @@ }, { "name": "laravel/scout", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/laravel/scout.git", - "reference": "547ff55530a16e31b3b1142dd4dfdb654ad2bae0" + "reference": "5a899828bf154ae7d957a2a78b4b6002e9fdf0fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/scout/zipball/547ff55530a16e31b3b1142dd4dfdb654ad2bae0", - "reference": "547ff55530a16e31b3b1142dd4dfdb654ad2bae0", + "url": "https://api.github.com/repos/laravel/scout/zipball/5a899828bf154ae7d957a2a78b4b6002e9fdf0fa", + "reference": "5a899828bf154ae7d957a2a78b4b6002e9fdf0fa", "shasum": "" }, "require": { @@ -1752,6 +1797,11 @@ "extra": { "branch-alias": { "dev-master": "3.0-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Scout\\ScoutServiceProvider" + ] } }, "autoload": { @@ -1775,7 +1825,7 @@ "laravel", "search" ], - "time": "2017-06-01T13:21:09+00:00" + "time": "2017-07-12T12:29:47+00:00" }, { "name": "laravel/tinker", @@ -2735,16 +2785,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.8", + "version": "v0.8.9", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e" + "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/fe65c30cbc55c71e61ba3a38b5a581149be31b8e", - "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/58a31cc4404c8f632d8c557bc72056af2d3a83db", + "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db", "shasum": "" }, "require": { @@ -2804,7 +2854,7 @@ "interactive", "shell" ], - "time": "2017-06-24T06:16:19+00:00" + "time": "2017-07-06T14:53:52+00:00" }, { "name": "ramsey/uuid",