mirror of
https://github.com/redstrate/Astra.git
synced 2025-06-09 23:17:46 +00:00
Improve login process
More progress on support Steam service accounts, make it clear whether or not you have a expired subscription/terms not accepted. Also add "Free Trial" as a license type.
This commit is contained in:
parent
c460f2d956
commit
8408a2b154
4 changed files with 55 additions and 12 deletions
|
@ -17,7 +17,8 @@ class Watchdog;
|
||||||
enum class GameLicense {
|
enum class GameLicense {
|
||||||
WindowsStandalone,
|
WindowsStandalone,
|
||||||
WindowsSteam,
|
WindowsSteam,
|
||||||
macOS
|
macOS,
|
||||||
|
FreeTrial
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProfileSettings {
|
struct ProfileSettings {
|
||||||
|
|
|
@ -23,7 +23,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
QString getBootHash(const LoginInformation& info);
|
QString getBootHash(const LoginInformation& info);
|
||||||
|
|
||||||
QString stored, SID;
|
QString stored, SID, username;
|
||||||
LoginAuth auth;
|
LoginAuth auth;
|
||||||
|
|
||||||
LauncherCore& window;
|
LauncherCore& window;
|
||||||
|
|
|
@ -105,7 +105,13 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
||||||
gameArgs.push_back({"IsSteam", "1"});
|
gameArgs.push_back({"IsSteam", "1"});
|
||||||
env.insert("IS_FFXIV_LAUNCH_FROM_STEAM", QString::number(1));
|
env.insert("IS_FFXIV_LAUNCH_FROM_STEAM", QString::number(1));
|
||||||
}
|
}
|
||||||
env.insert("DALAMUD_RUNTIME", "Z:" + dataDir.replace('/', '\\') + "\\DalamudRuntime");
|
|
||||||
|
if(profile.dalamud.enabled) {
|
||||||
|
// TODO: this depends on the default wine Z: path existing, which may not
|
||||||
|
// always the case.
|
||||||
|
env.insert("DALAMUD_RUNTIME",
|
||||||
|
"Z:" + dataDir.replace('/', '\\') + "\\DalamudRuntime");
|
||||||
|
}
|
||||||
|
|
||||||
gameProcess->setProcessEnvironment(env);
|
gameProcess->setProcessEnvironment(env);
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,22 @@ QString getFileHash(QString file) {
|
||||||
|
|
||||||
void SquareLauncher::getStored(const LoginInformation& info) {
|
void SquareLauncher::getStored(const LoginInformation& info) {
|
||||||
QUrlQuery query;
|
QUrlQuery query;
|
||||||
|
// en is always used to the top url
|
||||||
query.addQueryItem("lng", "en");
|
query.addQueryItem("lng", "en");
|
||||||
|
// for some reason, we always use region 3. the actual region is acquired later
|
||||||
query.addQueryItem("rgn", "3");
|
query.addQueryItem("rgn", "3");
|
||||||
query.addQueryItem("isft", "0");
|
query.addQueryItem("isft", info.settings->license == GameLicense::FreeTrial ? "1" : "0");
|
||||||
query.addQueryItem("cssmode", "1");
|
query.addQueryItem("cssmode", "1");
|
||||||
query.addQueryItem("isnew", "1");
|
query.addQueryItem("isnew", "1");
|
||||||
query.addQueryItem("issteam", info.settings->license == GameLicense::WindowsSteam ? "1" : "0");
|
query.addQueryItem("launchver", "3");
|
||||||
|
|
||||||
|
if(info.settings->license == GameLicense::WindowsSteam) {
|
||||||
|
query.addQueryItem("issteam", "1");
|
||||||
|
|
||||||
|
// TODO: get steam ticket information from steam api
|
||||||
|
query.addQueryItem("session_ticket", "1");
|
||||||
|
query.addQueryItem("ticket_size", "1");
|
||||||
|
}
|
||||||
|
|
||||||
QUrl url("https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/top");
|
QUrl url("https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/top");
|
||||||
url.setQuery(query);
|
url.setQuery(query);
|
||||||
|
@ -49,6 +59,21 @@ void SquareLauncher::getStored(const LoginInformation& info) {
|
||||||
connect(reply, &QNetworkReply::finished, [=] {
|
connect(reply, &QNetworkReply::finished, [=] {
|
||||||
auto str = QString(reply->readAll());
|
auto str = QString(reply->readAll());
|
||||||
|
|
||||||
|
// fetches Steam username
|
||||||
|
if(info.settings->license == GameLicense::WindowsSteam) {
|
||||||
|
QRegularExpression re(R"lit(<input name=""sqexid"" type=""hidden"" value=""(?<sqexid>.*)""\/>)lit");
|
||||||
|
QRegularExpressionMatch match = re.match(str);
|
||||||
|
|
||||||
|
if(match.hasMatch()) {
|
||||||
|
username = match.captured(1);
|
||||||
|
} else {
|
||||||
|
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Could not get Steam username, have you attached your account?");
|
||||||
|
messageBox->show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
username = info.username;
|
||||||
|
}
|
||||||
|
|
||||||
QRegularExpression re(R"lit(\t<\s*input .* name="_STORED_" value="(?<stored>.*)">)lit");
|
QRegularExpression re(R"lit(\t<\s*input .* name="_STORED_" value="(?<stored>.*)">)lit");
|
||||||
QRegularExpressionMatch match = re.match(str);
|
QRegularExpressionMatch match = re.match(str);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
|
@ -86,18 +111,29 @@ void SquareLauncher::login(const LoginInformation& info, const QUrl referer) {
|
||||||
const bool terms = parts[3] == "1";
|
const bool terms = parts[3] == "1";
|
||||||
const bool playable = parts[9] == "1";
|
const bool playable = parts[9] == "1";
|
||||||
|
|
||||||
if(!terms || !playable) {
|
if(!playable) {
|
||||||
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Your game is unplayable. You may need to accept the terms from the official launcher.");
|
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Your game is unplayable. Please check that you have the right license selected, and a subscription to play.");
|
||||||
window.addUpdateButtons(*info.settings, *messageBox);
|
window.addUpdateButtons(*info.settings, *messageBox);
|
||||||
|
|
||||||
messageBox->show();
|
messageBox->show();
|
||||||
} else {
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!terms) {
|
||||||
|
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Your game is unplayable. You need to accept the terms of service from the official launcher.");
|
||||||
|
window.addUpdateButtons(*info.settings, *messageBox);
|
||||||
|
|
||||||
|
messageBox->show();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SID = parts[1];
|
SID = parts[1];
|
||||||
auth.region = parts[5].toInt();
|
auth.region = parts[5].toInt();
|
||||||
auth.maxExpansion = parts[13].toInt();
|
auth.maxExpansion = parts[13].toInt();
|
||||||
|
|
||||||
registerSession(info);
|
registerSession(info);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Invalid username/password.");
|
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Invalid username/password.");
|
||||||
messageBox->show();
|
messageBox->show();
|
||||||
|
|
Loading…
Add table
Reference in a new issue