Add OnlyOffice-based preview for office documents
Replace Aspose.Words with OnlyOffice Document Server for generating bitmap previews of office documents (Word, Excel, PowerPoint, etc.). Backend: - Add cista/onlyoffice.py conversion client - Convert office docs directly to PNG via OnlyOffice, then AVIF via pyvips - Make office previews optional based on OnlyOffice availability - Remove Aspose.Words dependency and all related code - Add spreadsheet and presentation format support Frontend: - Mark office files as previewable in Document.ts - Add office extensions to MediaPreview.vue preview list - Fix pre-existing @ts-ignore in HeaderMain.vue Tests: - Fix test_lrucache.py parameter name (open -> opener) Also run ruff format across the codebase to satisfy linter checks.
This commit is contained in:
@@ -12,19 +12,19 @@ def mock_open(key):
|
||||
|
||||
|
||||
def test_contains():
|
||||
cache = LRUCache(open=mock_open, capacity=2, maxage=10)
|
||||
cache = LRUCache(opener=mock_open, capacity=2, maxage=10)
|
||||
assert "key1" not in cache
|
||||
cache["key1"]
|
||||
assert "key1" in cache
|
||||
|
||||
|
||||
def test_getitem():
|
||||
cache = LRUCache(open=mock_open, capacity=2, maxage=10)
|
||||
cache = LRUCache(opener=mock_open, capacity=2, maxage=10)
|
||||
assert cache["key1"].content == "content-key1"
|
||||
|
||||
|
||||
def test_capacity():
|
||||
cache = LRUCache(open=mock_open, capacity=2, maxage=10)
|
||||
cache = LRUCache(opener=mock_open, capacity=2, maxage=10)
|
||||
item1 = cache["key1"]
|
||||
cache["key2"]
|
||||
cache["key3"]
|
||||
@@ -33,7 +33,7 @@ def test_capacity():
|
||||
|
||||
|
||||
def test_expiry():
|
||||
cache = LRUCache(open=mock_open, capacity=2, maxage=0.1)
|
||||
cache = LRUCache(opener=mock_open, capacity=2, maxage=0.1)
|
||||
item = cache["key1"]
|
||||
sleep(0.2) # Wait for expiration
|
||||
cache.expire_items()
|
||||
@@ -42,7 +42,7 @@ def test_expiry():
|
||||
|
||||
|
||||
def test_close():
|
||||
cache = LRUCache(open=mock_open, capacity=2, maxage=10)
|
||||
cache = LRUCache(opener=mock_open, capacity=2, maxage=10)
|
||||
item = cache["key1"]
|
||||
cache.close()
|
||||
assert "key1" not in cache
|
||||
@@ -50,7 +50,7 @@ def test_close():
|
||||
|
||||
|
||||
def test_lru_mechanism():
|
||||
cache = LRUCache(open=mock_open, capacity=2, maxage=10)
|
||||
cache = LRUCache(opener=mock_open, capacity=2, maxage=10)
|
||||
item1 = cache["key1"]
|
||||
item2 = cache["key2"]
|
||||
cache["key1"] # Make key1 recently used
|
||||
|
||||
Reference in New Issue
Block a user