mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 19:04:23 +00:00
feat(webui): remove original-file display fallbacks, use proxies only (#273)
* feat(webui): remove original-file display fallbacks, use proxies only WebUI now never uses the raw original file for display. All viewers (image, video, compare, pdf) render exclusively from transcoded proxies; when no proxy exists the viewer shows an unavailable placeholder instead of falling back to media.original. - getBestTranscode: drop the isRaw fallback candidates - video-viewer / compare-video-pane: remove the synthetic 'Original' resolution entry and the original.downloadUrl hasMedia gate - image-viewer / compare-image-pane: remove original.downloadUrl default - pdf-viewer: require pdfTranscode.url (no original fallback) - download menus (video-control-bar, breadcrumb-nav): use media.original.key for the 'Original' download option instead of the isRaw transcode marker entry Backend: - transcode-video workflow no longer pushes the isRaw:true marker entry into videoTranscodes (it pointed at the original file key) - remove media.original.downloadUrl from the DTO, asset service mapping, MediaInfo DB type, and transcode workflows/activities (it was only consumed by the removed display fallbacks; downloads already use key via the download-url endpoints) Tests/fixtures updated; docs updated to state the proxy-only display policy. * refactor: remove isRaw field via data migration, clean legacy media JSON Add a Prisma data migration that cleans legacy media JSONB on both assets and watermark_files: - drop the raw-original marker entries (isRaw: true) from videoTranscodes / imageTranscodes — they pointed at the original file key and were only used by the removed display fallbacks / download menus, which now use media.original.key directly - strip the isRaw field from remaining transcode entries - drop original.downloadUrl (removed from the AssetInfo DTO) The migration is generated via prisma migrate dev --create-only and applied automatically by migrate deploy in production. It is guarded by a test (packages/db/src/clean-media-migration.test.ts) that seeds legacy media JSON, runs the migration SQL, and asserts the transform on both tables. With the data cleaned, remove the isRaw field entirely from the codebase: - DTO schemas + ImageTranscode/VideoTranscode interfaces - PrismaJson MediaInfo transcode types - watermark activity isRaw skip (and its test), watermark proxy mapping, agent-embedding transcode selection, webui transcode filters, and all test fixtures AGENTS.md: clarify that the no-manual-migration rule applies to DDL; data migrations (pure SQL transforms, no schema change) are allowed inside a --create-only generated migration and must be tested.
This commit is contained in:
@@ -54,7 +54,6 @@ async function applyWatermarkToAssetMedia(
|
||||
width: vt.width ?? 0,
|
||||
height: vt.height ?? 0,
|
||||
size: 0,
|
||||
isRaw: false,
|
||||
})),
|
||||
)
|
||||
: []
|
||||
@@ -69,7 +68,6 @@ async function applyWatermarkToAssetMedia(
|
||||
width: it.width ?? 0,
|
||||
height: it.height ?? 0,
|
||||
size: 0,
|
||||
isRaw: false,
|
||||
})),
|
||||
)
|
||||
: []
|
||||
|
||||
@@ -71,7 +71,6 @@ function watermarkMediaInfo(overrides: Partial<PrismaJson.MediaInfo> = {}): Pris
|
||||
},
|
||||
original: {
|
||||
key: 'files/orig.mp4',
|
||||
downloadUrl: 'u',
|
||||
filesizeInBytes: 100,
|
||||
codec: '',
|
||||
},
|
||||
@@ -245,11 +244,10 @@ describe('Share API', () => {
|
||||
width: 640,
|
||||
height: 360,
|
||||
size: 1,
|
||||
isRaw: false,
|
||||
},
|
||||
],
|
||||
imageTranscodes: [],
|
||||
original: { downloadUrl: 'u', key: 'files/orig.mp4' },
|
||||
original: { key: 'files/orig.mp4' },
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -270,11 +268,10 @@ describe('Share API', () => {
|
||||
width: 640,
|
||||
height: 360,
|
||||
size: 1,
|
||||
isRaw: false,
|
||||
},
|
||||
],
|
||||
imageTranscodes: [],
|
||||
original: { downloadUrl: 'u', key: 'files/orig.mp4' },
|
||||
original: { key: 'files/orig.mp4' },
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -290,7 +287,7 @@ describe('Share API', () => {
|
||||
pdfTranscode: { url: 'u', key: 'files/doc.pdf' },
|
||||
videoTranscodes: [],
|
||||
imageTranscodes: [],
|
||||
original: { downloadUrl: 'u', key: 'files/doc.pdf' },
|
||||
original: { key: 'files/doc.pdf' },
|
||||
},
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -326,7 +323,6 @@ describe('Share API', () => {
|
||||
width: 640,
|
||||
height: 360,
|
||||
size: 0,
|
||||
isRaw: false,
|
||||
},
|
||||
])
|
||||
// Pending item → original transcodes emptied
|
||||
@@ -368,11 +364,10 @@ describe('Share API', () => {
|
||||
width: 640,
|
||||
height: 360,
|
||||
size: 100,
|
||||
isRaw: false,
|
||||
},
|
||||
],
|
||||
imageTranscodes: [],
|
||||
original: { downloadUrl: 'http://s3/original', key: 'files/original.mp4' },
|
||||
original: { key: 'files/original.mp4' },
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any
|
||||
@@ -411,7 +406,6 @@ describe('Share API', () => {
|
||||
width: 640,
|
||||
height: 360,
|
||||
size: 0,
|
||||
isRaw: false,
|
||||
},
|
||||
])
|
||||
expect(body.media.imageTranscodes).toEqual([])
|
||||
@@ -447,7 +441,7 @@ describe('Share API', () => {
|
||||
pdfTranscode: { url: 'http://s3/doc', key: 'files/doc.pdf' },
|
||||
videoTranscodes: [],
|
||||
imageTranscodes: [],
|
||||
original: { downloadUrl: 'http://s3/doc-original', key: 'files/doc.pdf' },
|
||||
original: { key: 'files/doc.pdf' },
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
@@ -495,7 +489,6 @@ describe('Share API', () => {
|
||||
width: 640,
|
||||
height: 360,
|
||||
size: 100,
|
||||
isRaw: false,
|
||||
},
|
||||
])
|
||||
expect(wfSpy).not.toHaveBeenCalled()
|
||||
|
||||
Reference in New Issue
Block a user