![]() |
Sunshine latest
Self-hosted game stream host for Moonlight.
|
Definitions for the Web UI Config HTTP server. More...
#include <filesystem>
#include <set>
#include <boost/algorithm/string.hpp>
#include <boost/asio/ssl/context.hpp>
#include <boost/asio/ssl/context_base.hpp>
#include <boost/filesystem.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <Simple-Web-Server/crypto.hpp>
#include <Simple-Web-Server/server_https.hpp>
#include "config.h"
#include "confighttp.h"
#include "crypto.h"
#include "display_device.h"
#include "file_handler.h"
#include "globals.h"
#include "httpcommon.h"
#include "logging.h"
#include "network.h"
#include "nvhttp.h"
#include "platform/common.h"
#include "process.h"
#include "rtsp.h"
#include "utility.h"
#include "uuid.h"
#include "version.h"
Enumerations | |
enum class | confighttp::op_e { ADD , REMOVE } |
Functions | |
bool | confighttp::authenticate (resp_https_t response, req_https_t request) |
Authenticate the user. | |
void | confighttp::bad_request (resp_https_t response, req_https_t request, const std::string &error_message="Bad Request") |
Send a 400 Bad Request response. | |
void | confighttp::closeApp (resp_https_t response, req_https_t request) |
Close the currently running application. | |
void | confighttp::deleteApp (resp_https_t response, req_https_t request) |
Delete an application. | |
void | confighttp::getApps (resp_https_t response, req_https_t request) |
Get the list of available applications. | |
void | confighttp::getAppsPage (resp_https_t response, req_https_t request) |
Get the apps page. | |
void | confighttp::getClientsPage (resp_https_t response, req_https_t request) |
Get the clients page. | |
void | confighttp::getConfig (resp_https_t response, req_https_t request) |
Get the configuration settings. | |
void | confighttp::getConfigPage (resp_https_t response, req_https_t request) |
Get the configuration page. | |
void | confighttp::getFaviconImage (resp_https_t response, req_https_t request) |
Get the favicon image. | |
void | confighttp::getIndexPage (resp_https_t response, req_https_t request) |
Get the index page. | |
void | confighttp::getLocale (resp_https_t response, req_https_t request) |
Get the locale setting. This endpoint does not require authentication. | |
void | confighttp::getLogs (resp_https_t response, req_https_t request) |
Get the logs from the log file. | |
void | confighttp::getNodeModules (resp_https_t response, req_https_t request) |
Get an asset from the node_modules directory. | |
void | confighttp::getPasswordPage (resp_https_t response, req_https_t request) |
Get the password page. | |
void | confighttp::getPinPage (resp_https_t response, req_https_t request) |
Get the PIN page. | |
void | confighttp::getSunshineLogoImage (resp_https_t response, req_https_t request) |
Get the Sunshine logo image. | |
void | confighttp::getTroubleshootingPage (resp_https_t response, req_https_t request) |
Get the troubleshooting page. | |
void | confighttp::getWelcomePage (resp_https_t response, req_https_t request) |
Get the welcome page. | |
bool | confighttp::isChildPath (fs::path const &base, fs::path const &query) |
Check if a path is a child of another path. | |
void | confighttp::listClients (resp_https_t response, req_https_t request) |
Get the list of paired clients. | |
void | confighttp::not_found (resp_https_t response, req_https_t request) |
Send a 404 Not Found response. | |
void | confighttp::print_req (const req_https_t &request) |
Log the request details. | |
void | confighttp::resetDisplayDevicePersistence (resp_https_t response, req_https_t request) |
Reset the display device persistence. | |
void | confighttp::restart (resp_https_t response, req_https_t request) |
Restart Sunshine. | |
void | confighttp::saveApp (resp_https_t response, req_https_t request) |
Save an application. To save a new application the index must be -1 . To update an existing application, you must provide the current index of the application. | |
void | confighttp::saveConfig (resp_https_t response, req_https_t request) |
Save the configuration settings. | |
void | confighttp::savePassword (resp_https_t response, req_https_t request) |
Update existing credentials. | |
void | confighttp::savePin (resp_https_t response, req_https_t request) |
Send a pin code to the host. The pin is generated from the Moonlight client during the pairing process. | |
void | confighttp::send_redirect (resp_https_t response, req_https_t request, const char *path) |
Send a redirect response. | |
void | confighttp::send_response (resp_https_t response, const pt::ptree &output_tree) |
Send a response. | |
void | confighttp::send_unauthorized (resp_https_t response, req_https_t request) |
Send a 401 Unauthorized response. | |
void | confighttp::start () |
void | confighttp::unpair (resp_https_t response, req_https_t request) |
Unpair a client. | |
void | confighttp::unpairAll (resp_https_t response, req_https_t request) |
Unpair all clients. | |
void | confighttp::uploadCover (resp_https_t response, req_https_t request) |
Upload a cover image. | |
Definitions for the Web UI Config HTTP server.
|
strong |
bool confighttp::authenticate | ( | resp_https_t | response, |
req_https_t | request ) |
Authenticate the user.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::bad_request | ( | resp_https_t | response, |
req_https_t | request, | ||
const std::string & | error_message = "Bad Request" ) |
Send a 400 Bad Request response.
response | The HTTP response object. |
request | The HTTP request object. |
error_message | The error message to include in the response. |
void confighttp::closeApp | ( | resp_https_t | response, |
req_https_t | request ) |
Close the currently running application.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::deleteApp | ( | resp_https_t | response, |
req_https_t | request ) |
Delete an application.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getApps | ( | resp_https_t | response, |
req_https_t | request ) |
Get the list of available applications.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getAppsPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the apps page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getClientsPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the clients page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getConfig | ( | resp_https_t | response, |
req_https_t | request ) |
Get the configuration settings.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getConfigPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the configuration page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getFaviconImage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the favicon image.
response | The HTTP response object. |
request | The HTTP request object. |
combine function with getSunshineLogoImage and possibly getNodeModules
use mime_types map
void confighttp::getIndexPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the index page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getLocale | ( | resp_https_t | response, |
req_https_t | request ) |
Get the locale setting. This endpoint does not require authentication.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getLogs | ( | resp_https_t | response, |
req_https_t | request ) |
Get the logs from the log file.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getNodeModules | ( | resp_https_t | response, |
req_https_t | request ) |
Get an asset from the node_modules directory.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getPasswordPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the password page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getPinPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the PIN page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getSunshineLogoImage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the Sunshine logo image.
response | The HTTP response object. |
request | The HTTP request object. |
combine function with getFaviconImage and possibly getNodeModules
use mime_types map
void confighttp::getTroubleshootingPage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the troubleshooting page.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::getWelcomePage | ( | resp_https_t | response, |
req_https_t | request ) |
Get the welcome page.
response | The HTTP response object. |
request | The HTTP request object. |
bool confighttp::isChildPath | ( | fs::path const & | base, |
fs::path const & | query ) |
Check if a path is a child of another path.
base | The base path. |
query | The path to check. |
void confighttp::listClients | ( | resp_https_t | response, |
req_https_t | request ) |
Get the list of paired clients.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::not_found | ( | resp_https_t | response, |
req_https_t | request ) |
Send a 404 Not Found response.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::print_req | ( | const req_https_t & | request | ) |
Log the request details.
request | The HTTP request object. |
void confighttp::resetDisplayDevicePersistence | ( | resp_https_t | response, |
req_https_t | request ) |
Reset the display device persistence.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::restart | ( | resp_https_t | response, |
req_https_t | request ) |
Restart Sunshine.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::saveApp | ( | resp_https_t | response, |
req_https_t | request ) |
Save an application. To save a new application the index must be -1
. To update an existing application, you must provide the current index of the application.
response | The HTTP response object. |
request | The HTTP request object. The body for the post request should be JSON serialized in the following format: {
"name": "Application Name",
"output": "Log Output Path",
"cmd": "Command to run the application",
"index": -1,
"exclude-global-prep-cmd": false,
"elevated": false,
"auto-detach": true,
"wait-all": true,
"exit-timeout": 5,
"prep-cmd": [
{
"do": "Command to prepare",
"undo": "Command to undo preparation",
"elevated": false
}
],
"detached": [
"Detached command"
],
"image-path": "Full path to the application image. Must be a png file."
}
|
void confighttp::saveConfig | ( | resp_https_t | response, |
req_https_t | request ) |
Save the configuration settings.
response | The HTTP response object. |
request | The HTTP request object. The body for the post request should be JSON serialized in the following format: {
"key": "value"
}
|
void confighttp::savePassword | ( | resp_https_t | response, |
req_https_t | request ) |
Update existing credentials.
response | The HTTP response object. |
request | The HTTP request object. The body for the post request should be JSON serialized in the following format: {
"currentUsername": "Current Username",
"currentPassword": "Current Password",
"newUsername": "New Username",
"newPassword": "New Password",
"confirmNewPassword": "Confirm New Password"
}
|
void confighttp::savePin | ( | resp_https_t | response, |
req_https_t | request ) |
Send a pin code to the host. The pin is generated from the Moonlight client during the pairing process.
response | The HTTP response object. |
request | The HTTP request object. The body for the post request should be JSON serialized in the following format: {
"pin": "<pin>",
"name": "Friendly Client Name"
}
|
void confighttp::send_redirect | ( | resp_https_t | response, |
req_https_t | request, | ||
const char * | path ) |
Send a redirect response.
response | The HTTP response object. |
request | The HTTP request object. |
path | The path to redirect to. |
void confighttp::send_response | ( | resp_https_t | response, |
const pt::ptree & | output_tree ) |
Send a response.
response | The HTTP response object. |
output_tree | The JSON tree to send. |
void confighttp::send_unauthorized | ( | resp_https_t | response, |
req_https_t | request ) |
Send a 401 Unauthorized response.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::unpair | ( | resp_https_t | response, |
req_https_t | request ) |
Unpair a client.
response | The HTTP response object. |
request | The HTTP request object. The body for the post request should be JSON serialized in the following format: {
"uuid": "<uuid>"
}
|
void confighttp::unpairAll | ( | resp_https_t | response, |
req_https_t | request ) |
Unpair all clients.
response | The HTTP response object. |
request | The HTTP request object. |
void confighttp::uploadCover | ( | resp_https_t | response, |
req_https_t | request ) |
Upload a cover image.
response | The HTTP response object. |
request | The HTTP request object. The body for the post request should be JSON serialized in the following format: {
"key": "igdb_<game_id>",
"url": "https://images.igdb.com/igdb/image/upload/t_cover_big_2x/<slug>.png"
}
|