Added Curseforge API Key fetching

This commit also improves the existing MSA Client ID fetching.

Signed-off-by: sneedium <sneed@sneedmc.org>
This commit is contained in:
sneedium 2022-07-03 00:02:25 -04:00
parent 4ccd16a1da
commit 7addde4a40
Signed by: sneedium
GPG Key ID: 906F66490FBE722F
3 changed files with 32 additions and 25 deletions

View File

@ -87,9 +87,6 @@ set(Launcher_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch
# Imgur API Client ID
set(Launcher_IMGUR_CLIENT_ID "5b97b0713fba4a3" CACHE STRING "Client ID you can get from Imgur when you register an application")
# MSA Client ID
execute_process(COMMAND ./id.sh OUTPUT_VARIABLE Launcher_MSA_CLIENT_ID)
# Bug tracker URL
set(Launcher_BUG_TRACKER_URL "https://github.com/Sneederix/SneedMC/issues" CACHE STRING "URL for the bug tracker.")
@ -112,21 +109,13 @@ set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries,
set(Launcher_QT_VERSION_MAJOR "5" CACHE STRING "Major Qt version to build against")
# API Keys
# NOTE: These API keys are here for convenience. If you rebrand this software or intend to break the terms of service
# of these platforms, please change these API keys beforehand.
# Be aware that if you were to use these API keys for malicious purposes they might get revoked, which might cause
# breakage to thousands of users.
# If you don't plan to use these features of this software, you can just remove these values.
# NOTE: These API keys are here for you to abuse.
# By using this key in your builds you accept the terms of use laid down in
# https://docs.microsoft.com/en-us/legal/microsoft-identity-platform/terms-of-use
set(Launcher_MSA_CLIENT_ID "549033b2-1532-4d4e-ae77-1bbaa46f9d74" CACHE STRING "Client ID you can get from Microsoft Identity Platform when you register an application")
# By using this key in your builds you accept the terms and conditions laid down in
# https://support.curseforge.com/en/support/solutions/articles/9000207405-curse-forge-3rd-party-api-terms-and-conditions
# NOTE: CurseForge requires you to change this if you make any kind of derivative work.
set(Launcher_CURSEFORGE_API_KEY "$2a$10$1Oqr2MX3O4n/ilhFGc597u8tfI3L2Hyr9/rtWDAMRjghSQV2QUuxq" CACHE STRING "CurseForge API Key")
# MSA Client ID
execute_process(COMMAND ./id.sh OUTPUT_VARIABLE Launcher_MSA_CLIENT_ID)
# Curseforge API Key
execute_process(COMMAND ./cf.sh OUTPUT_VARIABLE Launcher_CURSEFORGE_API_KEY)
#### Check the current Git commit and branch
include(GetGitRevisionDescription)

25
cf.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# Copyleft (C) 2022 Chuckium
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
command -v wscat &> /dev/null || { echo "YOU MUST HAVE wscat INSTALLED." 1>&2 && exit 1; }
wget -qO- https://curseforge.overwolf.com/downloads/curseforge-latest-linux.zip | funzip > cf.AppImage
chmod +x cf.AppImage
./cf.AppImage --appimage-extract &> /dev/null
squashfs-root/resources/plugins/curse/linux/Curse.Agent.Host &> /dev/null &
sleep 15
printf '{"type":"method","id":0,"name":"getSystemProperties","args":[]}' | timeout 2 wscat -i /dev/stdin -c ws://127.0.0.1:12345/CurseForge | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | jq -r .result.data.Ak | tr -d '\n'
rm cf.AppImage &> /dev/null
rm -rf squashfs-root &> /dev/null
kill %1

11
id.sh
View File

@ -1,10 +1,7 @@
#!/bin/sh
# Credit to Lenny for this script.
#git fetch --all
#git reset --hard origin/develop
wget "https://files.multimc.org/downloads/mmc-stable-lin64.tar.gz"
wget -q "https://files.multimc.org/downloads/mmc-stable-lin64.tar.gz"
tar xzf mmc-stable-lin64.tar.gz
@ -19,7 +16,3 @@ cd ../../
echo -n $client_id
rm -rf mmc-stable-lin64.tar.gz MultiMC
#sed -i "s/.*Launcher_MSA_CLIENT_ID.*/set(Launcher_MSA_CLIENT_ID \"$client_id\" CACHE STRING \"Client ID you can get from Microsoft Identity Platform when you register an application\")/g" CMakeLists.txt
#git commit -S -am "update to new MultiMC MSA ID" || echo "not changing ID" && (git remote | xargs -L1 git push --all)