Skip to content

Commit

Permalink
增强对第三方API兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
icret committed Mar 4, 2023
1 parent 271d1a4 commit 6cae61e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
7 changes: 6 additions & 1 deletion api/index.php
Expand Up @@ -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'])) {
Expand Down
1 change: 1 addition & 0 deletions docs/update.md
Expand Up @@ -8,6 +8,7 @@
- 更换存储密码算法为SHA256
- 默认不支持SVG文件上传
- 完全兼容 PHP5.6-8.0
- 对picgo/ShareX/盘络等第三方API增强兼容性
- 本次漏洞修复和代码增强感谢 [xulei1112](https://github.com/xulei1112)

* 2023-02-24 v2.7.5
Expand Down
10 changes: 5 additions & 5 deletions 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/
10 changes: 5 additions & 5 deletions docs/使用ShareX上传.md
Expand Up @@ -7,7 +7,7 @@

```ShareX
{
"Version": "13.5.0",
"Version": "15.0.0",
"Name": "简单图床API图片上传",
"DestinationType": "ImageUploader",
"RequestMethod": "POST",
Expand All @@ -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)
Expand Down

0 comments on commit 6cae61e

Please sign in to comment.