CompleteFTP is highly customizable allowing users to extend its inbuilt functionality using JSS, as well as .NET assemblies, batch scripts, Powershell scripts and executables.
JSS (Javascript Server-Side) is the name given to CompleteFTP's scripting environment. It includes a Javascript language interpreter and an API for integrating with CompleteFTP as well as performing common tasks.
Applications of JSS
JSS may be used to implement:
-
Process triggers that are executed when one or more specified events occur within CompleteFTP, such as a user logging in, a client uploading a file or a scheduled timer ticking over.
-
IP filter extensions facilitate the addition of custom rules for blocking connections from specified IP addresses (e.g. IP addresses from particular countries).
-
Authentication extensions allowing CompleteFTP to authenticate via a source other than those that are already built-in (i.e. internal users, Windows users, databases and remote FTP/SFTP servers).
-
File-system extensions which implement custom file systems that may, for example, store files in storage other than file-systems, e.g. databases.
-
Custom-command extensions contain user-defined functions that may be invoked by clients via FTP (via the SITE command), SFTP (via SSH_FXP_EXTENDED), SSH (as terminal commands) and HTTP/S (via GET or POST).
-
Web applications that may be accessed by regular users just like any other web application. EnterpriseDT's own customer portal, edtConnect, is a JSS web-app that's hosted on CompleteFTP. It accepts electronic payments and manages licenses for many thousands of users
JSS API
The JSS API is the set of functions, services and classes available for integrating with CompleteFTP and for performing common operations, such as HTTP requests, sending e-mails and access databases.
JSS API Services
JSS API services in CompleteFTP are global objects containing properties and functions.
Their names start with a lower-case letter, e.g. console, http, mail. Since they
are global objects, they may be used without first instantiating an object. For
example, the statement, console.log("Hello")
, logs a message to the CompleteFTP
logs. The services are listed in the right side-bar.
JSS API Classes
JSS API classes provide features such as FTP/SFTP clients, virtual file-system access
and database access. The names of JSS API classes begin with an upper-case letter.
The classes are listed in the right side-bar.
JSS API Functions
The JSS API provides two global functions: include and publish. These allow the developer to reuse code between script files and control which functions are exposed via RPC.
Integrating with .NET
JSS offers two methods of integrating with .NET:
-
Inline use of .NET libraries - in JSS process triggers and all types of JSS extensions, .NET classes may be instantiated directly from JSS, for example,
new System.Text.StringBuilder()
will instantiate the .NET class,StringBuilder
. This objects properties and methods may be accessed in the same way as those of native Javascript objects. The names of classes must be fully qualified. This usage is disallowed in web apps for security reasons. -
JSS-to-.NET bridge extensions - any .NET class that has a public null constructor may be registered as a JSS-to-.NET extension. Once this has been done, an instance of it will be created when a JSS script is invoked by CompleteFTP. The name of this instance will be the same as the registered name of the extension. So if, for example, a class called
MyNamespace.MyClass
containing a method calledMyMethod
is registered in CompleteFTP Manager with the namemyStuff
, then the method may be called from JSS using the expressionmyStuff.MyMethod()
. The location of the assembly containing this class is specified upon registration..
ECMAScript compliance
JSS's Javascript interpreter is compliant with ECMAScript 3 (ES3), but includes some ES5 features such as inbuilt JSON support, and extra methods on Array, Date and String objects.