release: v1.4.2
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
Fix batch tagging and upload token auth; single API token and tagNames-only upload; tag management sort and responsive layout.
This commit is contained in:
1 parent
6cc4f27f7d
commit
4ed4692f5e
24 files changed
+828
-370
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { readMultipartFormData } from 'h3'
|
||||
import { verifyUploadTokenValue } from '../../utils/access'
|
||||
import { verifyUploadTokenValue, getUploadUserId } from '../../utils/access'
|
||||
import { checkUploadRateLimit } from '../../utils/rate-limit'
|
||||
import {
|
||||
detectMimeFromSignature,
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
mimeMatchesDeclared,
|
||||
processSingleImageUpload
|
||||
} from '../../utils/process-image-upload'
|
||||
import { getApiUploadToken } from '../../utils/env'
|
||||
|
||||
/** EasyImages 2.0 兼容上传(Twikoo IMAGE_CDN=easyimage) */
|
||||
export default defineEventHandler(async (event) => {
|
||||
@@ -29,15 +28,14 @@ export default defineEventHandler(async (event) => {
|
||||
: ''
|
||||
|
||||
if (!devBypass) {
|
||||
if (!getApiUploadToken(event)) {
|
||||
return easyImageError(500, '服务端未配置 API_UPLOAD_TOKEN')
|
||||
}
|
||||
if (!verifyUploadTokenValue(event, token)) {
|
||||
if (!token || !verifyUploadTokenValue(event, token)) {
|
||||
return easyImageError(401, 'token 错误或无效')
|
||||
}
|
||||
checkUploadRateLimit(event, token)
|
||||
}
|
||||
|
||||
const uploadUserId = await getUploadUserId(event, token)
|
||||
|
||||
const imagePart = formData.find(
|
||||
part => part.name === 'image' && part.data?.length
|
||||
)
|
||||
@@ -60,7 +58,8 @@ export default defineEventHandler(async (event) => {
|
||||
const result = await processSingleImageUpload(event, {
|
||||
bytes,
|
||||
filename: imagePart.filename,
|
||||
source: 'api'
|
||||
source: 'api',
|
||||
userId: uploadUserId
|
||||
})
|
||||
|
||||
if ('error' in result) {
|
||||
|
||||
Reference in new issue
Block a user