How yv798an/jh-nas-os works
OrangePi NAS Web Server serves a browser-based file manager and system-monitoring UI over HTTP. The main workflow is browser request → HTTP server → router → file or system API → domain service and filesystem/platform state → HTTP response; file operations include safe shared-root resolution, browsing/search and mutations, while downloads support Range and an optional io_uring reader. Separate documented branches expose health checks and Prometheus metrics. The README documents these capabilities and the layers; some handler and metrics wiring is unsampled, so uncertain direct links are omitted.
Main entry points: main.cpp Service entry · AsyncFileReader.cpp Async file reader · Router.cpp HTTP router · FileApi.cpp File API
Components 22
Runtime and HTTP
- Service entry
src/main.cpp - HTTP server
src/http/HttplibHttpServer.cpp - HTTP router
src/http/Router.cpp - Web UI
src/http/WebUi.cpp - System API
src/http/Api.cpp - Health probe
src/http/HealthProbe.cpp - HTTP metrics
include/http/HttpStats.h
File management
- File API
src/http/FileApi.cpp - File service
src/file/FileService.cpp - Shared storage
System monitoring
- System monitor
src/system/SystemMonitor.cpp - Share registry
src/system/ShareRegistry.cpp - Platform state
include/platform/ISystemState.h - Linux state
src/platform/linux/LinuxSystemState.cpp - Linux proc and mounts
Asynchronous I/O
- Async file reader
src/io/AsyncFileReader.cpp - io_uring backend
src/io/IoUring.cpp - Buffer pool
src/io/BufferPool.cpp - SPSC queue
include/concurrent/SpscRingBuffer.h
Configuration and logging
- Configuration
src/config/Config.cpp - Logger
src/common/Logger.cpp
Other components
- Browser
Connections 23
- Browser → HTTP server: sends requests
- HTTP server → HTTP router: dispatches requests
- Service entry → HTTP server: creates and serves
- Service entry → HTTP router: registers routes
- HTTP router → File API: dispatches file routes
- HTTP router → System API: dispatches system routes
- HTTP router → Web UI: serves UI route
- File API → File service: calls file operations
- File service → Shared storage: reads and writes
- System API → System monitor: requests status
- System monitor → Platform state: reads snapshots and usage
- System monitor → Share registry: filters mounted shares
- Linux state → Platform state: implements interface
- Linux state → Linux proc and mounts: collects system data
- Service entry → Linux state: starts and stops
- Service entry → Configuration: loads settings
- Service entry → Logger: initializes and shuts down
- Service entry → Health probe: runs health check
- File API → Async file reader: uses for eligible reads
- Async file reader → io_uring backend: submits reads
- Async file reader → Buffer pool: acquires buffers
- Async file reader → SPSC queue: passes completed blocks
- Async file reader → Shared storage: reads file ranges