This document outlines the process for a client application (e.g., the Tuff app) to discover, install, and manage plugins from this repository.
The integration process relies on a single manifest file, plugins.json, located at the root of the repository. This file acts as the single source of truth for all available plugins and their versions.
The typical workflow is as follows:
- Fetch Manifest: The client periodically fetches
plugins.json. - Display Plugins: The client parses the manifest to display a list of available plugins to the user (e.g., in a plugin marketplace).
- Install Plugin: When a user chooses to install a plugin, the client downloads the correct version of the
.tpexfile using the path provided in the manifest. - Check for Updates: The client compares its locally installed plugin versions against the latest versions listed in the manifest to detect available updates.
The client must first retrieve the central manifest file.
- Endpoint: The client should be configured to fetch
plugins.jsonfrom the root of this repository. The raw file URL would be something like:https://github.com/YourUsername/tuff-official-plugins/raw/main/plugins.json - Caching: To reduce network traffic and improve performance, the client should implement a caching mechanism. It is highly recommended to use HTTP headers like
ETagorLast-Modifiedto only download the file when it has actually changed. - Frequency: The client can fetch this file on startup and then periodically (e.g., once every 24 hours).
Once plugins.json is fetched and parsed, the client has an array of plugin objects. For each plugin, the client can use the following fields to populate its UI:
name: The display name of the plugin.description: A short summary of what the plugin does.author: The plugin's author.category: Used to group plugins in the UI (e.g., "Tools", "Themes").version: The latest available version string.
When a user initiates an installation for a plugin with a specific id:
- Find the Plugin: The client locates the corresponding object in the
plugins.jsonarray by itsid. - Construct URL: It reads the
pathproperty (e.g.,plugins/tools/com.tuffex.translation/1.0.0-Alpha/touch-translation-1.0.0-Alpha.tpex). - Download: The client prepends the base repository URL to this relative path to get the full download URL for the
.tpexfile. - Install: After downloading, the client installs the
.tpexpackage into its local plugins directory. - Store Metadata: The client must store the
idand the installedversionlocally for future update checks.
To check for updates:
- Fetch Latest Manifest: The client gets the latest
plugins.json. - Compare Versions: For each locally installed plugin, the client finds its entry in the manifest using the
id. It then compares the locally stored version string with theversionstring from the manifest. (It is recommended to use a semantic versioning (semver) comparison library for robust checking). - Prompt for Update: If the manifest version is newer than the local version, the client should notify the user that an update is available.
- Perform Update: The update process is identical to the installation process: download the new version's
.tpexfile and replace the old one.
The versions array within each plugin object provides a history of available versions. This allows for advanced features like version rollback.
- If a user encounters a bug with a new update, the client could present a list of older versions from the
versionsarray. - The user can then select a specific version to downgrade to, and the client would use the
pathfrom that version's object to download and install it.
This structured approach ensures a robust and maintainable plugin ecosystem.