Public Access
GeminiService fetches on a short-lived task and hands the App a GeminiPage: header, the body as lines in 4 KB chunks (TextBuffer: no large block, no doubling copies), the final URL after up to 5 redirects. Certificates are pinned on first use per host and port; a change comes back as its own outcome with both fingerprints. No fetch starts below 55 KB free (Q86). With a card, the body streams to /gemini/cache/page.gmi in 1 KB pieces while the connection is open, then loads into RAM once its memory is back (Q87); StorageService::runAndWait (moved from the Debug Console) keeps every card access on the storage task. Without a card: RAM, with the steady and transient floors. Measured with IRC connected: Cosmos (31.6 KB) went from 4.6 KB to the whole page on the card and 20 KB on screen; lowest free heap 19.5 KB in transfer, 43 KB once loaded. `gemini get` and `gemini trust` on the console. 14 Gemini tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
26 lines
858 B
C++
26 lines
858 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace roro::gemini {
|
|
|
|
enum class LineType { Text, Link, Heading1, Heading2, Heading3, ListItem, Quote, PreToggle, Preformatted };
|
|
|
|
// One gemtext line. Link: `url` and its label in `text` (the URL itself without a label).
|
|
// PreToggle: the ``` line, with its alt text. Preformatted: kept exactly.
|
|
struct GemLine {
|
|
LineType type = LineType::Text;
|
|
std::string text, url;
|
|
};
|
|
|
|
// One line; `preformatted` carries the ``` state from line to line (start with false).
|
|
GemLine parseGemLine(const std::string& line, bool& preformatted);
|
|
std::vector<GemLine> parseGemtext(const std::string& document);
|
|
|
|
// For the Latin-1 fonts (Q79): valid UTF-8 up to U+00FF kept, anything else '?', and tabs
|
|
// expanded to 4-column stops.
|
|
std::string displayText(const std::string& utf8);
|
|
|
|
} // namespace roro::gemini
|