How to write a JSS extension

A JSS Extension is an extension written in JSS (Javascript Server-Side).

Four types of JSS extensions are supported:

Note that this feature is only available in Enterprise MFT.

Creating a JSS extension

To create a CompleteFTP JSS extension:

  1. Open the CompleteFTP Manager.
  2. Select the Extensions panel then select the Extensions tab.
  3. Click 'Add extension'.
  4. Select 'Javascript (JSS) extension'.
  5. Select extension type (e.g. 'Authentication').
  6. Enter the code for your extension. You can write it in the CompleteFTP syntax-highlighting editor or any of your favourite Javascript editors, then add this JSS file to the CompleteFTP editor by 'File/Open from/File on server...'.
  7. Some extension types require you to perform an additional registration step, such as adding a new folder-type, or granting permissions to site-commands.
  8. Click the 'Apply Changes' button.
  9. Test your JSS Extension by using an FTP client.

Note: Full details of JSS API are provided in the JSS API Reference.

Registration of JSS extensions

Some JSS extensions must be registered in order for them to take effect. This is done automatically for authentication and file-system extensions when they are created, but it must be done manually for custom-command extensions. Each type of JSS extension has its own method of registration:

IP filter extensions

IP filter extensions will be used as soon as they're added.

Authentication extensions

Custom authenticators will only be used if they're enabled in the 'Other authentication methods' list, in General User Settings, in the Users panel.

Custom Command extensions

Only users who have permission for a particular custom command extension may invoke the commands that it defines. Permission may be granted to individual users or groups in the Permissions tab, in the Extensions panel, as shown in the example below:

File-System extensions

Folders that use a custom file-system extension may only be created, if they have a folder-type defined for them. This is done in the 'Folder Types' tab of the Extensions panel.

Saving a JSS extension

For the JSS code in the CompleteFTP editor, you can save it by choosing 'File/Save to/File on server...' then choose where to save the file and name the file.

After that, the file can be loaded by 'File/Open from/File on server...'.

For a quick save after editing, you can use 'File/Save [Ctrl+S]' or just click on 'Apply Changes'.