A Gate One Application (GOApplication) that provides a terminal emulator.
Terminates all the terminal processes associated with session. If kill_dtach is True, the dtach processes associated with the session will also be killed.
Note
This function gets appended to the SESSIONS[session]["kill_session_callbacks"] list inside of TerminalApplication.authenticate().
Attached to Gate One's 'timeout_callbacks'; kills the given session.
If 'dtach' support is enabled the dtach processes associated with the session will also be killed.
Called by terminal_policies(), returns True if the user is authorized to execute new_terminal() and applies any configured restrictions (e.g. max_dimensions). Specifically, checks to make sure the user is not in violation of their applicable policies (e.g. max_terms).
Called by terminal_policies(), returns True if the user is authorized to execute share_terminal().
Called by terminal_policies(), returns True if the user is authorized to write to the current (or specified) terminal.
This function gets registered under 'terminal' in the ApplicationWebSocket.security dict and is called by the require() decorator by way of the policies sub-function. It returns True or False depending on what is defined in the settings dir and what function is being called.
This function will keep track of and place limmits on the following:
- The number of open terminals.
- How big each terminal may be.
- Who may view or write to a shared terminal.
If no 'terminal' policies are defined this function will always return True.
Renders shared.html which allows an anonymous user to view a shared terminal.
Serves static files in the gateone/applications/terminal/static directory.
Note
This is configured via the web_handlers global (a feature inherent to Gate One applications).
A Gate One Application (GOApplication) that handles creating and controlling terminal applications running on the Gate One server.
Called when the WebSocket is instantiated, sets up our WebSocket actions, security policies, and attaches all of our plugin hooks/events.
This gets called at the end of ApplicationWebSocket.open() when the WebSocket is opened.
This gets called immediately after the user is authenticated successfully at the end of ApplicationWebSocket.authenticate(). Sends all plugin JavaScript files to the client and triggers the 'terminal:authenticate' event.
Returns a JSON-encoded object containing the installed text color schemes.
Saves whatever settings (must be JSON-encodable) are provided in the user's session directory; associated with the given term.
The restore_term_settings function can be used to restore the provided settings.
Note
This method is primarily to aid dtach support.
Reads the settings associated with the given term that are stored in the user's session directory and applies them to self.loc_terms[term]
Removes any settings associated with the given term in the user's term_settings.json file (in their session directory).
Sends the 'term_ended' message to the client letting it know that the given term is no more.
Sets up all the callbacks associated with the given term, multiplex instance and callback_id.
Removes all the Multiplex and terminal emulator callbacks attached to the given multiplex instance and callback_id.
Returns a new instance of termio.Multiplex with the proper global and client-specific settings.
cmd: The command to execute inside of Multiplex. term_id: The terminal to associate with this Multiplex or a descriptive identifier (it's only used for logging purposes). logging: If False, logging will be disabled for this instance of Multiplex (even if it would otherwise be enabled). encoding: The default encoding that will be used when reading or writing to the Multiplex instance. debug: If True, will enable debugging on the created Multiplex instance.
Returns the highest terminal number at the given location (so we can figure out what's next). If location is omitted, uses self.ws.location.
Sends a message to the client indicating the encoding of term (in the event that a terminal is reattached or when sharing a terminal).
Sends a message to the client indicating the mode of term (in the event that a terminal is reattached or when sharing a terminal).
Tells the client to reset the terminal (clear the screen and remove scrollback).
Handles Device Status Report (DSR) calls from the underlying program that get caught by the terminal emulator. response is what the terminal emulator returns from the CALLBACK_DSR callback.
Note
This also handles the CSI DSR sequence.
Sends the text of our term_ww.js to the client in order to get around the limitations of loading remote Web Worker URLs (for embedding Gate One into other apps).
Sends the text color stylesheet matching the properties specified in settings to the client. settings must contain the following:
colors: The name of the CSS text color scheme to be retrieved.
Renders the CSS for 256 color support and saves the result as '256_colors.css' in Gate One's configured cache_dir. If that file already exists and has not been modified since the last time it was generated rendering will be skipped.
Returns the path to that file as a string.