INTRODUCING GOPHHUB

So in my last post I talked about restoring my Gopher services 
(FireText and Gopher Banker) with the CGI-friendly Gopher that 
lives at Tilde.Club, then I went into a rant about GitHub killing 
off the ability to browse their web interface to Git repos without 
Javascript. I concluded there that there was no point bothering to 
code a way around the problem because they'll break that too, and 
everyone using GitHub should mirror their Git repos over Gopher as 
well.

The thing is, nobody ever listens to me, not even me, so over the 
following weekend, after I remembered hearing about a GitHub API a 
while ago, I indeed tried to code my way out of the problem by 
making all Git repos on GitHub accessible using Gopher, whether 
their creators listen to me or not. The result is GophHub:

gopher://tilde.club/1/~freet/gophhub/

Basically I tried to add all the main features that worked without 
Javascript in the previous GitHub website before they applied the 
"code view and navigation" update to users that aren't logged-in,
on the 6th of July.*

Key features are:

* View any GitHub Git repo "homepage" with root directory list, 
  default README, and latest release, displayed along with some repo 
  info.
* Browse repo directories as gophermaps
* View files via HTTPS or (under 500KB) Gopher
* View MarkDown/AsciiDoc documents and source code (under 500KB) 
  with syntax highlighting rendered in HTML via Gopher (works best if 
  your Gopher browser also supports HTML - Dillo + Gopher plug-in 
  works well for me)
* Line numbering of source code files accessed via Gopher
* Options menu (bottom of gophermap) to configure the above (you 
  can also set URL parameters in the search URL to your preferred 
  defaults, eg. in a bookmark)
* Accepts GitHub repo and sub-directory/file URLs (non-Git content 
  URLs such as Issues, Wiki, etc. aren't supported. They're currently 
  still vaguely usable without Javascript on the GitHub website)

As it was a weekend project, I of course ran out of time to do 
everything (including writing this announcement post). It's 
actually implemented as a Bash script with a terribly hacky 
newline-reliant approach to parsing the JSON output of the GitHub 
API, and in theory my plan was to go back now that I've got the 
general logic worked out and re-implement it in C. But that's not 
going to happen.

What might happen are the following features that I didn't quite 
get to (or think of in time) for GophHub version 0.2:

* Convert file sizes to human-readable units
* Display the GitHub git:// clone URL on the repo "homepage"
* Convert URLs in HTML-rendered MarkDown/AsciiDoc documents to 
  GophHub links (but only if they point to somewhere actually in a 
  Git repo)
* Rework the JSON parsing so that nothing relies on the order of 
  the fields (yeah, I know, ouch, hey I just wanted to see if it 
  would work)

Plus I need to Write set-up docs and publish the script in the 
Scripts section here. API calls are limited at 5000 per hour, so 
like Invidious and SearX (both possibly misspelt) people might need 
to set up their own 'instances' if it becomes popular (it works 
without an API token for 50 or 60 requests per hour, so you don't 
need a GitHub account). Then again things I like are very rarely 
popular, so even publishing the script is probably a waste of 
valuable time (I've been looking at more depressingly single-digit 
download stats for things I published elsewhere again).

On that note feedback and bug reports are welcome. New features are 
obviously backloged already, but requests will at least be given 
consideration for "one day". Email: freet@aussies.space

 - The Free Thinker

* Announced here:
https://github.blog/changelog/2023-07-06-anonymous-users-have-access-to-new-code-view-and-navigation/

There is a feedback topic on their (barely navigatable, even with 
Javascript) support forum for it, where I was glad to find that 
many people have voiced objections to the blank-page results from 
browsing without Javascript, and while it was in beta one even got 
a promise (months ago) that a Javascript-free fall-back view was in 
development. But now they're just not talking to anyone about the 
Javascript requirement. The silent treatement is presumably the 
PR-friendly way of saying "we don't care, get lost".

https://github.com/orgs/community/discussions/54546