Add STATICSCHEME macro to be used with requests to STATICSERVER

Make up your mind, jacob1!
This commit is contained in:
Tamás Bálint Misius 2019-03-14 07:56:44 +01:00 committed by jacob1
parent 5bc3c03082
commit 263f756a20
5 changed files with 9 additions and 11 deletions

View File

@ -87,6 +87,7 @@
#define SCHEME "https://" #define SCHEME "https://"
#define SERVER "powdertoy.co.uk" #define SERVER "powdertoy.co.uk"
#define STATICSCHEME "https://"
#define STATICSERVER "static.powdertoy.co.uk" #define STATICSERVER "static.powdertoy.co.uk"
#define LOCAL_SAVE_DIR "Saves" #define LOCAL_SAVE_DIR "Saves"
@ -95,9 +96,6 @@
#define BRUSH_DIR "Brushes" #define BRUSH_DIR "Brushes"
//Number of unique thumbnails to have in cache at one time
#define THUMB_CACHE_SIZE 256
#ifndef M_GRAV #ifndef M_GRAV
#define M_GRAV 6.67300e-1 #define M_GRAV 6.67300e-1
#endif #endif

View File

@ -1195,9 +1195,9 @@ unsigned char * Client::GetSaveData(int saveID, int saveDate, int & dataLength)
dataLength = 0; dataLength = 0;
ByteString urlStr; ByteString urlStr;
if (saveDate) if (saveDate)
urlStr = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps"); urlStr = ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps");
else else
urlStr = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, ".cps"); urlStr = ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, ".cps");
data = http::Request::Simple(urlStr, &dataStatus); data = http::Request::Simple(urlStr, &dataStatus);

View File

@ -4,7 +4,7 @@
namespace http namespace http
{ {
AvatarRequest::AvatarRequest(ByteString username, int width, int height) : AvatarRequest::AvatarRequest(ByteString username, int width, int height) :
ImageRequest(ByteString::Build(SCHEME STATICSERVER "/avatars/", username, ".pti"), width, height) ImageRequest(ByteString::Build(STATICSCHEME STATICSERVER "/avatars/", username, ".pti"), width, height)
{ {
} }

View File

@ -6,8 +6,8 @@ namespace http
ThumbnailRequest::ThumbnailRequest(int saveID, int saveDate, int width, int height) : ThumbnailRequest::ThumbnailRequest(int saveID, int saveDate, int width, int height) :
ImageRequest(( ImageRequest((
saveDate saveDate
? ByteString::Build(SCHEME STATICSERVER "/", saveID, "_", saveDate, "_small.pti") ? ByteString::Build(STATICSCHEME STATICSERVER "/", saveID, "_", saveDate, "_small.pti")
: ByteString::Build(SCHEME STATICSERVER "/", saveID, "_small.pti") : ByteString::Build(STATICSCHEME STATICSERVER "/", saveID, "_small.pti")
), width, height) ), width, height)
{ {
} }

View File

@ -72,9 +72,9 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
ByteString url; ByteString url;
if (saveDate) if (saveDate)
url = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps"); url = ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps");
else else
url = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, ".cps"); url = ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, ".cps");
saveDataDownload = new http::Request(url); saveDataDownload = new http::Request(url);
saveDataDownload->Start(); saveDataDownload->Start();
@ -239,7 +239,7 @@ bool PreviewModel::ParseSaveInfo(ByteString &saveInfoResponse)
saveDataDownload->Cancel(); saveDataDownload->Cancel();
delete saveData; delete saveData;
saveData = NULL; saveData = NULL;
saveDataDownload = new http::Request(ByteString::Build(SCHEME, STATICSERVER, "/2157797.cps")); saveDataDownload = new http::Request(ByteString::Build(STATICSCHEME, STATICSERVER, "/2157797.cps"));
saveDataDownload->Start(); saveDataDownload->Start();
} }
return true; return true;