Shortcut Actions


FastX 4 adds a new shortcut action feature that lets a client execute specific actions after login. This can be used to start new sessions, connect to existing sessions, etc. This can allow customized shortcuts that enable fine grained post login setups for administrators.

SHORTCUT_SCRIPT

Set the SHORTCUT_SCRIPT environment variable to the script that you would like to execute. The script takes a JSON string on stdin

Stdin

The script will take a JSON object that is sent as a string with data needed to make a custom decision.

{
   "user": <the me object of the user who made the call>,
   "sessions": <array of the user's running sessions>,
   "nodeID": "the_nodeID_of_the_node_running_the_script",
   "apps": { 
        "user": <array of user apps>,
        "system": <array of system apps>,
        "history": <array of user's launch history>,
        "favorites": <array of user's favorite app ids>,
   },
   "input": <optional data object that was sent via the api call>
}

Output

The output of the script should be a JSON object or array of JSON objects of actions to perform. The actions will be executed on the client side in order.

Exit Code

Scripts should exit with code 0. Anything else will result in an error

Errors

On error, the client will decide what extra actions to take (usually a log and that is it).

Client Action Objects

Each action object has its own format. In general the action object takes the following format. The following is a list of action objects that are supported by the FastX clients

{
   "action": "action_name_required",
   "data": {},
   "sameWindow": false,
   "uri": "/uri..."
}

notify

Pop up a notification on the client side

{ 
   "action": "notify", 
   "data": {
        "message": "Message to display",
	"data": <Optional data object with more info>
    }
}

connect

Connect to an existing session

{     
    "action": "connect",     
    "data": {  
        "id" : "sessionId"
    } 
}

start

Start a new session

{
   "action": "start",
   "data": { start object data }
}