Compare commits

...

172 Commits

Author SHA1 Message Date
LinkinStars 9e55ba4bb7 Merge branch 'refactor/file' into release/1.2.5
# Conflicts:
#	pkg/checker/file_type.go
2024-02-20 11:08:09 +08:00
LinkinStars b6aba55b7d ci(goreleaser): add wrap in directory 2024-01-30 16:35:28 +08:00
LinkinStars cf4e05fbc6 refactor(file): refactor file format check function 2024-01-30 16:16:07 +08:00
LinkinStars 5caabae82c Merge remote-tracking branch 'origin/main' into release/1.2.5 2024-01-29 19:12:41 +08:00
LinkinStars 83ae704747 Merge branch 'fix/1.2.5/file' into release/1.2.5 2024-01-29 19:12:26 +08:00
LinkinStars 0e178fc5e9 chore(lint): add ASF header 2024-01-29 17:17:11 +08:00
LinkinStars 387c4f6431 docs(upgrade): update version 1.2.5 2024-01-29 17:11:55 +08:00
LinkinStars 15358b8d16 feat(plugin): remove plugin log 2024-01-29 17:10:22 +08:00
LinkinStars 4852d4213b Merge remote-tracking branch 'origin/main' into test
# Conflicts:
#	internal/service/plugin_common/plugin_common_service.go
2024-01-29 17:04:31 +08:00
LinkinStars e9ca0c6458 Merge branch 'fix/1.2.5/summary' into test 2024-01-29 16:06:17 +08:00
LinkinStars 3c510073d7 Merge branch 'fix/1.2.5/signup' into test 2024-01-29 16:06:09 +08:00
LinkinStars d897e5f20a Merge branch 'dev' into test 2024-01-29 16:05:14 +08:00
dashuai 5f6e554ba5 Feat/1.2.5/UI (#758) 2024-01-29 15:41:38 +08:00
dashuai 1ed4f62612 Feat/1.2.5/UI (#757) 2024-01-29 15:30:54 +08:00
hbsciw db0eb2b583 fix: resolve MeiliSearch plugin not updating new answers 2024-01-29 14:12:10 +08:00
dashuai 2bd410544a Feat/1.2.5/UI (#756) 2024-01-29 10:51:12 +08:00
LinkinStars c435ec19f3 Merge branch 'feat/1.2.5/notification' into test 2024-01-26 19:12:00 +08:00
LinkinStars beb2f0c2dd feat(plugin): add config class 2024-01-26 19:11:45 +08:00
dashuai 9516dec4a4 Feat/1.2.5/UI (#753) 2024-01-26 17:39:23 +08:00
LinkinStars a9a7ff422c Merge branch 'feat/1.2.5/notification' into test 2024-01-26 16:26:46 +08:00
LinkinStars e606901575 feat(plugin): add config type 2024-01-26 16:25:01 +08:00
LinkinStars 9122bd9eef Merge branch 'feat/1.2.5/notification' into test 2024-01-26 15:34:26 +08:00
LinkinStars a54ec96237 fix(notification): change notification message type 2024-01-26 15:31:49 +08:00
dashuai 05117c3374 Feat/1.2.5/UI (#752) 2024-01-26 12:29:19 +08:00
shuai 0bac1c1436 fix: admin theme primary-color add reset btn 2024-01-26 10:45:57 +08:00
shuai 5a4c633653 fix: resolve conflict 2024-01-23 17:30:33 +08:00
shuai 6fd5980e55 fix: dark mode question detail info color 2024-01-23 17:27:36 +08:00
dashuai 6ddd6e07dd Feat/1.2.5/UI (#742) 2024-01-23 17:19:06 +08:00
shuai b3811a48cc fix: dark mode tag selector style 2024-01-23 17:16:05 +08:00
shuai 8c5f249ae8 fix: dark mode header nav light style 2024-01-23 16:23:14 +08:00
shuai 409eb60b87 fix: dark mode codemirrow selected style 2024-01-23 15:49:34 +08:00
shuai 12d4874a83 Merge branch 'feat/1.2.5/ui' into test 2024-01-23 12:06:20 +08:00
shuai 418666e3f7 fix: dark mode style 2024-01-23 12:04:03 +08:00
LinkinStars 2d1aea6200 Merge branch 'feat/1.2.5/notification' into test 2024-01-23 11:58:40 +08:00
LinkinStars a328e615ed fix(notification): update wrong notification type 2024-01-23 11:58:00 +08:00
shuai d159809fb1 fix: remove console 2024-01-19 16:01:30 +08:00
shuai 1e67ca909c fix: dark mode style optimizaiotn 2024-01-19 12:07:54 +08:00
LinkinStars 8574e4c824 Merge remote-tracking branch 'origin/dev' into test 2024-01-18 19:09:41 +08:00
LinkinStars 7d0f83731a fix(user): fix the captcha edit user type 2024-01-18 19:08:21 +08:00
shuai 64e2473a8a fix: conflict 2024-01-18 16:32:58 +08:00
Han Gao 1b1c994a22 fix: the answer's content in edit answer page disappears (#715)
fix #713 .

After changing to `useEffect`, the issue was resolved. I don't know why
we use `useLayoutEffect`. Pls let me know if something I missed.
2024-01-18 16:26:50 +08:00
Yang Wong d7daea4e0e Move sorting logic before setComments for clarity 2024-01-18 15:31:02 +08:00
Yang Wong bbc3e5c91e comments less than 3 resorting by created_at in frontend 2024-01-18 15:31:02 +08:00
Yang Wong 0f2ff8d83b fix issue: Display the number of unexpanded comments (apache#705) 2024-01-18 15:31:02 +08:00
shuai 5418bdb2fa fix: resolve conflict 2024-01-17 16:30:35 +08:00
shuai 28705b7edb Merge branch 'test' of github.com:answerdev/answer into test 2024-01-17 16:29:10 +08:00
shuai 9f63557046 fix: invite answer item add foucs function 2024-01-17 16:22:52 +08:00
LinkinStars 70152b5dc5 fix(user): update captcha strategy 2024-01-17 16:16:50 +08:00
dashuai 12eb388189 Feat/1.2.5/UI (#729) 2024-01-17 15:31:56 +08:00
shuai 8684b03e48 fix: tag editor blur state change 2024-01-17 15:10:40 +08:00
shuai 1ce1b12d6c fix: dark style optimization 2024-01-17 11:58:46 +08:00
LinkinStars 9b34c273b8 fix(activity): convert revision comment 2024-01-17 11:30:37 +08:00
LinkinStars 90bce89e04 Merge remote-tracking branch 'origin/dev' into test
# Conflicts:
#	ui/src/common/constants.ts
2024-01-17 10:37:05 +08:00
LinkinStars 5ee1ebd11c Merge branch 'feat/1.2.5/theme' into test 2024-01-17 10:32:07 +08:00
shuai 6bf3d3cf72 fix: default value 2024-01-17 10:01:37 +08:00
shuai ce82ef50a9 fix: style optimization 2024-01-16 18:41:41 +08:00
shuai f54715fe1d fix: change invite answer componet styles 2024-01-16 18:36:03 +08:00
hgaol 4375964eba resolve comments 2024-01-16 16:36:35 +08:00
hgaol 640690a5b7 update 2024-01-16 16:36:35 +08:00
hgaol a9849334e6 update 2024-01-16 16:36:35 +08:00
hgaol b743c1d24f fix hardcoded value 2024-01-16 16:36:35 +08:00
hgaol fdca1b977d add default custom privilige option 2024-01-16 16:36:35 +08:00
hgaol 7fc703325f add validation for privilege fields 2024-01-16 16:36:35 +08:00
hgaol 7259915d02 add custome privilege 2024-01-16 16:36:35 +08:00
hgaol e51f438e19 developing 2024-01-16 16:36:35 +08:00
shuai 1c6c084cda fix: delete theme console 2024-01-16 12:26:21 +08:00
shuai e89989a0de fix: conflict 2024-01-16 12:01:46 +08:00
shuai b3d64a963c fix: dark mode optimiazation 2024-01-16 11:58:05 +08:00
LinkinStars f111a4e269 feat(theme): set default color scheme 2024-01-16 10:46:20 +08:00
dashuai 6a62e8d3c0 Feat/1.2.5/UI (#727) 2024-01-16 10:42:51 +08:00
shuai 992bbc5c7c fix: delete console 2024-01-16 10:41:50 +08:00
shuai 8e1e55e089 feat: add dark mode 2024-01-16 10:38:20 +08:00
LinkinStars cb940bde95 feat(theme): site info add color scheme 2024-01-15 17:32:05 +08:00
LinkinStars 442a0c19b3 feat(theme): add migration for theme 2024-01-15 15:51:35 +08:00
LinkinStars 348607f64b Merge remote-tracking branch 'origin/test' into feat/1.2.5/theme 2024-01-15 15:44:39 +08:00
LinkinStars bab5737c84 feat(theme): add color scheme config 2024-01-15 15:44:27 +08:00
dashuai c58a2af505 Feat/1.2.5/UI (#719) 2024-01-11 16:56:31 +08:00
LinkinStars 05b5e66c35 fix(file): add check file rule 2024-01-11 16:52:31 +08:00
dashuai da65266014 Fix/UI notification (#718) 2024-01-11 16:37:40 +08:00
shuai 97e75c014a fix: optimization tag edtior 2024-01-11 16:25:44 +08:00
LinkinStars 4859b1d61c Merge branch 'fix/1.2.5/user' into test 2024-01-11 14:28:53 +08:00
LinkinStars 661a1c225b fix(user): move logout and change email router 2024-01-11 14:28:25 +08:00
LinkinStars a87a1ad9cd docs(README): add mockgen and wire in Prerequisites 2024-01-09 16:43:08 +08:00
LinkinStars d2471d9541 chore(asf): add asf header 2024-01-09 15:53:36 +08:00
LinkinStars 4b762804b9 chore(workflows): remove github action workflows 2024-01-09 15:50:40 +08:00
LinkinStars 57bc5d6a86 Merge remote-tracking branch 'origin/main' into dev 2024-01-09 15:47:23 +08:00
shuai 7f8e592415 fix: optimize tag editor interaction 2024-01-09 09:48:18 +08:00
LinkinStars 7ea206f5ec Merge remote-tracking branch 'origin/main' into dev 2024-01-08 15:26:24 +08:00
shuai 9c5934e531 fix: delete unused code 2024-01-04 14:19:02 +08:00
shuai 4ff480fbda fix: adjustment of invitation answer interaction mode 2024-01-04 14:18:04 +08:00
LinkinStars 618f63cdb2 Merge branch 'feat/1.2.5/noindex' into test 2024-01-03 15:51:24 +08:00
LinkinStars 458aec1f44 feat(template): add noindex meta tag #661 2024-01-03 15:50:47 +08:00
LinkinStars 7afef1049e Merge branch 'feat/1.2.5/notification' into test 2024-01-02 18:08:48 +08:00
LinkinStars ed8792ffc1 fix(notification): set right subscriber userID 2024-01-02 18:08:38 +08:00
LinkinStars 4163d8e5e2 Merge branch 'feat/1.2.5/notification' into test 2024-01-02 17:54:17 +08:00
LinkinStars efc8b9ea04 fix(notification): refactor new question notification 2024-01-02 17:53:17 +08:00
LinkinStars 2edd73a58f Merge branch 'feat/1.2.5/notification' into test
# Conflicts:
#	i18n/en_US.yaml
#	i18n/zh_CN.yaml
2024-01-02 15:31:54 +08:00
LinkinStars 0c8c8fd464 refactor(wire): update wire go 2024-01-02 15:30:15 +08:00
LinkinStars 51fb30860c Merge remote-tracking branch 'origin/dev' into feat/1.2.5/notification
# Conflicts:
#	cmd/wire_gen.go
2024-01-02 15:29:09 +08:00
LinkinStars a8e06213eb Merge branch 'dev' into feat/1.2.5/notification 2024-01-02 15:28:22 +08:00
LinkinStars a5d2a06935 refactor(asf): add asf header 2024-01-02 15:26:45 +08:00
dashuai 07b829dbc1 Fix/UI notification (#704) 2024-01-02 15:11:00 +08:00
LinkinStars 9f434ef751 feat(notification): add notification type for plugin 2024-01-02 14:53:13 +08:00
shuai 4b8ad99a3a fix: resolve conflict 2024-01-02 14:48:10 +08:00
Yang Wong 29b40ab862 Undo redundant commit files 2023-12-31 11:13:04 +08:00
Yang Wong 6817583e03 fix issue:userprofile hide unlisted post(#661) 2023-12-31 11:13:04 +08:00
LinkinStars f2656ec749 feat(notification): add notification for plugin 2023-12-28 17:01:43 +08:00
LinkinStars a005f004aa feat(notification): update notification config 2023-12-27 11:10:44 +08:00
LinkinStars 269882071d fix(plugin): remove disabled plugin form user plugin list 2023-12-26 17:27:22 +08:00
LinkinStars 645df7f2a6 feat(notification): add user config plugin API 2023-12-26 15:27:04 +08:00
Han Gao ec11a126c4 fix: tags will not be synced to search plugin when adding new question (#697)
fix #696 .

changes,
1. change `qr.updateSearch` to `qr.UpdateSearch` to make it accessible
outside.
2. update search (search plugin) after updating or adding records in the
`TagRel` table.

---------

Signed-off-by: Adam Vollrath <adam.d.vollrath@gmail.com>
Co-authored-by: sy-records <52o@qq52o.cn>
Co-authored-by: Adam Vollrath <adam.d.vollrath@gmail.com>
Co-authored-by: kumfo <kumfo@sifou.com>
2023-12-26 14:26:12 +08:00
shuai ba3f5a5a92 fix: tag form logic optimization arc 2023-12-26 11:14:42 +08:00
Lu Fei ab2be1479b feat(build): add timezone arg for dockerfile (#581)
close #528

---------

Signed-off-by: Adam Vollrath <adam.d.vollrath@gmail.com>
Co-authored-by: Adam Vollrath <adam.d.vollrath@gmail.com>
2023-12-22 13:59:20 +08:00
hgaol 67d1af366d update 2023-12-18 17:52:51 +08:00
hgaol e362ca8073 replace builder.Eq with In 2023-12-18 17:52:51 +08:00
hgaol fd75d2f50d update search question and answer 2023-12-18 17:52:51 +08:00
hgaol c0a231ede3 update for synonym tag logic 2023-12-18 17:52:51 +08:00
hgaol 4aa42891ce fix: questions with synonym tags do not show under the origin tag 2023-12-18 17:52:51 +08:00
LinkinStars 937f95df68 Merge branch 'dev' into test 2023-12-14 15:04:47 +08:00
LinkinStars c14a1f6eec Merge branch 'main' into dev 2023-12-14 15:03:57 +08:00
dashuai a637efae55 Fix/UI restrict answer (#675) 2023-12-13 16:57:41 +08:00
dashuai 95cdacefb4 fix: set restrict_answer default value true (#674) 2023-12-13 14:29:55 +08:00
LinkinStars ae6d98a32b fix(siteinfo): set default login config 2023-12-13 11:39:24 +08:00
LinkinStars 935ed47837 feat(answer): add default restrict_answer config 2023-12-13 11:15:05 +08:00
LinkinStars 9c7055b373 Merge branch 'dev' into test 2023-12-13 10:42:14 +08:00
Han Gao c81ea6597c feat: (restrict) users can only write one answer to the same question (#668)
users can only write one answer to the same question
2023-12-13 10:32:01 +08:00
LinkinStars 6f55ff7899 Merge branch 'fix/1.2.1/user' into test 2023-12-07 11:14:17 +08:00
LinkinStars f0ebcaf3f6 fix(activity): remove identical block fix #559 2023-12-07 11:13:36 +08:00
sy-records d7136ba0c9 fix: timeline page sort error 2023-12-07 11:08:28 +08:00
Han Gao b72058d1f6 fix: can't show tag description in tag edit page (#664)
fix #637 .
2023-12-07 11:08:28 +08:00
LinkinStars 088585e5d5 docs(image): rename all docker image name to apache/answer 2023-12-07 11:08:28 +08:00
shuai 7d28759470 fix: pnpm-lock 2023-12-06 11:48:53 +08:00
shuai 22687746e8 fix: conflcit 2023-12-06 11:12:38 +08:00
LinkinStars 36827ebc6b fix(user): remove deleted user from ranking 2023-12-05 14:44:06 +08:00
shuai 7a96ff5a8e feat: add logout page 2023-12-05 14:17:51 +08:00
LinkinStars 3fc0b3bce1 Merge branch 'dev' into test 2023-11-29 16:47:39 +08:00
LinkinStars 1a7cbb780b docs(swagger): update swagger docs 2023-11-29 16:46:49 +08:00
LinkinStars 42b4d74d98 Merge branch 'refactor/collection' into dev 2023-11-29 16:46:04 +08:00
LinkinStars b2de62d0b9 Merge remote-tracking branch 'origin/main' into dev 2023-11-29 16:45:51 +08:00
hgaol f1e6af0fab sort imports 2023-11-29 16:43:19 +08:00
hgaol 72ff929fab add default notification config for users registered by third party connector 2023-11-29 16:43:19 +08:00
kelvinkuo 138934692c simply the GetTagPage logic 2023-11-29 16:42:25 +08:00
kelvinkuo 7b709ece22 support tag search for synonyms 2023-11-29 16:42:25 +08:00
shuai 1f8d08ccd5 fix: update depedence 2023-11-29 16:34:04 +08:00
shuai 619149f37c fix: resolve conflict lock file 2023-11-29 16:23:24 +08:00
LinkinStars 8ddaba853b Merge branch 'feat/1.2.1/dashboard' into test 2023-11-29 16:14:00 +08:00
shuai ac18f302a6 fix: bookmark params changed 2023-11-28 18:00:01 +08:00
LinkinStars 0e430827c0 refactor(collection): refactor collection 2023-11-28 17:00:06 +08:00
dashuai 5bc5f3fba2 Feat/1.2.1/UI (#655) 2023-11-24 15:49:47 +08:00
shuai 75ad9862ca fix: change props name 2023-11-24 15:47:48 +08:00
shuai 587148882d fix: editor img btn props add editor instance 2023-11-24 15:46:56 +08:00
dashuai d598b1635b Feat/1.2.1/UI (#654) 2023-11-24 14:49:19 +08:00
shuai 81ad54c4c8 fix: the editor clicks the img button for the first time and it does not take effect 2023-11-24 14:47:39 +08:00
dashuai f770445993 Feat/1.2.1/UI (#650) 2023-11-24 11:13:14 +08:00
shuai 615d90f7c8 fix: editor auto focus 2023-11-24 11:09:02 +08:00
dashuai 6a0432bd12 Feat/1.2.1/UI (#645) 2023-11-21 17:44:34 +08:00
shuai ae95a95ea1 fix: fix some ui bugs 2023-11-21 17:43:30 +08:00
shuai c99b45014c fix: upgrade ui eslint dependences 2023-11-17 11:54:18 +08:00
LinkinStars 107316d2f5 fix(user): update the length of user avatar field #620 2023-11-16 16:07:30 +08:00
LinkinStars def4d8cbb7 feat(command): add config command to set default config 2023-11-16 15:55:03 +08:00
shuai a17ce16303 fix: resolve conflict 2023-11-15 14:20:04 +08:00
shuai 498daa36e3 fix: login default value 2023-11-15 14:14:11 +08:00
shuai 5a06b5d2ac fix: github links error 2023-11-15 12:40:32 +08:00
dashuai 175c042af0 Feat/1.2.1/UI (#623) 2023-11-15 12:00:07 +08:00
LinkinStars b4545157c0 feat(siteinfo): add allow_password_login config 2023-11-15 10:24:06 +08:00
shuai 913bd87977 feat: add background color to comment area #575 2023-11-14 12:09:37 +08:00
shuai d736547725 feat: allow admin can disable the default log in form #565 2023-11-14 11:28:56 +08:00
LinkinStars 92911e37be feat(dashboard): add more information to dashboard 2023-11-14 10:25:26 +08:00
shuai 21697044f8 fix: escape the label slug to prevent url errors 2023-11-13 17:49:05 +08:00
shuai 1975d0e46a fix: add debounce to similar questions #616 2023-11-13 17:45:44 +08:00
shuai 89e918ba97 fix: default pop-up box displays the cancel button 2023-11-13 17:41:48 +08:00
shuai 68994ac152 feat: dashboard improvement #617 2023-11-13 17:39:15 +08:00
3 changed files with 65 additions and 20 deletions
+2
View File
@@ -65,6 +65,7 @@ archives:
dst: licenses/
- src: "DISCLAIMER"
dst: DISCLAIMER
wrap_in_directory: true
checksum:
name_template: 'checksums.txt'
snapshot:
@@ -79,6 +80,7 @@ changelog:
source:
enabled: true
name_template: apache-answer-{{ .RawVersion }}-incubating-src
prefix_template: "apache-answer-{{ .RawVersion }}-incubating-src/"
# goreleaser release --skip-validate --skip-publish --clean
+1 -1
View File
@@ -244,7 +244,7 @@ func (us *uploaderService) uploadFile(ctx *gin.Context, file *multipart.FileHead
}
defer src.Close()
if !checker.IsSupportedImageFile(src, filepath.Ext(fileSubPath)) {
if !checker.IsSupportedImageFile(filePath) {
return "", errors.BadRequest(reason.UploadFileUnsupportedFileFormat)
}
+62 -19
View File
@@ -20,13 +20,18 @@
package checker
import (
"golang.org/x/image/webp"
"fmt"
"image"
_ "image/gif" // use init to support decode jpeg,jpg,png,gif
_ "image/jpeg"
_ "image/png"
"io"
"os"
"path/filepath"
"strings"
"github.com/segmentfault/pacman/log"
"golang.org/x/image/webp"
)
const (
@@ -35,47 +40,85 @@ const (
// IsSupportedImageFile currently answers support image type is
// `image/jpeg, image/jpg, image/png, image/gif, image/webp`
func IsSupportedImageFile(file io.Reader, ext string) bool {
ext = strings.ToLower(strings.TrimPrefix(ext, "."))
var err error
func IsSupportedImageFile(localFilePath string) bool {
ext := strings.ToLower(strings.TrimPrefix(filepath.Ext(localFilePath), "."))
switch ext {
case "jpg", "jpeg", "png", "gif": // only allow for `image/jpeg,image/jpg,image/png, image/gif`
if !checkImageSize(file) {
if !decodeAndCheckImageFile(localFilePath, standardImageConfigCheck) {
return false
}
if !decodeAndCheckImageFile(localFilePath, standardImageCheck) {
return false
}
_, _, err = image.Decode(file)
case "ico":
// TODO: There is currently no good Golang library to parse whether the image is in ico format.
return true
case "webp":
if !checkWebpSize(file) {
if !decodeAndCheckImageFile(localFilePath, webpImageConfigCheck) {
return false
}
if !decodeAndCheckImageFile(localFilePath, webpImageCheck) {
return false
}
_, err = webp.Decode(file)
default:
return false
}
return err == nil
return true
}
func checkImageSize(file io.Reader) bool {
func decodeAndCheckImageFile(localFilePath string, checker func(io.Reader) error) bool {
file, err := os.Open(localFilePath)
if err != nil {
log.Errorf("open file error: %v", err)
return false
}
defer file.Close()
if err = checker(file); err != nil {
log.Errorf("check image format error: %v", err)
return false
}
return true
}
func standardImageConfigCheck(file io.Reader) error {
config, _, err := image.DecodeConfig(file)
if err != nil {
return false
return fmt.Errorf("decode image config error: %v", err)
}
if (config.Width * config.Height) > maxImageSize {
return false
if imageSizeTooLarge(config) {
return fmt.Errorf("image size too large")
}
return true
return nil
}
func checkWebpSize(file io.Reader) bool {
func standardImageCheck(file io.Reader) error {
_, _, err := image.Decode(file)
if err != nil {
return fmt.Errorf("decode image error: %v", err)
}
return nil
}
func webpImageConfigCheck(file io.Reader) error {
config, err := webp.DecodeConfig(file)
if err != nil {
return false
return fmt.Errorf("decode webp image config error: %v", err)
}
if (config.Width * config.Height) > maxImageSize {
return false
if imageSizeTooLarge(config) {
return fmt.Errorf("image size too large")
}
return true
return nil
}
func webpImageCheck(file io.Reader) error {
_, err := webp.Decode(file)
if err != nil {
return fmt.Errorf("decode webp image error: %v", err)
}
return nil
}
func imageSizeTooLarge(config image.Config) bool {
return config.Width*config.Height > maxImageSize
}