UFO: Alien Invasion
Loading...
Searching...
No Matches
web_main.h
Go to the documentation of this file.
1
6
7/*
8Copyright (C) 2002-2025 UFO: Alien Invasion.
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19See the GNU General Public License for more details.m
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24*/
25
26#pragma once
27
28#include "../../common/common.h"
29#include "../../common/http.h"
30
31#define WEB_API_SERVER "http://ufoai.org/"
32
33extern cvar_t* web_username;
34extern cvar_t* web_password;
35extern cvar_t* web_userid;
36
37bool WEB_CheckAuth(void);
38bool WEB_Auth(const char* username, const char* password);
39void WEB_InitStartup(void);
40bool WEB_GetURL(const char* url, http_callback_t callback, void* userdata = nullptr);
41bool WEB_GetToFile(const char* url, FILE* file);
42bool WEB_PutFile(const char* formName, const char* fileName, const char* url, upparam_t* params = nullptr);
definitions common between client and server, but not game lib
cvar_t * password
Definition g_main.cpp:67
void(* http_callback_t)(const char *response, void *userdata)
Definition http.h:65
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
Definition cvar.h:71
#define FILE
cvar_t * web_username
Definition web_main.cpp:33
cvar_t * web_password
Definition web_main.cpp:34
cvar_t * web_userid
Definition web_main.cpp:35
bool WEB_Auth(const char *username, const char *password)
Performs a web auth request.
Definition web_main.cpp:135
bool WEB_CheckAuth(void)
Pushes the webauth window if the password is not yet set.
Definition web_main.cpp:176
void WEB_InitStartup(void)
Definition web_main.cpp:185
bool WEB_GetURL(const char *url, http_callback_t callback, void *userdata=nullptr)
Downloads the given url and notify the callback. The login credentials are automatically added as GET...
Definition web_main.cpp:44
bool WEB_PutFile(const char *formName, const char *fileName, const char *url, upparam_t *params=nullptr)
Uploads a file to the server with the login credentials.
Definition web_main.cpp:87
bool WEB_GetToFile(const char *url, FILE *file)
Downloads the given url directly into the given file. The login credentials are automatically added a...
Definition web_main.cpp:65