diff --git a/composer.lock b/composer.lock index 6b1947c9..6454fcf2 100644 --- a/composer.lock +++ b/composer.lock @@ -6,68 +6,6 @@ ], "content-hash": "2a6f1476b71a2ab6a252565c5c2a39c7", "packages": [ - { - "name": "asm89/stack-cors", - "version": "v2.1.1", - "source": { - "type": "git", - "url": "https://github.com/asm89/stack-cors.git", - "reference": "73e5b88775c64ccc0b84fb60836b30dc9d92ac4a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/asm89/stack-cors/zipball/73e5b88775c64ccc0b84fb60836b30dc9d92ac4a", - "reference": "73e5b88775c64ccc0b84fb60836b30dc9d92ac4a", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.2|^8.0", - "symfony/http-foundation": "^4|^5|^6", - "symfony/http-kernel": "^4|^5|^6" - }, - "require-dev": { - "phpunit/phpunit": "^7|^9", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "psr-4": { - "Asm89\\Stack\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alexander", - "email": "iam.asm89@gmail.com" - } - ], - "description": "Cross-origin resource sharing library and stack middleware", - "homepage": "https://github.com/asm89/stack-cors", - "keywords": [ - "cors", - "stack" - ], - "support": { - "issues": "https://github.com/asm89/stack-cors/issues", - "source": "https://github.com/asm89/stack-cors/tree/v2.1.1" - }, - "time": "2022-01-18T09:12:03+00:00" - }, { "name": "aws/aws-crt-php", "version": "v1.0.2", @@ -126,16 +64,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.209.26", + "version": "3.209.27", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "bf29058fc637e4949ec42281e9572b9c968b38cc" + "reference": "4a0ded3a5f380f7654da5dc194161588a87d9d3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bf29058fc637e4949ec42281e9572b9c968b38cc", - "reference": "bf29058fc637e4949ec42281e9572b9c968b38cc", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4a0ded3a5f380f7654da5dc194161588a87d9d3b", + "reference": "4a0ded3a5f380f7654da5dc194161588a87d9d3b", "shasum": "", "mirrors": [ { @@ -217,9 +155,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.209.26" + "source": "https://github.com/aws/aws-sdk-php/tree/3.209.27" }, - "time": "2022-02-17T19:15:52+00:00" + "time": "2022-02-18T19:19:17+00:00" }, { "name": "brick/math", @@ -690,16 +628,16 @@ }, { "name": "fruitcake/laravel-cors", - "version": "v2.0.5", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/fruitcake/laravel-cors.git", - "reference": "3a066e5cac32e2d1cdaacd6b961692778f37b5fc" + "reference": "361d71f00a0eea8b74da26ae75d0d207c53aa5b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/3a066e5cac32e2d1cdaacd6b961692778f37b5fc", - "reference": "3a066e5cac32e2d1cdaacd6b961692778f37b5fc", + "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/361d71f00a0eea8b74da26ae75d0d207c53aa5b3", + "reference": "361d71f00a0eea8b74da26ae75d0d207c53aa5b3", "shasum": "", "mirrors": [ { @@ -709,12 +647,10 @@ ] }, "require": { - "asm89/stack-cors": "^2.0.1", + "fruitcake/php-cors": "^1", "illuminate/contracts": "^6|^7|^8|^9", "illuminate/support": "^6|^7|^8|^9", - "php": ">=7.2", - "symfony/http-foundation": "^4|^5|^6", - "symfony/http-kernel": "^4.3.4|^5|^6" + "php": ">=7.2" }, "require-dev": { "laravel/framework": "^6|^7.24|^8", @@ -725,7 +661,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" }, "laravel": { "providers": [ @@ -761,7 +697,7 @@ ], "support": { "issues": "https://github.com/fruitcake/laravel-cors/issues", - "source": "https://github.com/fruitcake/laravel-cors/tree/v2.0.5" + "source": "https://github.com/fruitcake/laravel-cors/tree/v2.1.0" }, "funding": [ { @@ -773,7 +709,80 @@ "type": "github" } ], - "time": "2022-01-03T14:53:04+00:00" + "time": "2022-02-19T14:17:28+00:00" + }, + { + "name": "fruitcake/php-cors", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/fruitcake/php-cors.git", + "reference": "07611b4d603a72f097aeeeeb1e67d5ae7a6d0798" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fruitcake/php-cors/zipball/07611b4d603a72f097aeeeeb1e67d5ae7a6d0798", + "reference": "07611b4d603a72f097aeeeeb1e67d5ae7a6d0798", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2|^8.0", + "symfony/http-foundation": "^4|^5|^6" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "phpunit/phpunit": "^7|^9", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Fruitcake\\Cors\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barryvdh", + "email": "barryvdh@gmail.com" + } + ], + "description": "Cross-origin resource sharing library for the Symfony HttpFoundation", + "homepage": "https://github.com/fruitcake/php-cors", + "keywords": [ + "cors", + "laravel", + "symfony" + ], + "support": { + "issues": "https://github.com/fruitcake/php-cors/issues", + "source": "https://github.com/fruitcake/php-cors/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2022-02-19T16:21:54+00:00" }, { "name": "graham-campbell/result-type", @@ -8236,16 +8245,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "665a1ac0a763c51afc30d6d130dac0813092b17f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/665a1ac0a763c51afc30d6d130dac0813092b17f", + "reference": "665a1ac0a763c51afc30d6d130dac0813092b17f", "shasum": "", "mirrors": [ { @@ -8307,7 +8316,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.11" }, "funding": [ { @@ -8315,7 +8324,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-02-18T12:46:09+00:00" }, { "name": "phpunit/php-file-iterator", @@ -8584,16 +8593,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.13", + "version": "9.5.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "597cb647654ede35e43b137926dfdfef0fb11743" + "reference": "1883687169c017d6ae37c58883ca3994cfc34189" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743", - "reference": "597cb647654ede35e43b137926dfdfef0fb11743", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1883687169c017d6ae37c58883ca3994cfc34189", + "reference": "1883687169c017d6ae37c58883ca3994cfc34189", "shasum": "", "mirrors": [ { @@ -8677,7 +8686,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.14" }, "funding": [ { @@ -8689,7 +8698,7 @@ "type": "github" } ], - "time": "2022-01-24T07:33:35+00:00" + "time": "2022-02-18T12:54:07+00:00" }, { "name": "sebastian/cli-parser", diff --git a/public/css/app.css b/public/css/app.css index f042518e..214558d5 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -748,6 +748,14 @@ select { margin-top: -0.5rem; margin-bottom: -0.5rem; } +.mx-1 { + margin-left: 0.25rem; + margin-right: 0.25rem; +} +.my-1 { + margin-top: 0.25rem; + margin-bottom: 0.25rem; +} .ml-3 { margin-left: 0.75rem; } @@ -823,6 +831,9 @@ select { .-mr-2 { margin-right: -0.5rem; } +.mb-1 { + margin-bottom: 0.25rem; +} .block { display: block; } @@ -1174,6 +1185,11 @@ select { border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); border-bottom-width: calc(1px * var(--tw-divide-y-reverse)); } +.divide-x > :not([hidden]) ~ :not([hidden]) { + --tw-divide-x-reverse: 0; + border-right-width: calc(1px * var(--tw-divide-x-reverse)); + border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse))); +} .divide-solid > :not([hidden]) ~ :not([hidden]) { border-style: solid; } @@ -1375,6 +1391,10 @@ select { --tw-bg-opacity: 1; background-color: rgb(254 242 242 / var(--tw-bg-opacity)); } +.bg-gray-400 { + --tw-bg-opacity: 1; + background-color: rgb(156 163 175 / var(--tw-bg-opacity)); +} .bg-opacity-75 { --tw-bg-opacity: 0.75; } @@ -1515,6 +1535,21 @@ select { .pb-1 { padding-bottom: 0.25rem; } +.pl-2 { + padding-left: 0.5rem; +} +.pl-6 { + padding-left: 1.5rem; +} +.pl-12 { + padding-left: 3rem; +} +.pl-8 { + padding-left: 2rem; +} +.pl-10 { + padding-left: 2.5rem; +} .text-left { text-align: left; } @@ -1575,6 +1610,9 @@ select { .font-bold { font-weight: 700; } +.font-normal { + font-weight: 400; +} .uppercase { text-transform: uppercase; } diff --git a/resources/views/common/api.blade.php b/resources/views/common/api.blade.php index 39423b75..bb6ce1fb 100644 --- a/resources/views/common/api.blade.php +++ b/resources/views/common/api.blade.php @@ -2,7 +2,191 @@
- {{ Auth::user()->tokens }} +

接口说明

+
+
+

接口URL

+ {{ request()->getSchemeAndHttpHost() }}/api/v1 +

请求接口时,必须设置 header 标头 Accept: application/json。

+
+ +
+

验证方式

+
+ 当前版本接口采用 「HTTP 基本验证」的方式验证授权,通过接口获取 token 后,通过设置请求 header 标头来验证请求,例如: + "Authorization": "1|1bJbwlqBfnggmOMEZqXT5XusaIwqiZjCDs7r1Ob5" + 或者: + "Authorization": "Bearer 1|1bJbwlqBfnggmOMEZqXT5XusaIwqiZjCDs7r1Ob5" +

如果未设置 Authorization 的情况下请求上传接口,将被视为游客上传。

+
+
+
+ +

图片相关

+
+
+

上传图片

+ POST /upload + +
+

Headers

+ + + + + + + + + + + + + + + +
+ 字段 + + 类型 + + 说明 +
Content-TypeString需要设置为 multipart/form-data
+
+ +
+

请求参数

+ + + + + + + + + + + + + + + +
+ 字段 + + 类型 + + 说明 +
fileFile图片文件
+
+ +
+

返回参数

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 字段 + + 类型 + + 说明 +
statusBoolean状态,true 或 false
messageString描述信息
dataObject图片数据
idInteger图片唯一ID
pathnameString图片路径名
origin_nameString图片原始名
sizeFloat图片大小,单位 KB
mimetypeString图片类型
md5String图片 md5 值
sha1String图片 sha1 值
linksObject链接
urlString图片访问 url
htmlString-
bbcodeString-
markdownString-
markdown_with_linkString-
thumbnail_urlString缩略图 url
+
+
+
@push('scripts') diff --git a/resources/views/components/code.blade.php b/resources/views/components/code.blade.php new file mode 100644 index 00000000..295e0cfa --- /dev/null +++ b/resources/views/components/code.blade.php @@ -0,0 +1,3 @@ +
merge(['class' => 'my-2 bg-white rounded-md p-4 text-sm bg-gray-500 text-white overflow-x-auto']) }}>
+{{ $slot ?? '' }}
+
diff --git a/routes/api.php b/routes/api.php index 7ca240c9..a173790f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,6 +2,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; +use App\Http\Controllers\Controller; /* |-------------------------------------------------------------------------- @@ -17,6 +18,8 @@ use Illuminate\Support\Facades\Route; use App\Http\Controllers\Api\V1\TokenController; Route::group(['prefix' => 'v1'], function () { + Route::post('upload', [Controller::class, 'upload']); + Route::group([ 'middleware' => 'auth:sanctum', ], function () {