UFO: Alien Invasion
|
UFOAI web interface management. Authentication as well as uploading/downloading stuff to and from your account is done here. More...
#include "web_main.h"
#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "web_cgame.h"
#include "../../common/sha1.h"
Go to the source code of this file.
Functions | |
bool | WEB_GetURL (const char *url, http_callback_t callback, void *userdata) |
Downloads the given url and notify the callback. The login credentials are automatically added as GET parameters. More... | |
bool | WEB_GetToFile (const char *url, FILE *file) |
Downloads the given url directly into the given file. The login credentials are automatically added as GET parameters. More... | |
bool | WEB_PutFile (const char *formName, const char *fileName, const char *url, upparam_t *params) |
Uploads a file to the server with the login credentials. More... | |
static void | WEB_AuthResponse (const char *response, void *userdata) |
The callback for the web auth request. More... | |
bool | WEB_Auth (const char *username, const char *password) |
Performs a web auth request. More... | |
static void | WEB_Auth_f (void) |
Console callback for handling the web auth. More... | |
bool | WEB_CheckAuth (void) |
Pushes the webauth window if the password is not yet set. More... | |
void | WEB_InitStartup (void) |
Variables | |
static cvar_t * | web_authurl |
cvar_t * | web_username |
cvar_t * | web_password |
cvar_t * | web_userid |
UFOAI web interface management. Authentication as well as uploading/downloading stuff to and from your account is done here.
Definition in file web_main.cpp.
bool WEB_Auth | ( | const char * | username, |
const char * | password | ||
) |
Performs a web auth request.
[in] | username | The (unencoded) username |
[in] | password | The (ununcoded) password |
web_username
and web_password
are going to become overridden here. If the auth failed, the cvar web_password
is set to an empty string again. true
if the auth was successful, false
otherwise. Definition at line 135 of file web_main.cpp.
References Com_SHA1Buffer(), Com_sprintf(), Cvar_Set(), MAX_VAR, Q_strlwr(), Q_strncpyz(), Q_strvalid, cvar_s::string, user, WEB_AuthResponse(), and WEB_GetURL().
Referenced by TEST_F(), and WEB_Auth_f().
Console callback for handling the web auth.
Definition at line 159 of file web_main.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), UI_ExecuteConfunc(), and WEB_Auth().
Referenced by WEB_InitStartup().
The callback for the web auth request.
[in] | response | The web auth response |
[in] | userdata | The userdata. NULL in this case. |
Definition at line 110 of file web_main.cpp.
References Com_DPrintf(), Cvar_Set(), DEBUG_CLIENT, and Q_streq.
Referenced by WEB_Auth(), and WEB_InitStartup().
bool WEB_CheckAuth | ( | void | ) |
Pushes the webauth window if the password is not yet set.
true
if the user is authenticated, false
otherwise Definition at line 176 of file web_main.cpp.
References Q_strnull(), cvar_s::string, and UI_PushWindow().
Referenced by WEB_CGameDelete(), WEB_CGameListForUser(), and WEB_CGameUpload().
bool WEB_GetToFile | ( | const char * | url, |
FILE * | file | ||
) |
Downloads the given url directly into the given file. The login credentials are automatically added as GET parameters.
[in] | url | The url to download |
[in] | file | The file to write into |
true
if the download was successful, false
otherwise Definition at line 65 of file web_main.cpp.
References Com_Printf(), Com_sprintf(), HTTP_Encode(), HTTP_GetToFile(), MAX_VAR, and cvar_s::string.
bool WEB_GetURL | ( | const char * | url, |
http_callback_t | callback, | ||
void * | userdata | ||
) |
Downloads the given url and notify the callback. The login credentials are automatically added as GET parameters.
[in] | url | The url to download |
[in] | callback | The callback to given the downloaded data to |
[in] | userdata | Userdata that is given to the callback |
true
if the download was successful, false
otherwise Definition at line 44 of file web_main.cpp.
References Com_Printf(), Com_sprintf(), HTTP_Encode(), HTTP_GetURL(), and cvar_s::string.
Referenced by WEB_Auth(), WEB_CGameDelete(), WEB_CGameListForUser(), and WEB_InitStartup().
Definition at line 185 of file web_main.cpp.
References Cmd_AddCommand(), Com_Printf(), CVAR_ARCHIVE, Cvar_Get(), Cvar_Set(), Q_strvalid, cvar_s::string, Sys_GetCurrentUser(), WEB_API_SERVER, WEB_Auth_f(), WEB_AuthResponse(), WEB_CGameCommands(), WEB_CGameCvars(), and WEB_GetURL().
Referenced by CL_InitLocal(), and WebApiTest::SetUpTestCase().
bool WEB_PutFile | ( | const char * | formName, |
const char * | fileName, | ||
const char * | url, | ||
upparam_t * | params | ||
) |
Uploads a file to the server with the login credentials.
[in] | formName | The name of the form to submit with the file upload |
[in] | fileName | The filename to upload - this must be a full path, not a virtual filesystem path |
[in] | url | The url to open |
[in] | params | Additional parameters for the form. The username and password values are automatically filled in and don't have to be specified here. |
Definition at line 87 of file web_main.cpp.
References HTTP_PutFile(), upparam_s::name, upparam_s::next, cvar_s::string, and upparam_s::value.
Referenced by WEB_CGameUpload().
|
static |
Definition at line 32 of file web_main.cpp.
cvar_t* web_password |
Definition at line 34 of file web_main.cpp.
cvar_t* web_userid |
Definition at line 35 of file web_main.cpp.
Referenced by TEST_F(), WEB_CGameDelete(), WEB_CGameListForUser(), and WEB_ListCGameFilesCallback().
cvar_t* web_username |
Definition at line 33 of file web_main.cpp.