sepluginloader / PluginLoader

A tool to load plugins for Space Engineers automatically.
https://sepluginloader.github.io/
MIT License
46 stars 12 forks source link

GitHub based plugin usage counter #13

Closed viktor-ferenczi closed 2 years ago

viktor-ferenczi commented 2 years ago

Using GitHub's release file download counters to track plugin usage (compilations) on clients. No separate hosting required.

For example this release: https://github.com/viktor-ferenczi/toolbar-manager/releases/tag/1.2.0.0

Is counted by downloading file after successful source download and compilation (very short delay for compiled plugins only): https://github.com/viktor-ferenczi/toolbar-manager/releases/tag/1.2.0.0/README.md

Plugin developer must have a release for the latest version on the PluginHub for the counter to work. Otherwise the counter will disappear from the list (cannot be incremented, nor downloaded). This is what we pay for not having to host it. These readme files are actually useful to instruct people why there is no binary release of these plugins.

The counter is available from GitHub API: https://api.github.com/repos/viktor-ferenczi/toolbar-manager/releases

JSON is filtered for entries by name or tag_name, then assets for file name README.md (exact match, case sensitive).

Usage counts of the enabled GitHub plugins are downloaded once on Plugin Loader startup in a background thread, so no slowdown in game startup. The download needs the assembly version, so it is not possible to download the counts for the plugins which are not loaded.

Q: Why we don't count the source ZIP downloads? A: Because GitHub stopped counting them many years ago.

Q: Is the GitHub API rate limited? A: Yes, it is: GitHub API rate limits - We will need to have caching of usage values once a player can have more than 60 plugins active at a time.

viktor-ferenczi commented 2 years ago

It may be useful for some other way of counting compiles or usage.