File 0001-allow-setting-ms-auth-token-via-env-var.patch of Package multimc
From 68edc33a5872631b7877bb8e7848c2504a50f9ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20=22sp1rit=22=E2=80=8B?= <sp1ritCS@protonmail.com>
Date: Mon, 14 Feb 2022 22:23:35 +0100
Subject: [PATCH] allow setting ms auth token via env var
---
notsecrets/Secrets.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/notsecrets/Secrets.cpp b/notsecrets/Secrets.cpp
index 88995635..a3875c10 100644
--- a/notsecrets/Secrets.cpp
+++ b/notsecrets/Secrets.cpp
@@ -3,6 +3,9 @@
#include <array>
#include <cstdio>
+#include <stdlib.h>
+#define MMC_MSA_TOKEN_VAR "MMC_MS_TOKEN"
+
namespace {
/*
@@ -28,15 +31,14 @@ namespace {
* If you intend to base your own launcher on this code, take care and customize this to obfuscate the client ID, so it cannot be trivially found by casual attackers.
*/
-QString MSAClientID = "";
}
namespace Secrets {
bool hasMSAClientID() {
- return !MSAClientID.isEmpty();
+ return getenv(MMC_MSA_TOKEN_VAR);
}
QString getMSAClientID(uint8_t separator) {
- return MSAClientID;
+ return getenv(MMC_MSA_TOKEN_VAR);
}
}
--
2.35.1