feat: add View option to context menu for browser-renderable files#349
feat: add View option to context menu for browser-renderable files#349
Conversation
Adds a "View" item to the "..." context menu that opens images, video, audio, and PDF files directly in a new browser tab via the /api/content/ endpoint. The item is only shown for non-directory, non-symlink files with a browser-renderable extension. Introduces getBrowserRenderableType() in fileContentQueries.ts (exported for future inline FileViewer preview use) and a useHandleView hook mirroring the existing useHandleDownload pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request just introduces a "View" menu option as shown below. If you select "View", the file opens in a separate browser tab. @neomorphic mentioned an approach along these lines many weeks ago, and my intent here is a minimal implementation without introducing anything fancy such as inline displays of the content.
|
|
A potential further extension would be recognizing file types that are not handled easily by the browser directly but that could be viewed by other web applications. One example of this would be viewing HDF5 files via MyHDF5. In this, we could would just need to append the proxied path as a query value to a URI prefix: Like MyHDF5, many of these web applications could be implemented completely within the browser via static web pages. |

Summary
Adds a View option to the
...context menu for files that browsers can render natively (images, video, audio, PDF). Clicking it opens the file in a new browser tab via the existing/api/content/endpoint.The item only appears for non-directory, non-symlink files with a browser-renderable extension:
png,jpg,jpeg,gif,webp,svg,ico,bmpmp4,webm,ogvmp3,wav,ogg,aac,flacpdfNew files:
frontend/src/hooks/useHandleView.ts— mirrors the existinguseHandleDownloadpatterngetBrowserRenderableType(filename)exported fromfileContentQueries.tsfor future inline FileViewer preview useTest plan
...menu on a PNG/JPEG/PDF/MP4 — View appears and opens the file in a new tab...menu on a.h5,.txt, or folder — View does not appearpixi run node-check— no TypeScript errorspixi run node-eslint-check— no ESLint errorspixi run test-frontend— all unit tests pass🤖 Generated with Claude Code