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

🌆 图片上传功能 #95

Merged
merged 4 commits into from
Apr 13, 2022
Merged

🌆 图片上传功能 #95

merged 4 commits into from
Apr 13, 2022

Conversation

qwqcode
Copy link
Member

@qwqcode qwqcode commented Apr 13, 2022

  • 支持按钮图片上传
  • 支持拖拽图片上传 (类似于 GitHub issues 评论框逻辑)
  • 当后端 img_upload.enabledfalse 时,非管理员图片上传按钮自动隐藏
  • 增加 Api.imgUpload 方法,适配后端新增 /api/img-upload
  • 增加 conf-updated 事件,以后 this.ctx.conf set 时需要手动 trigger 一下
  • 上传到 GitHub 仓库或各种图床,可搭配 https://github.com/pluveto/upgit 使用

后端更新

关联后端 PR:ArtalkJS/ArtalkGo#18

  • 支持指定上传目录 img_upload.path
  • 图片大小限制 img_upload.max_size
  • 支持指定 img_upload.public_path
  • 支持验证码请求限制,跟随 captcha 开启
  • 功能开关 img_upload.enabled,当设为 false 时仅管理员可上传
  • 调用 upgit 可以上传到各种图床或 GitHub 仓库,配置 img_upload.upgit

本次更新变动配置文件,可参考最新 artalk.config.example.yml

演示

0g9rl-711un

TODOs

  • 多张图片同时上传有待测试
  • 上传过程中改变 textarea.value 加载中占位字符会导致上传失败

Signed-off-by: qwqcode <qwqcode@gmail.com>
Signed-off-by: qwqcode <qwqcode@gmail.com>
Signed-off-by: qwqcode <qwqcode@gmail.com>
Signed-off-by: qwqcode <qwqcode@gmail.com>
@qwqcode qwqcode merged commit d119336 into master Apr 13, 2022
@qwqcode qwqcode deleted the img-upload branch April 13, 2022 16:46
qwqcode referenced this pull request Apr 13, 2022
Signed-off-by: qwqcode <qwqcode@gmail.com>
@qwqcode qwqcode mentioned this pull request Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant