Skip to content
Permalink
Browse files

Change scheme to https everywhere

  • Loading branch information...
LBPHacker authored and jacob1 committed Mar 13, 2019
1 parent e29e348 commit 5bc3c03082105c9c67ecfeda9a01161d781b5419
@@ -27,7 +27,7 @@
#define SNAPSHOT_ID 0
#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
// See jacob1 to get a mod ID
#ifndef MOD_ID
@@ -85,6 +85,7 @@
#define MTOS_EXPAND(str) #str
#define MTOS(str) MTOS_EXPAND(str)

#define SCHEME "https://"
#define SERVER "powdertoy.co.uk"
#define STATICSERVER "static.powdertoy.co.uk"

@@ -543,7 +543,7 @@ void BlueScreen(String detailMessage)
String errorTitle = "ERROR";
String errorDetails = "Details: " + detailMessage;
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 errorWidth = 0;
Graphics::textsize(errorHelp, errorWidth, height);
@@ -128,7 +128,7 @@ void Client::Initialise(ByteString proxyString)
stampsLib.close();

//Begin version check
versionCheckRequest = new http::Request("http://" SERVER "/Startup.json");
versionCheckRequest = new http::Request(SCHEME SERVER "/Startup.json");

if (authUser.UserID)
{
@@ -138,7 +138,7 @@ void Client::Initialise(ByteString proxyString)

#ifdef UPDATESERVER
// use an alternate update server
alternateVersionCheckRequest = new http::Request("http://" UPDATESERVER "/Startup.json");
alternateVersionCheckRequest = new http::Request(SCHEME UPDATESERVER "/Startup.json");
usingAltUpdateServer = true;
if (authUser.UserID)
{
@@ -977,7 +977,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
}
#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() },
{ "Description", save.GetDescription().ToUtf8() },
{ "Data:save.bin", ByteString(gameData, gameData + gameDataLength) },
@@ -1173,7 +1173,7 @@ RequestStatus Client::ExecVote(int saveID, int direction)
{
ByteString saveIDText = ByteString::Build(saveID);
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 },
{ "Action", direction == 1 ? "Up" : "Down" },
});
@@ -1195,9 +1195,9 @@ unsigned char * Client::GetSaveData(int saveID, int saveDate, int & dataLength)
dataLength = 0;
ByteString urlStr;
if (saveDate)
urlStr = ByteString::Build("http://", STATICSERVER, "/", saveID, "_", saveDate, ".cps");
urlStr = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps");
else
urlStr = ByteString::Build("http://", STATICSERVER, "/", saveID, ".cps");
urlStr = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, ".cps");

data = http::Request::Simple(urlStr, &dataStatus);

@@ -1245,7 +1245,7 @@ LoginStatus Client::Login(ByteString username, ByteString password, User & user)

ByteString data;
int dataStatus;
data = http::Request::Simple("http://" SERVER "/Login.json", &dataStatus, {
data = http::Request::Simple(SCHEME SERVER "/Login.json", &dataStatus, {
{ "Username", username },
{ "Hash", totalHash },
});
@@ -1300,7 +1300,7 @@ RequestStatus Client::DeleteSave(int saveID)
{
lastError = "";
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;
if(authUser.UserID)
{
@@ -1321,7 +1321,7 @@ RequestStatus Client::AddComment(int saveID, String comment)
lastError = "";
ByteString data;
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)
{
ByteString userID = ByteString::Build(authUser.UserID);
@@ -1344,7 +1344,7 @@ RequestStatus Client::FavouriteSave(int saveID, bool favourite)
ByteStringBuilder urlStream;
ByteString data;
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)
urlStream << "&Mode=Remove";
if(authUser.UserID)
@@ -1366,7 +1366,7 @@ RequestStatus Client::ReportSave(int saveID, String message)
lastError = "";
ByteString data;
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)
{
ByteString userID = ByteString::Build(authUser.UserID);
@@ -1388,7 +1388,7 @@ RequestStatus Client::UnpublishSave(int saveID)
lastError = "";
ByteString data;
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)
{
ByteString userID = ByteString::Build(authUser.UserID);
@@ -1408,7 +1408,7 @@ RequestStatus Client::PublishSave(int saveID)
lastError = "";
ByteString data;
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)
{
ByteString userID = ByteString::Build(authUser.UserID);
@@ -1429,7 +1429,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
{
lastError = "";
ByteStringBuilder urlStream;
urlStream << "http://" << SERVER << "/Browse/View.json?ID=" << saveID;
urlStream << SCHEME << SERVER << "/Browse/View.json?ID=" << saveID;
if(saveDate)
{
urlStream << "&Date=" << saveDate;
@@ -1504,7 +1504,7 @@ std::vector<std::pair<ByteString, int> > * Client::GetTags(int start, int count,
ByteStringBuilder urlStream;
ByteString data;
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())
{
urlStream << "&Search_Query=";
@@ -1550,7 +1550,7 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, String query,
ByteStringBuilder urlStream;
ByteString data;
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())
{
urlStream << "&Search_Query=";
@@ -1618,7 +1618,7 @@ std::list<ByteString> * Client::RemoveTag(int saveID, ByteString tag)
std::list<ByteString> * tags = NULL;
ByteString data;
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)
{
ByteString userID = ByteString::Build(authUser.UserID);
@@ -1657,7 +1657,7 @@ std::list<ByteString> * Client::AddTag(int saveID, ByteString tag)
std::list<ByteString> * tags = NULL;
ByteString data;
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)
{
ByteString userID = ByteString::Build(authUser.UserID);
@@ -4,7 +4,7 @@
namespace http
{
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)
{
}

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

@@ -3,7 +3,7 @@
namespace http
{
SaveUserInfoRequest::SaveUserInfoRequest(UserInfo info) :
APIRequest("http://" SERVER "/Profile.json")
APIRequest(SCHEME SERVER "/Profile.json")
{
AddPostData({
{ "Location", info.location.ToUtf8() },
@@ -6,8 +6,8 @@ namespace http
ThumbnailRequest::ThumbnailRequest(int saveID, int saveDate, int width, int height) :
ImageRequest((
saveDate
? ByteString::Build("http://" STATICSERVER "/", saveID, "_", saveDate, "_small.pti")
: ByteString::Build("http://" STATICSERVER "/", saveID, "_small.pti")
? ByteString::Build(SCHEME STATICSERVER "/", saveID, "_", saveDate, "_small.pti")
: ByteString::Build(SCHEME STATICSERVER "/", saveID, "_small.pti")
), width, height)
{
}
@@ -687,7 +687,7 @@ bool GameController::MouseUp(int x, int y, unsigned button, char type)
case 't':
{
// 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;
}
case 's':
@@ -1716,9 +1716,9 @@ void GameController::RunUpdater()
#else

#ifdef UPDATESERVER
ByteString file = ByteString::Build("https://", UPDATESERVER, Client::Ref().GetUpdateInfo().File);
ByteString file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
#else
ByteString file = ByteString::Build("https://", SERVER, Client::Ref().GetUpdateInfo().File);
ByteString file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
#endif

Platform::OpenURI(file);
@@ -153,7 +153,7 @@ void PreviewController::FavouriteSave()

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);
}

@@ -72,13 +72,13 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)

ByteString url;
if (saveDate)
url = ByteString::Build("http://", STATICSERVER, "/", saveID, "_", saveDate, ".cps");
url = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, "_", saveDate, ".cps");
else
url = ByteString::Build("http://", STATICSERVER, "/", saveID, ".cps");
url = ByteString::Build(SCHEME, STATICSERVER, "/", saveID, ".cps");
saveDataDownload = new http::Request(url);
saveDataDownload->Start();

url = ByteString::Build("http://", SERVER , "/Browse/View.json?ID=", saveID);
url = ByteString::Build(SCHEME, SERVER , "/Browse/View.json?ID=", saveID);
if (saveDate)
url += ByteString::Build("&Date=", saveDate);
saveInfoDownload = new http::Request(url);
@@ -89,7 +89,7 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
{
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->AuthHeaders(ByteString::Build(Client::Ref().GetAuthUser().UserID), Client::Ref().GetAuthUser().SessionID);
commentsDownload->Start();
@@ -141,7 +141,7 @@ void PreviewModel::UpdateComments(int pageNumber)
commentsPageNumber = pageNumber;
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->AuthHeaders(ByteString::Build(Client::Ref().GetAuthUser().UserID), Client::Ref().GetAuthUser().SessionID);
commentsDownload->Start();
@@ -166,7 +166,7 @@ void PreviewModel::OnSaveReady()
{
GameSave *gameSave = new GameSave(*saveData);
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);
}
catch(ParseException &e)
@@ -239,7 +239,7 @@ bool PreviewModel::ParseSaveInfo(ByteString &saveInfoResponse)
saveDataDownload->Cancel();
delete saveData;
saveData = NULL;
saveDataDownload = new http::Request(ByteString::Build("http://", STATICSERVER, "/2157797.cps"));
saveDataDownload = new http::Request(ByteString::Build(SCHEME, STATICSERVER, "/2157797.cps"));
saveDataDownload->Start();
}
return true;
@@ -81,7 +81,7 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
public:
void ActionCallback(ui::Button * sender_) override
{
Platform::OpenURI("http://" SERVER "/Profile/Avatar.html");
Platform::OpenURI(SCHEME SERVER "/Profile/Avatar.html");
}
};

@@ -115,9 +115,9 @@ class UpdateDownloadTask : public Task
UpdateActivity::UpdateActivity() {
ByteString file;
#ifdef UPDATESERVER
file = ByteString::Build("http://", UPDATESERVER, Client::Ref().GetUpdateInfo().File);
file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
#else
file = ByteString::Build("http://", SERVER, Client::Ref().GetUpdateInfo().File);
file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
#endif
updateDownloadTask = new UpdateDownloadTask(file, this);
updateWindow = new TaskWindow("Downloading update...", updateDownloadTask, true);
@@ -149,7 +149,7 @@ void UpdateActivity::NotifyError(Task * sender)
if (result == ConfirmPrompt::ResultOkay)
{
#ifndef UPDATESERVER
Platform::OpenURI("http://powdertoy.co.uk/Download.html");
Platform::OpenURI(SCHEME "powdertoy.co.uk/Download.html");
#endif
}
a->Exit();
@@ -1350,7 +1350,7 @@ int luatpt_getscript(lua_State* l)
int runScript = luaL_optint(l, 3, 0);
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"))
return 0;

0 comments on commit 5bc3c03

Please sign in to comment.
You can’t perform that action at this time.