kimi-code/packages/server/test
qer ec758c747a
fix(web): make uploaded videos play in the chat (#1343)
* feat(media): materialize video uploads to cache and reference by path

- copy TUI video placeholders into the shared cache instead of
  inlining the original source path
- emit <video path="..."> tags so ReadMediaFile / the provider's
  VideoUploader owns upload behavior
- apply the same cache materialization to server prompt video
  submissions, matching the TUI flow
- update TUI unit tests and server e2e test to assert cache-path
  behavior

* fix(web): make uploaded videos play in the chat

Render the server's <video path> tag as a real video and reconcile the echoed user message so the bubble no longer shows raw markup or a duplicate. Serve file downloads with byte-range support and fetch video bytes with the bearer credential into a blob URL, since browsers cannot authorize a <video> src on their own. Also let users click an uploaded image to open it in the preview panel.

* fix(web): use authenticated source for uploaded image previews

openMediaPreview stored the raw getFileUrl as sourceUrl, and FilePreview renders it with a native <img> that sends no Authorization header, so the enlarge action 401'd for uploaded images. When the media carries a fileId, fetch the bytes through the authenticated API client and preview a blob URL instead, revoking it when the preview is replaced or closed.

* fix(web): ignore stale authenticated media fetches

AuthMedia fetches the file bytes asynchronously; when the component is reused with a new fileId before a prior fetch resolves (e.g. queued thumbnails keyed by index), the older response could still create a blob URL and show the previous file. Add a per-request sequence guard (and an unmount guard) so a stale response is discarded and its blob URL revoked instead of being applied.

* fix(web): gate media path tags on file-store id shape

Treating any standalone <video path="..."> text as an uploaded daemon file and stripping the basename into getFileUrl is only valid for server cache files named after the file-store id (f_…). TUI/ReadMediaFile tags use arbitrary cache names like <uuid>-<label>, and older transcripts may point at paths like /tmp/foo.mp4; those produced a broken /files/<basename> request. Only extract a fileId when the basename matches the file-store id shape, otherwise leave the raw tag as text.

* fix(web): invalidate pending media preview on close

Closing an uploaded-image preview before getFileBlob() resolved left previewRequestSeq untouched, so the fetch callback still passed its seq check, created a blob URL, then skipped attaching it because previewFile was already null — leaking up to the file size until another preview opened. Bump previewRequestSeq on close so the in-flight callback bails before creating the blob URL.

* fix(web): defer authenticated media fetch until near viewport

AuthMedia fetched the full image/video into a Blob on mount whenever a fileId was present, bypassing native loading="lazy" and preload="metadata". Opening a session with several historical large video uploads started many full downloads and held all blobs in memory even if the user never scrolled to or played them. Use an IntersectionObserver to defer the fetch until the element nears the viewport.

* fix(web): revoke preview blob when leaving the file panel

Switching to another detail panel only flips detailTarget and never calls closeFilePreview, so an in-flight getFileBlob could still create a blob URL after the file panel hid, and an already-shown blob URL was held until the next file preview. Check detailTarget before creating the blob URL, and reset/revoke the preview when detailTarget leaves 'file'.

---------

Co-authored-by: haozhe.yang <yanghaozhe@moonshot.ai>
2026-07-04 00:36:00 +08:00
..
__snapshots__ feat(server): add GUI store API mirroring localStorage (#1231) 2026-06-30 21:04:59 +08:00
helpers feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
svc ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
anti-corruption.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
api-surface.snapshot.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
approval.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
auth-middleware.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
auth-wiring.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
auth.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
authTokenService.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
bindClassify.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
config.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
connections.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
debug-nonloopback.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
defineRoute.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
error-handler.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
fileLaunch.test.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
files.e2e.test.ts fix(web): make uploaded videos play in the chat (#1343) 2026-07-04 00:36:00 +08:00
fs-basic.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-batch.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-browse.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-download.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-git.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-mkdir.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
fs-path-safety.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
fs-search.e2e.test.ts chore(telemetry): add ripgrep fallback telemetry (#1203) 2026-06-29 18:30:09 +08:00
fs-watch.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
guiStore.e2e.test.ts feat(server): add GUI store API mirroring localStorage (#1231) 2026-06-30 21:04:59 +08:00
host-exposure.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
host-origin.e2e.test.ts feat(server): add --allowed-host flag for DNS-rebinding allowlist (#1128) 2026-06-26 17:06:01 +08:00
hostnames.test.ts feat(server): add --allowed-host flag for DNS-rebinding allowlist (#1128) 2026-06-26 17:06:01 +08:00
lock.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
messages.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
meta.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
model-catalog-refresh-scheduler.test.ts feat(server): auto-refresh provider model catalog and push change events (#1207) 2026-06-30 12:29:10 +08:00
model-catalog.e2e.test.ts feat(server): auto-refresh provider model catalog and push change events (#1207) 2026-06-30 12:29:10 +08:00
oauth.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
origin.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
prompt.e2e.test.ts fix(web): make uploaded videos play in the chat (#1343) 2026-07-04 00:36:00 +08:00
question.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
rate-limit.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
security-headers.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
services-auth.test.ts fix(server): skip Unix-only permission check on Windows for server token (#1135) 2026-06-26 18:38:24 +08:00
services.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
sessions-workspace.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
sessions.e2e.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
skills.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshot.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshot.perf.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshot.smoke.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
snapshotService.unit.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
start.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
swagger.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
tasks.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
terminals.e2e.test.ts ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
terminalTestBackend.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
tools.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
workspaces.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-abort.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-auth.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-broadcast.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-handshake.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-resync.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00
ws-terminal.e2e.test.ts feat(server): add bearer-token auth and safe host exposure (#1006) 2026-06-25 17:57:56 +08:00