This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/test by this push:
new 21655f68 feat(upload): add support for attachment uploads and improve
image handling
21655f68 is described below
commit 21655f68184c3879c47842fc2e13a9b80689fdf9
Author: LinkinStars <[email protected]>
AuthorDate: Wed Dec 4 14:58:27 2024 +0800
feat(upload): add support for attachment uploads and improve image handling
---
docs/docs.go | 49 +++++++++++++++++++++++++++++++--
docs/swagger.json | 49 +++++++++++++++++++++++++++++++--
docs/swagger.yaml | 31 +++++++++++++++++++++
internal/base/constant/upload.go | 19 +++++++++++++
ui/src/components/QueryGroup/index.scss | 19 +++++++++++++
5 files changed, 163 insertions(+), 4 deletions(-)
diff --git a/docs/docs.go b/docs/docs.go
index 424bd669..9e21f05b 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -3145,6 +3145,7 @@ const docTemplate = `{
{
"enum": [
"post",
+ "post_attachment",
"avatar",
"branding"
],
@@ -4483,7 +4484,8 @@ const docTemplate = `{
"hot",
"score",
"unanswered",
- "recommend"
+ "recommend",
+ "frequent"
],
"type": "string",
"name": "order",
@@ -9666,7 +9668,8 @@ const docTemplate = `{
"hot",
"score",
"unanswered",
- "recommend"
+ "recommend",
+ "frequent"
]
},
"page": {
@@ -10641,6 +10644,27 @@ const docTemplate = `{
"schema.SiteWriteReq": {
"type": "object",
"properties": {
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ },
"recommend_tags": {
"type": "array",
"items": {
@@ -10664,6 +10688,27 @@ const docTemplate = `{
"schema.SiteWriteResp": {
"type": "object",
"properties": {
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ },
"recommend_tags": {
"type": "array",
"items": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 7ec493b2..9b45f1cf 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -3118,6 +3118,7 @@
{
"enum": [
"post",
+ "post_attachment",
"avatar",
"branding"
],
@@ -4456,7 +4457,8 @@
"hot",
"score",
"unanswered",
- "recommend"
+ "recommend",
+ "frequent"
],
"type": "string",
"name": "order",
@@ -9639,7 +9641,8 @@
"hot",
"score",
"unanswered",
- "recommend"
+ "recommend",
+ "frequent"
]
},
"page": {
@@ -10614,6 +10617,27 @@
"schema.SiteWriteReq": {
"type": "object",
"properties": {
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ },
"recommend_tags": {
"type": "array",
"items": {
@@ -10637,6 +10661,27 @@
"schema.SiteWriteResp": {
"type": "object",
"properties": {
+ "authorized_attachment_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "authorized_image_extensions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "max_attachment_size": {
+ "type": "integer"
+ },
+ "max_image_megapixel": {
+ "type": "integer"
+ },
+ "max_image_size": {
+ "type": "integer"
+ },
"recommend_tags": {
"type": "array",
"items": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 4622e964..b8bade56 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1556,6 +1556,7 @@ definitions:
- score
- unanswered
- recommend
+ - frequent
type: string
page:
minimum: 1
@@ -2221,6 +2222,20 @@ definitions:
type: object
schema.SiteWriteReq:
properties:
+ authorized_attachment_extensions:
+ items:
+ type: string
+ type: array
+ authorized_image_extensions:
+ items:
+ type: string
+ type: array
+ max_attachment_size:
+ type: integer
+ max_image_megapixel:
+ type: integer
+ max_image_size:
+ type: integer
recommend_tags:
items:
$ref: '#/definitions/schema.SiteWriteTag'
@@ -2236,6 +2251,20 @@ definitions:
type: object
schema.SiteWriteResp:
properties:
+ authorized_attachment_extensions:
+ items:
+ type: string
+ type: array
+ authorized_image_extensions:
+ items:
+ type: string
+ type: array
+ max_attachment_size:
+ type: integer
+ max_image_megapixel:
+ type: integer
+ max_image_size:
+ type: integer
recommend_tags:
items:
$ref: '#/definitions/schema.SiteWriteTag'
@@ -4767,6 +4796,7 @@ paths:
- description: identify the source of the file upload
enum:
- post
+ - post_attachment
- avatar
- branding
in: formData
@@ -5601,6 +5631,7 @@ paths:
- score
- unanswered
- recommend
+ - frequent
in: query
name: order
type: string
diff --git a/internal/base/constant/upload.go b/internal/base/constant/upload.go
index 5a884ae7..c01c9279 100644
--- a/internal/base/constant/upload.go
+++ b/internal/base/constant/upload.go
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package constant
const (
diff --git a/ui/src/components/QueryGroup/index.scss
b/ui/src/components/QueryGroup/index.scss
index 9ab5b36d..3a05069f 100644
--- a/ui/src/components/QueryGroup/index.scss
+++ b/ui/src/components/QueryGroup/index.scss
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
.md-show {
display: flex !important;
}