Skip to content

Commit

Permalink
support upload webp format image as picture when send tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Jan 20, 2024
1 parent e937eb5 commit 2c11957
Show file tree
Hide file tree
Showing 45 changed files with 3,697 additions and 3,757 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to paopao-ce are documented in this file.
- add all-in-one docker image build scripts.
- frontend: add tweets filter support use tag for home page and make it as default behavior.
- add pin topic support.
- support upload webp format image as picture when send tweet.

## 0.5.2
### Change
Expand Down
4 changes: 3 additions & 1 deletion internal/model/web/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func fileCheck(uploadType string, size int64) mir.Error {

func getFileExt(s string) (string, mir.Error) {
switch s {
case "image/webp":
return ".webp", nil
case "image/png":
return ".png", nil
case "image/jpg":
Expand All @@ -42,6 +44,6 @@ func getFileExt(s string) (string, mir.Error) {
"application/x-zip-compressed":
return ".zip", nil
default:
return "", ErrFileInvalidExt.WithDetails("仅允许 png/jpg/gif/mp4/mov/zip 类型")
return "", ErrFileInvalidExt.WithDetails("仅允许 webp/png/jpg/gif/mp4/mov/zip 类型")
}
}
2 changes: 1 addition & 1 deletion web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ VITE_COPYRIGHT_RIGHT_LINK="https://www.paopao.info"
# 图片推文参数
VITE_DEFAULT_TWEET_IMAGE_404="https://paopao-assets.oss-cn-shanghai.aliyuncs.com/public/404.png"
# AliOSS 图片thumbnail参数
VITE_TWEET_IMAGE_THUMBNAIL="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,png"
VITE_TWEET_IMAGE_THUMBNAIL="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,webp"
# MinIOn 图片thumbnail参数
# VITE_TWEET_IMAGE_THUMBNAIL="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,png"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions web/dist/assets/@opentiny-aQTMhBID.js

This file was deleted.

2 changes: 2 additions & 0 deletions web/dist/assets/@opentiny-uoOjf5Au.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 2c11957

Please sign in to comment.