feat(storage): add archive storage support for assets (#514)

* feat(storage): add archive storage support for assets

* fix(webui): show archive icon in front of file name in breadcrumb bar

* fix(webui): display archive icon in breadcrumbs when restoring

* refactor(transcode): simplify restore asset workflow to single while loop

* docs(configuration): add archive storage documentation and readme entries

* fix(webui): show archive icon in front of version names and prevent version card overflow

* fix(webui): fix overflow in manage versions dialog scroll area

* fix(webui): prevent manage versions dialog overflow on long file names

* docs(configuration): fix archive storage environment variables and defaults

* fix(storage): address code review findings for archive storage
This commit is contained in:
Yiling-J
2026-11-03 20:31:56 +08:00
committed by GitHub
parent 49a2d7c380
commit ba3c6dbfee
110 changed files with 7013 additions and 199 deletions
+32 -9
View File
@@ -183,16 +183,39 @@ export const transcodeWatermarkMediaActivity = defineStep(
})
}
const inputKey = is3d
? (asset.media as PrismaJson.MediaInfo | null)?.videoTranscodes?.[0]?.key ||
const isArchived = Boolean(asset.storageKey.isArchived || asset.status === 'archived')
let inputKey: string | undefined
if (is3d) {
inputKey =
(asset.media as PrismaJson.MediaInfo | null)?.videoTranscodes?.[0]?.key ||
(asset.media as PrismaJson.MediaInfo | null)?.videoPreview?.key
: assetKey
if (is3d && !inputKey) {
throw ApplicationFailure.create({
message: `Turntable video transcode not found for 3D asset ${params.assetId}`,
nonRetryable: true,
})
if (!inputKey) {
throw ApplicationFailure.create({
message: `Turntable video transcode not found for 3D asset ${params.assetId}`,
nonRetryable: true,
})
}
} else if (isArchived) {
const media = asset.media as PrismaJson.MediaInfo | null
if (isVideo) {
const sortedVideos = [...(media?.videoTranscodes || [])]
.filter((t) => Boolean(t.key))
.sort((a, b) => (b.height || 0) - (a.height || 0))
inputKey = sortedVideos[0]?.key || media?.videoPreview?.key
} else if (isImage) {
const sortedImages = [...(media?.imageTranscodes || [])]
.filter((t) => Boolean(t.key))
.sort((a, b) => (b.width || 0) * (b.height || 0) - (a.width || 0) * (a.height || 0))
inputKey = sortedImages[0]?.key
}
if (!inputKey) {
throw ApplicationFailure.create({
message: `Original file is archived and no transcoded proxy is available in main storage for asset ${params.assetId}`,
nonRetryable: true,
})
}
} else {
inputKey = assetKey
}
const rawFilePath = path.join(tmpDir, path.basename(inputKey!))