πŸ‘½ erick

I took some time yesterday during my morning commute to fork kineto’s source code and make a change to replace the `/x/` proxy for external domains with a user provided β€œportal” URL like portal.mozz.us. The change is live in my server and so far it is working great, but I need to clean up my changes before I consider sending a patch.

1 week ago Β· πŸ‘ m0xee, fab

Actions

πŸ‘‹ Join Station

18 Replies

πŸ‘½ erick

Never mind.I just noticed that I changed ioutil.ReadFile to os.ReadFile in one of my first commits. I'll revert that back to keep the version on 1.15. Β· 2 days ago

πŸ‘½ erick

@m0xee Got your changes into my fork. I had to keep the version in 1.16 though because one of the calls, os.ReadFile was introduce in that version. Β· 2 days ago

πŸ‘½ m0xee

@erick Sure, feel free to use it β€” what I did is basically reworking your code a bit.

BTW I don't think Drew DeVault β€” the original author of kineto, is still interested in its development, so we can just use your fork as a base for further improvements if we make any.

I have a couple more patches in my local repo, but I'm not sure those are of interest to anyone but me: like implemention of <summary> tag in JS so it works in older browsers. Β· 2 days ago

πŸ‘½ erick

@m0xee I'll use your changes to update my code if that is ok with you. I do want to send this patch upstream but haven't had time lately. Β· 2 days ago

πŸ‘½ erick

@m0xee nice changes! I love using build in functions insted of implementing them myself, I love there is a built-in way of handling file extensions; I need to get used to search go's standard library docs just like I do with python, or any other thing I use. Β· 2 days ago

πŸ‘½ m0xee

In any case, I've only put the list of extensions of format that I'm likely to use myself. There are no immutable arrays in Go to make it a constant, another option is const string with a comma separated list of extensions in it and using stings.Contains() on it, but it's probably the same in terms of performance.

You can use my about page as demo: https://m0xee.net/about.gmi , but it's not much different from what you do anyway. Β· 6 days ago

https://m0xee.net/about.gmi

πŸ‘½ m0xee

I've modified your code a bit:

gemini://m0xEE.Net/pub/0001-Initial-support-for-image-inlining.patch

I'm using normal loop instead of slices.Contains() so it's still possible to build it with Go 1.15, but I'm using filepath.Ext to extract the extension β€” no point in doing this yourself, it was in the standard library since forever.

I'm also keeping the anchor tag around the inlined image so it only serves as a thumbnail that you can still click to see the image in its full.

My list of extensions is a bit shorter than yours β€” I don't like WebPee and friends, that is kinda my thing πŸ˜… Β· 6 days ago

gemini://m0xEE.Net/pub/0001-Initial-support-for-image-inlining.patch

πŸ‘½ erick

@m0xee I still need to learn how to send a patch via email (already working on it). You can look at my changes at https://code.palmiers.xyz/erick/kineto

I did bump the Go version from 1.15 to 1.21 I think becase I am using slices.Contains. (I am too lazy to write my own contains function AND I am an absolute Go beginner 😜) · 1 week ago

https://code.palmiers.xyz/erick/kineto

πŸ‘½ m0xee

@erick In any case, I wonder how you did it β€” on the templating end or otherwise. Β· 1 week ago

πŸ‘½ m0xee

@erick

Nice! Post a patch or make the repo of your fork public when you have time.

I did take a look into it myself β€” only to find out that kineto does the processing not the way I would personally do it…

I'm always reluctant to use advanced features of Go templating language because the capabilities differ drastically from version to version, e.g. on my PowerPC machine I only have Go 1.10, it's not where gmid and kineto are hosted, but I strive for the lowest version, having compatibility in mind. In 1.10 variable assignments are not global, the only work inside the block that follows, so you can't do advanced branching and conditions with it. Β· 1 week ago

πŸ‘½ erick

@m0xee inline image implemented πŸ‘

I have a test page at gemini://erick.is/test.gmi and its web version seved with my custom kineto build at https://erick.is/test.gmi (I am using custom styles on my site) Β· 1 week ago

gemini://erick.is/test.gmi

https://erick.is/test.gmi

πŸ‘½ erick

@m0xee not yet, but I might look into if I wake up early again tomorrow (most likely). No promises though. Β· 1 week ago

πŸ‘½ m0xee

@erick Did you implement the image inlining?

Upgrading the tag from <a href="…"> to <img src="…"> if the link ends in .jpeg or .png doesn't seem hard to implement, but I'm a lazy ass πŸ˜‹ Β· 1 week ago

πŸ‘½ erick

Couple of updates to my kineto fork based on your excelent comments:

-P flag to completely disable proxying and URL rewriting of external URLs. That is, any external gemini url will left as is and any attempts to use /x/ for any external site will return a 404.

-R flag to disable built-int robots.txt. With this you can host your own robots.txt on your capsule (I am already doing this).

-r flag to rewrite any external gemini URLs to a custom URL to provide details about Gemini, browsers, etc. Β· 1 week ago

πŸ‘½ m0xee

@erick

I want the reader to be able to reach such information

I do understand your reasoning, but in this case convenience is an illusion: visitors won't even understand that they are browsing Gemini via a third-party service, it might fool them into thinking they are doing it normally, they might even bookmark some pages β€” and all those bookmarks would stop working in case mozz.us goes offline, while pages themselves are still there, by promoting Gemini-native browsers you're providing them with tools to reach those on their own.

There is a way to do it both ways, such as displaying a top frame a-la Google Translate, but this would require a more complex solution. Β· 1 week ago

πŸ‘½ erick

@m0xee I thought about blocking the path on my Caddy server, but for me it felt more a workaround than an actual fix, so I decided to modify the server instead. The source is so simple and straight forward that I felt confident about doing it. As for redirecting the users to a downloads page is also a valid use case, just not for me; if I am linking to a site, I want the reader to be able to reach such information.

@fab I had no idea kineto was also serving a robots.txt file, I didn't notice it in the source! Yeah, I have very little experience with robots.txt but see what you mean by very restrictive! Β· 1 week ago

πŸ‘½ fab

@erick yes, did it the same way as @m0xee did and I also redirected robots.txt because kineto serves a very restrictive one by itself. Β· 1 week ago

πŸ‘½ m0xee

In my nginx configuration I just don't let the /x/ paths through and redirect them to a web page suggesting downloading one of the Gemini browsers.

IMO explaining how to have proper Gemini experience is preferrable to keeping them browsing through the web and relying on a third-party service which might work or be offline.

Besides, it stops web crawlers going through your website right in their tracks. Β· 1 week ago