feat(api): enhance image module management and export functionality
- Added read-write access to the darktable SQLite catalog for module parameter edits. - Implemented new endpoints for exporting images and retrieving full-resolution images. - Introduced PATCH method for updating module parameters with optional preview. - Added comprehensive tests for new API functionalities, including module retrieval and error handling. - Updated CORS headers to support new HTTP methods. - Created detailed documentation for new API endpoints and module operations.
This commit is contained in:
@@ -38,8 +38,13 @@ router.get("/health", api.health)
|
||||
|
||||
router.get("/api/v1/images", api.list_images)
|
||||
router.get("/api/v1/images/:id", api.get_image)
|
||||
router.get("/api/v1/images/:id/preview", api.get_preview)
|
||||
router.post("/api/v1/images/:id/refresh", api.refresh_cache)
|
||||
router.get("/api/v1/images/:id/preview", api.get_preview)
|
||||
router.get("/api/v1/images/:id/full", api.get_full)
|
||||
router.post("/api/v1/images/:id/refresh", api.refresh_cache)
|
||||
router.post("/api/v1/images/:id/export", api.trigger_export)
|
||||
router.get("/api/v1/images/:id/modules", api.list_modules)
|
||||
router.get("/api/v1/images/:id/modules/:op", api.get_module)
|
||||
router.patch("/api/v1/images/:id/modules/:op", api.patch_module)
|
||||
|
||||
router.get("/api/v1/tags", api.list_tags)
|
||||
router.get("/api/v1/films", api.list_films)
|
||||
@@ -47,11 +52,11 @@ router.get("/api/v1/films", api.list_films)
|
||||
-- ── HTTP helpers ──────────────────────────────────────────────────────────────
|
||||
|
||||
local STATUS_TEXT = {
|
||||
[200] = "OK", [201] = "Created", [204] = "No Content",
|
||||
[200] = "OK", [201] = "Created", [202] = "Accepted", [204] = "No Content",
|
||||
[301] = "Moved Permanently",
|
||||
[400] = "Bad Request", [401] = "Unauthorized", [403] = "Forbidden",
|
||||
[404] = "Not Found", [405] = "Method Not Allowed",
|
||||
[500] = "Internal Server Error",
|
||||
[500] = "Internal Server Error", [504] = "Gateway Timeout",
|
||||
}
|
||||
|
||||
local function url_decode(s)
|
||||
@@ -110,7 +115,7 @@ end
|
||||
|
||||
local CORS_HEADERS = {
|
||||
["Access-Control-Allow-Origin"] = "*",
|
||||
["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS",
|
||||
["Access-Control-Allow-Methods"] = "GET, POST, PATCH, PUT, DELETE, OPTIONS",
|
||||
["Access-Control-Allow-Headers"] = "Authorization, Content-Type",
|
||||
["Access-Control-Max-Age"] = "86400",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user