Skip to content

Conversation

friday
Copy link
Member

@friday friday commented Feb 19, 2023

While #1196 solved the issue with hitting GitHubs API rate limits, and also made the code simpler and more standardized, it still assumed that:

  1. All repos are in the form of https://host.tld/user/repo
  2. All repos have a tarball download endpoint

This was true for all the hosts we supported, and with this PR if the host is github, gitlab or codeberg or if the user doesn't have git installed it, it keeps using the old (tarball) install, as that's faster.

But if the user has git installed and trying to install from any other host it will instead use git clone --bare and checkout, which should work for any git host. This includes local paths such as file:///home/me/my-code/my-ulauncher-extensions (the file:// prefix is optional, so you can use just /path/to/dir. It will store the url with the file://-protocol either way).

This has also been documented as a replacement from the debugging instructions we removed (63fc112). I think this is a good enough substitute and arguably fixes #818. While not as powerful as using ipdb I think that was way too complicated ("leaky" abstraction). Extensions are not complicated enough to need that.

The recommended/supported url format now is the HTTPS git repo you use for cloning (so https://github.com/user/repo.git rather than just https://github.com/user/repo). Either ones will work for github, gitlab or codeberg, but for other hosts we need the exact HTTPS GIT remote URL.

Unfortunarely ExtensionRemote has now become quite complex and hard to test again, and I want to merge the remote and downloader classes (downloader is just a thin layer over remote now). So I don't want to add lots of tests and then have to rewrite them anyway.

spoiler: Planning to move all of extension downloader in there and
rename it so we don't need these two classes (and eventually also the
runner class and the extension controller.
… path rather than always user/repos

Some hosts use other links like rhodecode using https://code.rhodecode.com/repo for the main project and https://code.rhodecode.com/u/user/repo for forks
Regular git hosts without any web interface/api can use any path format
(although these have no tarfile we can download)
@friday friday added this to the 6.0.0 milestone Feb 19, 2023
…it installed and we aren't sure there are tarball endpoints

sneaky bonus feat: you can now install local git paths. Ex: file:///home/me/my-code/my-ulauncher-extensions (file:// is optional)
I think this is already a big improvement from before when you had to
manually copy or symlink your local repo, or run it with the weird long
CLI instructions.

Maybe we want a command on top of this to simply run your extension
without installing it, but I think it's mostly over-thinking and a
bad idea. If extensions are allowed to run from any path we need to keep
track of that when we load/handle/change the extension settings for example.
We normally use the extension id (derived from the URL) as the unique
identifier to handle the settings and other things.
@friday friday force-pushed the feat/remote-support-git branch from dccba8c to c14e21b Compare February 19, 2023 20:45
@friday friday merged commit 6cc8324 into v6 Feb 19, 2023
@friday friday deleted the feat/remote-support-git branch February 19, 2023 21:26
@friday friday mentioned this pull request Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document extension loading mechanism in extension dev guide
1 participant