GMAP API¶
GMAP (Gemini Mailbox Access Protocol) components for serving mailbox contents over Gemini protocol.
GmapHandler¶
GmapHandler ¶
Routes GMAP requests and manages per-mailbox indices.
Source code in src/titlani/gmap/handler.py
GeminiRequest¶
GeminiRequest
dataclass
¶
GeminiRequest(
url: str,
hostname: str,
path: str,
query: str | None,
client_cert: Certificate | None,
)
GeminiResponse¶
parse_gemini_request¶
parse_gemini_request ¶
Parse a Gemini request line into a GeminiRequest.
Format: gemini://hostname/path?query
Source code in src/titlani/gmap/handler.py
GmapMailbox¶
GmapMailbox ¶
Manages the GMAP index for a single mailbox directory.
Source code in src/titlani/gmap/mailbox.py
load ¶
Load index from disk. Creates empty index if missing.
Source code in src/titlani/gmap/mailbox.py
save ¶
Write index to disk atomically (temp + rename).
Source code in src/titlani/gmap/mailbox.py
sync_filesystem ¶
Scan mailbox for new .gemmail files not in the index.
Auto-tags new messages with Inbox and Unread. Returns True if index was modified.
Source code in src/titlani/gmap/mailbox.py
list_all_msgids ¶
list_by_tag ¶
Return message IDs with the given tag.
Messages tagged Trash are excluded unless querying Trash itself.
Source code in src/titlani/gmap/mailbox.py
get_message_bytes ¶
Read a message file and return its raw bytes.
Source code in src/titlani/gmap/mailbox.py
is_encrypted ¶
Check if a message is encrypted (.gemmail.enc or .gemmail.enc.new).
add_tag ¶
Add a tag to a message. Returns True if changed.
Source code in src/titlani/gmap/mailbox.py
remove_tag ¶
Remove a tag from a message. Returns True if changed.
Source code in src/titlani/gmap/mailbox.py
delete_message ¶
Permanently delete a message. Only succeeds if tagged Trash.
Source code in src/titlani/gmap/mailbox.py
MessageEntry¶
MessageEntry
dataclass
¶
GeminiServerProtocol¶
GeminiServerProtocol ¶
GeminiServerProtocol(
request_handler: Callable[
[GeminiRequest],
GeminiResponse | Awaitable[GeminiResponse],
],
)
Bases: Protocol
Gemini protocol handler for GMAP requests.
Simpler than MisfinServerProtocol: single-phase (no body), accumulate until CRLF, parse URL, route to handler.