Giter VIP home page Giter VIP logo

amfora's People

Contributors

a-h avatar aabacchus avatar arkaeriit avatar awfulcooking avatar bouncepaw avatar dependabot[bot] avatar dvejmz avatar fiskfan1999 avatar jedthehumanoid avatar leifmetcalf avatar lokesh-krishna avatar lostleonardo avatar luetage avatar makew0rld avatar marcransome avatar mcdevnagh avatar mntn-xyz avatar mvllow avatar objectliteral avatar oholiab avatar p1gp1g avatar phaedrus-jaf avatar pniedzwiedzinski avatar regr4 avatar sergetymo avatar sotpapathe avatar sudobash1 avatar sumpygump avatar thomasadam avatar tslocum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amfora's Issues

strange paste behaviour for address bar on Windows

I'm seeing a strange behaviour - when I try to paste a URL from the clipboard into Amfora on Windows (win10 x64) it seems to truncate the URL. Similar behaviour using the right mouse click or Edit->paste menu, both of which normally paste OK in other apps.

For example here I pasted the following URL: gemini://gemini.marmaladefoo.com/blog/7-Jul-2020_GemiNaut_v0_8_6_release.gmi

the truncation happens as you paste, before you hit enter to navigate to that URL. Amfora cannot navigate as the URL is broken.

amfora_paste_bug

Open link in new tab

What's a good non-interfering way to achieve this? Maybe Ctrl-T with a link selected, as well as new:12, to open link number 12 in a new tab for example.

Left margin performance

In #13 I made this fix for left margins:

just shifting the content over every time it's displayed. This is less performant, but I don't know if it would make much of a difference.

It did end up making a difference, on long documents like gemini://tilde.black/users/fox/irc/log.txt. It takes a long time to load, which is one thing, but also even once it's cached, it takes 20 seconds to view it after navigating away from it and coming back. This is because the left margin spaces are being added to the entire document again. One solution would be to have a Page.LeftMargin integer attribute. And that's only recalculated when a reload happens, which would set it back to -1 or something.

Cache redirects?

Add some more functions to the cache package so that it can cache redirects and load them, and have handleURL try to use that, to prevent requesting redirects each time.

The problem is how can the user easily clear the cache? For example this would break the redirect hell test. One way would be a clear cache command, but still there could be unexpected behaviour.

Support common history navigation shortcuts

It would be nice to support the commonly used keyboard shortcuts for navigating history used in common browsers (firefox, google etc) that we are all trained to use, namely:

ALT+LEFT -> go back
ALT+RIGHT -> go forward

Downloading

Amfora should be able to download pages as well as any file.

  • There should be a downloads option in config.toml default set to "" which means the config package will figure out and use the default downloads folder for each platform
  • Page download
    • For pages, Page.Raw can just be written to a file easily
    • The downloading should happen in a goroutine, and display a Info modal when it's done, with the file path
    • There should be a page download mutex, so that multiple goroutines don't download the same page at once if the user spams the download button
    • Download page with Ctrl-S
  • Data download
    • Replace "Open in Portal" modal with buttons for downloading the data, using the portal, or cancelling
    • Progress bar in modal
      • This means you can't browse while downloading, or do multiple downloads at once, which is fine for now but could potentially be added later with difficulty

Improve TOFU

  • Store port number as well - if not port number is provided assume 1965 for backward compatibility
  • Switch to storing the hash of cert.RawSubjectPublicKeyInfo instead of cert.Raw.

Search in pages

Ctrl-F should bring up a bottom bar prompt to enter a search term. On Enter a ["search"] region will be prepended to any bit of text that matches the search, with a [""] after it. Link selecting will have to be disabled, maybe with some global per-tab mode setting that switches between link, off, and search. Tab and Backtab can be used to navigate through all the found text fragments. Esc should switch the global per-tab mode back to off, and maybe use a regex to remove all the region open and close tags for the search.

Bookmarks

  • Display the list of them on the New Tab page
  • Ctrl-D to add a bookmark of the current URL
    • Input field to set bookmark title, which defaults to the first top level header line if it's a text/gemini page
  • Store in XDG_DATA_HOME aka ~/.local/share/, as a TOML file
    • Add this file and TOFU file to README

Support streams

An example page with a stream URL is gemini://chat.mozz.us, with the actual stream at gemini://chat.mozz.us/stream.

Even for plaintext streams like the one above, this would require a major architectural change, since Pages are designed to hold their entire content in a string. A work around could be a stream mode, which might be hard/annoying to get the user to choose though. Could be a shortcut, so they select a link and then press Ctrl-S, or maybe it could be dynamically determined once content reaches a certain length, or the connection doesn't close?

Edit: I no longer consider stream mode to be a viable solution. Large non-stream pages would also benefit from Amfora moving to a stream-based architecture.

Dynamic wrapping

Potentially for v1.3.0 or later.

  • Change Page to store raw response as well as the formatted one
  • Also store terminal width at time of formatting in each Page
  • Every time a Page is loaded, reformat it if the terminal size is different, using the raw response, and store the new formatted string

This will allow pages to dynamically change their wrap width when the terminal width changes, without reloading and causing another network request. It would double the cache size per page though.

Re-store expiry date every time for TOFU

NOTE: If you are using SPKI as a cert ID as I recommend, then you should be re-storing the expiry date of the cert every time a request is made, BEFORE doing any checks. This is because it's possible to change a cert's expiry date but leave the SPKI section the same.

From gemini://makeworld.gq/gemlog/2020-07-03-tofu-rec.gmi

Add version command

if os.Args[1] == "--version" || os.Args[1] == "-v" {
    fmt.Println(version)
    return
}

Cached pages will not update margins on terminal width change

This could be fixed by removing Page.Displayable, and just shifting the content over every time it's displayed. This is less performant, but I don't know if it would make much of a difference. Possibly a "Performance" issue should be opened later, and tests on very long documents done.

Crash on wrapping certain pages

gemini://wp.pitr.ca/en/Gemini_(constellation) was pasted into the bottom bar. This was the panic output:

Loading...                                                  panic: runtime error: slice bounds out of range [:17] with length 12                                                              

                                                                                                                                goroutine 82 [running]:
                                                                                                                                                       gitlab.com/tslocum/cview.WordWrap.func1(0xc0003b5ea8, 0xc, 0x62, 0xde3e40, 0xc)
                                                /home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/util.go:487 +0x117
                                                                                                                                                           gitlab.com/tslocum/cview.WordWrap.func2(0xc0000000e1, 0x0, 0x0, 0x0, 0xd1, 0x2, 0xc5, 0x1, 0xc0001e8300)
                                                                        /home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/util.go:535 +0x341
                                                                                                                                                                                   gitlab.com/tslocum/cview.iterateString(0xc00025a0f0, 0xe7, 0xc000169940, 0xffffffffffffffff)
                                                                                        /home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/util.go:594 +0x187
     gitlab.com/tslocum/cview.WordWrap(0xc0003b5e46, 0xea, 0x64, 0xc000238d90, 0x1, 0x1)
                                                                                                /home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/util.go:492 +0x3a2
             github.com/makeworld-the-better-one/amfora/renderer.convertRegularGemini(0xc0003b2800, 0x42a9, 0x0, 0x64, 0x0, 0x9d3f7b, 0x2, 0xc0003b2800, 0x42a9)
                                                                                                                                                                        /home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/renderer/renderer.go:133 +0xc69
                                                                           github.com/makeworld-the-better-one/amfora/renderer.RenderGemini(0xc000380000, 0x4118, 0x64, 0x7e00, 0xc000380000, 0x4118, 0x0, 0x0)
                        /home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/renderer/renderer.go:182 +0x6af
                                                                                                                         github.com/makeworld-the-better-one/amfora/renderer.MakePage(0xc00059f400, 0x2d, 0xc0000fa210, 0x64, 0x0, 0x0, 0x0)
                                                /home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/renderer/page.go:79 +0x363
                                                                                                                                            github.com/makeworld-the-better-one/amfora/display.handleURL(0xc00024bc80, 0x2d, 0x0, 0x0, 0x0)
                                                /home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/display/private.go:246 +0x289
                                                                                                                                               github.com/makeworld-the-better-one/amfora/display.URL.func1(0xc00024bc80, 0x2d)
                                        /home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/display/display.go:452 +0x3f
                                                                                                                                      created by github.com/makeworld-the-better-one/amfora/display.URL
                /home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/display/display.go:451 +0xe7

                                                                                                              

Only (re)format visible area, and some padding lines

This would be difficult to implement, but would be great for performance on very long documents. Might be more necessary when #9 is implemented, as streams could result in larger documents over time.

This qualifies as a "stretch goal", non-urgent and not needed for any specific release.

provide advice on or otherwise improve unicode rendering on Windows

unincode and bullet characters do not display correctly on windows. Initially it seems it could be down to the Windows Terminal, but the same problem is seen in other terminal emulators like the suggested Cmder. Same for favicons such as makeworld.gq/favicon.txt

Cmder uses ConEmu which claims to support unicode https://conemu.github.io/en/UnicodeSupport.html

Edit: it seems some unicode points are not shown, others are. Strange. The favicon above and the bullets are not though.

amfora_windows
amfora_cmder

Improve side-scrolling / wrapping UX for different terminal sizes

Long preformatted disappears at right side, and when scrolling to the right, the text will disapear at the left. This is the correct behaviour in the code, but unexpected to the user. A better behaviour would be to have long preformatted text continue off screen, and when you scroll to the right, the text will go all the way to the left side of the screen and even off it.

One way to achieve this would be to add many spaces to the beginning of each rendered line. These spaces would have to be based on the terminal width though.

Application Crashes in Bookmarks when pressing Enter key

OS: OSX Mojave 10.14.6
Release: v1.2.0 amfora-darwin-amd64

Steps to reproduce

  1. run amfora
  2. navigate to "bookmarks"
  3. press the enter key (I don't have any bookmarks, I'm not sure if this is related)

Error output in terminal

panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
gitlab.com/tslocum/cview.(*Application).Run.func1(0xc00011cfc0)
	/home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/application.go:268 +0x81
panic(0x1599b00, 0xc00056b9e0)
	/usr/lib/go/src/runtime/panic.go:969 +0x166
github.com/makeworld-the-better-one/amfora/display.NewTab.func2(0xc00060000d)
	/home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/display/display.go:402 +0x742
gitlab.com/tslocum/cview.(*TextView).InputHandler.func1(0xc00060f7c0, 0xc00001f130)
	/home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/textview.go:1177 +0x1ca
gitlab.com/tslocum/cview.(*Box).WrapInputHandler.func1(0xc00060f7c0, 0xc00001f130)
	/home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/box.go:192 +0x5d
gitlab.com/tslocum/cview.(*Application).Run(0xc00011cfc0, 0x0, 0x0)
	/home/makeworld/go/pkg/mod/gitlab.com/tslocum/[email protected]/application.go:357 +0x66d
main.main()
	/home/makeworld/go/src/github.com/makeworld-the-better-one/amfora/amfora.go:42 +0x289

Paging

Sloum mentioned by email:

I missed the availability of paging down (in bombadillo the equivalent would be 'd' or 'u' to do a 3/4 page down or up)

More informative TOFU warning

AV-98 does this:

"A different certificate has previously been seen 999 times. That certificate is still valid for: 29 days, 14:23:08.649315"

Support multiple charsets

Work is being done on the charsets branch.

Issues

  • UTF-16 does not decode correctly, maybe? On egsam test
  • us-ascii crashes the browser, unless I add a special case to ignore it

Themes

It'd be good to have an option to change colors of the browser. The default forced white-on-black colorscheme is too heavy for my eyes. I couldn't find any way to change it. Even if I turn off colors in config, it is still white-on-black.

Perhaps an option to fall back to shell colorscheme would be great. It would work perfect for everyone.

Response size limit

50 MiB or maybe 15 MiB. Probably should be a new config option, with a low default, maybe even 10 MiB.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.