Merge branch 'release/0.0.4'
This commit is contained in:
commit
8ea0f7ecd4
141 changed files with 1863 additions and 1047 deletions
|
|
@ -1,5 +1,7 @@
|
|||
APP_ENV=local
|
||||
APP_KEY=SomeRandomString
|
||||
APP_DEBUG=true
|
||||
APP_LOG_LEVEL=debug
|
||||
APP_KEY=SomeRandomString
|
||||
APP_TIMEZONE=UTC
|
||||
APP_LANG=en
|
||||
|
|
|
|||
22
.eslintrc.yml
Normal file
22
.eslintrc.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
env:
|
||||
browser: true
|
||||
es6: true
|
||||
extends: 'eslint:recommended'
|
||||
rules:
|
||||
indent:
|
||||
- error
|
||||
- 4
|
||||
linebreak-style:
|
||||
- error
|
||||
- unix
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
no-console:
|
||||
- error
|
||||
- allow:
|
||||
- warn
|
||||
- error
|
||||
6
.stylelintrc
Normal file
6
.stylelintrc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"extends": "stylelint-config-standard",
|
||||
"rules": {
|
||||
"indentation": 4
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,6 @@ class PasswordController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
$this->middleware($this->guestMiddleware());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class NotesController extends Controller
|
|||
*/
|
||||
public function showNotes()
|
||||
{
|
||||
$notes = Note::orderBy('id', 'desc')->with('webmentions', 'place')->simplePaginate(10);
|
||||
$notes = Note::orderBy('id', 'desc')->with('webmentions', 'place', 'media')->simplePaginate(10);
|
||||
foreach ($notes as $note) {
|
||||
$replies = 0;
|
||||
foreach ($note->webmentions as $webmention) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class NoteService
|
|||
if ($request->hasFile('photo')) {
|
||||
$files = $request->file('photo');
|
||||
foreach ($files as $file) {
|
||||
$note->addMedia($file)->toMediaLibraryOnDisk('images', 's3');
|
||||
$note->addMedia($file)->toMediaLibrary('images', 's3');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"Jonny Barnes <jonny@jonnybarnes.uk>"
|
||||
],
|
||||
"license": "CC0-1.0",
|
||||
"homepage": "https://github.com/jonnybarnes/jbl5",
|
||||
"homepage": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
||||
"moduleType": [],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Changelog
|
||||
|
||||
## Version 0.0.4 (2016-06-21)
|
||||
- Move bower components into their own subdir
|
||||
- Move my js into `resources/`, apply an eslint pre-commit hook
|
||||
- Better guplfile, next thing is to add cleanup of old compressed files
|
||||
- Update `spatie/laravel-medialibrary` to v4, tweak associated code
|
||||
- Merge in upstream changes
|
||||
- Add a stylelint lint-staged hook
|
||||
|
||||
## Version 0.0.3 (2013-06-09)
|
||||
- Better tag normalization code organisation
|
||||
- Remove `jonnybarnes/unicode-tools` dependency and clean up relevant code
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"indieauth/client": "~0.1",
|
||||
"ezyang/htmlpurifier": "~4.6",
|
||||
"league/commonmark": "^0.13.0",
|
||||
"spatie/laravel-medialibrary": "^3.5",
|
||||
"spatie/laravel-medialibrary": "^4.0",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
"phaza/laravel-postgis": "~3.1",
|
||||
"lcobucci/jwt": "^3.1"
|
||||
|
|
|
|||
205
composer.lock
generated
205
composer.lock
generated
|
|
@ -4,8 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "ae25cd7787df367a650bf7dc2fa74227",
|
||||
"content-hash": "7982802429d5fe540f528ec69c3d84d2",
|
||||
"hash": "e17d58f5ff05d8a71261984fb22e0757",
|
||||
"content-hash": "875c8207087b92da0cffdf369815dd27",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anahkiasen/underscore-php",
|
||||
|
|
@ -59,16 +59,16 @@
|
|||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.18.16",
|
||||
"version": "3.18.18",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "5b959dda467752d4db8fa41fe9bbce85cabbe81e"
|
||||
"reference": "68b9d0b7e007782bc0f2633cdf5a4a6bf08aaafc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5b959dda467752d4db8fa41fe9bbce85cabbe81e",
|
||||
"reference": "5b959dda467752d4db8fa41fe9bbce85cabbe81e",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/68b9d0b7e007782bc0f2633cdf5a4a6bf08aaafc",
|
||||
"reference": "68b9d0b7e007782bc0f2633cdf5a4a6bf08aaafc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2016-06-07 21:16:15"
|
||||
"time": "2016-06-14 20:35:03"
|
||||
},
|
||||
{
|
||||
"name": "barnabywalters/mf-cleaner",
|
||||
|
|
@ -1131,16 +1131,16 @@
|
|||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.2.36",
|
||||
"version": "v5.2.39",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "236d7c0c5b67a2348ac7831391031d93000de3ab"
|
||||
"reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/236d7c0c5b67a2348ac7831391031d93000de3ab",
|
||||
"reference": "236d7c0c5b67a2348ac7831391031d93000de3ab",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/c2a77050269b4e03bd9a735a9f24e573a7598b8a",
|
||||
"reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -1256,7 +1256,7 @@
|
|||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2016-06-06 15:18:48"
|
||||
"time": "2016-06-17 19:25:12"
|
||||
},
|
||||
{
|
||||
"name": "lcobucci/jwt",
|
||||
|
|
@ -1318,16 +1318,16 @@
|
|||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
"version": "0.13.3",
|
||||
"version": "0.13.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/commonmark.git",
|
||||
"reference": "35816f39eb2498484fbb7b1495633a976ee1a8de"
|
||||
"reference": "83f8210427fb01f671e272bb8d44b4ed3a94d459"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/35816f39eb2498484fbb7b1495633a976ee1a8de",
|
||||
"reference": "35816f39eb2498484fbb7b1495633a976ee1a8de",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/83f8210427fb01f671e272bb8d44b4ed3a94d459",
|
||||
"reference": "83f8210427fb01f671e272bb8d44b4ed3a94d459",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -1383,7 +1383,7 @@
|
|||
"markdown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2016-05-21 18:41:30"
|
||||
"time": "2016-06-14 14:49:29"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
|
|
@ -1517,34 +1517,33 @@
|
|||
},
|
||||
{
|
||||
"name": "league/glide",
|
||||
"version": "0.3.6",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/glide.git",
|
||||
"reference": "e45a4b536924956e1b20f5d023800557d466eda7"
|
||||
"reference": "4218b548401ff3a8f602e2c3f78849a381b2c1bf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/glide/zipball/e45a4b536924956e1b20f5d023800557d466eda7",
|
||||
"reference": "e45a4b536924956e1b20f5d023800557d466eda7",
|
||||
"url": "https://api.github.com/repos/thephpleague/glide/zipball/4218b548401ff3a8f602e2c3f78849a381b2c1bf",
|
||||
"reference": "4218b548401ff3a8f602e2c3f78849a381b2c1bf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"intervention/image": "~2.1",
|
||||
"league/flysystem": "~1.0",
|
||||
"php": ">=5.4",
|
||||
"symfony/http-foundation": "~2.3|~3.0",
|
||||
"symfony/http-kernel": "~2.3|~3.0"
|
||||
"intervention/image": "^2.1",
|
||||
"league/flysystem": "^1.0",
|
||||
"php": "^5.4 | ^7.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9",
|
||||
"phpunit/php-token-stream": ">=1.3.0",
|
||||
"phpunit/php-token-stream": "^1.4",
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.3-dev"
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
|
@ -1564,7 +1563,7 @@
|
|||
}
|
||||
],
|
||||
"description": "Wonderfully easy on-demand image manipulation library with an HTTP based API.",
|
||||
"homepage": "https://github.com/thephpleague/glide",
|
||||
"homepage": "http://glide.thephpleague.com",
|
||||
"keywords": [
|
||||
"ImageMagick",
|
||||
"editing",
|
||||
|
|
@ -1575,7 +1574,7 @@
|
|||
"manipulation",
|
||||
"processing"
|
||||
],
|
||||
"time": "2016-01-25 13:35:12"
|
||||
"time": "2016-06-13 14:45:28"
|
||||
},
|
||||
{
|
||||
"name": "martinbean/laravel-sluggable-trait",
|
||||
|
|
@ -2106,16 +2105,16 @@
|
|||
},
|
||||
{
|
||||
"name": "predis/predis",
|
||||
"version": "v1.1.0",
|
||||
"version": "v1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nrk/predis.git",
|
||||
"reference": "0e17edbefb50c6cbd1acc4a6f6ef06399deb1af2"
|
||||
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nrk/predis/zipball/0e17edbefb50c6cbd1acc4a6f6ef06399deb1af2",
|
||||
"reference": "0e17edbefb50c6cbd1acc4a6f6ef06399deb1af2",
|
||||
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
|
||||
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -2152,7 +2151,7 @@
|
|||
"predis",
|
||||
"redis"
|
||||
],
|
||||
"time": "2016-06-01 22:06:21"
|
||||
"time": "2016-06-16 16:22:20"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
|
|
@ -2395,31 +2394,31 @@
|
|||
},
|
||||
{
|
||||
"name": "spatie/laravel-glide",
|
||||
"version": "2.3.3",
|
||||
"version": "3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-glide.git",
|
||||
"reference": "06bcfb85464a1202dfaa7494d1b1600c88c418e5"
|
||||
"reference": "9a5f8cac9ed2246b41afd6aa1f2b3034a6aa9ba4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-glide/zipball/06bcfb85464a1202dfaa7494d1b1600c88c418e5",
|
||||
"reference": "06bcfb85464a1202dfaa7494d1b1600c88c418e5",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-glide/zipball/9a5f8cac9ed2246b41afd6aa1f2b3034a6aa9ba4",
|
||||
"reference": "9a5f8cac9ed2246b41afd6aa1f2b3034a6aa9ba4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "5.*",
|
||||
"league/glide": "0.3.*",
|
||||
"php": ">=5.4.0"
|
||||
"league/glide": "^1.0",
|
||||
"php": "^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "2.*",
|
||||
"mockery/mockery": "~0.9.3"
|
||||
"orchestra/testbench": "^3.2",
|
||||
"phpunit/phpunit": "5.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Spatie\\Glide": "src/"
|
||||
"psr-4": {
|
||||
"Spatie\\Glide\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
|
@ -2432,22 +2431,22 @@
|
|||
"email": "freek@spatie.be"
|
||||
}
|
||||
],
|
||||
"description": "A Glide Service Provider for Laravel",
|
||||
"description": "Easily convert images with Glide",
|
||||
"homepage": "https://github.com/spatie/laravel-glide",
|
||||
"time": "2016-05-13 14:56:07"
|
||||
"time": "2016-05-05 15:35:48"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-medialibrary",
|
||||
"version": "3.18.0",
|
||||
"version": "4.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-medialibrary.git",
|
||||
"reference": "e7a0a564707b29e22c4e03c815d455de515bc230"
|
||||
"reference": "3499014e3b2de852f1e5f4bd4006e4031dd49daa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/e7a0a564707b29e22c4e03c815d455de515bc230",
|
||||
"reference": "e7a0a564707b29e22c4e03c815d455de515bc230",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-medialibrary/zipball/3499014e3b2de852f1e5f4bd4006e4031dd49daa",
|
||||
"reference": "3499014e3b2de852f1e5f4bd4006e4031dd49daa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -2455,16 +2454,16 @@
|
|||
"illuminate/console": "~5.1.16|~5.2.0",
|
||||
"illuminate/database": "~5.1.16|~5.2.0",
|
||||
"illuminate/support": "~5.1.16|~5.2.0",
|
||||
"php": "^5.5|^7.0",
|
||||
"spatie/laravel-glide": "^2.2.4",
|
||||
"php": "^7.0",
|
||||
"spatie/laravel-glide": "^3.0.0",
|
||||
"spatie/pdf-to-image": "^1.0.1",
|
||||
"spatie/string": "^2.0"
|
||||
"spatie/string": "^2.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^2.5.2",
|
||||
"mockery/mockery": "^0.9.4",
|
||||
"orchestra/testbench": "^3.0",
|
||||
"phpunit/phpunit": "^4.0",
|
||||
"phpunit/phpunit": "^5.0.0",
|
||||
"scrutinizer/ocular": "^1.1"
|
||||
},
|
||||
"type": "library",
|
||||
|
|
@ -2494,7 +2493,7 @@
|
|||
"media",
|
||||
"spatie"
|
||||
],
|
||||
"time": "2016-06-02 11:45:10"
|
||||
"time": "2016-06-03 11:06:43"
|
||||
},
|
||||
{
|
||||
"name": "spatie/pdf-to-image",
|
||||
|
|
@ -2771,16 +2770,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "0343b2cedd0edb26cdc791212a8eb645c406018b"
|
||||
"reference": "f5b7563f67779c6d3d5370e23448e707c858df3e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0343b2cedd0edb26cdc791212a8eb645c406018b",
|
||||
"reference": "0343b2cedd0edb26cdc791212a8eb645c406018b",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f5b7563f67779c6d3d5370e23448e707c858df3e",
|
||||
"reference": "f5b7563f67779c6d3d5370e23448e707c858df3e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -2827,7 +2826,7 @@
|
|||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-04-12 18:27:47"
|
||||
"time": "2016-06-06 11:42:41"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
|
|
@ -3519,16 +3518,16 @@
|
|||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
"version": "v2.2.1",
|
||||
"version": "v2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vlucas/phpdotenv.git",
|
||||
"reference": "63f37b9395e8041cd4313129c08ece896d06ca8e"
|
||||
"reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/63f37b9395e8041cd4313129c08ece896d06ca8e",
|
||||
"reference": "63f37b9395e8041cd4313129c08ece896d06ca8e",
|
||||
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/9ca5644c536654e9509b9d257f53c58630eb2a6a",
|
||||
"reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -3540,7 +3539,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev"
|
||||
"dev-master": "2.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
|
@ -3565,7 +3564,7 @@
|
|||
"env",
|
||||
"environment"
|
||||
],
|
||||
"time": "2016-04-15 10:48:49"
|
||||
"time": "2016-06-14 14:14:52"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
|
@ -4054,22 +4053,22 @@
|
|||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"version": "3.0.2",
|
||||
"version": "3.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||
"reference": "45ada3e3fd09789fbfbd6d65b3f0901f0030dc61"
|
||||
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/45ada3e3fd09789fbfbd6d65b3f0901f0030dc61",
|
||||
"reference": "45ada3e3fd09789fbfbd6d65b3f0901f0030dc61",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd",
|
||||
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"phpdocumentor/reflection-common": "^1.0@dev",
|
||||
"phpdocumentor/type-resolver": "^0.1.5",
|
||||
"phpdocumentor/type-resolver": "^0.2.0",
|
||||
"webmozart/assert": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
@ -4095,20 +4094,20 @@
|
|||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"time": "2016-06-06 06:44:13"
|
||||
"time": "2016-06-10 09:48:41"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
"version": "0.1.8",
|
||||
"version": "0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
||||
"reference": "9891754231e55d42f0d16988ffb799af39f31a12"
|
||||
"reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9891754231e55d42f0d16988ffb799af39f31a12",
|
||||
"reference": "9891754231e55d42f0d16988ffb799af39f31a12",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443",
|
||||
"reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4117,7 +4116,7 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.4",
|
||||
"phpunit/phpunit": "^5.2"
|
||||
"phpunit/phpunit": "^5.2||^4.8.24"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
|
@ -4142,7 +4141,7 @@
|
|||
"email": "me@mikevanriel.com"
|
||||
}
|
||||
],
|
||||
"time": "2016-03-28 10:02:29"
|
||||
"time": "2016-06-10 07:14:17"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
|
|
@ -4452,16 +4451,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "5.4.2",
|
||||
"version": "5.4.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "f5726a0262e5f74f8e9cf03128798b64160c441d"
|
||||
"reference": "2f1fc94b77ea6418bd6a06c64a1dac0645fbce59"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f5726a0262e5f74f8e9cf03128798b64160c441d",
|
||||
"reference": "f5726a0262e5f74f8e9cf03128798b64160c441d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2f1fc94b77ea6418bd6a06c64a1dac0645fbce59",
|
||||
"reference": "2f1fc94b77ea6418bd6a06c64a1dac0645fbce59",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4480,7 +4479,7 @@
|
|||
"phpunit/phpunit-mock-objects": "^3.2",
|
||||
"sebastian/comparator": "~1.1",
|
||||
"sebastian/diff": "~1.2",
|
||||
"sebastian/environment": "~1.3",
|
||||
"sebastian/environment": "^1.3 || ^2.0",
|
||||
"sebastian/exporter": "~1.2",
|
||||
"sebastian/global-state": "~1.0",
|
||||
"sebastian/object-enumerator": "~1.0",
|
||||
|
|
@ -4488,6 +4487,9 @@
|
|||
"sebastian/version": "~1.0|~2.0",
|
||||
"symfony/yaml": "~2.1|~3.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpdocumentor/reflection-docblock": "3.0.2"
|
||||
},
|
||||
"suggest": {
|
||||
"phpunit/php-invoker": "~1.1"
|
||||
},
|
||||
|
|
@ -4523,20 +4525,20 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-06-03 09:59:50"
|
||||
"time": "2016-06-16 06:01:15"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
"version": "3.2.1",
|
||||
"version": "3.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
||||
"reference": "0dc8fd8e87e0366c22b6c25d1f43c4e2e66847b3"
|
||||
"reference": "b13d0d9426ced06958bd32104653526a6c998a52"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/0dc8fd8e87e0366c22b6c25d1f43c4e2e66847b3",
|
||||
"reference": "0dc8fd8e87e0366c22b6c25d1f43c4e2e66847b3",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b13d0d9426ced06958bd32104653526a6c998a52",
|
||||
"reference": "b13d0d9426ced06958bd32104653526a6c998a52",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4582,7 +4584,7 @@
|
|||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-06-04 05:52:19"
|
||||
"time": "2016-06-12 07:37:26"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
|
|
@ -4797,16 +4799,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "7ae5513327cb536431847bcc0c10edba2701064e"
|
||||
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
|
||||
"reference": "7ae5513327cb536431847bcc0c10edba2701064e",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
|
||||
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -4814,12 +4816,13 @@
|
|||
"sebastian/recursion-context": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-mbstring": "*",
|
||||
"phpunit/phpunit": "~4.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
|
@ -4859,7 +4862,7 @@
|
|||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2015-06-21 07:55:53"
|
||||
"time": "2016-06-17 09:04:28"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
|
|
@ -5207,16 +5210,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.1.0",
|
||||
"version": "v3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a"
|
||||
"reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a",
|
||||
"reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623",
|
||||
"reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -5252,7 +5255,7 @@
|
|||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-05-26 21:46:24"
|
||||
"time": "2016-06-14 11:18:07"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ return [
|
|||
|
||||
'log' => env('APP_LOG', 'single'),
|
||||
|
||||
'log_level' => env('APP_LOG_LEVEL', 'debug'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ return [
|
|||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "redis", "log"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'pusher'),
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ return [
|
|||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ return [
|
|||
'secret' => env('MAILGUN_SECRET'),
|
||||
],
|
||||
|
||||
'mandrill' => [
|
||||
'secret' => env('MANDRILL_SECRET'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('SES_KEY'),
|
||||
'secret' => env('SES_SECRET'),
|
||||
|
|
|
|||
96
gulpfile.js
96
gulpfile.js
|
|
@ -16,50 +16,31 @@ var elixir = require('laravel-elixir');
|
|||
|
||||
elixir(function(mix) {
|
||||
mix.sass('global.scss', 'public/assets/css');
|
||||
mix.copy('resources/assets/js', 'public/assets/js');
|
||||
mix.version([
|
||||
//hand-made css
|
||||
'assets/css/global.css',
|
||||
'assets/css/projects.css',
|
||||
'assets/css/alertify.css',
|
||||
'assets/css/sanitize.min.css',
|
||||
'assets/css/prism.css',
|
||||
//hand-made js
|
||||
'assets/js/form-save.js',
|
||||
'assets/js/links.js',
|
||||
'assets/js/maps.js',
|
||||
'assets/js/newplace.js',
|
||||
'assets/js/newnote.js',
|
||||
'assets/js/fetch.js',
|
||||
'assets/js/alertify.js',
|
||||
'assets/js/store2.min.js',
|
||||
'assets/js/Autolinker.min.js',
|
||||
'assets/js/marked.min.js',
|
||||
'assets/js/prism.js',
|
||||
//bower components
|
||||
'assets/bower/alertify.css',
|
||||
'assets/bower/sanitize.css',
|
||||
'assets/bower/fetch.js',
|
||||
'assets/bower/alertify.js',
|
||||
'assets/bower/store2.min.js',
|
||||
'assets/bower/Autolinker.min.js',
|
||||
'assets/bower/marked.min.js',
|
||||
//prism
|
||||
'assets/prism/prism.js',
|
||||
'assets/prism/prism.css',
|
||||
]);
|
||||
});
|
||||
|
||||
gulp.task('gzip-built-css', function() {
|
||||
return gulp.src('public/build/assets/css/*.css')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/css/'));
|
||||
});
|
||||
|
||||
gulp.task('br-built-css', function() {
|
||||
return gulp.src('public/build/assets/css/*.css')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/css/'));
|
||||
});
|
||||
|
||||
gulp.task('gzip-built-js', function() {
|
||||
return gulp.src('public/build/assets/js/*.js')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/js/'));
|
||||
});
|
||||
|
||||
gulp.task('br-built-js', function() {
|
||||
return gulp.src('public/build/assets/js/*.js')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/js/'));
|
||||
});
|
||||
|
||||
gulp.task('bower', function() {
|
||||
//copy JS files
|
||||
gulp.src([
|
||||
|
|
@ -69,13 +50,54 @@ gulp.task('bower', function() {
|
|||
'bower_components/Autolinker.js/dist/Autolinker.min.js',
|
||||
'bower_components/marked/marked.min.js',
|
||||
])
|
||||
.pipe(gulp.dest('public/assets/js/'));
|
||||
.pipe(gulp.dest('public/assets/bower/'));
|
||||
//copy CSS files
|
||||
gulp.src([
|
||||
'bower_components/alertify.js/dist/css/alertify.css',
|
||||
'bower_components/sanitize-css/dist/sanitize.min.css',
|
||||
'bower_components/sanitize-css/sanitize.css',
|
||||
])
|
||||
.pipe(gulp.dest('public/assets/css/'));
|
||||
.pipe(gulp.dest('public/assets/bower/'));
|
||||
});
|
||||
|
||||
gulp.task('compress', ['gzip-built-css', 'br-built-css', 'gzip-built-js', 'br-built-js']);
|
||||
gulp.task('compress', function () {
|
||||
//hand-made css
|
||||
gulp.src('public/build/assets/css/*.css')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/css/'));
|
||||
gulp.src('public/build/assets/css/*.css')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/css/'));
|
||||
//hand-made js
|
||||
gulp.src('public/build/assets/js/*.js')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/js/'));
|
||||
gulp.src('public/build/assets/js/*.js')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/js/'));
|
||||
//bower components
|
||||
gulp.src('public/build/assets/bower/*.css')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/bower/'));
|
||||
gulp.src('public/build/assets/bower/*.js')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/bower/'));
|
||||
gulp.src('public/build/assets/bower/*.css')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/bower/'));
|
||||
gulp.src('public/build/assets/bower/*.js')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/bower/'));
|
||||
//prism
|
||||
gulp.src('public/build/assets/prism/*.css')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/prism/'));
|
||||
gulp.src('public/build/assets/prism/*.js')
|
||||
.pipe(zopfli({ format: 'gzip', append: true }))
|
||||
.pipe(gulp.dest('public/build/assets/prism/'));
|
||||
gulp.src('public/build/assets/prism/*.css')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/prism/'));
|
||||
gulp.src('public/build/assets/prism/*.js')
|
||||
.pipe(brotli.compress({mode: 1, quality: 11}))
|
||||
.pipe(gulp.dest('public/build/assets/prism/'));
|
||||
});
|
||||
|
|
|
|||
21
package.json
21
package.json
|
|
@ -1,17 +1,30 @@
|
|||
{
|
||||
"name": "jbuk-frontend",
|
||||
"version": "0.0.1",
|
||||
"repository": "https://github.com/jonnybarnes/jbl5",
|
||||
"repository": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
||||
"license": "CC0-1.0",
|
||||
"devDependencies": {
|
||||
"gulp": "~3.9",
|
||||
"gulp-brotli": "^1.0.1",
|
||||
"gulp-zopfli": "^1.0.0",
|
||||
"laravel-elixir": "^5.0.0"
|
||||
"laravel-elixir": "^6.0.0-2",
|
||||
"lint-staged": "^1.0.1",
|
||||
"pre-commit": "^1.1.3",
|
||||
"stylelint": "^6.6.0",
|
||||
"stylelint-config-standard": "^9.0.0"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"prod": "gulp --production",
|
||||
"dev": "gulp watch"
|
||||
}
|
||||
"dev": "gulp watch",
|
||||
"lint-staged": "lint-staged",
|
||||
"stylelint-staged": "stylelint --syntax=scss"
|
||||
},
|
||||
"lint-staged": {
|
||||
"eslint": "resources/assets/js/*.js",
|
||||
"stylelint-staged": "resources/assets/sass/**/*.scss"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint-staged"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
10
public/assets/bower/Autolinker.min.js
vendored
Normal file
10
public/assets/bower/Autolinker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/assets/bower/alertify.css
vendored
Normal file
1
public/assets/bower/alertify.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.alertify-logs>*{padding:12px 24px;color:#fff;box-shadow:0 2px 5px 0 rgba(0,0,0,.2);border-radius:1px}.alertify-logs>*,.alertify-logs>.default{background:rgba(0,0,0,.8)}.alertify-logs>.error{background:rgba(244,67,54,.8)}.alertify-logs>.success{background:rgba(76,175,80,.9)}.alertify{position:fixed;background-color:rgba(0,0,0,.3);left:0;right:0;top:0;bottom:0;width:100%;height:100%;z-index:1}.alertify.hide{opacity:0;pointer-events:none}.alertify,.alertify.show{box-sizing:border-box;transition:all .33s cubic-bezier(.25,.8,.25,1)}.alertify,.alertify *{box-sizing:border-box}.alertify .dialog{padding:12px}.alertify .alert,.alertify .dialog{width:100%;margin:0 auto;position:relative;top:50%;transform:translateY(-50%)}.alertify .alert>*,.alertify .dialog>*{width:400px;max-width:95%;margin:0 auto;text-align:center;padding:12px;background:#fff;box-shadow:0 2px 4px -1px rgba(0,0,0,.14),0 4px 5px 0 rgba(0,0,0,.098),0 1px 10px 0 rgba(0,0,0,.084)}.alertify .alert .msg,.alertify .dialog .msg{padding:12px;margin-bottom:12px;margin:0;text-align:left}.alertify .alert input:not(.form-control),.alertify .dialog input:not(.form-control){margin-bottom:15px;width:100%;font-size:100%;padding:12px}.alertify .alert input:not(.form-control):focus,.alertify .dialog input:not(.form-control):focus{outline-offset:-2px}.alertify .alert nav,.alertify .dialog nav{text-align:right}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button),.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button){background:transparent;box-sizing:border-box;color:rgba(0,0,0,.87);position:relative;outline:0;border:0;display:inline-block;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:0 6px;margin:6px 8px;line-height:36px;min-height:36px;white-space:nowrap;min-width:88px;text-align:center;text-transform:uppercase;font-size:14px;text-decoration:none;cursor:pointer;border:1px solid transparent;border-radius:2px}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):active,.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):hover,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):active,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):hover{background-color:rgba(0,0,0,.05)}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):focus,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):focus{border:1px solid rgba(0,0,0,.1)}.alertify .alert nav button.btn,.alertify .dialog nav button.btn{margin:6px 4px}.alertify-logs{position:fixed;z-index:1}.alertify-logs.bottom,.alertify-logs:not(.top){bottom:16px}.alertify-logs.left,.alertify-logs:not(.right){left:16px}.alertify-logs.left>*,.alertify-logs:not(.right)>*{float:left;transform:translateZ(0);height:auto}.alertify-logs.left>.show,.alertify-logs:not(.right)>.show{left:0}.alertify-logs.left>*,.alertify-logs.left>.hide,.alertify-logs:not(.right)>*,.alertify-logs:not(.right)>.hide{left:-110%}.alertify-logs.right{right:16px}.alertify-logs.right>*{float:right;transform:translateZ(0)}.alertify-logs.right>.show{right:0;opacity:1}.alertify-logs.right>*,.alertify-logs.right>.hide{right:-110%;opacity:0}.alertify-logs.top{top:0}.alertify-logs>*{box-sizing:border-box;transition:all .4s cubic-bezier(.25,.8,.25,1);position:relative;clear:both;backface-visibility:hidden;perspective:1000;max-height:0;margin:0;padding:0;overflow:hidden;opacity:0;pointer-events:none}.alertify-logs>.show{margin-top:12px;opacity:1;max-height:1000px;padding:12px;pointer-events:auto}
|
||||
1
public/assets/bower/alertify.js
Normal file
1
public/assets/bower/alertify.js
Normal file
File diff suppressed because one or more lines are too long
393
public/assets/bower/fetch.js
Normal file
393
public/assets/bower/fetch.js
Normal file
|
|
@ -0,0 +1,393 @@
|
|||
(function(self) {
|
||||
'use strict';
|
||||
|
||||
if (self.fetch) {
|
||||
return
|
||||
}
|
||||
|
||||
function normalizeName(name) {
|
||||
if (typeof name !== 'string') {
|
||||
name = String(name)
|
||||
}
|
||||
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
|
||||
throw new TypeError('Invalid character in header field name')
|
||||
}
|
||||
return name.toLowerCase()
|
||||
}
|
||||
|
||||
function normalizeValue(value) {
|
||||
if (typeof value !== 'string') {
|
||||
value = String(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function Headers(headers) {
|
||||
this.map = {}
|
||||
|
||||
if (headers instanceof Headers) {
|
||||
headers.forEach(function(value, name) {
|
||||
this.append(name, value)
|
||||
}, this)
|
||||
|
||||
} else if (headers) {
|
||||
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
||||
this.append(name, headers[name])
|
||||
}, this)
|
||||
}
|
||||
}
|
||||
|
||||
Headers.prototype.append = function(name, value) {
|
||||
name = normalizeName(name)
|
||||
value = normalizeValue(value)
|
||||
var list = this.map[name]
|
||||
if (!list) {
|
||||
list = []
|
||||
this.map[name] = list
|
||||
}
|
||||
list.push(value)
|
||||
}
|
||||
|
||||
Headers.prototype['delete'] = function(name) {
|
||||
delete this.map[normalizeName(name)]
|
||||
}
|
||||
|
||||
Headers.prototype.get = function(name) {
|
||||
var values = this.map[normalizeName(name)]
|
||||
return values ? values[0] : null
|
||||
}
|
||||
|
||||
Headers.prototype.getAll = function(name) {
|
||||
return this.map[normalizeName(name)] || []
|
||||
}
|
||||
|
||||
Headers.prototype.has = function(name) {
|
||||
return this.map.hasOwnProperty(normalizeName(name))
|
||||
}
|
||||
|
||||
Headers.prototype.set = function(name, value) {
|
||||
this.map[normalizeName(name)] = [normalizeValue(value)]
|
||||
}
|
||||
|
||||
Headers.prototype.forEach = function(callback, thisArg) {
|
||||
Object.getOwnPropertyNames(this.map).forEach(function(name) {
|
||||
this.map[name].forEach(function(value) {
|
||||
callback.call(thisArg, value, name, this)
|
||||
}, this)
|
||||
}, this)
|
||||
}
|
||||
|
||||
function consumed(body) {
|
||||
if (body.bodyUsed) {
|
||||
return Promise.reject(new TypeError('Already read'))
|
||||
}
|
||||
body.bodyUsed = true
|
||||
}
|
||||
|
||||
function fileReaderReady(reader) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
reader.onload = function() {
|
||||
resolve(reader.result)
|
||||
}
|
||||
reader.onerror = function() {
|
||||
reject(reader.error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function readBlobAsArrayBuffer(blob) {
|
||||
var reader = new FileReader()
|
||||
reader.readAsArrayBuffer(blob)
|
||||
return fileReaderReady(reader)
|
||||
}
|
||||
|
||||
function readBlobAsText(blob) {
|
||||
var reader = new FileReader()
|
||||
reader.readAsText(blob)
|
||||
return fileReaderReady(reader)
|
||||
}
|
||||
|
||||
var support = {
|
||||
blob: 'FileReader' in self && 'Blob' in self && (function() {
|
||||
try {
|
||||
new Blob()
|
||||
return true
|
||||
} catch(e) {
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
formData: 'FormData' in self,
|
||||
arrayBuffer: 'ArrayBuffer' in self
|
||||
}
|
||||
|
||||
function Body() {
|
||||
this.bodyUsed = false
|
||||
|
||||
|
||||
this._initBody = function(body) {
|
||||
this._bodyInit = body
|
||||
if (typeof body === 'string') {
|
||||
this._bodyText = body
|
||||
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
||||
this._bodyBlob = body
|
||||
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
||||
this._bodyFormData = body
|
||||
} else if (!body) {
|
||||
this._bodyText = ''
|
||||
} else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
|
||||
// Only support ArrayBuffers for POST method.
|
||||
// Receiving ArrayBuffers happens via Blobs, instead.
|
||||
} else {
|
||||
throw new Error('unsupported BodyInit type')
|
||||
}
|
||||
|
||||
if (!this.headers.get('content-type')) {
|
||||
if (typeof body === 'string') {
|
||||
this.headers.set('content-type', 'text/plain;charset=UTF-8')
|
||||
} else if (this._bodyBlob && this._bodyBlob.type) {
|
||||
this.headers.set('content-type', this._bodyBlob.type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (support.blob) {
|
||||
this.blob = function() {
|
||||
var rejected = consumed(this)
|
||||
if (rejected) {
|
||||
return rejected
|
||||
}
|
||||
|
||||
if (this._bodyBlob) {
|
||||
return Promise.resolve(this._bodyBlob)
|
||||
} else if (this._bodyFormData) {
|
||||
throw new Error('could not read FormData body as blob')
|
||||
} else {
|
||||
return Promise.resolve(new Blob([this._bodyText]))
|
||||
}
|
||||
}
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
}
|
||||
|
||||
this.text = function() {
|
||||
var rejected = consumed(this)
|
||||
if (rejected) {
|
||||
return rejected
|
||||
}
|
||||
|
||||
if (this._bodyBlob) {
|
||||
return readBlobAsText(this._bodyBlob)
|
||||
} else if (this._bodyFormData) {
|
||||
throw new Error('could not read FormData body as text')
|
||||
} else {
|
||||
return Promise.resolve(this._bodyText)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.text = function() {
|
||||
var rejected = consumed(this)
|
||||
return rejected ? rejected : Promise.resolve(this._bodyText)
|
||||
}
|
||||
}
|
||||
|
||||
if (support.formData) {
|
||||
this.formData = function() {
|
||||
return this.text().then(decode)
|
||||
}
|
||||
}
|
||||
|
||||
this.json = function() {
|
||||
return this.text().then(JSON.parse)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
// HTTP methods whose capitalization should be normalized
|
||||
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
|
||||
|
||||
function normalizeMethod(method) {
|
||||
var upcased = method.toUpperCase()
|
||||
return (methods.indexOf(upcased) > -1) ? upcased : method
|
||||
}
|
||||
|
||||
function Request(input, options) {
|
||||
options = options || {}
|
||||
var body = options.body
|
||||
if (Request.prototype.isPrototypeOf(input)) {
|
||||
if (input.bodyUsed) {
|
||||
throw new TypeError('Already read')
|
||||
}
|
||||
this.url = input.url
|
||||
this.credentials = input.credentials
|
||||
if (!options.headers) {
|
||||
this.headers = new Headers(input.headers)
|
||||
}
|
||||
this.method = input.method
|
||||
this.mode = input.mode
|
||||
if (!body) {
|
||||
body = input._bodyInit
|
||||
input.bodyUsed = true
|
||||
}
|
||||
} else {
|
||||
this.url = input
|
||||
}
|
||||
|
||||
this.credentials = options.credentials || this.credentials || 'omit'
|
||||
if (options.headers || !this.headers) {
|
||||
this.headers = new Headers(options.headers)
|
||||
}
|
||||
this.method = normalizeMethod(options.method || this.method || 'GET')
|
||||
this.mode = options.mode || this.mode || null
|
||||
this.referrer = null
|
||||
|
||||
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||
throw new TypeError('Body not allowed for GET or HEAD requests')
|
||||
}
|
||||
this._initBody(body)
|
||||
}
|
||||
|
||||
Request.prototype.clone = function() {
|
||||
return new Request(this)
|
||||
}
|
||||
|
||||
function decode(body) {
|
||||
var form = new FormData()
|
||||
body.trim().split('&').forEach(function(bytes) {
|
||||
if (bytes) {
|
||||
var split = bytes.split('=')
|
||||
var name = split.shift().replace(/\+/g, ' ')
|
||||
var value = split.join('=').replace(/\+/g, ' ')
|
||||
form.append(decodeURIComponent(name), decodeURIComponent(value))
|
||||
}
|
||||
})
|
||||
return form
|
||||
}
|
||||
|
||||
function headers(xhr) {
|
||||
var head = new Headers()
|
||||
var pairs = (xhr.getAllResponseHeaders() || '').trim().split('\n')
|
||||
pairs.forEach(function(header) {
|
||||
var split = header.trim().split(':')
|
||||
var key = split.shift().trim()
|
||||
var value = split.join(':').trim()
|
||||
head.append(key, value)
|
||||
})
|
||||
return head
|
||||
}
|
||||
|
||||
Body.call(Request.prototype)
|
||||
|
||||
function Response(bodyInit, options) {
|
||||
if (!options) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
this.type = 'default'
|
||||
this.status = options.status
|
||||
this.ok = this.status >= 200 && this.status < 300
|
||||
this.statusText = options.statusText
|
||||
this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
|
||||
this.url = options.url || ''
|
||||
this._initBody(bodyInit)
|
||||
}
|
||||
|
||||
Body.call(Response.prototype)
|
||||
|
||||
Response.prototype.clone = function() {
|
||||
return new Response(this._bodyInit, {
|
||||
status: this.status,
|
||||
statusText: this.statusText,
|
||||
headers: new Headers(this.headers),
|
||||
url: this.url
|
||||
})
|
||||
}
|
||||
|
||||
Response.error = function() {
|
||||
var response = new Response(null, {status: 0, statusText: ''})
|
||||
response.type = 'error'
|
||||
return response
|
||||
}
|
||||
|
||||
var redirectStatuses = [301, 302, 303, 307, 308]
|
||||
|
||||
Response.redirect = function(url, status) {
|
||||
if (redirectStatuses.indexOf(status) === -1) {
|
||||
throw new RangeError('Invalid status code')
|
||||
}
|
||||
|
||||
return new Response(null, {status: status, headers: {location: url}})
|
||||
}
|
||||
|
||||
self.Headers = Headers
|
||||
self.Request = Request
|
||||
self.Response = Response
|
||||
|
||||
self.fetch = function(input, init) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var request
|
||||
if (Request.prototype.isPrototypeOf(input) && !init) {
|
||||
request = input
|
||||
} else {
|
||||
request = new Request(input, init)
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest()
|
||||
|
||||
function responseURL() {
|
||||
if ('responseURL' in xhr) {
|
||||
return xhr.responseURL
|
||||
}
|
||||
|
||||
// Avoid security warnings on getResponseHeader when not allowed by CORS
|
||||
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
|
||||
return xhr.getResponseHeader('X-Request-URL')
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
xhr.onload = function() {
|
||||
var status = (xhr.status === 1223) ? 204 : xhr.status
|
||||
if (status < 100 || status > 599) {
|
||||
reject(new TypeError('Network request failed'))
|
||||
return
|
||||
}
|
||||
var options = {
|
||||
status: status,
|
||||
statusText: xhr.statusText,
|
||||
headers: headers(xhr),
|
||||
url: responseURL()
|
||||
}
|
||||
var body = 'response' in xhr ? xhr.response : xhr.responseText
|
||||
resolve(new Response(body, options))
|
||||
}
|
||||
|
||||
xhr.onerror = function() {
|
||||
reject(new TypeError('Network request failed'))
|
||||
}
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
reject(new TypeError('Network request failed'))
|
||||
}
|
||||
|
||||
xhr.open(request.method, request.url, true)
|
||||
|
||||
if (request.credentials === 'include') {
|
||||
xhr.withCredentials = true
|
||||
}
|
||||
|
||||
if ('responseType' in xhr && support.blob) {
|
||||
xhr.responseType = 'blob'
|
||||
}
|
||||
|
||||
request.headers.forEach(function(value, name) {
|
||||
xhr.setRequestHeader(name, value)
|
||||
})
|
||||
|
||||
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
|
||||
})
|
||||
}
|
||||
self.fetch.polyfill = true
|
||||
})(typeof self !== 'undefined' ? self : this);
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue