JSS Custom Command Extensions

User-defined commands can be implemented in Javascript - each command is implemented by a Javascript function.

Creating a JSS custom command extension

To add JSS custom commands extension:

  1. Open CompleteFTP Manager.
  2. Select the Extensions panel then select the Extensions tab in sub menu.
  3. Click 'Add extension'.
  4. Select 'Javascript(JSS) extension'.
  5. Select 'Custom Command'
  6. Write your command
  7. Click the Apply Changes button.
  8. Select Permissions tab and grant permission for groups or users to use this extension.
  9. Click the Apply Changes button.
  10. Test your JSS Extension by using a FTP client

The commands may be accessed as SITE commands in FTP/FTPS and as regular commands in SSH terminal. They may also be invoked via HTTP/HTTPS using a URL of the format shown below and the result is returned in JSON format.

http://hostname/CustomCommand/commandName?arg1=val1

The following function defines a command called 'Hello' which takes one argument:

function Hello(who)
{
	return 'Hello ' + who;
}

All arguments are strings.

Commands added in this way are available to all users who have permission for the 'CustomCommandScript' extension. These permissions may be modified in the Permissions tab of the Extensions panel.

.NET objects may be instantiated using the 'new' keyword followed by the fully qualified name, e.g.

function Hello(who)
{
	var b = new System.Text.StringBuilder();
	b.Append('Hello').Append(' ').Append(who);
	return b.ToString();
}

Static methods and properties of .NET objects may be accessed using their fully qualified name, e.g.

function HostName()
{
	return System.Environment.MachineName;
}

Note: you can use .Net library for JSS extension but cannot use it for Web-Apps.