Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gemini support. #2024

Merged
merged 18 commits into from Jan 20, 2022
Merged

Gemini support. #2024

merged 18 commits into from Jan 20, 2022

Conversation

aartaka
Copy link
Contributor

@aartaka aartaka commented Jan 17, 2022

This allows us to browse pretty-formatted Gemini pages, see images/videos, listen to audio and interact with Gemini input pages. It's most probably 90% of what proper Gemini client should do.

What's new

  • WebKit-friendly support for gemini: scheme.
  • Dependency on phos for gemini requests.

To do:

  • Support redirections.
  • Control number of redirections (should it happen on the phos side?)
  • Allow self-signed certs (phos too?)
  • Process phos, usocket &c. conditions & errors.
  • Make error pages for all the Gemini error codes (4x-6x) there are.
  • Unite Gopher and Gemini support into small-web-mode (a different name?), as they share a lot of rendering and interaction code.

How does it look?

@aartaka
Copy link
Contributor Author

aartaka commented Jan 18, 2022

I think that self-signed certs are the phos-side matter and I hopefully fill test and contribute cert checking there.

On Nyxt side, this PR is complete and one can already browse Gemini space with style using Nyxt :)

The work done there hints me at the fact that lots of internal scheme processing works done in the last months share things such as:

  • Error handling.
  • Mode setting .
  • usocket requests.

If we have a macro to define an internal scheme that would do all hte dirty work of catching usocket errors, adding auto-mode rules and adding necessary settings for the scheme for every initialized WebKitWebContext, that will make our internal schemes hella resilient and customizable :D

I will get to it once we merge this PR.

@aartaka aartaka marked this pull request as ready for review January 18, 2022 09:59
@aartaka aartaka requested a review from Ambrevar January 19, 2022 06:39
build-scripts/nyxt.scm Outdated Show resolved Hide resolved
nyxt.asd Show resolved Hide resolved
source/mode/small-web.lisp Outdated Show resolved Hide resolved
(defgeneric render (line &optional mode)
(:documentation "Produce a page content string/array given LINE.
(export-always 'gopher-render)
(defgeneric gopher-render (line &optional mode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why prefixing with "gopher"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there's also gemini-render :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we have 2 methods specializations here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, no way -- gemini page body is a string (or a list of gemini objects if we parse it before rendering), while gopher rendering is line-oriented. Specializing against string doesn't feel right, so I'd better stay with two distinctly named functions.

Let me move the body of gemini-render into process-gemini-scheme in source/renderer/gtk.lisp. It will be a bit more coherent this way.

However, I'd leave gopher-render as it is, as it's Gopher-specific (like search-gopher) while everything else in small-web.lisp isn't.

source/mode/small-web.lisp Outdated Show resolved Hide resolved
source/mode/small-web.lisp Outdated Show resolved Hide resolved
source/renderer/gtk.lisp Outdated Show resolved Hide resolved
source/renderer/gtk.lisp Outdated Show resolved Hide resolved
source/renderer/gtk.lisp Show resolved Hide resolved
@Ambrevar
Copy link
Member

How can I test?

@aartaka
Copy link
Contributor Author

aartaka commented Jan 19, 2022

How can I test?

Run Nyxt, open gemini://gemini.circumlunar.space/ and browser from there :)

This allows us to pretty-formatted Gemini pages, see images/videos,
listen to audio and interact with Gemini input pages. It's most
probably 90% of what proper Gemini client should do.

Things left to do:
- Support redirections.
- Control number of redirections (should it happen on the phos side?)
- Allow self-signed certs (phos too?)
- Make error pages for all the error codes there are.
This also changes error page printing to a more convenient one.
@aartaka
Copy link
Contributor Author

aartaka commented Jan 19, 2022

I've inlined gemini-render into process-gemini-scheme. While at it, I've dramatically simplified Gopher search. Anything else before merging?

@aartaka aartaka mentioned this pull request Jan 20, 2022
17 tasks
@Ambrevar
Copy link
Member

Tested, works beautifully!

Feel free to merge once the CI passes. I've re-run the job, it should pass now that sbcl-phos is into Guix.

@aartaka aartaka merged commit 33f724e into master Jan 20, 2022
@aartaka aartaka deleted the gemini-support branch January 20, 2022 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants