Skip to content

Commit 9162e80

Browse files
committed
feat: add /files/serve/{path} endpoint for iframe relative URL resolution
1 parent f74428f commit 9162e80

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [0.11.34] - 2026-04-08
8+
9+
### Added
10+
11+
- 🌐 **Path-based file serving** — new `GET /files/serve/{path}` endpoint enables HTML files loaded in iframes to resolve relative CSS, JS, and image references to sibling files. Used by Open WebUI's FileNav to render multi-file websites.
12+
713
## [0.11.33] - 2026-04-08
814

915
### Fixed

open_terminal/main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,16 @@ async def view_file(
594594
return Response(content=raw, media_type=mime)
595595

596596

597+
@app.get(
598+
"/files/serve/{path:path}",
599+
include_in_schema=False,
600+
dependencies=[Depends(verify_api_key)],
601+
)
602+
async def serve_file(path: str, fs: UserFS = Depends(get_filesystem)):
603+
"""Path-based alias for view_file — enables relative URL resolution in iframes."""
604+
return await view_file(path=f"/{path}", fs=fs)
605+
606+
597607
@app.post(
598608
"/files/write",
599609
operation_id="write_file",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "open-terminal"
3-
version = "0.11.33"
3+
version = "0.11.34"
44
description = "A remote terminal API."
55
license = "MIT"
66
readme = "README.md"

0 commit comments

Comments
 (0)