From 6cae61ee339fae7ad6bfe35398ed4a28cf3327fd Mon Sep 17 00:00:00 2001 From: icret Date: Sat, 4 Mar 2023 17:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=AF=B9=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9API=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/index.php | 7 ++++++- docs/update.md | 1 + docs/使用PicGo上传.md | 10 +++++----- docs/使用ShareX上传.md | 10 +++++----- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/api/index.php b/api/index.php index 229efde..5b179ef 100755 --- a/api/index.php +++ b/api/index.php @@ -6,7 +6,12 @@ require_once __DIR__ . '/../application/function.php'; require_once APP_ROOT . '/application/class.upload.php'; require_once APP_ROOT . '/config/api_key.php'; -header('Access-Control-Allow-Origin:*'); +// 允许跨域 https://stackoverflow.com/questions/8719276/cross-origin-request-headerscors-with-php-headers +header("Access-Control-Max-Age: 3600"); +header("Access-Control-Allow-Origin: *"); +header("Access-Control-Allow-Credentials: true"); +header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE"); +header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding"); // 无文件 if (empty($_FILES['image'])) { diff --git a/docs/update.md b/docs/update.md index ef52e7d..ecdda97 100644 --- a/docs/update.md +++ b/docs/update.md @@ -8,6 +8,7 @@ - 更换存储密码算法为SHA256 - 默认不支持SVG文件上传 - 完全兼容 PHP5.6-8.0 +- 对picgo/ShareX/盘络等第三方API增强兼容性 - 本次漏洞修复和代码增强感谢 [xulei1112](https://github.com/xulei1112) * 2023-02-24 v2.7.5 diff --git a/docs/使用PicGo上传.md b/docs/使用PicGo上传.md index ab1aaea..2125211 100644 --- a/docs/使用PicGo上传.md +++ b/docs/使用PicGo上传.md @@ -1,18 +1,18 @@ -1. 下载最新版[PicGo-windows版][1]或者[PicGo-mac版][2](我下载的版本是:PicGo-Setup-2.3.1-x64) +1. 下载最新版[PicGo-windows版][1]或者[PicGo-mac版][2](测试版本:PicGo-Setup-2.3.1-x64/PicGo-Setup-2.4.0-beta.0-x64) 2. 安装后在插件设置中搜索`web-uploader 1.1.1` 并安装(下载插件可能需要[node.js][3]插件) 3. 图床设置-自定义Web图床中按照如下方式填写,然后点击确定并设置为默认图床。 4. 登录图床后台->图床安全->高级设置->开启API上传 + +![EasyImage简单图床使用PicGo上传图片](images/4128197507.png) + ```PicGo -API地址:https://png.cm/api/index.php // 输入你的网站api地址 +API地址:https://png.cm/api/index.php // 输入你网站api地址 POST参数名: image JSON路径: url 自定义Body: {"token":"1c17b11693cb5ec63859b091c5b9c1b2"} // 这里输入你网站生成的token ``` -![EasyImage简单图床使用PicGo上传图片](images/4128197507.png) - - [1]: https://github.com/Molunerfinn/PicGo/releases [2]: https://github.com/Molunerfinn/PicGo/releases [3]: https://nodejs.org/zh-cn/ diff --git a/docs/使用ShareX上传.md b/docs/使用ShareX上传.md index 909a2f2..3748f9a 100644 --- a/docs/使用ShareX上传.md +++ b/docs/使用ShareX上传.md @@ -7,7 +7,7 @@ ```ShareX { - "Version": "13.5.0", + "Version": "15.0.0", "Name": "简单图床API图片上传", "DestinationType": "ImageUploader", "RequestMethod": "POST", @@ -17,10 +17,10 @@ "token": "8337effca0ddfcd9c5899f3509b23657" }, "FileFormName": "image", - "URL": "$json:url$", - "ThumbnailURL": "$json:thumb$", - "DeletionURL": "$json:del$", - "ErrorMessage": "$json:message$" + "URL": "{json:url}", + "ThumbnailURL": "{json:thumb}", + "DeletionURL": "{json:del}", + "ErrorMessage": "{json:message}" } ``` ![](images/ShareX_UwVwPnC3MJ.png)