Conversations: the app starts without the libredesk link; attachments downloadable from the transcript frame
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
45db86d1ff
commit
adc5ae12bd
4 files changed
+20
-6
No files matched your search
@@ -408,6 +408,12 @@ def check_conversations():
|
||||
refuses(server.conversation_file, "42", "../../etc/passwd")
|
||||
assert "From and To" in refuses(conversations.pump, {"start": "2026-11-01"})
|
||||
assert set(conversations.pump_state()) == {"running", "log"}
|
||||
pompage, conversations.pompage = conversations.pompage, None # no libredesk/ link: the app still runs
|
||||
try:
|
||||
assert "libredesk/" in refuses(conversations.pump, {})
|
||||
assert conversations.pump_state()["running"] is False and "libredesk/" in conversations.pump_state()["log"][0]
|
||||
finally:
|
||||
conversations.pompage = pompage
|
||||
finally:
|
||||
conversations.FOLDER = before
|
||||
shutil.rmtree(root)
|
||||
|
||||
@@ -13,17 +13,25 @@ import station
|
||||
|
||||
FOLDER = station.LABELS / "auto" / "conversations"
|
||||
LIBREDESK = station.ROOT / "libredesk"
|
||||
sys.path.insert(0, str(LIBREDESK / "conversations"))
|
||||
import pompage # noqa: E402
|
||||
sys.path.append(str(LIBREDESK / "conversations"))
|
||||
try:
|
||||
import pompage # noqa: E402
|
||||
except ImportError: # the page is not core: without the link, the rest of the app runs
|
||||
pompage = None
|
||||
MISSING = "no libredesk/ link to ~/aimsight-libredesk with conversations/ (README)"
|
||||
|
||||
INLINE = {".png", ".jpg", ".jpeg", ".gif", ".webp"} # shown in the page; any other attachment is downloaded
|
||||
|
||||
|
||||
def pump_state():
|
||||
if not pompage:
|
||||
return {"running": False, "log": [MISSING]}
|
||||
return {"running": pompage.running(), "log": pompage.log()}
|
||||
|
||||
|
||||
def pump(body):
|
||||
if not pompage:
|
||||
raise station.Refusal(MISSING)
|
||||
try:
|
||||
pompage.start(body.get("start") or "", body.get("end") or "", str(FOLDER))
|
||||
except ValueError as e:
|
||||
|
||||
Reference in new issue
Block a user