The Example Packaged Gate One Plugin

This documentation covers the example packaged plugin. It’s purpose is to demonstrate how to create an installation package for Gate One that can include plugins or applications.

Just make a copy of the example_package directory and start renaming things, add your own code, etc etc.

A Gate One Terminal plugin that doesn’t do anything in particular. It simply gets installed as part of the example package to demonstrate how to install a plugin.

Installation

Just run sudo python setup.py install in the ‘example_package’ directory:

user@host:~ $ sudo python setup.py install

Including JavaScript or CSS

You can use this package to have your own JavaScript or CSS files automatically loaded by Gate One. Just place the files in the static directory and as long as their filenames end in .css or .js they will be loaded automatically by Gate One when the user connects.

Source Code Documentation

Python

example_package.initialize(self)[source]

Called inside of TerminalApplication.initialize() shortly after the WebSocket is instantiated. Put whatever code you want here that should be called whenever a user connects to Gate One.

Note

You don’t actually have to put anything inside this plugin if you’re just loading JavaScript/CSS. It can still be useful to know that your plugin got loaded successfully by Gate One though so it’s best to have at least a simple logging.info() call indicating that your plugin was installed/loaded correctly.

JavaScript

GateOne.Terminal.ExamplePackage

The code below is just boilerplate, “best practices” for running JavaScript in Gate One. You can replace this file with one of your own making or remove it entirely. Just note that it’s all wrapped in the superSandbox() function and you should do that in your code as well. That will ensure that all dependencies get loaded before your code gets run.

Also note that Gate One will take care of minifying this JavaScript code before it gets delivered to clients. There’s no need to do that ahead of time.

GateOne.Terminal.ExamplePackage.init()

This function gets called when the plugin is initialized (after all the superSandbox dependencies have been loaded).

Indices and tables