Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: 可以通过action直接请求上传接口,并移除key与secret的注入 #119

Merged
merged 12 commits into from
Dec 4, 2019

Conversation

donaldshen
Copy link
Contributor

@donaldshen donaldshen commented Nov 29, 2019

Why

之前的上传方式使得 oss 的 key & secret 暴露在前端。十分危险。

How

以后必须使用以下两种方式之一上传:

  1. 传入 action 作为上传地址。上传地址接受 file 作为 formData 的参数的 POST 请求。其返回的数据格式如下:
{
  payload: {
    url: '上传后的地址',
  }
}
  1. 传入 request 函数。完全自定义上传逻辑。request 函数需要接受 file 类型的参数,返回一个上传后的地址

Test

image

@auto-add-label auto-add-label bot added the enhancement New feature or request label Nov 29, 2019
@netlify
Copy link

netlify bot commented Nov 29, 2019

Deploy preview for upload-to-ali ready!

Built with commit 7b39f8d

https://deploy-preview-119--upload-to-ali.netlify.com

newClient() {
const missingKey = [
'region',
'bucket',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑在组件里声明可用的 bucket 选项

@donaldshen donaldshen changed the title feat: 使用接口上传 feat!: 使用接口上传 Nov 30, 2019
@levy9527 levy9527 changed the title feat!: 使用接口上传 refactor!: 移除key与secret的注入 Dec 2, 2019
@levy9527 levy9527 changed the title refactor!: 移除key与secret的注入 feat!: 可以通过action直接请求上传接口,并移除key与secret的注入 Dec 4, 2019
@levy9527 levy9527 changed the title feat!: 可以通过action直接请求上传接口,并移除key与secret的注入 feat!: 可以通过action直接请求上传接口,并移除key与secret的注入 Dec 4, 2019
@levy9527 levy9527 changed the title feat!: 可以通过action直接请求上传接口,并移除key与secret的注入 fix!: 可以通过action直接请求上传接口,并移除key与secret的注入 Dec 4, 2019
@levy9527 levy9527 removed breaking-change enhancement New feature or request labels Dec 4, 2019
@levy9527 levy9527 changed the title fix!: 可以通过action直接请求上传接口,并移除key与secret的注入 feat!: 可以通过action直接请求上传接口,并移除key与secret的注入 Dec 4, 2019
@levy9527 levy9527 merged commit 455cf18 into FEMessage:dev Dec 4, 2019
@levy9527
Copy link
Contributor

levy9527 commented Dec 4, 2019

@all-contributors add @donaldshen test

@allcontributors
Copy link
Contributor

@levy9527

I've put up a pull request to add @donaldshen! 🎉

@donaldshen donaldshen deleted the feat/request branch December 4, 2019 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants