Custom Source - Qkrisi/ktanemodkit GitHub Wiki

Creating Plugin Manager Sources

A plugin source contains the catalog of plugins the plugin manager should display.

When fetching the catalog of plugins from a source, the plugin manager performs a GET request to the specified URL.

The page should return a JSON string representing an array of FeatureInfo, each containing the required information about the respective plugin for the manager in order to display and install it.

Objects

FeatureInfo

Contains required information of the plugin in order to display and install it.

Field name Field type Description Required?
Name string Name of the plugin Required
Author string Author(s) of the plugin Required
Description string Description of the plugin Required
MinVersion string Minimum compatible modkit version Optional
MaxVersion string Maximum compatible modkit version Optional
Links object Dictionary (string -> string) of links related to the plugin that should appear under the description (key: link name, value: URL) Optional
Integration bool true if the plugin modifies base-modkit files (plugin manager should create backups), false otherwise Required
Vendor FileVendor Type of host to download the plugin from Required
DownloadData
If Vendor is... then...
GithubRelease GithubDownloadData
Direct DirectDownloadData
Information about the file to download Required
FileType DownloadType Tells the plugin manager what kind of file the plugin is Required
FileData InstallData Information about installing the plugin Required if FileType is Text or Binary
ZipTargets array of ZipTarget Information required to unpack the plugin Required if FileType is Zip

GithubDownloadData

Download information of a plugin when GitHub releases are used as host.

Field name Field type Description Required?
Repo string Repository hosting the plugin in its releases (full URL not required, just user/repo) Required
UseSourceCode bool true if the plugin is the source code from the release, false if a separate asset Optional (defaults to false)
ContentType string MIME type of the file to download. If UseSourceCode is true, the value should be the MIME type of a zip file.
Common plugin MIME types:
File extension MIME type
dll application/x-msdownload
zip application/x-zip-compressed
cs text/x-csharp
Required if ContentTypes isn't given or if the source should be compatible with old modkit versions (versions before 1.1.0.0)
ContentTypes string Allowed MIME types of files to download (separated by ;) Required if ContentType isn't given
NamePattern string RegEx pattern of the asset name (with extension) (filtering purposes) Optional (can be used when UseSourceCode is false)
TagPattern string RegEx pattern of the tag name (filtering purposes) Optional (can be used when UseSourceCode is false)
Default string Name of the asset (with extension) the selection should default to Optional (can be used when UseSourceCode is false)

DirectDownloadData

Download a file directly from a server.

Field name Field type Description Required?
Name string Name of the file (with extension) Required
URL string URL to download the file from Required
Size string Size of the file in bytes (unsigned 64-bit integer as string) Required

InstallData

Information about installing the plugin (singular file).

Field name Field type Description Required?
Location string Directory within Assets the file should be downloaded into (. for the Assets directory itself) Required

ZipTarget

Information about a file or directory in a ZIP archive to unpack.

Field name Field type Description Required?
Location string Directory within Assets the file should be unpacked into (. for the Assets directory itself) Required
Target string The location of the target within the ZIP archive (* to unpack everything) Required
TargetType ZipTargetType Type of the target. Should be Directory if Target is *. Required
IgnoreFiles array of string Ignore files Optional (can be used if TargetType is Directory)

Enumerations

When using these enumerations in the above objects, their Value (number) should be used.

FileVendor

Type of host a plugin is downloaded from

Value Name Description
0 GithubRelease The plugin should be downloaded from a GitHub release
1 Direct The plugin should be downloaded directly from a given URL

DownloadType

Type of file to be downloaded

Value Name Description
0 Text The file is a text file (for example a C# script (.cs))
1 Binary The file is a binary file (for example a C# library (.dll))
2 Zip The file is a zip archive to then unpack

ZipTargetType

Type of a ZIP target to unpack

Value Name Description
0 Directory The target is a directory
1 File The target is a singular file

Example

This example JSON defines 2 plugins, Emik's wawa library and the Delegate Editor:

[
	{
		"Name": "wawa.Editors",
		"Author": "Emik",
		"Description": "...",
		"MinVersion": "1.1.0.0",
		"Links": {
			"Documentation": "https://github.com/emik03/wawa#libraries",
			"Source code": "https://github.com/emik03/wawa",
			"License": "https://github.com/Emik03/wawa/blob/main/LICENSE"
		},
		"Integration": false,
		"Vendor": 0,
		"DownloadData": {
			"Repo": "emik03/wawa",
			"Default": "wawa.Editors.dll",
			"NamePattern": "wawa.Editors.dll",
			"ContentType": "application/octet-stream",
			"ContentTypes": "application/octet-stream;application/x-msdownload"
		},
		"FileType": 1,
		"FileData": {
			"Location": "Editor/Plugins/Managed"
		}
	},
	{
		"Name": "Delegate Editor",
		"Author": "Qkrisi",
		"Description": "...",
		"MinVersion": "1.1.1.0",
		"Integration": false,
		"Vendor": 1,
		"DownloadData": {
			"Name": "KMDelegates.zip",
			"URL": "https://qkrisi.xyz/kmplugins/KMDelegates.zip",
			"Size": "7300"
		},
		"FileType": 2,
		"ZipTargets":  [
			{
				"Location": "Editor/Scripts/CustomEditors",
				"Target": "DelegateEditors.cs",
				"TargetType": 1
			},
			{
				"Location": "Scripts",
				"Target": "KMDelegateInfo.cs",
				"TargetType": 1
			}
		]
	}
]
⚠️ **GitHub.com Fallback** ⚠️