Merge branch 'release/0.0.13'
This commit is contained in:
commit
aa0316ffe0
42 changed files with 271 additions and 545 deletions
|
@ -204,34 +204,37 @@ class MicropubClientController extends Controller
|
||||||
*/
|
*/
|
||||||
public function postNewPlace(Request $request)
|
public function postNewPlace(Request $request)
|
||||||
{
|
{
|
||||||
|
if ($request->session()->has('token') === false) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'error_description' => 'No known token',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
$domain = $request->session()->get('me');
|
$domain = $request->session()->get('me');
|
||||||
$token = $request->session()->get('token');
|
$token = $request->session()->get('token');
|
||||||
|
|
||||||
$micropubEndpoint = $this->indieAuthService->discoverMicropubEndpoint($domain, $this->indieClient);
|
$micropubEndpoint = $this->indieAuthService->discoverMicropubEndpoint($domain, $this->indieClient);
|
||||||
if (! $micropubEndpoint) {
|
if (! $micropubEndpoint) {
|
||||||
return (new Response(json_encode([
|
return response()->json([
|
||||||
'error' => true,
|
'error' => true,
|
||||||
'message' => 'Could not determine the micropub endpoint.',
|
'error_description' => 'Could not determine the micropub endpoint.',
|
||||||
]), 400))
|
], 400);
|
||||||
->header('Content-Type', 'application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$place = $this->postPlaceRequest($request, $micropubEndpoint, $token);
|
$place = $this->postPlaceRequest($request, $micropubEndpoint, $token);
|
||||||
if ($place === false) {
|
if ($place === false) {
|
||||||
return (new Response(json_encode([
|
return response()->json([
|
||||||
'error' => true,
|
'error' => true,
|
||||||
'message' => 'Unable to create the new place',
|
'error_description' => 'Unable to create the new place',
|
||||||
]), 400))
|
], 400);
|
||||||
->header('Content-Type', 'application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (new Response(json_encode([
|
return response()->json([
|
||||||
'url' => $place,
|
'url' => $place,
|
||||||
'name' => $request->input('place-name'),
|
'name' => $request->input('place-name'),
|
||||||
'latitude' => $request->input('place-latitude'),
|
'latitude' => $request->input('place-latitude'),
|
||||||
'longitude' => $request->input('place-longitude'),
|
'longitude' => $request->input('place-longitude'),
|
||||||
]), 200))
|
]);
|
||||||
->header('Content-Type', 'application/json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,7 +266,7 @@ class MicropubClientController extends Controller
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
]);
|
]);
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
//not sure yet...
|
return false;
|
||||||
}
|
}
|
||||||
if ($response->getStatusCode() == 201) {
|
if ($response->getStatusCode() == 201) {
|
||||||
return $response->getHeader('Location')[0];
|
return $response->getHeader('Location')[0];
|
||||||
|
@ -285,12 +288,22 @@ class MicropubClientController extends Controller
|
||||||
$latitude,
|
$latitude,
|
||||||
$longitude
|
$longitude
|
||||||
) {
|
) {
|
||||||
|
if ($request->session()->has('token') === false) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'error_description' => 'No known token',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
$domain = $request->session()->get('me');
|
$domain = $request->session()->get('me');
|
||||||
$token = $request->session()->get('token');
|
$token = $request->session()->get('token');
|
||||||
|
|
||||||
$micropubEndpoint = $this->indieAuthService->discoverMicropubEndpoint($domain, $this->indieClient);
|
$micropubEndpoint = $this->indieAuthService->discoverMicropubEndpoint($domain, $this->indieClient);
|
||||||
|
|
||||||
if (! $micropubEndpoint) {
|
if (! $micropubEndpoint) {
|
||||||
return;
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'error_description' => 'No known endpoint',
|
||||||
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -299,7 +312,10 @@ class MicropubClientController extends Controller
|
||||||
'query' => ['q' => 'geo:' . $latitude . ',' . $longitude],
|
'query' => ['q' => 'geo:' . $latitude . ',' . $longitude],
|
||||||
]);
|
]);
|
||||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||||
return;
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'error_description' => 'The endpoint returned a non-good response',
|
||||||
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (new Response($response->getBody(), 200))
|
return (new Response($response->getBody(), 200))
|
||||||
|
|
|
@ -57,54 +57,44 @@ class MicropubController extends Controller
|
||||||
if (array_search('post', $scopes) !== false) {
|
if (array_search('post', $scopes) !== false) {
|
||||||
$clientId = $tokenData->getClaim('client_id');
|
$clientId = $tokenData->getClaim('client_id');
|
||||||
if (($request->input('h') == 'entry') || ($request->input('type')[0] == 'h-entry')) {
|
if (($request->input('h') == 'entry') || ($request->input('type')[0] == 'h-entry')) {
|
||||||
$note = $this->noteService->createNote($request, $clientId);
|
try {
|
||||||
$content = <<<EOD
|
$note = $this->noteService->createNote($request, $clientId);
|
||||||
{
|
} catch (Exception $exception) {
|
||||||
"response": "created",
|
return response()->json(['error' => true], 400);
|
||||||
"location": "$note->longurl"
|
}
|
||||||
}
|
|
||||||
EOD;
|
|
||||||
|
|
||||||
return (new Response($content, 201))
|
return response()->json([
|
||||||
->header('Location', $note->longurl)
|
'response' => 'created',
|
||||||
->header('Content-Type', 'application/json');
|
'location' => $note->longurl,
|
||||||
|
], 201)->header('Location', $note->longurl);
|
||||||
}
|
}
|
||||||
if ($request->input('h') == 'card' || $request->input('type')[0] == 'h-card') {
|
if ($request->input('h') == 'card' || $request->input('type')[0] == 'h-card') {
|
||||||
$place = $this->placeService->createPlace($request);
|
try {
|
||||||
$content = <<<EOD
|
$place = $this->placeService->createPlace($request);
|
||||||
{
|
} catch (Exception $exception) {
|
||||||
"response": "created",
|
return response()->json(['error' => true], 400);
|
||||||
"location": "$place->longurl"
|
}
|
||||||
}
|
|
||||||
EOD;
|
|
||||||
|
|
||||||
return (new Response($content, 201))
|
return response()->json([
|
||||||
->header('Location', $place->longurl)
|
'response' => 'created',
|
||||||
->header('Content-Type', 'application/json');
|
'location' => $place->longurl,
|
||||||
|
], 201)->header('Location', $place->longurl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$content = <<<'EOD'
|
|
||||||
{
|
|
||||||
"response": "error",
|
|
||||||
"error": "invalid_token",
|
|
||||||
"error_description": "The token provided is not valid or does not have the necessary scope",
|
|
||||||
}
|
|
||||||
EOD;
|
|
||||||
|
|
||||||
return (new Response($content, 400))
|
return response()->json([
|
||||||
->header('Content-Type', 'application/json');
|
'response' => 'error',
|
||||||
|
'error' => 'invalid_token',
|
||||||
|
'error_description' => 'The token provided is not valid or does not have the necessary scope',
|
||||||
|
], 400);
|
||||||
}
|
}
|
||||||
$content = <<<'EOD'
|
|
||||||
{
|
|
||||||
"response": "error",
|
|
||||||
"error": "no_token",
|
|
||||||
"error_description": "No OAuth token sent with request"
|
|
||||||
}
|
|
||||||
EOD;
|
|
||||||
|
|
||||||
return (new Response($content, 400))
|
return response()->json([
|
||||||
->header('Content-Type', 'application/json');
|
'response' => 'error',
|
||||||
|
'error' => 'no_token',
|
||||||
|
'error_description' => 'No OAuth token sent with request',
|
||||||
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,9 +4,7 @@ namespace App;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Phaza\LaravelPostgis\Geometries\Point;
|
|
||||||
use MartinBean\Database\Eloquent\Sluggable;
|
use MartinBean\Database\Eloquent\Sluggable;
|
||||||
use Phaza\LaravelPostgis\Geometries\Polygon;
|
|
||||||
use Phaza\LaravelPostgis\Eloquent\PostgisTrait;
|
use Phaza\LaravelPostgis\Eloquent\PostgisTrait;
|
||||||
|
|
||||||
class Place extends Model
|
class Place extends Model
|
||||||
|
@ -33,8 +31,8 @@ class Place extends Model
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $postgisFields = [
|
protected $postgisFields = [
|
||||||
'location' => Point::class,
|
'location',
|
||||||
'polygon' => Polygon::class,
|
'polygon',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,21 +16,26 @@ class PlaceService
|
||||||
*/
|
*/
|
||||||
public function createPlace(Request $request)
|
public function createPlace(Request $request)
|
||||||
{
|
{
|
||||||
//we’ll either have latitude and longitude sent together in a
|
if ($request->header('Content-Type') == 'application/json') {
|
||||||
//geo-url (micropub), or seperatley (/admin)
|
$name = $request->input('properties.name');
|
||||||
if ($request->input('geo') !== null) {
|
$description = $request->input('properties.description') ?? null;
|
||||||
$parts = explode(':', $request->input('geo'));
|
$geo = $request->input('properties.geo');
|
||||||
$latlng = explode(',', $parts[1]);
|
} else {
|
||||||
$latitude = $latlng[0];
|
$name = $request->input('name');
|
||||||
$longitude = $latlng[1];
|
$description = $request->input('description');
|
||||||
|
$geo = $request->input('geo');
|
||||||
}
|
}
|
||||||
|
$parts = explode(':', $geo);
|
||||||
|
$latlng = explode(',', $parts[1]);
|
||||||
|
$latitude = $latlng[0];
|
||||||
|
$longitude = $latlng[1];
|
||||||
if ($request->input('latitude') !== null) {
|
if ($request->input('latitude') !== null) {
|
||||||
$latitude = $request->input('latitude');
|
$latitude = $request->input('latitude');
|
||||||
$longitude = $request->input('longitude');
|
$longitude = $request->input('longitude');
|
||||||
}
|
}
|
||||||
$place = new Place();
|
$place = new Place();
|
||||||
$place->name = $request->input('name');
|
$place->name = $name;
|
||||||
$place->description = $request->input('description');
|
$place->description = $description;
|
||||||
$place->location = new Point((float) $latitude, (float) $longitude);
|
$place->location = new Point((float) $latitude, (float) $longitude);
|
||||||
$place->save();
|
$place->save();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
## Version 0.0.12 (2016-09-21)
|
## Version 0.0.12 (2016-09-21)
|
||||||
- Better indication of number of replies to a note (issue#17)
|
- Better indication of number of replies to a note (issue#17)
|
||||||
- Use generic twitter status URL so my own profile name isn’t hardcoded (issue#14)
|
- Use generic twitter status URL so my own profile name isn’t hardcoded (issue#14)
|
||||||
|
|
51
composer.lock
generated
51
composer.lock
generated
|
@ -58,16 +58,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aws/aws-sdk-php",
|
"name": "aws/aws-sdk-php",
|
||||||
"version": "3.19.9",
|
"version": "3.19.10",
|
||||||
"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": "55da42fee5ff26f962b2366b08e4f32e348cd1d9"
|
"reference": "eb9488f671175e708cf68c74cc04bd9115c96761"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/55da42fee5ff26f962b2366b08e4f32e348cd1d9",
|
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/eb9488f671175e708cf68c74cc04bd9115c96761",
|
||||||
"reference": "55da42fee5ff26f962b2366b08e4f32e348cd1d9",
|
"reference": "eb9488f671175e708cf68c74cc04bd9115c96761",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
"s3",
|
"s3",
|
||||||
"sdk"
|
"sdk"
|
||||||
],
|
],
|
||||||
"time": "2016-09-20 22:11:12"
|
"time": "2016-09-22 19:32:03"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "barnabywalters/mf-cleaner",
|
"name": "barnabywalters/mf-cleaner",
|
||||||
|
@ -2891,16 +2891,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "spatie/laravel-medialibrary",
|
"name": "spatie/laravel-medialibrary",
|
||||||
"version": "4.8.4",
|
"version": "4.9.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/spatie/laravel-medialibrary.git",
|
"url": "https://github.com/spatie/laravel-medialibrary.git",
|
||||||
"reference": "8c862e270d49e8bbff6f0993900c8bb59ea165ea"
|
"reference": "bb8786724f87c2d187897809849b7dc79a84a4d9"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/8c862e270d49e8bbff6f0993900c8bb59ea165ea",
|
"url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/bb8786724f87c2d187897809849b7dc79a84a4d9",
|
||||||
"reference": "8c862e270d49e8bbff6f0993900c8bb59ea165ea",
|
"reference": "bb8786724f87c2d187897809849b7dc79a84a4d9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2910,7 +2910,7 @@
|
||||||
"illuminate/support": "~5.1.16|~5.2.0|~5.3.0",
|
"illuminate/support": "~5.1.16|~5.2.0|~5.3.0",
|
||||||
"php": "^7.0",
|
"php": "^7.0",
|
||||||
"spatie/laravel-glide": "^3.0.0",
|
"spatie/laravel-glide": "^3.0.0",
|
||||||
"spatie/pdf-to-image": "^1.0.1",
|
"spatie/pdf-to-image": "^1.2",
|
||||||
"spatie/string": "^2.0.0"
|
"spatie/string": "^2.0.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
|
@ -2919,8 +2919,7 @@
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/dbal": "^2.5.2",
|
"doctrine/dbal": "^2.5.2",
|
||||||
"mockery/mockery": "^0.9.4",
|
"mockery/mockery": "^0.9.4",
|
||||||
"orchestra/database": "3.3.x-dev",
|
"orchestra/testbench": "^3.1",
|
||||||
"orchestra/testbench": "3.3.x-dev",
|
|
||||||
"phpunit/phpunit": "^5.0.0",
|
"phpunit/phpunit": "^5.0.0",
|
||||||
"scrutinizer/ocular": "^1.1"
|
"scrutinizer/ocular": "^1.1"
|
||||||
},
|
},
|
||||||
|
@ -2954,7 +2953,7 @@
|
||||||
"media",
|
"media",
|
||||||
"spatie"
|
"spatie"
|
||||||
],
|
],
|
||||||
"time": "2016-09-14 16:31:49"
|
"time": "2016-09-23 11:54:31"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "spatie/pdf-to-image",
|
"name": "spatie/pdf-to-image",
|
||||||
|
@ -4031,28 +4030,28 @@
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
"name": "barryvdh/laravel-debugbar",
|
"name": "barryvdh/laravel-debugbar",
|
||||||
"version": "V2.2.3",
|
"version": "v2.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||||
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd"
|
"reference": "0c87981df959c7c1943abe227baf607c92f204f9"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
|
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/0c87981df959c7c1943abe227baf607c92f204f9",
|
||||||
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
|
"reference": "0c87981df959c7c1943abe227baf607c92f204f9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/support": "5.1.*|5.2.*|5.3.*",
|
"illuminate/support": "5.1.*|5.2.*|5.3.*",
|
||||||
"maximebf/debugbar": "~1.11.0|~1.12.0",
|
"maximebf/debugbar": "~1.13.0",
|
||||||
"php": ">=5.5.9",
|
"php": ">=5.5.9",
|
||||||
"symfony/finder": "~2.7|~3.0"
|
"symfony/finder": "~2.7|~3.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.2-dev"
|
"dev-master": "2.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -4081,7 +4080,7 @@
|
||||||
"profiler",
|
"profiler",
|
||||||
"webprofiler"
|
"webprofiler"
|
||||||
],
|
],
|
||||||
"time": "2016-07-29 15:00:36"
|
"time": "2016-09-15 14:05:56"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/instantiator",
|
"name": "doctrine/instantiator",
|
||||||
|
@ -4232,16 +4231,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maximebf/debugbar",
|
"name": "maximebf/debugbar",
|
||||||
"version": "v1.12.0",
|
"version": "v1.13.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/maximebf/php-debugbar.git",
|
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||||
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988"
|
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
|
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/5f49a5ed6cfde81d31d89378806670d77462526e",
|
||||||
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
|
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -4260,7 +4259,7 @@
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.12-dev"
|
"dev-master": "1.13-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -4289,7 +4288,7 @@
|
||||||
"debug",
|
"debug",
|
||||||
"debugbar"
|
"debugbar"
|
||||||
],
|
],
|
||||||
"time": "2016-05-15 13:11:34"
|
"time": "2016-09-15 14:01:59"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "mockery/mockery",
|
||||||
|
|
|
@ -222,6 +222,7 @@ return [
|
||||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||||
|
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||||
'Config' => Illuminate\Support\Facades\Config::class,
|
'Config' => Illuminate\Support\Facades\Config::class,
|
||||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
|
var pump = require('pump');
|
||||||
var sass = require('gulp-sass');
|
var sass = require('gulp-sass');
|
||||||
var brotli = require('gulp-brotli');
|
var brotli = require('gulp-brotli');
|
||||||
|
var uglify = require('gulp-uglify');
|
||||||
var zopfli = require('gulp-zopfli');
|
var zopfli = require('gulp-zopfli');
|
||||||
var sourcemaps = require('gulp-sourcemaps');
|
var sourcemaps = require('gulp-sourcemaps');
|
||||||
var autoprefixer = require('gulp-autoprefixer');
|
var autoprefixer = require('gulp-autoprefixer');
|
||||||
|
@ -17,7 +19,12 @@ gulp.task('sass', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('js-assets', function () {
|
gulp.task('js-assets', function () {
|
||||||
|
//return gulp.src(['resources/assets/js/**/*'])
|
||||||
|
// .pipe(gulp.dest('./public/assets/js'));
|
||||||
return gulp.src(['resources/assets/js/**/*'])
|
return gulp.src(['resources/assets/js/**/*'])
|
||||||
|
.pipe(sourcemaps.init())
|
||||||
|
.pipe(uglify())
|
||||||
|
.pipe(sourcemaps.write('./maps'))
|
||||||
.pipe(gulp.dest('./public/assets/js'));
|
.pipe(gulp.dest('./public/assets/js'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"gulp-brotli": "^1.0.1",
|
"gulp-brotli": "^1.0.1",
|
||||||
"gulp-sass": "^2.3.2",
|
"gulp-sass": "^2.3.2",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
|
"gulp-uglify": "^2.0.0",
|
||||||
"gulp-zopfli": "^1.0.0",
|
"gulp-zopfli": "^1.0.0",
|
||||||
"lint-staged": "^1.0.1",
|
"lint-staged": "^1.0.1",
|
||||||
"pre-commit": "^1.1.3",
|
"pre-commit": "^1.1.3",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,69 +1,2 @@
|
||||||
/* global alertify, store */
|
function getKeys(){for(var e=[],t=document.querySelectorAll("input[type=text], textarea"),r=0;r<t.length;r++){var o=getFormElement(t[r]);if(o!==!1){var n=o.id+"~"+t[r].id;e.push(n)}}return e}function getFormElement(e){if("body"!==e.nodeName.toLowerCase()){var t=e.parentNode;return"form"===t.nodeName.toLowerCase()?t:getFormElement(t)}return!1}var feature={addEventListener:!!window.addEventListener,querySelectorAll:!!document.querySelectorAll};if(feature.addEventListener&&feature.querySelectorAll)for(var keys=getKeys(),i=0;i<keys.length;i++)if(store.get(keys[i])){var formId=keys[i].split("~")[1];document.getElementById(formId).value=store.get(keys[i])}for(var timerId=window.setInterval(function(){for(var e=!1,t=document.querySelectorAll("input[type=text], textarea"),r=0;r<t.length;r++){var o=getFormElement(t[r]).id+"~"+t[r].id;store.get(o)!==t[r].value&&""!==t[r].value&&(store.set(o,t[r].value),e=!0)}e===!0&&(alertify.logPosition("top right"),alertify.success("Auto saved text"))},5e3),forms=document.querySelectorAll("form"),f=0;f<forms.length;f++){var form=forms[f];form.addEventListener("submit",function(){window.clearInterval(timerId);for(var e=form.id,t=store.keys(),r=0;r<t.length;r++)t[r].indexOf(e)>-1&&store.remove(t[r])})}
|
||||||
var feature = {
|
//# sourceMappingURL=maps/form-save.js.map
|
||||||
addEventListener : !!window.addEventListener,
|
|
||||||
querySelectorAll : !!document.querySelectorAll
|
|
||||||
};
|
|
||||||
|
|
||||||
if (feature.addEventListener && feature.querySelectorAll) {
|
|
||||||
var keys = getKeys();
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
if (store.get(keys[i])) {
|
|
||||||
var formId = keys[i].split('~')[1];
|
|
||||||
document.getElementById(formId).value = store.get(keys[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var timerId = window.setInterval(function() {
|
|
||||||
var saved = false;
|
|
||||||
var inputs = document.querySelectorAll('input[type=text], textarea');
|
|
||||||
for (var i = 0; i < inputs.length; i++) {
|
|
||||||
var key = getFormElement(inputs[i]).id + '~' + inputs[i].id;
|
|
||||||
if (store.get(key) !== inputs[i].value && inputs[i].value !== '') {
|
|
||||||
store.set(key, inputs[i].value);
|
|
||||||
saved = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (saved === true) {
|
|
||||||
alertify.logPosition('top right');
|
|
||||||
alertify.success('Auto saved text');
|
|
||||||
}
|
|
||||||
}, 5000);
|
|
||||||
var forms = document.querySelectorAll('form');
|
|
||||||
for (var f = 0; f < forms.length; f++) {
|
|
||||||
var form = forms[f];
|
|
||||||
form.addEventListener('submit', function() {
|
|
||||||
window.clearInterval(timerId);
|
|
||||||
var formId = form.id;
|
|
||||||
var storedKeys = store.keys();
|
|
||||||
for (var i = 0; i < storedKeys.length; i++) {
|
|
||||||
if (storedKeys[i].indexOf(formId) > -1) {
|
|
||||||
store.remove(storedKeys[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getKeys() {
|
|
||||||
var keys = [];
|
|
||||||
var formFields = document.querySelectorAll('input[type=text], textarea');
|
|
||||||
for (var f = 0; f < formFields.length; f++) {
|
|
||||||
var parent = getFormElement(formFields[f]);
|
|
||||||
if (parent !== false) {
|
|
||||||
var key = parent.id + '~' + formFields[f].id;
|
|
||||||
keys.push(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
function getFormElement(elem) {
|
|
||||||
if (elem.nodeName.toLowerCase() !== 'body') {
|
|
||||||
var parent = elem.parentNode;
|
|
||||||
if (parent.nodeName.toLowerCase() === 'form') {
|
|
||||||
return parent;
|
|
||||||
} else {
|
|
||||||
return getFormElement(parent);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,26 +1,2 @@
|
||||||
/* global Autolinker */
|
for(var autolinker=new Autolinker,ytidregex=/watch\?v=([A-Za-z0-9\-_]+)/,spotifyregex=/https\:\/\/play\.spotify\.com\/(.*)\b/,notes=document.querySelectorAll(".e-content"),i=0;i<notes.length;i++){var ytid=notes[i].textContent.match(ytidregex);if(null!==ytid){var yid=ytid[1],yiframe=document.createElement("iframe");yiframe.classList.add("youtube"),yiframe.setAttribute("src","//www.youtube.com/embed/"+yid),yiframe.setAttribute("frameborder",0),yiframe.setAttribute("allowfullscreen","true"),notes[i].appendChild(yiframe)}var spotifyid=notes[i].textContent.match(spotifyregex);if(null!==spotifyid){var sid=spotifyid[1].replace("/",":"),siframe=document.createElement("iframe");siframe.classList.add("spotify"),siframe.setAttribute("src","https://embed.spotify.com/?uri=spotify:"+sid),siframe.setAttribute("frameborder",0),siframe.setAttribute("allowtransparency","true"),notes[i].appendChild(siframe)}var orig=notes[i].innerHTML,linked=autolinker.link(orig);notes[i].innerHTML=linked}
|
||||||
//the autlinker object
|
//# sourceMappingURL=maps/links.js.map
|
||||||
var autolinker = new Autolinker();
|
|
||||||
|
|
||||||
//the youtube regex
|
|
||||||
var ytidregex = /watch\?v=([A-Za-z0-9\-_]+)/;
|
|
||||||
|
|
||||||
//grab the notes and loop through them
|
|
||||||
var notes = document.querySelectorAll('.e-content');
|
|
||||||
for (var i = 0; i < notes.length; i++) {
|
|
||||||
//get Youtube ID
|
|
||||||
var ytid = notes[i].textContent.match(ytidregex);
|
|
||||||
if (ytid !== null) {
|
|
||||||
var id = ytid[1];
|
|
||||||
var iframe = document.createElement('iframe');
|
|
||||||
iframe.classList.add('youtube');
|
|
||||||
iframe.setAttribute('src', '//www.youtube.com/embed/' + id);
|
|
||||||
iframe.setAttribute('frameborder', 0);
|
|
||||||
iframe.setAttribute('allowfullscreen', 'true');
|
|
||||||
notes[i].appendChild(iframe);
|
|
||||||
}
|
|
||||||
//now linkify everything
|
|
||||||
var orig = notes[i].innerHTML;
|
|
||||||
var linked = autolinker.link(orig);
|
|
||||||
notes[i].innerHTML = linked;
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,16 +1,2 @@
|
||||||
/* global L */
|
for(var mapDivs=document.querySelectorAll(".map"),i=0;i<mapDivs.length;i++){var mapDiv=mapDivs[i],latitude=mapDiv.dataset.latitude,longitude=mapDiv.dataset.longitude;L.mapbox.accessToken="pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w";var map=L.mapbox.map(mapDiv,"jonnybarnes.gnoihnim").setView([latitude,longitude],15).addLayer(L.mapbox.tileLayer("jonnybarnes.gnoihnim",{detectRetina:!0}));L.marker([latitude,longitude]).addTo(map),map.scrollWheelZoom.disable()}
|
||||||
//This code runs on page load and looks for <div class="map">, then adds map
|
//# sourceMappingURL=maps/maps.js.map
|
||||||
var mapDivs = document.querySelectorAll('.map');
|
|
||||||
for (var i = 0; i < mapDivs.length; i++) {
|
|
||||||
var mapDiv = mapDivs[i];
|
|
||||||
var latitude = mapDiv.dataset.latitude;
|
|
||||||
var longitude = mapDiv.dataset.longitude;
|
|
||||||
L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';
|
|
||||||
var map = L.mapbox.map(mapDiv, 'jonnybarnes.gnoihnim')
|
|
||||||
.setView([latitude, longitude], 15)
|
|
||||||
.addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {
|
|
||||||
detectRetina: true
|
|
||||||
}));
|
|
||||||
L.marker([latitude, longitude]).addTo(map);
|
|
||||||
map.scrollWheelZoom.disable();
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
1
public/assets/js/maps/form-save.js.map
Normal file
1
public/assets/js/maps/form-save.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["form-save.js"],"names":["getKeys","keys","formFields","document","querySelectorAll","f","length","parent","getFormElement","key","id","push","elem","nodeName","toLowerCase","parentNode","feature","addEventListener","window","i","store","get","formId","split","getElementById","value","timerId","setInterval","saved","inputs","set","alertify","logPosition","success","forms","form","clearInterval","storedKeys","indexOf","remove"],"mappings":"AA6CA,QAASA,WAGL,IAAK,GAFDC,MACAC,EAAaC,SAASC,iBAAiB,8BAClCC,EAAI,EAAGA,EAAIH,EAAWI,OAAQD,IAAK,CACxC,GAAIE,GAASC,eAAeN,EAAWG,GACvC,IAAIE,KAAW,EAAO,CAClB,GAAIE,GAAMF,EAAOG,GAAK,IAAMR,EAAWG,GAAGK,EAC1CT,GAAKU,KAAKF,IAGlB,MAAOR,GAEX,QAASO,gBAAeI,GACpB,GAAoC,SAAhCA,EAAKC,SAASC,cAA0B,CACxC,GAAIP,GAASK,EAAKG,UAClB,OAAsC,SAAlCR,EAAOM,SAASC,cACTP,EAEAC,eAAeD,GAG1B,OAAO,EAjEf,GAAIS,UACAC,mBAAqBC,OAAOD,iBAC5Bb,mBAAqBD,SAASC,iBAGlC,IAAIY,QAAQC,kBAAoBD,QAAQZ,iBAEpC,IAAK,GADDH,MAAOD,UACFmB,EAAI,EAAGA,EAAIlB,KAAKK,OAAQa,IAC7B,GAAIC,MAAMC,IAAIpB,KAAKkB,IAAK,CACpB,GAAIG,QAASrB,KAAKkB,GAAGI,MAAM,KAAK,EAChCpB,UAASqB,eAAeF,QAAQG,MAAQL,MAAMC,IAAIpB,KAAKkB,IAqBnE,IAAK,GAhBDO,SAAUR,OAAOS,YAAY,WAG7B,IAAK,GAFDC,IAAQ,EACRC,EAAS1B,SAASC,iBAAiB,8BAC9Be,EAAI,EAAGA,EAAIU,EAAOvB,OAAQa,IAAK,CACpC,GAAIV,GAAMD,eAAeqB,EAAOV,IAAIT,GAAK,IAAMmB,EAAOV,GAAGT,EACrDU,OAAMC,IAAIZ,KAASoB,EAAOV,GAAGM,OAA6B,KAApBI,EAAOV,GAAGM,QAChDL,MAAMU,IAAIrB,EAAKoB,EAAOV,GAAGM,OACzBG,GAAQ,GAGZA,KAAU,IACVG,SAASC,YAAY,aACrBD,SAASE,QAAQ,qBAEtB,KACCC,MAAQ/B,SAASC,iBAAiB,QAC7BC,EAAI,EAAGA,EAAI6B,MAAM5B,OAAQD,IAAK,CACnC,GAAI8B,MAAOD,MAAM7B,EACjB8B,MAAKlB,iBAAiB,SAAU,WAC5BC,OAAOkB,cAAcV,QAGrB,KAAK,GAFDJ,GAASa,KAAKzB,GACd2B,EAAajB,MAAMnB,OACdkB,EAAI,EAAGA,EAAIkB,EAAW/B,OAAQa,IAC/BkB,EAAWlB,GAAGmB,QAAQhB,IAAU,GAChCF,MAAMmB,OAAOF,EAAWlB","file":"form-save.js","sourcesContent":["/* global alertify, store */\nvar feature = {\n addEventListener : !!window.addEventListener,\n querySelectorAll : !!document.querySelectorAll\n};\n\nif (feature.addEventListener && feature.querySelectorAll) {\n var keys = getKeys();\n for (var i = 0; i < keys.length; i++) {\n if (store.get(keys[i])) {\n var formId = keys[i].split('~')[1];\n document.getElementById(formId).value = store.get(keys[i]);\n }\n }\n}\n\nvar timerId = window.setInterval(function() {\n var saved = false;\n var inputs = document.querySelectorAll('input[type=text], textarea');\n for (var i = 0; i < inputs.length; i++) {\n var key = getFormElement(inputs[i]).id + '~' + inputs[i].id;\n if (store.get(key) !== inputs[i].value && inputs[i].value !== '') {\n store.set(key, inputs[i].value);\n saved = true;\n }\n }\n if (saved === true) {\n alertify.logPosition('top right');\n alertify.success('Auto saved text');\n }\n}, 5000);\nvar forms = document.querySelectorAll('form');\nfor (var f = 0; f < forms.length; f++) {\n var form = forms[f];\n form.addEventListener('submit', function() {\n window.clearInterval(timerId);\n var formId = form.id;\n var storedKeys = store.keys();\n for (var i = 0; i < storedKeys.length; i++) {\n if (storedKeys[i].indexOf(formId) > -1) {\n store.remove(storedKeys[i]);\n }\n }\n });\n}\nfunction getKeys() {\n var keys = [];\n var formFields = document.querySelectorAll('input[type=text], textarea');\n for (var f = 0; f < formFields.length; f++) {\n var parent = getFormElement(formFields[f]);\n if (parent !== false) {\n var key = parent.id + '~' + formFields[f].id;\n keys.push(key);\n }\n }\n return keys;\n}\nfunction getFormElement(elem) {\n if (elem.nodeName.toLowerCase() !== 'body') {\n var parent = elem.parentNode;\n if (parent.nodeName.toLowerCase() === 'form') {\n return parent;\n } else {\n return getFormElement(parent);\n }\n } else {\n return false;\n }\n}\n"],"sourceRoot":"/source/"}
|
1
public/assets/js/maps/links.js.map
Normal file
1
public/assets/js/maps/links.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["links.js"],"names":["autolinker","Autolinker","ytidregex","spotifyregex","notes","document","querySelectorAll","i","length","ytid","textContent","match","yid","yiframe","createElement","classList","add","setAttribute","appendChild","spotifyid","sid","replace","siframe","orig","innerHTML","linked","link"],"mappings":"AAWA,IAAK,GATDA,YAAa,GAAIC,YAGjBC,UAAY,6BAEZC,aAAe,wCAGfC,MAAQC,SAASC,iBAAiB,cAC7BC,EAAI,EAAGA,EAAIH,MAAMI,OAAQD,IAAK,CAEnC,GAAIE,MAAOL,MAAMG,GAAGG,YAAYC,MAAMT,UACtC,IAAa,OAATO,KAAe,CACf,GAAIG,KAAMH,KAAK,GACXI,QAAUR,SAASS,cAAc,SACrCD,SAAQE,UAAUC,IAAI,WACtBH,QAAQI,aAAa,MAAO,2BAA6BL,KACzDC,QAAQI,aAAa,cAAe,GACpCJ,QAAQI,aAAa,kBAAmB,QACxCb,MAAMG,GAAGW,YAAYL,SAGzB,GAAIM,WAAYf,MAAMG,GAAGG,YAAYC,MAAMR,aAC3C,IAAkB,OAAdgB,UAAoB,CACpB,GAAIC,KAAMD,UAAU,GAAGE,QAAQ,IAAK,KAChCC,QAAUjB,SAASS,cAAc,SACrCQ,SAAQP,UAAUC,IAAI,WACtBM,QAAQL,aAAa,MAAO,0CAA4CG,KACxEE,QAAQL,aAAa,cAAe,GACpCK,QAAQL,aAAa,oBAAqB,QAC1Cb,MAAMG,GAAGW,YAAYI,SAGzB,GAAIC,MAAOnB,MAAMG,GAAGiB,UAChBC,OAASzB,WAAW0B,KAAKH,KAC7BnB,OAAMG,GAAGiB,UAAYC","file":"links.js","sourcesContent":["/* global Autolinker */\n//the autlinker object\nvar autolinker = new Autolinker();\n\n//the youtube regex\nvar ytidregex = /watch\\?v=([A-Za-z0-9\\-_]+)/;\n\nvar spotifyregex = /https\\:\\/\\/play\\.spotify\\.com\\/(.*)\\b/;\n\n//grab the notes and loop through them\nvar notes = document.querySelectorAll('.e-content');\nfor (var i = 0; i < notes.length; i++) {\n //get Youtube ID\n var ytid = notes[i].textContent.match(ytidregex);\n if (ytid !== null) {\n var yid = ytid[1];\n var yiframe = document.createElement('iframe');\n yiframe.classList.add('youtube');\n yiframe.setAttribute('src', '//www.youtube.com/embed/' + yid);\n yiframe.setAttribute('frameborder', 0);\n yiframe.setAttribute('allowfullscreen', 'true');\n notes[i].appendChild(yiframe);\n }\n //get Spotify ID\n var spotifyid = notes[i].textContent.match(spotifyregex);\n if (spotifyid !== null) {\n var sid = spotifyid[1].replace('/', ':');\n var siframe = document.createElement('iframe');\n siframe.classList.add('spotify');\n siframe.setAttribute('src', 'https://embed.spotify.com/?uri=spotify:' + sid);\n siframe.setAttribute('frameborder', 0);\n siframe.setAttribute('allowtransparency', 'true');\n notes[i].appendChild(siframe);\n }\n //now linkify everything\n var orig = notes[i].innerHTML;\n var linked = autolinker.link(orig);\n notes[i].innerHTML = linked;\n}\n"],"sourceRoot":"/source/"}
|
1
public/assets/js/maps/maps.js.map
Normal file
1
public/assets/js/maps/maps.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["maps.js"],"names":["mapDivs","document","querySelectorAll","i","length","mapDiv","latitude","dataset","longitude","L","mapbox","accessToken","map","setView","addLayer","tileLayer","detectRetina","marker","addTo","scrollWheelZoom","disable"],"mappings":"AAGA,IAAK,GADDA,SAAUC,SAASC,iBAAiB,QAC/BC,EAAI,EAAGA,EAAIH,QAAQI,OAAQD,IAAK,CACrC,GAAIE,QAASL,QAAQG,GACjBG,SAAWD,OAAOE,QAAQD,SAC1BE,UAAaH,OAAOE,QAAQC,SAChCC,GAAEC,OAAOC,YAAc,wEACvB,IAAIC,KAAMH,EAAEC,OAAOE,IAAIP,OAAQ,wBAC1BQ,SAASP,SAAUE,WAAY,IAC/BM,SAASL,EAAEC,OAAOK,UAAU,wBACzBC,cAAc,IAEtBP,GAAEQ,QAAQX,SAAUE,YAAYU,MAAMN,KACtCA,IAAIO,gBAAgBC","file":"maps.js","sourcesContent":["/* global L */\n//This code runs on page load and looks for <div class=\"map\">, then adds map\nvar mapDivs = document.querySelectorAll('.map');\nfor (var i = 0; i < mapDivs.length; i++) {\n var mapDiv = mapDivs[i];\n var latitude = mapDiv.dataset.latitude;\n var longitude = mapDiv.dataset.longitude;\n L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';\n var map = L.mapbox.map(mapDiv, 'jonnybarnes.gnoihnim')\n .setView([latitude, longitude], 15)\n .addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {\n detectRetina: true\n }));\n L.marker([latitude, longitude]).addTo(map);\n map.scrollWheelZoom.disable();\n}\n"],"sourceRoot":"/source/"}
|
1
public/assets/js/maps/newnote.js.map
Normal file
1
public/assets/js/maps/newnote.js.map
Normal file
File diff suppressed because one or more lines are too long
1
public/assets/js/maps/newplace.js.map
Normal file
1
public/assets/js/maps/newplace.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["newplace.js"],"names":["getLocation","navigator","geolocation","getCurrentPosition","position","updateForm","coords","latitude","longitude","addMap","inputLatitude","document","querySelector","inputLongitude","value","form","div","createElement","setAttribute","appendChild","L","mapbox","accessToken","map","setView","addLayer","tileLayer","detectRetina","marker","draggable","addTo","on","markerLocation","getLatLng","lat","lng","button","addEventListener","attachEvent"],"mappings":"AASA,QAASA,eACD,eAAiBC,YACjBA,UAAUC,YAAYC,mBAAmB,SAASC,GAC9CC,WAAWD,EAASE,OAAOC,SAAUH,EAASE,OAAOE,WACrDC,OAAOL,EAASE,OAAOC,SAAUH,EAASE,OAAOE,aAK7D,QAASH,YAAWE,EAAUC,GAC1B,GAAIE,GAAgBC,SAASC,cAAc,aACvCC,EAAiBF,SAASC,cAAc,aAC5CF,GAAcI,MAAQP,EACtBM,EAAeC,MAAQN,EAG3B,QAASC,QAAOF,EAAUC,GACtB,GAAIO,GAAOJ,SAASC,cAAc,QAC9BI,EAAML,SAASM,cAAc,MACjCD,GAAIE,aAAa,KAAM,OACvBH,EAAKI,YAAYH,GACjBI,EAAEC,OAAOC,YAAc,wEACvB,IAAIC,GAAMH,EAAEC,OAAOE,IAAI,MAAO,wBACzBC,SAASjB,EAAUC,GAAY,IAC/BiB,SAASL,EAAEC,OAAOK,UAAU,wBACzBC,cAAc,KAElBC,EAASR,EAAEQ,QAAQrB,EAAUC,IAC7BqB,WAAW,IACZC,MAAMP,EACTK,GAAOG,GAAG,UAAW,WACjB,GAAIC,GAAiBJ,EAAOK,WAC5B5B,YAAW2B,EAAeE,IAAKF,EAAeG,OAxCtD,GAAIC,QAASzB,SAASC,cAAc,UAEhCwB,QAAOC,iBACPD,OAAOC,iBAAiB,QAASrC,aAEjCoC,OAAOE,YAAY,UAAWtC","file":"newplace.js","sourcesContent":["/* global L */\nvar button = document.querySelector('#locate');\n\nif (button.addEventListener) {\n button.addEventListener('click', getLocation);\n} else {\n button.attachEvent('onclick', getLocation);\n}\n\nfunction getLocation() {\n if ('geolocation' in navigator) {\n navigator.geolocation.getCurrentPosition(function(position) {\n updateForm(position.coords.latitude, position.coords.longitude);\n addMap(position.coords.latitude, position.coords.longitude);\n });\n }\n}\n\nfunction updateForm(latitude, longitude) {\n var inputLatitude = document.querySelector('#latitude');\n var inputLongitude = document.querySelector('#longitude');\n inputLatitude.value = latitude;\n inputLongitude.value = longitude;\n}\n\nfunction addMap(latitude, longitude) {\n var form = document.querySelector('form');\n var div = document.createElement('div');\n div.setAttribute('id', 'map');\n form.appendChild(div);\n L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';\n var map = L.mapbox.map('map', 'jonnybarnes.gnoihnim')\n .setView([latitude, longitude], 15)\n .addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {\n detectRetina: true\n }));\n var marker = L.marker([latitude, longitude], {\n draggable: true\n }).addTo(map);\n marker.on('dragend', function () {\n var markerLocation = marker.getLatLng();\n updateForm(markerLocation.lat, markerLocation.lng);\n });\n}\n"],"sourceRoot":"/source/"}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -1,44 +1,2 @@
|
||||||
/* global L */
|
function getLocation(){"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(function(t){updateForm(t.coords.latitude,t.coords.longitude),addMap(t.coords.latitude,t.coords.longitude)})}function updateForm(t,e){var o=document.querySelector("#latitude"),n=document.querySelector("#longitude");o.value=t,n.value=e}function addMap(t,e){var o=document.querySelector("form"),n=document.createElement("div");n.setAttribute("id","map"),o.appendChild(n),L.mapbox.accessToken="pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w";var a=L.mapbox.map("map","jonnybarnes.gnoihnim").setView([t,e],15).addLayer(L.mapbox.tileLayer("jonnybarnes.gnoihnim",{detectRetina:!0})),i=L.marker([t,e],{draggable:!0}).addTo(a);i.on("dragend",function(){var t=i.getLatLng();updateForm(t.lat,t.lng)})}var button=document.querySelector("#locate");button.addEventListener?button.addEventListener("click",getLocation):button.attachEvent("onclick",getLocation);
|
||||||
var button = document.querySelector('#locate');
|
//# sourceMappingURL=maps/newplace.js.map
|
||||||
|
|
||||||
if (button.addEventListener) {
|
|
||||||
button.addEventListener('click', getLocation);
|
|
||||||
} else {
|
|
||||||
button.attachEvent('onclick', getLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLocation() {
|
|
||||||
if ('geolocation' in navigator) {
|
|
||||||
navigator.geolocation.getCurrentPosition(function(position) {
|
|
||||||
updateForm(position.coords.latitude, position.coords.longitude);
|
|
||||||
addMap(position.coords.latitude, position.coords.longitude);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateForm(latitude, longitude) {
|
|
||||||
var inputLatitude = document.querySelector('#latitude');
|
|
||||||
var inputLongitude = document.querySelector('#longitude');
|
|
||||||
inputLatitude.value = latitude;
|
|
||||||
inputLongitude.value = longitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addMap(latitude, longitude) {
|
|
||||||
var form = document.querySelector('form');
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.setAttribute('id', 'map');
|
|
||||||
form.appendChild(div);
|
|
||||||
L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';
|
|
||||||
var map = L.mapbox.map('map', 'jonnybarnes.gnoihnim')
|
|
||||||
.setView([latitude, longitude], 15)
|
|
||||||
.addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {
|
|
||||||
detectRetina: true
|
|
||||||
}));
|
|
||||||
var marker = L.marker([latitude, longitude], {
|
|
||||||
draggable: true
|
|
||||||
}).addTo(map);
|
|
||||||
marker.on('dragend', function () {
|
|
||||||
var markerLocation = marker.getLatLng();
|
|
||||||
updateForm(markerLocation.lat, markerLocation.lng);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -5,19 +5,32 @@ var autolinker = new Autolinker();
|
||||||
//the youtube regex
|
//the youtube regex
|
||||||
var ytidregex = /watch\?v=([A-Za-z0-9\-_]+)/;
|
var ytidregex = /watch\?v=([A-Za-z0-9\-_]+)/;
|
||||||
|
|
||||||
|
var spotifyregex = /https\:\/\/play\.spotify\.com\/(.*)\b/;
|
||||||
|
|
||||||
//grab the notes and loop through them
|
//grab the notes and loop through them
|
||||||
var notes = document.querySelectorAll('.e-content');
|
var notes = document.querySelectorAll('.e-content');
|
||||||
for (var i = 0; i < notes.length; i++) {
|
for (var i = 0; i < notes.length; i++) {
|
||||||
//get Youtube ID
|
//get Youtube ID
|
||||||
var ytid = notes[i].textContent.match(ytidregex);
|
var ytid = notes[i].textContent.match(ytidregex);
|
||||||
if (ytid !== null) {
|
if (ytid !== null) {
|
||||||
var id = ytid[1];
|
var yid = ytid[1];
|
||||||
var iframe = document.createElement('iframe');
|
var yiframe = document.createElement('iframe');
|
||||||
iframe.classList.add('youtube');
|
yiframe.classList.add('youtube');
|
||||||
iframe.setAttribute('src', '//www.youtube.com/embed/' + id);
|
yiframe.setAttribute('src', '//www.youtube.com/embed/' + yid);
|
||||||
iframe.setAttribute('frameborder', 0);
|
yiframe.setAttribute('frameborder', 0);
|
||||||
iframe.setAttribute('allowfullscreen', 'true');
|
yiframe.setAttribute('allowfullscreen', 'true');
|
||||||
notes[i].appendChild(iframe);
|
notes[i].appendChild(yiframe);
|
||||||
|
}
|
||||||
|
//get Spotify ID
|
||||||
|
var spotifyid = notes[i].textContent.match(spotifyregex);
|
||||||
|
if (spotifyid !== null) {
|
||||||
|
var sid = spotifyid[1].replace('/', ':');
|
||||||
|
var siframe = document.createElement('iframe');
|
||||||
|
siframe.classList.add('spotify');
|
||||||
|
siframe.setAttribute('src', 'https://embed.spotify.com/?uri=spotify:' + sid);
|
||||||
|
siframe.setAttribute('frameborder', 0);
|
||||||
|
siframe.setAttribute('allowtransparency', 'true');
|
||||||
|
notes[i].appendChild(siframe);
|
||||||
}
|
}
|
||||||
//now linkify everything
|
//now linkify everything
|
||||||
var orig = notes[i].innerHTML;
|
var orig = notes[i].innerHTML;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global L */
|
/* global L, alertify */
|
||||||
if ('geolocation' in navigator) {
|
if ('geolocation' in navigator) {
|
||||||
var button = document.querySelector('#locate');
|
var button = document.querySelector('#locate');
|
||||||
if (button.addEventListener) {
|
if (button.addEventListener) {
|
||||||
|
@ -12,11 +12,11 @@ if ('geolocation' in navigator) {
|
||||||
function getLocation() {
|
function getLocation() {
|
||||||
navigator.geolocation.getCurrentPosition(function (position) {
|
navigator.geolocation.getCurrentPosition(function (position) {
|
||||||
//the locate button has been clicked so add the places/map
|
//the locate button has been clicked so add the places/map
|
||||||
addPlaces(position.coords.latitude, position.coords.longitude);
|
addPlacesMap(position.coords.latitude, position.coords.longitude);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPlaces(latitude, longitude) {
|
function addPlacesMap(latitude, longitude) {
|
||||||
//get the nearby places
|
//get the nearby places
|
||||||
fetch('/places/near/' + latitude + '/' + longitude, {
|
fetch('/places/near/' + latitude + '/' + longitude, {
|
||||||
credentials: 'same-origin',
|
credentials: 'same-origin',
|
||||||
|
@ -24,6 +24,10 @@ function addPlaces(latitude, longitude) {
|
||||||
}).then(function (response) {
|
}).then(function (response) {
|
||||||
return response.json();
|
return response.json();
|
||||||
}).then(function (j) {
|
}).then(function (j) {
|
||||||
|
if (j.error == true) {
|
||||||
|
alertify.reset();
|
||||||
|
alertify.error(j.error_description);
|
||||||
|
}
|
||||||
if (j.length > 0) {
|
if (j.length > 0) {
|
||||||
var i;
|
var i;
|
||||||
var places = [];
|
var places = [];
|
||||||
|
@ -195,17 +199,13 @@ function addMap(latitude, longitude, places) {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
.then(function (response) {
|
|
||||||
if (response.status >= 200 && response.status < 300) {
|
|
||||||
return Promise.resolve(response);
|
|
||||||
} else {
|
|
||||||
return Promise.reject(new Error(response.statusText));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(function (placeJson) {
|
.then(function (placeJson) {
|
||||||
|
if (placeJson.error == true) {
|
||||||
|
throw new Error(placeJson.error_description);
|
||||||
|
}
|
||||||
//create the slug from the url
|
//create the slug from the url
|
||||||
var urlParts = placeJson.split('/');
|
var urlParts = placeJson.split('/');
|
||||||
var slug = urlParts.pop();
|
var slug = urlParts.pop();
|
||||||
|
@ -247,7 +247,8 @@ function addMap(latitude, longitude, places) {
|
||||||
//make selected
|
//make selected
|
||||||
selectPlace(slug);
|
selectPlace(slug);
|
||||||
}).catch(function (placeError) {
|
}).catch(function (placeError) {
|
||||||
console.error(placeError);
|
alertify.reset();
|
||||||
|
alertify.error(placeError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -116,6 +116,103 @@ class MicropubTest extends TestCase
|
||||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||||
)->seeJson([
|
)->seeJson([
|
||||||
'response' => 'created'
|
'response' => 'created'
|
||||||
|
])->assertResponseStatus(201);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMicropubJSONRequestCreateNewNoteWithoutToken()
|
||||||
|
{
|
||||||
|
$faker = \Faker\Factory::create();
|
||||||
|
$note = $faker->text;
|
||||||
|
$this->json(
|
||||||
|
'POST',
|
||||||
|
$this->appurl . '/api/post',
|
||||||
|
[
|
||||||
|
'type' => ['h-entry'],
|
||||||
|
'properties' => [
|
||||||
|
'content' => [$note],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)->seeJson([
|
||||||
|
'response' => 'error',
|
||||||
|
'error' => 'no_token'
|
||||||
|
])->assertResponseStatus(400);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMicropubJSONRequestCreateNewNoteWithInvalidToken()
|
||||||
|
{
|
||||||
|
$faker = \Faker\Factory::create();
|
||||||
|
$note = $faker->text;
|
||||||
|
$this->json(
|
||||||
|
'POST',
|
||||||
|
$this->appurl . '/api/post',
|
||||||
|
[
|
||||||
|
'type' => ['h-entry'],
|
||||||
|
'properties' => [
|
||||||
|
'content' => [$note],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
['HTTP_Authorization' => 'Bearer ' . $this->getInvalidToken()]
|
||||||
|
)->seeJson([
|
||||||
|
'response' => 'error',
|
||||||
|
'error' => 'invalid_token'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMicropubJSONRequestCreateNewPlace()
|
||||||
|
{
|
||||||
|
$faker = \Faker\Factory::create();
|
||||||
|
$this->json(
|
||||||
|
'POST',
|
||||||
|
$this->appurl . '/api/post',
|
||||||
|
[
|
||||||
|
'type' => ['h-card'],
|
||||||
|
'properties' => [
|
||||||
|
'name' => $faker->name,
|
||||||
|
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude
|
||||||
|
],
|
||||||
|
],
|
||||||
|
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||||
|
)->seeJson([
|
||||||
|
'response' => 'created'
|
||||||
|
])->assertResponseStatus(201);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMicropubJSONRequestCreateNewPlaceWithoutToken()
|
||||||
|
{
|
||||||
|
$faker = \Faker\Factory::create();
|
||||||
|
$this->json(
|
||||||
|
'POST',
|
||||||
|
$this->appurl . '/api/post',
|
||||||
|
[
|
||||||
|
'type' => ['h-entry'],
|
||||||
|
'properties' => [
|
||||||
|
'name' => $faker->name,
|
||||||
|
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)->seeJson([
|
||||||
|
'response' => 'error',
|
||||||
|
'error' => 'no_token'
|
||||||
|
])->assertResponseStatus(400);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMicropubJSONRequestCreateNewPlaceWithInvalidToken()
|
||||||
|
{
|
||||||
|
$faker = \Faker\Factory::create();
|
||||||
|
$this->json(
|
||||||
|
'POST',
|
||||||
|
$this->appurl . '/api/post',
|
||||||
|
[
|
||||||
|
'type' => ['h-entry'],
|
||||||
|
'properties' => [
|
||||||
|
'name' => $faker->name,
|
||||||
|
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude
|
||||||
|
],
|
||||||
|
],
|
||||||
|
['HTTP_Authorization' => 'Bearer ' . $this->getInvalidToken()]
|
||||||
|
)->seeJson([
|
||||||
|
'response' => 'error',
|
||||||
|
'error' => 'invalid_token'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,4 +229,18 @@ class MicropubTest extends TestCase
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getInvalidToken()
|
||||||
|
{
|
||||||
|
$signer = new Sha256();
|
||||||
|
$token = (new Builder())
|
||||||
|
->set('client_id', 'https://quill.p3k.io')
|
||||||
|
->set('me', 'https://jonnybarnes.localhost')
|
||||||
|
->set('scope', 'view')
|
||||||
|
->set('issued_at', time())
|
||||||
|
->sign($signer, env('APP_KEY'))
|
||||||
|
->getToken();
|
||||||
|
|
||||||
|
return $token;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue