release: v1.4.3
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

Add a Telegram channel or group storage backend, with proxied image URLs and an optional API proxy.
This commit is contained in:
O96u committed 2026-10-09 15:39:24 +08:00
1 parent 4ed4692f5e
commit cc19dc6435
32 files changed
+1527 -143

No files matched your search

+9 -5
View File
@@ -12,8 +12,8 @@ import { generateImageKey } from './image-key'
import { buildImageItem, sanitizeOriginalName } from './image-response'
import { getStorageLayout, getWebpQuality } from './env'
import {
formatMaxFileSizeMessage,
getMaxFileSizeBytes,
formatEffectiveMaxFileSizeMessage,
getEffectiveMaxFileSizeBytes,
isMimeTypeAllowed,
isPreserveOriginalUpload
} from './upload-policy'
@@ -73,13 +73,13 @@ export async function processSingleImageUpload(
const originalName = sanitizeOriginalName(input.filename ?? 'image')
const bytes = input.bytes
if (bytes.byteLength > getMaxFileSizeBytes()) {
if (bytes.byteLength > getEffectiveMaxFileSizeBytes()) {
return {
error: {
name: originalName,
error: {
code: 'FILE_TOO_LARGE',
message: formatMaxFileSizeMessage()
message: formatEffectiveMaxFileSizeMessage()
}
}
}
@@ -144,12 +144,16 @@ export async function processSingleImageUpload(
name: originalName,
source: input.source ?? 'web'
})
const detail = error instanceof Error ? error.message.trim() : ''
const message = detail.startsWith('Telegram') || detail.includes('群组')
? detail
: '上传失败,请稍后重试'
return {
error: {
name: originalName,
error: {
code: 'UPLOAD_FAILED',
message: '上传失败,请稍后重试'
message
}
}
}