diff --git a/api/index.php b/api/index.php index 229efde28..5b179efb6 100755 --- a/api/index.php +++ b/api/index.php @@ -6,7 +6,12 @@ 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 ef52e7d12..ecdda970d 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/\344\275\277\347\224\250PicGo\344\270\212\344\274\240.md" "b/docs/\344\275\277\347\224\250PicGo\344\270\212\344\274\240.md" index ab1aaeaf9..2125211b3 100644 --- "a/docs/\344\275\277\347\224\250PicGo\344\270\212\344\274\240.md" +++ "b/docs/\344\275\277\347\224\250PicGo\344\270\212\344\274\240.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/\344\275\277\347\224\250ShareX\344\270\212\344\274\240.md" "b/docs/\344\275\277\347\224\250ShareX\344\270\212\344\274\240.md" index 909a2f2ae..3748f9a8e 100644 --- "a/docs/\344\275\277\347\224\250ShareX\344\270\212\344\274\240.md" +++ "b/docs/\344\275\277\347\224\250ShareX\344\270\212\344\274\240.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)