**Motivations:** - Align master with current codebase (token from projects/<id>/.secrets/<env>/ia_token) - Id resolution by mail To or by API token; no slug **Root causes:** - Token moved from conf.json to .secrets/<env>/ia_token; env from directory name **Correctifs:** - Server and scripts resolve project+env by scanning all projects and envs **Evolutions:** - tickets-fetch-inbox routes by To address; notary-ai agents and API doc updated **Pages affectées:** - ai_working_help/server.js, docs, project_config.py, lib/project_config.sh - projects/README.md, lecoffreio/docs/API.md, gitea-issues/tickets-fetch-inbox.py
42 lines
1.2 KiB
Python
Executable File
42 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Mark one email as read by UID (e.g. after replying without creating an issue).
|
|
Usage: ./gitea-issues/mail-mark-read.sh <uid>
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import imaplib
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
from mail_common import load_imap_config, repo_root, imap_ssl_context
|
|
|
|
|
|
def main() -> None:
|
|
if len(sys.argv) < 2:
|
|
print("[gitea-issues] Usage: mail-mark-read.sh <uid>", file=sys.stderr)
|
|
sys.exit(1)
|
|
uid = sys.argv[1].strip()
|
|
|
|
cfg = load_imap_config()
|
|
if not cfg["user"] or not cfg["password"]:
|
|
root = repo_root()
|
|
env_path = root / ".secrets" / "gitea-issues" / "imap-bridge.env"
|
|
print("[gitea-issues] ERROR: IMAP_USER and IMAP_PASSWORD required.", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
mail = imaplib.IMAP4(cfg["host"], int(cfg["port"]))
|
|
if cfg["use_starttls"]:
|
|
mail.starttls(imap_ssl_context(cfg.get("ssl_verify", True)))
|
|
mail.login(cfg["user"], cfg["password"])
|
|
mail.select("INBOX")
|
|
mail.store(uid, "+FLAGS", "\\Seen")
|
|
mail.logout()
|
|
print("[gitea-issues] Marked as read.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|