Loading libraries from GitHub Pages: space root in subdirectory

For visibility, I just want to post this issue/feature request I just created on GitHub: Hosting a library (or entire space) in a subdirectory (instead of subdomain) · Issue #1265 · silverbulletmd/silverbullet · GitHub

Summary:
I want to host (public) SB libraries on GitHub Pages.

This is currently not possible, because a GH Pages site for a repository always starts with a ‘subdirectory’ named after the repository (i.e. <username>.github.io/<repository>).

If the federation plug can normalize the URL for loading libraries, then it’s much easier and more secure (from a hosting point of view) to share themes and snippets!

2 Likes

I like the idea as well.

A similar idea I’d like to see would be the ability to import libraries directly from a git repo (bypassing the federation plug).

Plugs can be downloaded using a github url or a github release url. Having a similar format for Libraries would make sense imo, and make it a lot easier for people to share their libraries with each other.

1 Like

I hadn’t even considered an alternative format yet! But that does sound even better.

I can try something out as a separate plug. Then we can better evaluate if it should be integrated in the existing federation plug or not.

Started a small proof of concept on a plug that can download files from GitHub: GitHub - janssen-io/silverbullet-github-libraries-plug

First test was successful, but the code still needs some tests, tidying up and better error handling.
Maybe also cleaning up the old library before pulling in the new one like the federation plug does.

Initially I called the plug github-libraries. But there could be other providers as well.
Either configurable from within the plug or by passing some extra info in the settings.

I can imagine that you could have plain http(s) downloads from the same domain/path or other services that serve the raw files from a different location (like GitHub does).

So then maybe the name ‘external-libraries’ makes more sense.

Adding the functionality as a plug actually works very well for my needs. :slight_smile: So for now, I’m satisfied!

I’ve also just added the possibility to download from any https-resource. So Libraries in ‘spaces’ like https://janssen-io.github.io/silverbullet-libraries/Library/... can also be downloaded. The root of the ‘space’ (and thus the index.json location) is determined by the location of the Library directory.

1 Like