Merge branch 'release/0.5.24'

This commit is contained in:
Jonny Barnes 2017-07-13 15:51:52 +01:00
commit e42f1b9c1d
6 changed files with 90 additions and 25 deletions

View file

@ -32,10 +32,6 @@ env:
php: php:
- 7.1 - 7.1
- nightly
matrix:
allow_failures:
- php: nightly
before_install: before_install:
- cp .env.travis .env - cp .env.travis .env
@ -66,3 +62,8 @@ script:
- php vendor/bin/phpunit --coverage-text - php vendor/bin/phpunit --coverage-text
- php artisan dusk - php artisan dusk
- php vendor/bin/security-checker security:check ./composer.lock --end-point=http://security.sensiolabs.org/check_lock - 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

View file

@ -375,6 +375,9 @@ class MicropubController extends Controller
], 400); ], 400);
} }
$logger = new Logger('micropub');
$logger->pushHandler(new StreamHandler(storage_path('logs/micropub.log')), Logger::DEBUG);
$logger->debug('MicropubMediaLog', $request->all());
//check post scope //check post scope
if ($tokenData->hasClaim('scope')) { if ($tokenData->hasClaim('scope')) {
if (stristr($tokenData->getClaim('scope'), 'create') === false) { if (stristr($tokenData->getClaim('scope'), 'create') === false) {

View file

@ -7,11 +7,15 @@ use Twitter;
use Normalizer; use Normalizer;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Laravel\Scout\Searchable; use Laravel\Scout\Searchable;
use League\CommonMark\Converter;
use League\CommonMark\DocParser;
use Jonnybarnes\IndieWeb\Numbers; use Jonnybarnes\IndieWeb\Numbers;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Jonnybarnes\EmojiA11y\EmojiModifier; use Jonnybarnes\EmojiA11y\EmojiModifier;
use League\CommonMark\CommonMarkConverter;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Jonnybarnes\CommonmarkLinkify\LinkifyExtension;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
class Note extends Model class Note extends Model
@ -128,9 +132,12 @@ class Note extends Model
*/ */
public function getNoteAttribute($value) 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(); $emoji = new EmojiModifier();
$html = $markdown->convertToHtml($value);
$html = $converter->convertToHtml($value);
$hcards = $this->makeHCards($html); $hcards = $this->makeHCards($html);
$hashtags = $this->autoLinkHashtag($hcards); $hashtags = $this->autoLinkHashtag($hcards);
$modified = $emoji->makeEmojiAccessible($hashtags); $modified = $emoji->makeEmojiAccessible($hashtags);
@ -262,8 +269,7 @@ class Note extends Model
return; return;
} }
$arr = explode('/', $url); $tweetId = basename($this->in_reply_to);
$tweetId = end($arr);
if (Cache::has($tweetId)) { if (Cache::has($tweetId)) {
return Cache::get($tweetId); return Cache::get($tweetId);
} }

View file

@ -1,5 +1,9 @@
# Changelog # 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) ## Version 0.5.23 (2017-07-07)
- Add emoji 5.0 support with newer `emoji-a11y` package - Add emoji 5.0 support with newer `emoji-a11y` package
- Places can be “added” to a note in the mp-client again, (issue#47) - Places can be “added” to a note in the mp-client again, (issue#47)

View file

@ -10,6 +10,7 @@
"ezyang/htmlpurifier": "~4.6", "ezyang/htmlpurifier": "~4.6",
"guzzlehttp/guzzle": "~6.0", "guzzlehttp/guzzle": "~6.0",
"indieauth/client": "~0.1", "indieauth/client": "~0.1",
"jonnybarnes/commonmark-linkify": "^0.2",
"jonnybarnes/emoji-a11y": "^0.3", "jonnybarnes/emoji-a11y": "^0.3",
"jonnybarnes/indieweb": "dev-master", "jonnybarnes/indieweb": "dev-master",
"jonnybarnes/webmentions-parser": "0.4.*", "jonnybarnes/webmentions-parser": "0.4.*",

82
composer.lock generated
View file

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "0f8de1d2b229308f3862ff61f5468fcf", "content-hash": "747517e009c9d23ea87f46b70fd7d80b",
"packages": [ "packages": [
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.31.1", "version": "3.31.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "551865464a2779b9038aa871094a24bb9e254e24" "reference": "582e7764e0fa389c3248450cd6db2564dd656d99"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/551865464a2779b9038aa871094a24bb9e254e24", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/582e7764e0fa389c3248450cd6db2564dd656d99",
"reference": "551865464a2779b9038aa871094a24bb9e254e24", "reference": "582e7764e0fa389c3248450cd6db2564dd656d99",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -84,7 +84,7 @@
"s3", "s3",
"sdk" "sdk"
], ],
"time": "2017-07-05T17:26:26+00:00" "time": "2017-07-06T21:11:49+00:00"
}, },
{ {
"name": "barnabywalters/mf-cleaner", "name": "barnabywalters/mf-cleaner",
@ -1453,6 +1453,51 @@
], ],
"time": "2015-09-27T15:35:21+00:00" "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", "name": "jonnybarnes/emoji-a11y",
"version": "v0.3", "version": "v0.3",
@ -1719,16 +1764,16 @@
}, },
{ {
"name": "laravel/scout", "name": "laravel/scout",
"version": "v3.0.5", "version": "v3.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/scout.git", "url": "https://github.com/laravel/scout.git",
"reference": "547ff55530a16e31b3b1142dd4dfdb654ad2bae0" "reference": "5a899828bf154ae7d957a2a78b4b6002e9fdf0fa"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/scout/zipball/547ff55530a16e31b3b1142dd4dfdb654ad2bae0", "url": "https://api.github.com/repos/laravel/scout/zipball/5a899828bf154ae7d957a2a78b4b6002e9fdf0fa",
"reference": "547ff55530a16e31b3b1142dd4dfdb654ad2bae0", "reference": "5a899828bf154ae7d957a2a78b4b6002e9fdf0fa",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1752,6 +1797,11 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0-dev" "dev-master": "3.0-dev"
},
"laravel": {
"providers": [
"Laravel\\Scout\\ScoutServiceProvider"
]
} }
}, },
"autoload": { "autoload": {
@ -1775,7 +1825,7 @@
"laravel", "laravel",
"search" "search"
], ],
"time": "2017-06-01T13:21:09+00:00" "time": "2017-07-12T12:29:47+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -2735,16 +2785,16 @@
}, },
{ {
"name": "psy/psysh", "name": "psy/psysh",
"version": "v0.8.8", "version": "v0.8.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bobthecow/psysh.git", "url": "https://github.com/bobthecow/psysh.git",
"reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e" "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/fe65c30cbc55c71e61ba3a38b5a581149be31b8e", "url": "https://api.github.com/repos/bobthecow/psysh/zipball/58a31cc4404c8f632d8c557bc72056af2d3a83db",
"reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e", "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2804,7 +2854,7 @@
"interactive", "interactive",
"shell" "shell"
], ],
"time": "2017-06-24T06:16:19+00:00" "time": "2017-07-06T14:53:52+00:00"
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",