Console API and Web Application
Script Extender plugin exposing a very lightweight and simple API allowing to control the game via a web console or any HTTP client. Configuration allows console output to be redirected to file (as with my other mod) but also allows to create an API that can be called using any HTTP client, or alternatively you can use the web console provided.
This mod is a Script Extender plugin containing two main features:
– Write all untruncated console output to file
– Expose a HTTP POST API endpoint “/console” allowing to run commands
REQUIREMENTS
You must have Starfield Script Extender installed and working before you can use this mod.
FEATURES
Dynamic reloading of the plugin’s configuration is possible using a custom plugin specific console command:
sfse_plugin_console_api.reload_config
You can also view the currently active plugin configuration using this custom command:
sfse_plugin_console_api.dump_config
NOTE: You can update the plugin configuration file while the game is running and use the command above to reload the plugin configuration for the changes to take effect immediately.
FILES
The plugin library file, the configuration INI and the plugin log file for troubleshooting issues:
\Data\SFSE\plugins\sfse_plugin_console_api.dll
\Data\SFSE\plugins\sfse_plugin_console_api.ini
%USERPROFILE%\Documents\My Games\Starfield\SFSE\Logs\sfse_plugin_console_api.log
If you enable console text output to file (this is configurable – see configuration lower below):
%USERPROFILE%\Documents\My Games\Starfield\SFSE\Logs\sfse_plugin_console_output.log
If you installed the web application and you want to serve static files (this is configurable – see configuration lower below):
\Data\SFSE\plugins\sfse_plugin_console_web\*
API ENDPOINT
The plugin includes a very lightweight HTTP server with a single POST /console endpoint that the web app is using, or alternatively you can use any HTTP client or even the console with curl:
C:\>curl -X POST -d “GetSFSEVersion” http://127.0.0.1:55555/console
GetSFSEVersion
Command: GetSFSEVersion
SFSE version: 0.1.3, release idx 4, runtime 01070210
CONFIGURATION FILE CONTENT
[Plugin]
bEnableFileOutput=false
bEnableWebConsole=true
[FileOutput]
bOverwrite=true
sPath=%USERPROFILE%\Documents\My Games\Starfield\SFSE\Logs\sfse_plugin_console_output.log
[WebConsole]
sHost=localhost
iPort=55555
bDisableCORS=false
bDisableStaticFiles=false
sStaticFilesPath=Data\SFSE\plugins\sfse_plugin_console_web\
CONFIGURATION DETAILS
[Plugin] section:
– bEnableFileOutput: enable/disable the output of all untruncated console text to file
– bEnableWebConsole: enable/disable the API endpoint
[FileOutput] section:
– bOverwrite: true to overwrite the output file everytime time the game is started, false to keep the output file content
– sPath: the file path where to save the console text output to (you can use environment variables)
[WebConsole] section:
– sHost: the hostname or IP address to bind to for the API endpoint (localhost or 127.0.0.1 is recommended)
– iPort: the port to use for serving the API endpoint (make sure the port you specify is unused)
– bDisableCORS: enable/disable Cross-Origin Resource Sharing (CORS) – essentially for developers so a separately hosted web app can be used
– bDisableStaticFiles: enable/disable serving of static files (i.e. the web application files) – disabling this will turn off the web application while keeping the API endpoint untouched
– sStaticFilesPath: thhe path where the web application files are located (i.e. the static files)