Merge branch 'release/0.0.14.3'

This commit is contained in:
Jonny Barnes 2016-10-19 22:37:39 +01:00
commit 939cd419b8
12 changed files with 3034 additions and 50 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ Homestead.json
/public/files
/public/keybase.txt
/coverage
/storage/*.key

View file

@ -3,8 +3,8 @@
namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller

View file

@ -20,6 +20,13 @@ class ResetPasswordController extends Controller
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*

View file

@ -2,14 +2,15 @@
namespace App\Http\Controllers;
use Cache;
use Twitter;
use App\Tag;
use App\Note;
use HTMLPurifier;
use GuzzleHttp\Client;
use HTMLPurifier_Config;
use Jonnybarnes\IndieWeb\Numbers;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Cache;
use Jonnybarnes\WebmentionsParser\Authorship;
// Need to sort out Twitter and webmentions!
@ -40,9 +41,7 @@ class NotesController extends Controller
$latlng = explode(',', $pieces[0]);
$note->latitude = trim($latlng[0]);
$note->longitude = trim($latlng[1]);
if (count($pieces) == 2) {
$note->address = $pieces[1];
}
$note->address = $this->reverseGeoCode((float) trim($latlng[0]), (float) trim($latlng[1]));
}
if ($note->place !== null) {
$lnglat = explode(' ', $note->place->location);
@ -129,9 +128,7 @@ class NotesController extends Controller
$latlng = explode(',', $pieces[0]);
$note->latitude = trim($latlng[0]);
$note->longitude = trim($latlng[1]);
if (count($pieces) == 2) {
$note->address = $pieces[1];
}
$note->address = $this->reverseGeoCode((float) trim($latlng[0]), (float) trim($latlng[1]));
}
if ($note->place !== null) {
$lnglat = explode(' ', $note->place->location);
@ -280,4 +277,52 @@ class NotesController extends Controller
return $purifier->purify($html);
}
/**
* Do a reverse geocode lookup of a `lat,lng` value.
*
* @param float The latitude
* @param float The longitude
* @return string The location name
*/
public function reverseGeoCode(float $latitude, float $longitude): string
{
$latlng = $latitude . ',' . $longitude;
return Cache::get($latlng, function () use ($latlng, $latitude, $longitude) {
$guzzle = new Client();
$response = $guzzle->request('GET', 'https://nominatim.openstreetmap.org/reverse', [
'query' => [
'format' => 'json',
'lat' => $latitude,
'lon' => $longitude,
'zoom' => 18,
'addressdetails' => 1,
],
'headers' => ['User-Agent' => 'jonnybarnes.uk via Guzzle, email jonny@jonnybarnes.uk'],
]);
$json = json_decode($response->getBody());
if (isset($json->address->town)) {
$address = $json->address->town . ', ' . $json->address->country;
Cache::forever($latlng, $address);
return $address;
}
if (isset($json->address->city)) {
$address = $json->address->city . ', ' . $json->address->country;
Cache::forever($latlng, $address);
return $address;
}
if (isset($json->address->county)) {
$address = $json->address->county . ', ' . $json->reversegeocode->country;
Cache::forever($latlng, $address);
return $address;
}
Cache::forever($latlng, $json->address->country);
return $json->reversegeocode->addressparts->country;
});
}
}

View file

@ -1,5 +1,9 @@
# Changelog
## Version 0.0.14.3 (2016-10-19)
- Allow co-ordinates to be used for note location, reverse geocode place name will be used (w/o map)
- Switch from npm to yarn
## Version 0.0.14.2 (2016-10-17)
- Update .lock, particularly trying to get medialibrary working

View file

@ -17,12 +17,12 @@
"martinbean/laravel-sluggable-trait": "0.2.*",
"indieauth/client": "~0.1",
"ezyang/htmlpurifier": "~4.6",
"league/commonmark": "^0.14.0",
"league/commonmark": "^0.15.0",
"spatie/laravel-medialibrary": "^4.0",
"league/flysystem-aws-s3-v3": "^1.0",
"phaza/laravel-postgis": "~3.1",
"lcobucci/jwt": "^3.1",
"sensiolabs/security-checker": "^3.0"
"sensiolabs/security-checker": "^4.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",

74
composer.lock generated
View file

@ -4,7 +4,7 @@
"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": "86faec8ac49549630fc60578bcd085cc",
"content-hash": "52f9f6e1c88cb732b6b5c0c01646cdde",
"packages": [
{
"name": "anahkiasen/underscore-php",
@ -58,16 +58,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.19.15",
"version": "3.19.17",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "83e9522a0a1abce0b1a0c2971428a5bd975a212d"
"reference": "089ce29c428ce330b8e9eba8bbe8f2bdbb8b8af5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/83e9522a0a1abce0b1a0c2971428a5bd975a212d",
"reference": "83e9522a0a1abce0b1a0c2971428a5bd975a212d",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/089ce29c428ce330b8e9eba8bbe8f2bdbb8b8af5",
"reference": "089ce29c428ce330b8e9eba8bbe8f2bdbb8b8af5",
"shasum": ""
},
"require": {
@ -134,7 +134,7 @@
"s3",
"sdk"
],
"time": "2016-10-13T18:56:16+00:00"
"time": "2016-10-18T20:29:12+00:00"
},
{
"name": "barnabywalters/mf-cleaner",
@ -1532,16 +1532,16 @@
},
{
"name": "laravel/framework",
"version": "v5.3.18",
"version": "v5.3.19",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "9bee167d173857c25966c19afdaa66f127ca6784"
"reference": "f1a5bb417b3e0d1949fe84617eacd1a14d75d7f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/9bee167d173857c25966c19afdaa66f127ca6784",
"reference": "9bee167d173857c25966c19afdaa66f127ca6784",
"url": "https://api.github.com/repos/laravel/framework/zipball/f1a5bb417b3e0d1949fe84617eacd1a14d75d7f1",
"reference": "f1a5bb417b3e0d1949fe84617eacd1a14d75d7f1",
"shasum": ""
},
"require": {
@ -1623,7 +1623,7 @@
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).",
"symfony/css-selector": "Required to use some of the crawler integration testing tools (3.1.*).",
"symfony/dom-crawler": "Required to use most of the crawler integration testing tools (3.1.*).",
"symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)."
"symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)."
},
"type": "library",
"extra": {
@ -1656,7 +1656,7 @@
"framework",
"laravel"
],
"time": "2016-10-08T01:51:20+00:00"
"time": "2016-10-17T19:35:14+00:00"
},
{
"name": "lcobucci/jwt",
@ -1718,16 +1718,16 @@
},
{
"name": "league/commonmark",
"version": "0.14.0",
"version": "0.15.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "b73c0b7288bd0e6f9f56bd0b20d0657214b91838"
"reference": "19fb96643beba24e681c371dc133e25409742664"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b73c0b7288bd0e6f9f56bd0b20d0657214b91838",
"reference": "b73c0b7288bd0e6f9f56bd0b20d0657214b91838",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/19fb96643beba24e681c371dc133e25409742664",
"reference": "19fb96643beba24e681c371dc133e25409742664",
"shasum": ""
},
"require": {
@ -1740,7 +1740,7 @@
"require-dev": {
"cebe/markdown": "~1.0",
"erusev/parsedown": "~1.0",
"jgm/commonmark": "0.25",
"jgm/commonmark": "0.26",
"michelf/php-markdown": "~1.4",
"mikehaertl/php-shellcommand": "~1.2.0",
"phpunit/phpunit": "~4.3|~5.0",
@ -1756,7 +1756,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.15-dev"
"dev-master": "0.16-dev"
}
},
"autoload": {
@ -1783,24 +1783,24 @@
"markdown",
"parser"
],
"time": "2016-07-02T18:48:39+00:00"
"time": "2016-09-14T15:44:35+00:00"
},
{
"name": "league/flysystem",
"version": "1.0.28",
"version": "1.0.32",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "a9663643ff2d16d7f66ed1e0d3212c5491bc9044"
"reference": "1b5c4a0031697f46e779a9d1b309c2e1b24daeab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a9663643ff2d16d7f66ed1e0d3212c5491bc9044",
"reference": "a9663643ff2d16d7f66ed1e0d3212c5491bc9044",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1b5c4a0031697f46e779a9d1b309c2e1b24daeab",
"reference": "1b5c4a0031697f46e779a9d1b309c2e1b24daeab",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
"php": ">=5.5.9"
},
"conflict": {
"league/flysystem-sftp": "<1.0.6"
@ -1866,7 +1866,7 @@
"sftp",
"storage"
],
"time": "2016-10-07T12:20:37+00:00"
"time": "2016-10-19T20:38:46+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
@ -2348,16 +2348,16 @@
},
{
"name": "paragonie/random_compat",
"version": "v2.0.2",
"version": "v2.0.3",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "088c04e2f261c33bed6ca5245491cfca69195ccf"
"reference": "c0125896dbb151380ab47e96c621741e79623beb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/088c04e2f261c33bed6ca5245491cfca69195ccf",
"reference": "088c04e2f261c33bed6ca5245491cfca69195ccf",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/c0125896dbb151380ab47e96c621741e79623beb",
"reference": "c0125896dbb151380ab47e96c621741e79623beb",
"shasum": ""
},
"require": {
@ -2392,7 +2392,7 @@
"pseudorandom",
"random"
],
"time": "2016-04-03T06:00:07+00:00"
"time": "2016-10-17T15:23:22+00:00"
},
{
"name": "patchwork/utf8",
@ -2804,20 +2804,20 @@
},
{
"name": "sensiolabs/security-checker",
"version": "v3.0.2",
"version": "v4.0.0",
"source": {
"type": "git",
"url": "https://github.com/sensiolabs/security-checker.git",
"reference": "21696b0daa731064c23cfb694c60a2584a7b6e93"
"reference": "116027b57b568ed61b7b1c80eeb4f6ee9e8c599c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/21696b0daa731064c23cfb694c60a2584a7b6e93",
"reference": "21696b0daa731064c23cfb694c60a2584a7b6e93",
"url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/116027b57b568ed61b7b1c80eeb4f6ee9e8c599c",
"reference": "116027b57b568ed61b7b1c80eeb4f6ee9e8c599c",
"shasum": ""
},
"require": {
"symfony/console": "~2.0|~3.0"
"symfony/console": "~2.7|~3.0"
},
"bin": [
"security-checker"
@ -2825,7 +2825,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "4.0-dev"
}
},
"autoload": {
@ -2844,7 +2844,7 @@
}
],
"description": "A security checker for your composer.lock",
"time": "2015-11-07T08:07:40+00:00"
"time": "2016-09-23T18:09:57+00:00"
},
{
"name": "spatie/laravel-glide",

View file

@ -11,6 +11,7 @@
|
*/
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(App\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -19,7 +19,7 @@
@if($note->address)<span class="note-address p-location">in @if($note->placeLink)<a href="{{ $note->placeLink }}">@endif<span class="p-name">{{ $note->address }}</span>@if($note->placeLink)</a>@endif</span>@endif
@if($note->replies > 0)Replies: {{ $note->replies }}@endif
@if($note->tweet_id)@include('templates.social-links', ['tweet_id' => $note->tweet_id, 'nb60id' => $note->nb60id])@endif
@if ($note->latitude)
@if ($note->placeLink)
<div class="map" data-latitude="{{ $note->latitude }}" data-longitude="{{ $note->longitude }}"></div>
@endif
</div>

2928
yarn.lock Normal file

File diff suppressed because it is too large Load diff