Separate OnlyOffice async handling, add office_previews WS flag, framed worker protocol
- Move OnlyOffice conversion out of worker subprocesses into async event loop using httpx.AsyncClient with shared client and clean shutdown hook - Add OOConversionManager with in-flight deduplication (asyncio.Future) and configurable concurrency limit (OO_MAX_CONCURRENT=2) - Add 10s total timeout for office previews via asyncio.wait_for - Return 503 when OnlyOffice is unavailable, 504 on timeout - Remove office handling from worker dispatch(); workers now only do images, video, and PDFs - Replace PNG tempfile bridge with framed binary input protocol on worker stdin: (json_size)(data_size)(json)(raw_data) - Add process_image_buffer() for in-memory AVIF conversion via pyvips - Add office_previews to WS server message, cached every 30s from OO availability check - Frontend gates only office document previews on office_previews flag; images, video, PDFs remain unconditional - Change default OnlyOffice port from 8080 to 8988
This commit is contained in:
@@ -55,6 +55,8 @@ async def watch(req, ws):
|
||||
"privileged": req.ctx.user.privileged,
|
||||
}
|
||||
|
||||
from cista import onlyoffice
|
||||
|
||||
await ws.send(
|
||||
msgspec.json.encode(
|
||||
{
|
||||
@@ -63,6 +65,7 @@ async def watch(req, ws):
|
||||
"version": __version__,
|
||||
"public": config.config.public,
|
||||
"paskia": sso.paskia_enabled(),
|
||||
"office_previews": await onlyoffice.is_available_cached(),
|
||||
},
|
||||
"user": user_info,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user