foreseen

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

commit 56f7e76165748123b1c0b83f90129cd33c6cb1f9
parent ec809bc9272e95f08e68bbfdda2fb4ddfcbba2ec
Author: Andrew Laack <andrew@laack.co>
Date:   Sun, 27 Sep 2026 11:24:55 -0500

Fixed some stuff up

Diffstat:
Msrc/main.cpp | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/main.cpp b/src/main.cpp @@ -402,7 +402,13 @@ int main(int argc, char** argv) { } catch (...) { if(locationToGo != "") { if(locationToGo.find(":") == std::string::npos) { // TODO: Is this how we which scheme was specified? - if(locationToGo.find('.') != std::string::npos && urlEncode(locationToGo) == locationToGo) { // hmm, this feels weak. Like I can't search something if I add a period? + + // This still feels weak, but my urlencode(locationToGo) != locationToGo was worse + // because that removed stuff like tlgs.one/robots.txt and stuff like that. + // + // TODO: Make this a pure function and then write tests for it to define expected behavior. + + if(locationToGo.find('.') != std::string::npos && locationToGo.find(' ') == std::string::npos) { locationToGo = "gemini://" + locationToGo; } else { locationToGo = DEFAULT_SEARCH_ENGINE + urlEncode(locationToGo); @@ -446,6 +452,8 @@ int main(int argc, char** argv) { b.goToSite(b.getCurrentSite()->getMeta(),true); ds.y = 0; // todo: make this part of state somewhere. } + } else { // this should handle invalid status codes as well as 5x and 6x (for now) + b.goBack(); } }