Skip to content

Commit

Permalink
feat(upload): add support for attachment uploads and improve image ha…
Browse files Browse the repository at this point in the history
…ndling
  • Loading branch information
LinkinStars committed Dec 4, 2024
1 parent 0d41ee9 commit 21655f6
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 4 deletions.
49 changes: 47 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3145,6 +3145,7 @@ const docTemplate = `{
{
"enum": [
"post",
"post_attachment",
"avatar",
"branding"
],
Expand Down Expand Up @@ -4483,7 +4484,8 @@ const docTemplate = `{
"hot",
"score",
"unanswered",
"recommend"
"recommend",
"frequent"
],
"type": "string",
"name": "order",
Expand Down Expand Up @@ -9666,7 +9668,8 @@ const docTemplate = `{
"hot",
"score",
"unanswered",
"recommend"
"recommend",
"frequent"
]
},
"page": {
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
49 changes: 47 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3118,6 +3118,7 @@
{
"enum": [
"post",
"post_attachment",
"avatar",
"branding"
],
Expand Down Expand Up @@ -4456,7 +4457,8 @@
"hot",
"score",
"unanswered",
"recommend"
"recommend",
"frequent"
],
"type": "string",
"name": "order",
Expand Down Expand Up @@ -9639,7 +9641,8 @@
"hot",
"score",
"unanswered",
"recommend"
"recommend",
"frequent"
]
},
"page": {
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
31 changes: 31 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,7 @@ definitions:
- score
- unanswered
- recommend
- frequent
type: string
page:
minimum: 1
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -4767,6 +4796,7 @@ paths:
- description: identify the source of the file upload
enum:
- post
- post_attachment
- avatar
- branding
in: formData
Expand Down Expand Up @@ -5601,6 +5631,7 @@ paths:
- score
- unanswered
- recommend
- frequent
in: query
name: order
type: string
Expand Down
19 changes: 19 additions & 0 deletions internal/base/constant/upload.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
19 changes: 19 additions & 0 deletions ui/src/components/QueryGroup/index.scss
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down

0 comments on commit 21655f6

Please sign in to comment.