Creating a Plugin
This guide will walk you through the process of creating a plugin for Falkor. Plugins can be written in any language, as they are simply APIs that serve JSON data.
Prerequisites
To create a plugin, you need to use a language capable of serving JSON data. While we recommend using Node.js, you are free to use any language you are comfortable with. Here in the tutorial we will write endpoints in Node JS format where :value corresponds to the actual value such as “Windows” for :os.
Required Routes
For a plugin to work, the following routes are required:
/setup.json
/search/:os/:query
/return/:return
setup.json
The setup.json
file is used to configure the plugin. It contains the following fields:
- id: A unique identifier for the plugin.
- version: The version of the plugin, used to determine compatibility.
- config: A boolean or an object with the configuration for the plugin check out the
creating-a-configuration
for more information on this - multiple_choice: A boolean indicating whether the needs an extra request to get the source. If
true
, additional requests may be needed to fetch source links. - name: The name of the plugin, displayed in the settings menu.
- description: A description of the plugin, shown in the settings menu.
- logo: A URL to the plugin’s logo, displayed in the settings menu.
- banner: A URL to the plugin’s banner, displayed in the settings menu. (Optional)
- api_url: The base URL for the plugin’s API, used for making requests.
- author: Information about the author of the plugin. (Optional)
- setup_path: Used for updating the plugin from within the app
JSON Response - setup.json
{
"id": "example",
"version": "1.0.0",
"config": true,
"multiple_choice": false,
"name": "Example Plugin",
"description": "This is an example plugin.",
"logo": "https://example.com/logo.png",
"banner": "https://example.com/banner.png",
"api_url": "https://example.com/api",
"setup_path": "/1234/setup.json",
"author": {
"name": "example",
"url": "https://example.com"
}
}
search/:os/:query
The search/:os/:query
route is used to fetch games. It takes two parameters:
os
: The operating system of the games to search for.query
: The search query to use.
The route should return a JSON array of game objects. Each game object should contain the following fields:
JSON Response - DDL
[
{
"type": "ddl",
"name": "Example Game",
"return": "https://example.com/download",
"size": 1024,
"multiple_choice": true,
"uploader": "The uploader of the file",
"game_version": "V0.11.101",
"password": "password",
}
]
type
: Specifies the type of download. This should be set to"ddl"
for a direct download link.name
: The name of the game.return
: The URL for downloading the game. Ifmultiple_choice
is set, this field should be a base64 string that will be processed by the/return
endpoint.uploader
: The uploader of the gamesize
: The size of the game in bytes. This field is (optional).multiple_choice
: Boolean indicating if multiple download options are available. Setting this value here will override any value set insetup.json
(optional).game_version
: Version of the game. (optional).password
: Password required to access the game download, if applicable (optional).
JSON Response - Torrent
or Magnet
[
{
"type": "torrent",
"seeds": 100,
"name": "Example Game",
"uploader": "example",
"return": "base64-string",
"size": 1024,
"multiple_choice": false,
"game_version": "V0.11.101",
"password": "password",
}
]
type
: The type of game. This should be eithertorrent
, ormagnet
.name
: The name of the game.seeds
: The number of seeds for the game.uploader
: The uploader of the game.return
: The return type of the game. This should be eitherbase64-string
ormagnet-uri
.size
: The size of the game in bytes.multiple_choice
: setting the value here will override the one set in the setup.json (optional)game_version
Version of the game. (optional).password
: Password required to access the game download, if applicable (optional).
return/:return
The return/:return
route is used to fetch the actual torrent/direct link. It takes one parameter:
return
: The return type of the game. This should be eitherbase64-string
ormagnet-uri
.
The route should return a JSON ARRAY with the following fields:
JSON Response - return/:return
["link-to-torrent"]
That should be it now you just install the plugin using the setup.json file and the app should use it as intended.