foreseen

A text-based gemini browser with prefetching.
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

commit 0297baf1a235438549f68927be85e46021429469
parent 3d968dd52c302592398b5da327ea5d0eb4a1adfe
Author: Andrew Laack <andrew@laack.co>
Date:   Mon, 28 Sep 2026 15:50:21 -0500

Renaming gemini-browser -> gemi.

Diffstat:
MMakefile | 8++++----
MREADME | 26+++++++++++++-------------
MTODO.txt | 9++++++++-
Msrc/identity-manager.cpp | 2+-
Msrc/main.cpp | 2+-
Msrc/plaintext.cpp | 2+-
Msrc/preformatted.cpp | 2+-
Mtests/mem-leak-test.cpp | 11+++++------
8 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,16 +1,16 @@ include config.mk debug: - ${DCOMMAND_P} src/main.cpp ${DCOMMAND_S} -o gem-browser.out + ${DCOMMAND_P} src/main.cpp ${DCOMMAND_S} -o gemi.out build: - ${COMMAND_P} src/main.cpp ${COMMAND_S} -o gem-browser.out + ${COMMAND_P} src/main.cpp ${COMMAND_S} -o gemi.out install: build - cp gem-browser.out ${PREFIX}/bin/gem-browser + cp gemi.out ${PREFIX}/bin/gemi clean: - rm -rf test*.out gem-browser.out + rm -rf test*.out gemi.out browser-test: ${TCOMMAND_P} tests/browser-test.cpp ${TCOMMAND_S} -o test1.out diff --git a/README b/README @@ -8,10 +8,10 @@ C++ compiler, make, openssl, ncurses Installation ============ -Edit config.mk to match your local setup if necessary for building (gem-browser +Edit config.mk to match your local setup if necessary for building (gemi will be installed into /usr/local/bin by default). -Then run the following command to build and install gem-browser: +Then run the following command to build and install gemi: make install (the above command may require root, depending on the installation location) @@ -19,35 +19,35 @@ Then run the following command to build and install gem-browser: Usage ===== Open a specific site: - gem-browser {url} + gemi {url} (gemini:// is optional) Open a local gemtext file: - gem-browser {path} + gemi {path} -Start gem-browser: - gem-browser +Start gemi: + gemi Identities ========== These are specified in: - $HOME/.gb/{hostname}/client.crt - $HOME/.gb/{hostname}/client.key + $HOME/.gmi/{hostname}/client.crt + $HOME/.gmi/{hostname}/client.key Or for a non-standard port (port != 1965): - $HOME/.gb/{hostname}:{port}/client.crt - $HOME/.gb/{hostname}:{port}/client.key + $HOME/.gemi/{hostname}:{port}/client.crt + $HOME/.gemi/{hostname}:{port}/client.key Example: - > tree .gb - .gb + > tree .gemi + .gemi └── bbs.geminispace.org ├── client.crt └── client.key -(I recommend symlinking ~/.gb to somewhere you backup regularly) +(I recommend symlinking ~/.gemi to somewhere you backup regularly) Example command to generate keys: openssl req -x509 -newkey rsa:2048 -nodes -days 3650 -keyout client.key -out client.crt -subj "/CN=localhost" diff --git a/TODO.txt b/TODO.txt @@ -49,7 +49,7 @@ - auto-follow redirects based on domain? - A/y/n -- always, no, yes - hmm, does this not work with redirects from the cli? - - gem-browser gemini://larsthebear.me/ + - gemi gemini://larsthebear.me/ - (seems so... perhaps I was on the non-updated version.) --- @@ -110,3 +110,10 @@ - just typing in: - "what :// :// test" --- fails - i'd expect that to be searched. + - gemini://9e4.com + - that site just seems to ... hang? for like a long time, too long. + +- TESTING CHANGES: + - should be able to download to a specific path + - would like to be able to send stuff to /dev/null + - add more asserts in my code so edges can be pushed diff --git a/src/identity-manager.cpp b/src/identity-manager.cpp @@ -16,7 +16,7 @@ Identity IdentityManager::getIdentityForURI(uri destination) { } namespace fs = std::filesystem; - fs::path certDir = fs::path(getHome()) / ".gb"; + fs::path certDir = fs::path(getHome()) / ".gemi"; std::string host = destination.get_host(); std::string name = host; if (destination.get_port() && destination.get_port() != 1965) { diff --git a/src/main.cpp b/src/main.cpp @@ -439,7 +439,7 @@ int main(int argc, char** argv) { if(clk != nullptr) { ds.header = clk->getLinkDestination().to_string(); } else { - ds.header = "gem-browser"; + ds.header = "gemi"; } auto* st = b.getCurrentSite(); diff --git a/src/plaintext.cpp b/src/plaintext.cpp @@ -3,7 +3,7 @@ Plaintext::Plaintext(std::string input) : text(input) {} std::string Plaintext::textToDraw() { - return text + "\n"; + return text; } int Plaintext::getColor() { diff --git a/src/preformatted.cpp b/src/preformatted.cpp @@ -5,7 +5,7 @@ Preformatted::Preformatted(std::string input) : text(input) {} std::string Preformatted::textToDraw() { - return text + "\n"; + return text; } int Preformatted::getColor() { diff --git a/tests/mem-leak-test.cpp b/tests/mem-leak-test.cpp @@ -24,7 +24,7 @@ std::string gen_random(const int len) { void traversal() { Browser b{}; - b.goToSite("gemini://laack.co", true); + b.goToSite("gemini://laack.co/known-hosts", true); for(int i = 0; i < 10000; ++i) { @@ -36,13 +36,13 @@ void traversal() { std::cout << "CURRENTLY AT: " << b.getCurrentLink()->getLinkDestination().to_string() << std::endl; } - if(count == 0 && rand() % 5 == 0) { + if(count == 0 && rand() % 10 == 0) { std::cout << "GOING BACK" << std::endl; b.goBack(); } else if(rand() % 5 == 0) { std::cout << "GOING FORWARD" << std::endl; b.goForward(); - } else if(rand() % 5 == 0) { + } else if(rand() % 10 == 0) { std::cout << "GOING BACK" << std::endl; b.goBack(); } else if (rand() % 5 == 0){ @@ -55,8 +55,7 @@ void traversal() { std::cout << "TRAVELLING TO: " << dst << std::endl; b.goToSite(dst); } - - } else if (rand() % 10 == 0) { + } else if (rand() % 20 == 0) { Destination destination = handleDestinationResolution(gen_random(rand() % 50), false); if(rand() % 2 == 0) { destination = handleDestinationResolution(gen_random(rand() % 5), false); @@ -92,7 +91,7 @@ void traversal() { int main() { std::signal(SIGPIPE, SIG_IGN); // this is also done in main for the actual executable, this is for consistency. std::vector<std::thread*> vec {}; - for(int x = 0; x < 10; ++x) { + for(int x = 0; x < 5; ++x) { auto* t = new std::thread (&traversal); vec.push_back(t); }