Squashed commit of the following:
commit e7f1c4c84579b959fe2997ff4d2315ee53acfe9a Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Thu Sep 29 11:22:44 2016 +0100 Add latest change, fix spelling errors in rest of changelog commit 637b5107b557f1c2a56327a40b3d7b4b7297fa29 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 21:13:06 2016 +0100 Add a test for uncertainty parameter commit 5e7504b323debf9c91e0cca428b4dca7dda0789d Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 21:11:12 2016 +0100 Format the ternaty operator correctly commit 19c978a5ac59cd7dfdceee9a8f1aaa6539d8ac66 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 20:46:19 2016 +0100 Fix typo commit d4e5b5fc384d0ccd715ea28a51821f958f6c2caa Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 20:41:23 2016 +0100 Add paraphanalia commit a96f104894de6c06dc5e41044482de2355cb4965 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 20:35:17 2016 +0100 Add the geolocation uncertainty to nearby places request commit 0f6d5649e2f3316040d7453f5fcc96ac1f0ac783 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 20:34:38 2016 +0100 Use a query parameter for geolocation uncertainty commit a9147a074315fabb0d76e5991b34a70b2143761c Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 19:58:08 2016 +0100 Make use of uncertainty parameter when finding nearby places commit bad384b5d8be3ea8905d8f6ca3c20f448869853d Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 28 19:28:42 2016 +0100 Support sending uncertainty value to micropub endpoint
This commit is contained in:
parent
4e69a4d55c
commit
2c6b9df97a
9 changed files with 39 additions and 24 deletions
|
@ -307,9 +307,13 @@ class MicropubClientController extends Controller
|
|||
}
|
||||
|
||||
try {
|
||||
$query = 'geo:' . $latitude . ',' . $longitude;
|
||||
if ($request->input('uncertainty') !== null) {
|
||||
$query .= ';u=' . $request->input('uncertainty');
|
||||
}
|
||||
$response = $this->guzzleClient->get($micropubEndpoint, [
|
||||
'headers' => ['Authorization' => 'Bearer ' . $token],
|
||||
'query' => ['q' => 'geo:' . $latitude . ',' . $longitude],
|
||||
'query' => ['q' => $query],
|
||||
]);
|
||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||
return response()->json([
|
||||
|
|
|
@ -147,11 +147,13 @@ EOD;
|
|||
}
|
||||
//nope, how about a geo URL?
|
||||
if (substr($request->input('q'), 0, 4) === 'geo:') {
|
||||
$geo = explode(':', $request->input('q'));
|
||||
$latlng = explode(',', $geo[1]);
|
||||
$latitude = $latlng[0];
|
||||
$longitude = $latlng[1];
|
||||
$places = Place::near($latitude, $longitude, 1000);
|
||||
preg_match_all(
|
||||
'/([0-9\.\-]+)/',
|
||||
$request->input('q'),
|
||||
$matches
|
||||
);
|
||||
$distance = (count($matches[0]) == 3) ? 100 * $matches[0][2] : 1000;
|
||||
$places = Place::near($matches[0][0], $matches[0][1], $distance);
|
||||
|
||||
return response()->json([
|
||||
'response' => 'places',
|
||||
|
|
29
changelog.md
29
changelog.md
|
@ -1,9 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## Version {next}
|
||||
- Add support for accuracy/uncertainty in geo URIs (issue#20,issue#9)
|
||||
|
||||
## Version 0.0.13 (2016-09-26)
|
||||
- Better places support, particularly with micropub (issue#9)
|
||||
- Uglify js for better performance (issue#19)
|
||||
- Autolink spotify links (issue#18)
|
||||
- Uglify javascript for better performance (issue#19)
|
||||
- Auto-link Spotify links (issue#18)
|
||||
|
||||
## Version 0.0.12 (2016-09-21)
|
||||
- Better indication of number of replies to a note (issue#17)
|
||||
|
@ -32,7 +35,7 @@
|
|||
- Better handling of webmention reply HTML cache
|
||||
|
||||
## Version 0.0.11.2 (2016-09-19)
|
||||
- Update Typekit’s js sri hash
|
||||
- Update Typekit’s javascript sri hash
|
||||
|
||||
## Version 0.0.11.1 (2016-09-17)
|
||||
- Fix a syntax issue in the download webmention job
|
||||
|
@ -40,13 +43,13 @@
|
|||
## Version 0.0.11 (2016-09-17)
|
||||
- update linked GPG key (issue#7)
|
||||
- Added `integrity` values to external assets (issue#10)
|
||||
- Move mapbox links into own sub-view (issue#11)
|
||||
- Updated mapbox version (issue#12)
|
||||
- Move Mapbox links into own sub-view (issue#11)
|
||||
- Updated Mapbox version (issue#12)
|
||||
- Massive refactor of webmention code, allowing for re-parse command (issue#8)
|
||||
- Add license file (issue#13)
|
||||
|
||||
## Version 0.0.10 (2016-09-10)
|
||||
- Add an artisan command for sensiolab’s security check
|
||||
- Add an artisan command for Sensiolab’s security check
|
||||
- Remove `filp/whoops`, just use Laravel’s error reporting
|
||||
- Better TokenMismatchException handling (issue#5)
|
||||
|
||||
|
@ -59,27 +62,27 @@
|
|||
- Fix an issue with syndicating notes.
|
||||
|
||||
## Version 0.0.9 (2016-09-06)
|
||||
- Adding jsonb column to store webmentions’ mf2.
|
||||
- Adding `jsonb` column to store webmentions’ microformats.
|
||||
* As of L5.2 this needs a custom command to drop NOT NULL from content, L5.3 should allow a fix for this
|
||||
- Refactor receiving webmention code
|
||||
- Refactor sending webmention code to pass webmention.rocks
|
||||
- Refactor sending webmention code to pass `webmention.rocks`
|
||||
- Update to use Laravel 5.3
|
||||
|
||||
## Version 0.0.8.5 (2016-07-18)
|
||||
- Set the size of the textarea in a form better
|
||||
- Set the size of the `textarea` in a form better
|
||||
- Update to latest Guzzle to fix CVE-2016-5385
|
||||
|
||||
## Version 0.0.8.4 (2016-07-18)
|
||||
- Make the revised non-elixir asset links absolute
|
||||
|
||||
## Version 0.0.8.3 (2016-07-18)
|
||||
- Dump laravel-elixir, use gulp natively. Also this means using nginx and etags for cache-busting
|
||||
- Dump `laravel-elixir`, use gulp natively. Also this means using nginx and etags for cache-busting
|
||||
|
||||
## Version 0.0.8.2 (2016-07-15)
|
||||
- Improve syndication parsing to allow better name display on new note form
|
||||
|
||||
## Version 0.0.8.1 (2016-07-13)
|
||||
- Fix anh issue in the syndication target parsing method
|
||||
- Fix an issue in the syndication target parsing method
|
||||
|
||||
## Version 0.0.8 (2016-07-13)
|
||||
- Allow new notes to be made by a JSON request from a micropub client
|
||||
|
@ -116,11 +119,11 @@
|
|||
- Add a stylelint lint-staged hook
|
||||
|
||||
## Version 0.0.3 (2013-06-09)
|
||||
- Better tag normalization code organisation
|
||||
- Better tag normalisation code organisation
|
||||
- Remove `jonnybarnes/unicode-tools` dependency and clean up relevant code
|
||||
|
||||
## Version 0.0.2 (2016-05-25)
|
||||
- Fix issue#1: tagged notes page needs the tag from the URL normalizing.
|
||||
- Fix issue#1: tagged notes page needs the tag from the URL normalising.
|
||||
|
||||
## Version 0.0.1 (2016-05-25)
|
||||
- Initial release
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -12,13 +12,13 @@ if ('geolocation' in navigator) {
|
|||
function getLocation() {
|
||||
navigator.geolocation.getCurrentPosition(function (position) {
|
||||
//the locate button has been clicked so add the places/map
|
||||
addPlacesMap(position.coords.latitude, position.coords.longitude);
|
||||
addPlacesMap(position.coords.latitude, position.coords.longitude, position.coords.accuracy);
|
||||
});
|
||||
}
|
||||
|
||||
function addPlacesMap(latitude, longitude) {
|
||||
function addPlacesMap(latitude, longitude, uncertainty) {
|
||||
//get the nearby places
|
||||
fetch('/places/near/' + latitude + '/' + longitude, {
|
||||
fetch('/places/near/' + latitude + '/' + longitude + '?' + uncertainty, {
|
||||
credentials: 'same-origin',
|
||||
method: 'get'
|
||||
}).then(function (response) {
|
||||
|
|
|
@ -53,6 +53,12 @@ class MicropubTest extends TestCase
|
|||
$this->see('the-bridgewater-pub');
|
||||
}
|
||||
|
||||
public function testMicropubRequestForNearbyPlacesThatExistWithUncertaintyParameter()
|
||||
{
|
||||
$this->call('GET', $this->appurl . '/api/post', ['q' => 'geo:53.5,-2.38;u=35'], [], [], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
|
||||
$this->see('the-bridgewater-pub');
|
||||
}
|
||||
|
||||
public function testMicropubRequestForNearbyPlacesThatDoNotExist()
|
||||
{
|
||||
$this->call('GET', $this->appurl . '/api/post', ['q' => 'geo:1.23,4.56'], [], [], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
|
||||
|
|
Loading…
Add table
Reference in a new issue