Change scheme to https everywhere

This commit is contained in:
Tamás Bálint Misius 2019-03-13 22:47:19 +01:00 committed by jacob1
parent e29e3481e0
commit 5bc3c03082
13 changed files with 42 additions and 41 deletions

View File

@ -27,7 +27,7 @@
#define SNAPSHOT_ID 0 #define SNAPSHOT_ID 0
#endif #endif
// Mod ID, used on the http://starcatcher.us/TPT build server // Mod ID, used on the https://starcatcher.us/TPT build server
// The build server will compile for all platforms for you, and send updates in game // The build server will compile for all platforms for you, and send updates in game
// See jacob1 to get a mod ID // See jacob1 to get a mod ID
#ifndef MOD_ID #ifndef MOD_ID
@ -85,6 +85,7 @@
#define MTOS_EXPAND(str) #str #define MTOS_EXPAND(str) #str
#define MTOS(str) MTOS_EXPAND(str) #define MTOS(str) MTOS_EXPAND(str)
#define SCHEME "https://"
#define SERVER "powdertoy.co.uk" #define SERVER "powdertoy.co.uk"
#define STATICSERVER "static.powdertoy.co.uk" #define STATICSERVER "static.powdertoy.co.uk"

View File

@ -543,7 +543,7 @@ void BlueScreen(String detailMessage)
String errorTitle = "ERROR"; String errorTitle = "ERROR";
String errorDetails = "Details: " + detailMessage; String errorDetails = "Details: " + detailMessage;
String errorHelp = "An unrecoverable fault has occurred, please report the error by visiting the website below\n" String errorHelp = "An unrecoverable fault has occurred, please report the error by visiting the website below\n"
"http://" SERVER; SCHEME SERVER;
int currentY = 0, width, height; int currentY = 0, width, height;
int errorWidth = 0; int errorWidth = 0;
Graphics::textsize(errorHelp, errorWidth, height); Graphics::textsize(errorHelp, errorWidth, height);

View File

@ -128,7 +128,7 @@ void Client::Initialise(ByteString proxyString)
stampsLib.close(); stampsLib.close();
//Begin version check //Begin version check
versionCheckRequest = new http::Request("http://" SERVER "/Startup.json"); versionCheckRequest = new http::Request(SCHEME SERVER "/Startup.json");
if (authUser.UserID) if (authUser.UserID)
{ {
@ -138,7 +138,7 @@ void Client::Initialise(ByteString proxyString)
#ifdef UPDATESERVER #ifdef UPDATESERVER
// use an alternate update server // use an alternate update server
alternateVersionCheckRequest = new http::Request("http://" UPDATESERVER "/Startup.json"); alternateVersionCheckRequest = new http::Request(SCHEME UPDATESERVER "/Startup.json");
usingAltUpdateServer = true; usingAltUpdateServer = true;
if (authUser.UserID) if (authUser.UserID)
{ {
@ -977,7 +977,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
} }
#endif #endif
data = http::Request::SimpleAuth("http://" SERVER "/Save.api", &dataStatus, userID, authUser.SessionID, { data = http::Request::SimpleAuth(SCHEME SERVER "/Save.api", &dataStatus, userID, authUser.SessionID, {
{ "Name", save.GetName().ToUtf8() }, { "Name", save.GetName().ToUtf8() },
{ "Description", save.GetDescription().ToUtf8() }, { "Description", save.GetDescription().ToUtf8() },
{ "Data:save.bin", ByteString(gameData, gameData + gameDataLength) }, { "Data:save.bin", ByteString(gameData, gameData + gameDataLength) },
@ -1173,7 +1173,7 @@ RequestStatus Client::ExecVote(int saveID, int direction)
{ {
ByteString saveIDText = ByteString::Build(saveID); ByteString saveIDText = ByteString::Build(saveID);
ByteString userIDText = ByteString::Build(authUser.UserID); ByteString userIDText = ByteString::Build(authUser.UserID);
data = http::Request::SimpleAuth("http://" SERVER "/Vote.api", &dataStatus, userIDText, authUser.SessionID, { data = http::Request::SimpleAuth(SCHEME SERVER "/Vote.api", &dataStatus, userIDText, authUser.SessionID, {
{ "ID", saveIDText }, { "ID", saveIDText },
{ "Action", direction == 1 ? "Up" : "Down" }, { "Action", direction == 1 ? "Up" : "Down" },
}); });
@ -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("http://", STATICSERVER, "/", saveID, "_", saveDate, ".cps"); urlStr = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps");
else else
urlStr = ByteString::Build("http://", STATICSERVER, "/", saveID, ".cps"); urlStr = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, ".cps");
data = http::Request::Simple(urlStr, &dataStatus); data = http::Request::Simple(urlStr, &dataStatus);
@ -1245,7 +1245,7 @@ LoginStatus Client::Login(ByteString username, ByteString password, User & user)
ByteString data; ByteString data;
int dataStatus; int dataStatus;
data = http::Request::Simple("http://" SERVER "/Login.json", &dataStatus, { data = http::Request::Simple(SCHEME SERVER "/Login.json", &dataStatus, {
{ "Username", username }, { "Username", username },
{ "Hash", totalHash }, { "Hash", totalHash },
}); });
@ -1300,7 +1300,7 @@ RequestStatus Client::DeleteSave(int saveID)
{ {
lastError = ""; lastError = "";
ByteString data; ByteString data;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/Delete.json?ID=", saveID, "&Mode=Delete&Key=", authUser.SessionKey); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/Delete.json?ID=", saveID, "&Mode=Delete&Key=", authUser.SessionKey);
int dataStatus; int dataStatus;
if(authUser.UserID) if(authUser.UserID)
{ {
@ -1321,7 +1321,7 @@ RequestStatus Client::AddComment(int saveID, String comment)
lastError = ""; lastError = "";
ByteString data; ByteString data;
int dataStatus; int dataStatus;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/Comments.json?ID=", saveID); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/Comments.json?ID=", saveID);
if(authUser.UserID) if(authUser.UserID)
{ {
ByteString userID = ByteString::Build(authUser.UserID); ByteString userID = ByteString::Build(authUser.UserID);
@ -1344,7 +1344,7 @@ RequestStatus Client::FavouriteSave(int saveID, bool favourite)
ByteStringBuilder urlStream; ByteStringBuilder urlStream;
ByteString data; ByteString data;
int dataStatus; int dataStatus;
urlStream << "http://" << SERVER << "/Browse/Favourite.json?ID=" << saveID << "&Key=" << authUser.SessionKey; urlStream << SCHEME << SERVER << "/Browse/Favourite.json?ID=" << saveID << "&Key=" << authUser.SessionKey;
if(!favourite) if(!favourite)
urlStream << "&Mode=Remove"; urlStream << "&Mode=Remove";
if(authUser.UserID) if(authUser.UserID)
@ -1366,7 +1366,7 @@ RequestStatus Client::ReportSave(int saveID, String message)
lastError = ""; lastError = "";
ByteString data; ByteString data;
int dataStatus; int dataStatus;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/Report.json?ID=", saveID, "&Key=", authUser.SessionKey); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/Report.json?ID=", saveID, "&Key=", authUser.SessionKey);
if(authUser.UserID) if(authUser.UserID)
{ {
ByteString userID = ByteString::Build(authUser.UserID); ByteString userID = ByteString::Build(authUser.UserID);
@ -1388,7 +1388,7 @@ RequestStatus Client::UnpublishSave(int saveID)
lastError = ""; lastError = "";
ByteString data; ByteString data;
int dataStatus; int dataStatus;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/Delete.json?ID=", saveID, "&Mode=Unpublish&Key=", authUser.SessionKey); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/Delete.json?ID=", saveID, "&Mode=Unpublish&Key=", authUser.SessionKey);
if(authUser.UserID) if(authUser.UserID)
{ {
ByteString userID = ByteString::Build(authUser.UserID); ByteString userID = ByteString::Build(authUser.UserID);
@ -1408,7 +1408,7 @@ RequestStatus Client::PublishSave(int saveID)
lastError = ""; lastError = "";
ByteString data; ByteString data;
int dataStatus; int dataStatus;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/View.json?ID=", saveID, "&Key=", authUser.SessionKey); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/View.json?ID=", saveID, "&Key=", authUser.SessionKey);
if (authUser.UserID) if (authUser.UserID)
{ {
ByteString userID = ByteString::Build(authUser.UserID); ByteString userID = ByteString::Build(authUser.UserID);
@ -1429,7 +1429,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
{ {
lastError = ""; lastError = "";
ByteStringBuilder urlStream; ByteStringBuilder urlStream;
urlStream << "http://" << SERVER << "/Browse/View.json?ID=" << saveID; urlStream << SCHEME << SERVER << "/Browse/View.json?ID=" << saveID;
if(saveDate) if(saveDate)
{ {
urlStream << "&Date=" << saveDate; urlStream << "&Date=" << saveDate;
@ -1504,7 +1504,7 @@ std::vector<std::pair<ByteString, int> > * Client::GetTags(int start, int count,
ByteStringBuilder urlStream; ByteStringBuilder urlStream;
ByteString data; ByteString data;
int dataStatus; int dataStatus;
urlStream << "http://" << SERVER << "/Browse/Tags.json?Start=" << start << "&Count=" << count; urlStream << SCHEME << SERVER << "/Browse/Tags.json?Start=" << start << "&Count=" << count;
if(query.length()) if(query.length())
{ {
urlStream << "&Search_Query="; urlStream << "&Search_Query=";
@ -1550,7 +1550,7 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, String query,
ByteStringBuilder urlStream; ByteStringBuilder urlStream;
ByteString data; ByteString data;
int dataStatus; int dataStatus;
urlStream << "http://" << SERVER << "/Browse.json?Start=" << start << "&Count=" << count; urlStream << SCHEME << SERVER << "/Browse.json?Start=" << start << "&Count=" << count;
if(query.length() || sort.length()) if(query.length() || sort.length())
{ {
urlStream << "&Search_Query="; urlStream << "&Search_Query=";
@ -1618,7 +1618,7 @@ std::list<ByteString> * Client::RemoveTag(int saveID, ByteString tag)
std::list<ByteString> * tags = NULL; std::list<ByteString> * tags = NULL;
ByteString data; ByteString data;
int dataStatus; int dataStatus;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/EditTag.json?Op=delete&ID=", saveID, "&Tag=", tag, "&Key=", authUser.SessionKey); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/EditTag.json?Op=delete&ID=", saveID, "&Tag=", tag, "&Key=", authUser.SessionKey);
if(authUser.UserID) if(authUser.UserID)
{ {
ByteString userID = ByteString::Build(authUser.UserID); ByteString userID = ByteString::Build(authUser.UserID);
@ -1657,7 +1657,7 @@ std::list<ByteString> * Client::AddTag(int saveID, ByteString tag)
std::list<ByteString> * tags = NULL; std::list<ByteString> * tags = NULL;
ByteString data; ByteString data;
int dataStatus; int dataStatus;
ByteString url = ByteString::Build("http://", SERVER, "/Browse/EditTag.json?Op=add&ID=", saveID, "&Tag=", tag, "&Key=", authUser.SessionKey); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/EditTag.json?Op=add&ID=", saveID, "&Tag=", tag, "&Key=", authUser.SessionKey);
if(authUser.UserID) if(authUser.UserID)
{ {
ByteString userID = ByteString::Build(authUser.UserID); ByteString userID = ByteString::Build(authUser.UserID);

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("http://" STATICSERVER "/avatars/", username, ".pti"), width, height) ImageRequest(ByteString::Build(SCHEME STATICSERVER "/avatars/", username, ".pti"), width, height)
{ {
} }

View File

@ -3,7 +3,7 @@
namespace http namespace http
{ {
GetUserInfoRequest::GetUserInfoRequest(ByteString username) : GetUserInfoRequest::GetUserInfoRequest(ByteString username) :
APIRequest("http://" SERVER "/User.json?Name=" + username) APIRequest(SCHEME SERVER "/User.json?Name=" + username)
{ {
} }

View File

@ -3,7 +3,7 @@
namespace http namespace http
{ {
SaveUserInfoRequest::SaveUserInfoRequest(UserInfo info) : SaveUserInfoRequest::SaveUserInfoRequest(UserInfo info) :
APIRequest("http://" SERVER "/Profile.json") APIRequest(SCHEME SERVER "/Profile.json")
{ {
AddPostData({ AddPostData({
{ "Location", info.location.ToUtf8() }, { "Location", info.location.ToUtf8() },

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("http://" STATICSERVER "/", saveID, "_", saveDate, "_small.pti") ? ByteString::Build(SCHEME STATICSERVER "/", saveID, "_", saveDate, "_small.pti")
: ByteString::Build("http://" STATICSERVER "/", saveID, "_small.pti") : ByteString::Build(SCHEME STATICSERVER "/", saveID, "_small.pti")
), width, height) ), width, height)
{ {
} }

View File

@ -687,7 +687,7 @@ bool GameController::MouseUp(int x, int y, unsigned button, char type)
case 't': case 't':
{ {
// buff is already confirmed to be a number by sign::splitsign // buff is already confirmed to be a number by sign::splitsign
Platform::OpenURI(ByteString::Build("http://powdertoy.co.uk/Discussions/Thread/View.html?Thread=", link.ToUtf8())); Platform::OpenURI(ByteString::Build(SCHEME "powdertoy.co.uk/Discussions/Thread/View.html?Thread=", link.ToUtf8()));
break; break;
} }
case 's': case 's':
@ -1716,9 +1716,9 @@ void GameController::RunUpdater()
#else #else
#ifdef UPDATESERVER #ifdef UPDATESERVER
ByteString file = ByteString::Build("https://", UPDATESERVER, Client::Ref().GetUpdateInfo().File); ByteString file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
#else #else
ByteString file = ByteString::Build("https://", SERVER, Client::Ref().GetUpdateInfo().File); ByteString file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
#endif #endif
Platform::OpenURI(file); Platform::OpenURI(file);

View File

@ -153,7 +153,7 @@ void PreviewController::FavouriteSave()
void PreviewController::OpenInBrowser() void PreviewController::OpenInBrowser()
{ {
ByteString uri = ByteString::Build("http://", SERVER, "/Browse/View.html?ID=", saveId); ByteString uri = ByteString::Build(SCHEME, SERVER, "/Browse/View.html?ID=", saveId);
Platform::OpenURI(uri); Platform::OpenURI(uri);
} }

View File

@ -72,13 +72,13 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
ByteString url; ByteString url;
if (saveDate) if (saveDate)
url = ByteString::Build("http://", STATICSERVER, "/", saveID, "_", saveDate, ".cps"); url = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps");
else else
url = ByteString::Build("http://", STATICSERVER, "/", saveID, ".cps"); url = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, ".cps");
saveDataDownload = new http::Request(url); saveDataDownload = new http::Request(url);
saveDataDownload->Start(); saveDataDownload->Start();
url = ByteString::Build("http://", SERVER , "/Browse/View.json?ID=", saveID); url = ByteString::Build(SCHEME, SERVER , "/Browse/View.json?ID=", saveID);
if (saveDate) if (saveDate)
url += ByteString::Build("&Date=", saveDate); url += ByteString::Build("&Date=", saveDate);
saveInfoDownload = new http::Request(url); saveInfoDownload = new http::Request(url);
@ -89,7 +89,7 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
{ {
commentsLoaded = false; commentsLoaded = false;
url = ByteString::Build("http://", SERVER, "/Browse/Comments.json?ID=", saveID, "&Start=", (commentsPageNumber-1)*20, "&Count=20"); url = ByteString::Build(SCHEME, SERVER, "/Browse/Comments.json?ID=", saveID, "&Start=", (commentsPageNumber-1)*20, "&Count=20");
commentsDownload = new http::Request(url); commentsDownload = new http::Request(url);
commentsDownload->AuthHeaders(ByteString::Build(Client::Ref().GetAuthUser().UserID), Client::Ref().GetAuthUser().SessionID); commentsDownload->AuthHeaders(ByteString::Build(Client::Ref().GetAuthUser().UserID), Client::Ref().GetAuthUser().SessionID);
commentsDownload->Start(); commentsDownload->Start();
@ -141,7 +141,7 @@ void PreviewModel::UpdateComments(int pageNumber)
commentsPageNumber = pageNumber; commentsPageNumber = pageNumber;
if (!GetDoOpen()) if (!GetDoOpen())
{ {
ByteString url = ByteString::Build("http://", SERVER, "/Browse/Comments.json?ID=", saveID, "&Start=", (commentsPageNumber-1)*20, "&Count=20"); ByteString url = ByteString::Build(SCHEME, SERVER, "/Browse/Comments.json?ID=", saveID, "&Start=", (commentsPageNumber-1)*20, "&Count=20");
commentsDownload = new http::Request(url); commentsDownload = new http::Request(url);
commentsDownload->AuthHeaders(ByteString::Build(Client::Ref().GetAuthUser().UserID), Client::Ref().GetAuthUser().SessionID); commentsDownload->AuthHeaders(ByteString::Build(Client::Ref().GetAuthUser().UserID), Client::Ref().GetAuthUser().SessionID);
commentsDownload->Start(); commentsDownload->Start();
@ -166,7 +166,7 @@ void PreviewModel::OnSaveReady()
{ {
GameSave *gameSave = new GameSave(*saveData); GameSave *gameSave = new GameSave(*saveData);
if (gameSave->fromNewerVersion) if (gameSave->fromNewerVersion)
new ErrorMessage("This save is from a newer version", "Please update TPT in game or at http://powdertoy.co.uk"); new ErrorMessage("This save is from a newer version", "Please update TPT in game or at https://powdertoy.co.uk");
saveInfo->SetGameSave(gameSave); saveInfo->SetGameSave(gameSave);
} }
catch(ParseException &e) catch(ParseException &e)
@ -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("http://", STATICSERVER, "/2157797.cps")); saveDataDownload = new http::Request(ByteString::Build(SCHEME, STATICSERVER, "/2157797.cps"));
saveDataDownload->Start(); saveDataDownload->Start();
} }
return true; return true;

View File

@ -81,7 +81,7 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
public: public:
void ActionCallback(ui::Button * sender_) override void ActionCallback(ui::Button * sender_) override
{ {
Platform::OpenURI("http://" SERVER "/Profile/Avatar.html"); Platform::OpenURI(SCHEME SERVER "/Profile/Avatar.html");
} }
}; };

View File

@ -115,9 +115,9 @@ private:
UpdateActivity::UpdateActivity() { UpdateActivity::UpdateActivity() {
ByteString file; ByteString file;
#ifdef UPDATESERVER #ifdef UPDATESERVER
file = ByteString::Build("http://", UPDATESERVER, Client::Ref().GetUpdateInfo().File); file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
#else #else
file = ByteString::Build("http://", SERVER, Client::Ref().GetUpdateInfo().File); file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
#endif #endif
updateDownloadTask = new UpdateDownloadTask(file, this); updateDownloadTask = new UpdateDownloadTask(file, this);
updateWindow = new TaskWindow("Downloading update...", updateDownloadTask, true); updateWindow = new TaskWindow("Downloading update...", updateDownloadTask, true);
@ -149,7 +149,7 @@ void UpdateActivity::NotifyError(Task * sender)
if (result == ConfirmPrompt::ResultOkay) if (result == ConfirmPrompt::ResultOkay)
{ {
#ifndef UPDATESERVER #ifndef UPDATESERVER
Platform::OpenURI("http://powdertoy.co.uk/Download.html"); Platform::OpenURI(SCHEME "powdertoy.co.uk/Download.html");
#endif #endif
} }
a->Exit(); a->Exit();

View File

@ -1350,7 +1350,7 @@ int luatpt_getscript(lua_State* l)
int runScript = luaL_optint(l, 3, 0); int runScript = luaL_optint(l, 3, 0);
int confirmPrompt = luaL_optint(l, 4, 1); int confirmPrompt = luaL_optint(l, 4, 1);
ByteString url = ByteString::Build("http://starcatcher.us/scripts/main.lua?get=", scriptID); ByteString url = ByteString::Build(SCHEME "starcatcher.us/scripts/main.lua?get=", scriptID);
if (confirmPrompt && !ConfirmPrompt::Blocking("Do you want to install script?", url.FromUtf8(), "Install")) if (confirmPrompt && !ConfirmPrompt::Blocking("Do you want to install script?", url.FromUtf8(), "Install"))
return 0; return 0;