mirror of
https://github.com/seregonwar/zftpd.git
synced 2026-10-22 11:42:21 -05:00
Introduce an embedded Web File Explorer (zhttpd) and unified event loop implementation. Adds HTTP server headers and sources (http_api, http_parser, http_response, http_server, http_csrf, http_config), kqueue-based event loop (event_loop + event_loop_kqueue), embedded resource tooling and web UI (index.html, app.js, style.css, tools/generate_resources.py), API docs (docs/API.md), and tests (tests/test_http_query.c). Update Makefile to add ENABLE_ZHTTPD toggle (enabled by default on PS4/PS5), visibility flag for console targets, and test target for the new HTTP query test. Minor cleanup to include/ftp_config.h formatting and add ftpd.log to .gitignore.
862 B
862 B
zhttpd REST API Documentation
Endpoints
GET /api/list
List directory contents.
Query Parameters:
path(required): Directory path
Response:
{
"path": "/home",
"entries": [
{
"name": "file.txt",
"type": "file",
"size": 1024
},
{
"name": "subdir",
"type": "directory",
"size": 0
}
]
}
Errors:
404: Directory not found500: Internal error
GET /api/download
Download file (TODO).
Static Files
GET /→index.htmlGET /style.css→ CSSGET /app.js→ JavaScript
Adding Custom Endpoints
Edit zhttpd/src/http_api.c:
http_response_t* http_api_handle(const http_request_t *request) {
if (strncmp(request->uri, "/api/custom", 11) == 0) {
return handle_custom(request);
}
// ... existing handlers
}