Merge branch 'release/0.0.13.4'

This commit is contained in:
Jonny Barnes 2016-10-03 16:51:58 +01:00
commit 4beb9feae4
10 changed files with 30 additions and 15 deletions

View file

@ -309,7 +309,7 @@ class MicropubClientController extends Controller
try {
$query = 'geo:' . $latitude . ',' . $longitude;
if ($request->input('u') !== null) {
$query .= ';u=' . $request->input('uncertainty');
$query .= ';u=' . $request->input('u');
}
$response = $this->guzzleClient->get($micropubEndpoint, [
'headers' => ['Authorization' => 'Bearer ' . $token],
@ -319,6 +319,7 @@ class MicropubClientController extends Controller
return response()->json([
'error' => true,
'error_description' => 'The endpoint returned a non-good response',
'error_stack' => $e->getMessage()
], 400);
}

View file

@ -115,16 +115,11 @@ class MicropubController extends Controller
$valid = $this->tokenService->validateToken($token);
if ($valid === null) {
$content = <<<'EOD'
{
"respose": "error",
"error": "invalid_token",
"error_description": "The provided token did not pass validation"
}
EOD;
return (new Response($content, 400))
->header('Content-Type', 'application/json');
return response()->json([
'response' => 'error',
'error' => 'invalid_token',
'error_description' => 'The provided token did not pass validation'
], 400);
}
//we have a valid token, is `syndicate-to` set?
if ($request->input('q') === 'syndicate-to') {

View file

@ -45,6 +45,18 @@ class AppServiceProvider extends ServiceProvider
$note->tags()->attach($tagsToAdd);
}
});
//allow micropub use in development
if (env('APP_DEBUG') == true) {
$tokenService = new \App\Services\TokenService();
$token = $tokenService->getNewToken([
'me' => 'https://jonnybarnes.localhost',
'client_id' => 'https://jonnybarnes.localhost/notes/new',
'scope' => 'post'
]);
session(['me' => 'https://jonnybarnes.localhost']);
session(['token' => 'abc123']);
}
}
/**

View file

@ -38,6 +38,9 @@ class TokenService
*/
public function validateToken($token)
{
if (env('APP_DEBUG') == true) {
return true;
}
$signer = new Sha256();
try {
$token = (new Parser())->parse((string) $token);

View file

@ -1,5 +1,9 @@
# Changelog
## Version 0.0.13.4 (2016-10-03)
- Better working code for places in newnote.js (issue#21)
* In aid of this add ability to run micropub code locally
## Version 0.0.13.3 (2016-10-03)
- Use the actual results of places in `newnote.js` (issue#21)

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.

View file

@ -28,11 +28,11 @@ function addPlacesMap(latitude, longitude, uncertainty) {
alertify.reset();
alertify.error(j.error_description);
}
if (j.length > 0) {
if (j.places.length > 0) {
var i;
var places = [];
for (i = 0; i < j.places.length; ++i) {
var latlng = parseLocation(j[i].location);
var latlng = parseLocation(j.places[i].location);
var name = j.places[i].name;
var slug = j.places[i].slug;
places.push([name, slug, latlng[0], latlng[1]]);