- 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.
39 lines
1.5 KiB
Lua
39 lines
1.5 KiB
Lua
local M = {}
|
|
|
|
local home = os.getenv("HOME") or "/root"
|
|
|
|
M.host = os.getenv("DT_API_HOST") or "127.0.0.1"
|
|
M.port = tonumber(os.getenv("DT_API_PORT")) or 7645
|
|
|
|
-- Darktable paths
|
|
M.library_db = os.getenv("DT_LIBRARY") or (home .. "/.config/darktable/library.db")
|
|
M.data_db = os.getenv("DT_DATA_DB") or (home .. "/.config/darktable/data.db")
|
|
M.cache_dir = os.getenv("DT_CACHE_DIR") or (home .. "/.cache/darktable")
|
|
|
|
-- JWT / OAuth
|
|
M.jwt_secret = os.getenv("DT_JWT_SECRET") or "change-this-secret-in-production"
|
|
M.token_ttl = tonumber(os.getenv("DT_TOKEN_TTL")) or 3600
|
|
|
|
-- OAuth 2.0 clients table: client_id -> { secret, scopes[] }
|
|
-- Additional clients can be registered by adding entries here or setting
|
|
-- DT_CLIENT_ID / DT_CLIENT_SECRET environment variables.
|
|
M.clients = {}
|
|
local default_id = os.getenv("DT_CLIENT_ID") or "darktable-client"
|
|
local default_secret = os.getenv("DT_CLIENT_SECRET") or "changeme"
|
|
M.clients[default_id] = {
|
|
secret = default_secret,
|
|
scopes = { "images:read", "previews:read", "tags:read", "films:read", "cache:refresh" },
|
|
}
|
|
|
|
-- Queue file the bridge plugin watches for cache-refresh requests.
|
|
M.refresh_queue = os.getenv("DT_REFRESH_QUEUE") or "/tmp/dt-api-refresh.queue"
|
|
|
|
-- Queue file the bridge plugin watches for full-resolution export requests.
|
|
M.export_queue = os.getenv("DT_EXPORT_QUEUE") or "/tmp/dt-api-export.queue"
|
|
|
|
-- Directory where the bridge writes full-resolution JPEG exports.
|
|
-- Served by GET /api/v1/images/:id/full.
|
|
M.export_dir = os.getenv("DT_EXPORT_DIR") or "/tmp/dt-api-exports"
|
|
|
|
return M
|