Stellarium
HEAD
|
Control Stellarium through your web browser! For more information, see Remote Control Plug-in documentation. More...
Data Structures | |
struct | APIServiceResponse |
Thread-safe version of HttpResponse that can be passed around through QMetaObject::invokeMethod. More... | |
class | RemoteControlServiceInterface |
Interface for all Remote Control Plug-in services. More... | |
class | AbstractAPIService |
Abstract base class for all RemoteControlServiceInterface implementations which are provided by the Remote Control Plug-in plugin directly. More... | |
class | APIController |
This class handles the API-specific requests and dispatches them to the correct RemoteControlServiceInterface implementation. More... | |
class | LocationSearchService |
Provides predefined location search functionality, using the StelLocationMgr. More... | |
class | LocationService |
Provides methods to look up location-related information, and change the current location. More... | |
class | MainService |
Implements the main API services, including the status operation which can be repeatedly polled to find the current state of the main program, including time, view, location, StelAction and StelProperty state changes, movement, script status ... More... | |
class | ObjectService |
Provides operations to look up objects in the Stellarium catalogs. More... | |
class | RemoteControl |
Main class of the RemoteControl plug-in, implementing the StelModule interface. More... | |
class | RemoteControlStelPluginInterface |
This class defines the plugin interface with the main Stellarium program. More... | |
class | RequestHandler |
This is the main request handler for the remote control plugin, receiving and dispatching the HTTP requests. More... | |
class | SimbadService |
Allows SIMBAD object lookups like SearchDialog uses. More... | |
class | StelActionService |
Provides services related to StelAction. More... | |
class | StelPropertyService |
Provides services related to StelProperty. More... | |
class | ViewService |
Provides services related to the view (landscape, sky culture, projection). More... | |
Macros | |
#define | RemoteControlServiceInterface_iid "org.stellarium.plugin.RemoteSync.RemoteControlServiceInterface/1.0" |
Typedefs | |
typedef QMultiMap< QByteArray, QByteArray > | APIParameters |
Defines the HTTP request parameters for the service. | |
Control Stellarium through your web browser! For more information, see Remote Control Plug-in documentation.
struct APIServiceResponse |
Thread-safe version of HttpResponse that can be passed around through QMetaObject::invokeMethod.
It contains the data that will be sent back to the client in the HTTP thread, when control returns to the APIController.
Public Member Functions | |
APIServiceResponse () | |
Constructs an invalid response. | |
void | setHeader (const QByteArray &name, const QByteArray &val) |
Sets a specific HTTP header to the specified value. | |
void | setHeader (const QByteArray &name, const int val) |
Shortcut for int header values. | |
void | setCacheTime (int seconds) |
Sets the time in seconds for which the browser is allowed to cache the reply. | |
void | setStatus (int status, const QByteArray &text) |
Sets the HTTP status type and status text. | |
void | setData (const QByteArray &data) |
Replaces the current return data. | |
void | appendData (const QByteArray &data) |
Appends to the current return data. | |
void | writeRequestError (const QByteArray &msg) |
Sets the HTTP status to 400, and sets the response data to the message. | |
void | writeJSON (const QJsonDocument &doc) |
Sets the Content-Type to "application/json" and serializes the given document into JSON text format. | |
void | writeWrappedHTML (const QString &html, const QString &title) |
Because the HTML descriptions in Stellarium are often not compatible with "clean" HTML5 which is used for the main interface, this method can be used to explicitly wrap the given HTML snippet in a valid HTML 4.01 transitional document for better results, and include the stylesheet iframestyle.css for consistent styling when used in iframes of the RemoteControl web interface. More... | |
void | writeFile (const QString &path, bool allowCaching=false) |
Writes the specified file contents into the response. More... | |
Friends | |
class | APIController |
|
inline |
Writes the specified file contents into the response.
path | The (preferably absolute) path to a file |
allowCaching | if true, the browser is allowed to cache the file for one hour |
|
inline |
Because the HTML descriptions in Stellarium are often not compatible with "clean" HTML5 which is used for the main interface, this method can be used to explicitly wrap the given HTML snippet in a valid HTML 4.01 transitional document for better results, and include the stylesheet iframestyle.css
for consistent styling when used in iframes of the RemoteControl web interface.
html | The HTML snippet to wrap with HTML document tags |
title | The title of the page |
class RemoteControlServiceInterface |
Interface for all Remote Control Plug-in services.
Each implementation is mapped to a separate HTTP request path. The get() or post() method is called to handle each request. Instances of this class which are provided through the StelModuleMgr's extension mechanism (by adding it into the list returned by StelPluginInterface::getExtensionList()) are automatically discovered and registered with the APIController.
Public Member Functions | |
virtual QLatin1String | getPath () const =0 |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
virtual bool | isThreadSafe () const =0 |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
virtual void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response)=0 |
Implement this to define reactions to HTTP GET requests. More... | |
virtual void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response)=0 |
Implement this to define reactions to HTTP POST requests. More... | |
virtual void | update (double deltaTime)=0 |
Called in the main thread each frame. More... | |
|
pure virtual |
Implement this to define reactions to HTTP GET requests.
GET requests generally should only query data or program state, and not change it. If there is an error with the request, use APIServiceResponse::writeRequestError to notify the client.
operation | The operation string of the request (i.e. the part of the request URL after the service name, without parameters) |
parameters | The extracted service parameters (extracted from the URL) |
response | The response object, write your response into this |
Implemented in Scenery3dRemoteControlService, ViewService, StelPropertyService, StelActionService, SimbadService, ObjectService, MainService, LocationService, LocationSearchService, and AbstractAPIService.
|
pure virtual |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread.
This can result in better performance if done correctly. Unless you are sure, return false here.
Implemented in Scenery3dRemoteControlService, SimbadService, LocationSearchService, and AbstractAPIService.
|
pure virtual |
Implement this to define reactions to HTTP POST requests.
POST requests generally should change data or perform some action. If there is an error with the request, use APIServiceResponse::writeRequestError to notify the client.
operation | The operation string of the request (i.e. the part of the request URL after the service name, without parameters) |
parameters | The extracted service parameters (extracted from the URL, and form data, if applicable) |
data | The unmodified data as sent from the client |
response | The response object, write your response into this |
Implemented in Scenery3dRemoteControlService, StelPropertyService, StelActionService, MainService, LocationService, and AbstractAPIService.
|
pure virtual |
Called in the main thread each frame.
Can be used for ongoing actions, for example movement control.
Implemented in Scenery3dRemoteControlService, MainService, and AbstractAPIService.
class AbstractAPIService |
Abstract base class for all RemoteControlServiceInterface implementations which are provided by the Remote Control Plug-in plugin directly.
Public Member Functions | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Provides a default implementation which returns an error message. | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Provides a default implementation which returns an error message. | |
Public Member Functions inherited from RemoteControlServiceInterface | |
virtual QLatin1String | getPath () const =0 |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
Static Protected Attributes | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread.
This can result in better performance if done correctly. Unless you are sure, return false here.
Implements RemoteControlServiceInterface.
Reimplemented in SimbadService, and LocationSearchService.
|
overridevirtual |
Called in the main thread each frame.
Default implementation does nothing. Can be used for ongoing actions, for example movement control.
Implements RemoteControlServiceInterface.
Reimplemented in MainService.
class APIController |
This class handles the API-specific requests and dispatches them to the correct RemoteControlServiceInterface implementation.
Services are registered using registerService(). To see the default services used, see the RequestHandler::RequestHandler constructor.
Public Member Functions | |
APIController (int prefixLength, QObject *parent=nullptr) | |
Constructs an APIController. More... | |
void | update (double deltaTime) |
Should be called each frame from the main thread, like from StelModule::update. More... | |
void | service (HttpRequest &request, HttpResponse &response) override |
Handles an API-specific request. More... | |
void | registerService (RemoteControlServiceInterface *service) |
Registers a service with the APIController. More... | |
Public Member Functions inherited from HttpRequestHandler | |
HttpRequestHandler (QObject *parent=Q_NULLPTR) | |
Constructor. More... | |
virtual | ~HttpRequestHandler () |
Destructor. | |
APIController::APIController | ( | int | prefixLength, |
QObject * | parent = nullptr |
||
) |
Constructs an APIController.
prefixLength | Determines how many characters to strip from the front of the request path |
parent | passed on to QObject constructor |
void APIController::registerService | ( | RemoteControlServiceInterface * | service | ) |
Registers a service with the APIController.
The RemoteControlServiceInterface::getPath() determines the request path of the service.
|
overridevirtual |
Handles an API-specific request.
It finds out which RemoteControlServiceInterface to use depending on the service name (first part of path until slash). An error is returned for invalid requests. If a service was found, the request is passed on to its RemoteControlServiceInterface::get or RemoteControlServiceInterface::post method depending on the HTTP request type. If RemoteControlServiceInterface::isThreadSafe is false, these methods are called in the Stellarium main thread using QMetaObject::invokeMethod, otherwise they are directly executed in the current thread (HTTP worker thread).
Reimplemented from HttpRequestHandler.
void APIController::update | ( | double | deltaTime | ) |
Should be called each frame from the main thread, like from StelModule::update.
Passed on to each AbstractAPIService::update method for optional processing.
class LocationSearchService |
Provides predefined location search functionality, using the StelLocationMgr.
Public Member Functions | |
LocationSearchService (QObject *parent=nullptr) | |
bool | isThreadSafe () const override |
We work on a copy of the StelLocationMgr, to prevent hitches as the web user is typing. More... | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the GET method. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Provides a default implementation which returns an error message. | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
|
inlineoverridevirtual |
We work on a copy of the StelLocationMgr, to prevent hitches as the web user is typing.
Reimplemented from AbstractAPIService.
class LocationService |
Provides methods to look up location-related information, and change the current location.
Public Member Functions | |
LocationService (QObject *parent=nullptr) | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the HTTP GET requests. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Implements the HTTP POST requests. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
|
overridevirtual |
class MainService |
Implements the main API services, including the status
operation which can be repeatedly polled to find the current state of the main program, including time, view, location, StelAction and StelProperty state changes, movement, script status ...
Public Types | |
enum | SelectionMode { Center , Zoom , Mark } |
Public Member Functions | |
MainService (QObject *parent=nullptr) | |
void | update (double deltaTime) override |
Used to implement move functionality. | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the GET operations. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Implements the HTTP POST operations. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
|
overridevirtual |
class ObjectService |
Provides operations to look up objects in the Stellarium catalogs.
Public Member Functions | |
ObjectService (QObject *parent=nullptr) | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the HTTP GET method. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Provides a default implementation which returns an error message. | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
class RemoteControl |
Main class of the RemoteControl plug-in, implementing the StelModule interface.
Manages the settings and the starting/stopping of the QtWebApp web server. The RequestHandler class is used for request processing.
Public Slots | |
void | setFlagEnabled (bool b) |
Starts/stops the web server. | |
void | setFlagAutoStart (bool b) |
If true, the server is automatically started when init() is called. | |
void | setFlagUsePassword (bool b) |
If true, the password from setPassword() is required for all web requests. | |
void | setPassword (const QString &password) |
Sets the password that is optionally enabled with setFlagUsePassword(). More... | |
void | setFlagEnableCors (bool b) |
If true, Access-Control-Allow-Origin header will be appended to responses. | |
void | setCorsOrigin (const QString &corsOrigin) |
Sets the CORS origin that is optionally enabled with setFlagEnableCors(). | |
void | setPort (const int port) |
Sets the port where the server listens. More... | |
void | loadSettings () |
Load the plug-in's settings from the configuration file. More... | |
void | saveSettings () |
Save the plug-in's settings to the configuration file. More... | |
void | restoreDefaultSettings () |
Restore the plug-in's settings to the default state. More... | |
void | startServer () |
Starts the HTTP server using the current settings and begins handling requests. More... | |
void | stopServer () |
Stops the HTTP server gracefully. | |
Signals | |
void | flagEnabledChanged (bool val) |
void | flagAutoStartChanged (bool val) |
void | flagUsePasswordChanged (bool val) |
void | flagEnableCorsChanged (bool val) |
void | portChanged (int val) |
void | passwordChanged (const QString &val) |
void | corsOriginChanged (const QString &val) |
Public Member Functions | |
void | init () override |
Initialize itself. More... | |
void | update (double deltaTime) override |
Update the module with respect to the time. More... | |
void | draw (StelCore *core) override |
Execute all the drawing functions for this module. More... | |
double | getCallOrder (StelModuleActionName actionName) const override |
Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations. More... | |
void | handleKeys (QKeyEvent *event) override |
Handle key events. More... | |
bool | configureGui (bool show=true) override |
Detect or show the configuration GUI elements for the module. More... | |
bool | getFlagEnabled () const |
bool | getFlagAutoStart () const |
bool | getFlagUsePassword () const |
bool | getFlagEnableCors () const |
QString | getPassword () const |
QString | getCorsOrigin () const |
int | getPort () const |
Public Member Functions inherited from StelModule | |
StelModule () | |
Constructor. Every derived class MUST call setObjectName(className) in its constructor. | |
virtual void | deinit () |
Called before the module will be deleted, and before the OpenGL context is suppressed. More... | |
virtual QSettings * | getSettings () |
Return module-specific settings. More... | |
virtual QString | getModuleVersion () const |
Get the version of the module, default is stellarium main version. | |
virtual QString | getAuthorName () const |
Get the name of the module author. | |
virtual QString | getAuthorEmail () const |
Get the email address of the module author. | |
virtual void | handleMouseClicks (class QMouseEvent *) |
Handle mouse clicks. More... | |
virtual void | handleMouseWheel (class QWheelEvent *) |
Handle mouse wheel. More... | |
virtual bool | handleMouseMoves (int x, int y, Qt::MouseButtons b) |
Handle mouse moves. More... | |
virtual bool | handlePinch (qreal scale, bool started) |
Handle pinch gesture events. More... | |
Properties | |
bool | enabled |
Determines if the web server is running, and can be used to start/stop the server. | |
bool | autoStart |
If true, the server is automatically started when init() is called. | |
bool | usePassword |
If true, the password set with setPassword() is required for all requests. More... | |
bool | enableCors |
Additional Inherited Members | |
Public Types inherited from StelModule | |
enum | StelModuleSelectAction { AddToSelection , ReplaceSelection , RemoveFromSelection } |
Enum used when selecting objects to define whether to add to, replace, or remove from the existing selection list. More... | |
enum | StelModuleActionName { ActionDraw , ActionUpdate , ActionHandleMouseClicks , ActionHandleMouseMoves , ActionHandleKeys } |
Define the possible action for which an order is defined. More... | |
Protected Member Functions inherited from StelModule | |
class StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="") |
convenience methods to add an action (call to slot) to the StelActionMgr object. More... | |
class StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="") |
convenience methods to add an action (call to own slot) to the StelActionMgr object. More... | |
StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, QObject *contextObject, std::function< void()> lambda, const QString &shortcut="", const QString &altShortcut="") |
convenience methods to add an action (call to Lambda functor) to the StelActionMgr object. More... | |
|
overridevirtual |
Detect or show the configuration GUI elements for the module.
This is to be used with plugins to display a configuration dialog from the plugin list window.
show | if true, make the configuration GUI visible. If false, hide the config GUI if there is one. |
Reimplemented from StelModule.
|
overridevirtual |
Execute all the drawing functions for this module.
core | the core to use for the drawing |
Reimplemented from StelModule.
|
overridevirtual |
Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations.
actionName | the name of the action for which we want the call order |
Reimplemented from StelModule.
|
inlineoverridevirtual |
Handle key events.
Please note that most of the interactions will be done through the GUI module.
e | the Key event |
Reimplemented from StelModule.
|
overridevirtual |
Initialize itself.
If the initialization takes significant time, the progress should be displayed on the loading bar.
Implements StelModule.
|
slot |
Load the plug-in's settings from the configuration file.
Settings are kept in the "RemoteControl" section in Stellarium's configuration file. If no such section exists, it will load default values.
|
slot |
Restore the plug-in's settings to the default state.
Replace the plug-in's settings in Stellarium's configuration file with the default values and re-load them. Uses internally loadSettings() and saveSettings().
|
slot |
Save the plug-in's settings to the configuration file.
|
slot |
Sets the password that is optionally enabled with setFlagUsePassword().
The password is required by RequestHandler for all HTTP requests. Basic HTTP auth is used, without a user name.
|
slot |
Sets the port where the server listens.
Must be done before startServer() is called, or restart the server to use the new setting.
|
slot |
Starts the HTTP server using the current settings and begins handling requests.
Uses the RequestHandler class for processing.
|
overridevirtual |
Update the module with respect to the time.
deltaTime | the time increment in second since last call. |
Reimplemented from StelModule.
|
readwrite |
If true, the password set with setPassword() is required for all requests.
The password is passed on to the RequestHandler.
class RemoteControlStelPluginInterface |
This class defines the plugin interface with the main Stellarium program.
Public Member Functions | |
StelModule * | getStelModule () const override |
Get the instance of StelModule to include in the list of standard StelModule. | |
StelPluginInfo | getPluginInfo () const override |
Get information about the plugin. | |
Public Member Functions inherited from StelPluginInterface | |
virtual QObjectList | getExtensionList () const |
A mechanism to provide arbitrary QObjects to the StelModuleMgr. More... | |
class RequestHandler |
This is the main request handler for the remote control plugin, receiving and dispatching the HTTP requests.
It also handles the optional simple HTTP authentication. See service to find out how the requests are processed.
Public Slots | |
void | setUsePassword (bool v) |
Sets whether a password set with setPassword() is required by all requests. More... | |
bool | getUsePassword () |
Returns if a password is required to access the remote control. | |
void | setPassword (const QString &pw) |
void | setEnableCors (bool v) |
Sets whether CORS is enabled. More... | |
bool | getEnableCors () const |
Returns if CORS is enabled. | |
void | setCorsOrigin (const QString &origin) |
Set the host for which CORS is enabled. More... | |
Public Member Functions | |
RequestHandler (const StaticFileControllerSettings &settings, QObject *parent=nullptr) | |
Constructs the request handler. More... | |
~RequestHandler () override | |
The internal APIController, and all registered services are deleted. | |
void | update (double deltaTime) |
Called in the main thread each frame, only passed on to APIController::update. | |
void | service (HttpRequest &request, HttpResponse &response) override |
Receives the HttpRequest from the HttpListener. More... | |
Public Member Functions inherited from HttpRequestHandler | |
HttpRequestHandler (QObject *parent=Q_NULLPTR) | |
Constructor. More... | |
virtual | ~HttpRequestHandler () |
Destructor. | |
RequestHandler::RequestHandler | ( | const StaticFileControllerSettings & | settings, |
QObject * | parent = nullptr |
||
) |
Constructs the request handler.
This also creates an StaticFileController for the webroot
folder, and an APIController.
To see the default services that are registered here, see API reference.
|
overridevirtual |
Receives the HttpRequest from the HttpListener.
It checks the optional HTTP authentication and sets the keep-alive header if requested by the client.
If the authentication is correct, the request is processed according to the following rules:
"/api/"
, then the request is passed to the APIController without further processing.translate_files
file is requested, the cached translated version of this file is returned. This cache is updated each time the app language changes.data/webroot
folder.Reimplemented from HttpRequestHandler.
|
slot |
Set the host for which CORS is enabled.
Specify "*" to let any website take control.
|
slot |
Sets whether CORS is enabled.
|
slot |
|
slot |
Sets whether a password set with setPassword() is required by all requests.
It uses HTTP Basic authorization, with an empty username.
class SimbadService |
Allows SIMBAD object lookups like SearchDialog uses.
Public Member Functions | |
SimbadService (QObject *parent=nullptr) | |
bool | isThreadSafe () const override |
Simbad lookups dont block the main thread. | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the HTTP GET method. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Provides a default implementation which returns an error message. | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
class StelActionService |
Provides services related to StelAction.
See also the StelAction related operations of MainService.
Public Member Functions | |
StelActionService (QObject *parent=nullptr) | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the HTTP GET method. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Implements the HTTP POST method. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
|
overridevirtual |
class StelPropertyService |
Provides services related to StelProperty.
See also the StelProperty related operations of MainService.
Public Member Functions | |
StelPropertyService (QObject *parent=nullptr) | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the HTTP GET method. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Implements the HTTP POST method. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |
|
overridevirtual |
class ViewService |
Provides services related to the view (landscape, sky culture, projection).
Public Member Functions | |
ViewService (QObject *parent=nullptr) | |
QLatin1String | getPath () const override |
Returns the desired path mapping If there is a conflict, only the first object is mapped. | |
void | get (const QByteArray &operation, const APIParameters ¶meters, APIServiceResponse &response) override |
Implements the HTTP GET operations. More... | |
Public Member Functions inherited from AbstractAPIService | |
AbstractAPIService (QObject *parent=nullptr) | |
Only calls QObject constructor. | |
bool | isThreadSafe () const override |
Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More... | |
void | update (double deltaTime) override |
Called in the main thread each frame. More... | |
void | post (const QByteArray &operation, const APIParameters ¶meters, const QByteArray &data, APIServiceResponse &response) override |
Provides a default implementation which returns an error message. | |
Additional Inherited Members | |
Static Protected Attributes inherited from AbstractAPIService | |
static const Qt::ConnectionType | SERVICE_DEFAULT_INVOKETYPE |
This defines the connection type QMetaObject::invokeMethod has to use inside a service: either Qt::DirectConnection for main thread handling, or Qt::BlockingQueuedConnection for HTTP thread handling. | |
|
overridevirtual |