diff --git a/launcher/helper.sh b/launcher/helper.sh new file mode 100644 index 0000000..96aae28 --- /dev/null +++ b/launcher/helper.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# helper.sh - sources everything and tries to refresh the token +cd /meow + +source auth.sh +source ms_auth.sh +source launch.sh +source version.sh + +function _login() { + read -p "E-Mail: " login + read -s -p "Password: " pass + _login "$login" "$pass" + + cat auth.json +} + +echo "Welcome to CurseMe (WIP)!" +if [[ -f auth.json ]]; then + refresh +else + echo -e 'This looks like your first launch. Start with logging in by executing `_login` or `ms_login` (i will rename those later)' +fi + +PS1='CurseMe$ ' +echo "Available (user-facing) commands: + +list_versions - well... +fetch_version - downloads a specific version + +launch - launches a previously downloaded version + +_login - classic Mojang login +ms_login - microsoft login + +Have fun!" diff --git a/launcher/launch.sh b/launcher/launch.sh index a4d6954..6fad434 100755 --- a/launcher/launch.sh +++ b/launcher/launch.sh @@ -1,6 +1,10 @@ #!/bin/bash function launch() { + if [[ "$1" == '' ]]; then + echo uh oh + exit 1 + fi cd "$1" mkdir -p natives diff --git a/launcher/ms_auth.sh b/launcher/ms_auth.sh index bd27717..8124a7c 100755 --- a/launcher/ms_auth.sh +++ b/launcher/ms_auth.sh @@ -4,7 +4,7 @@ function get_client_id() { curl https://raw.githubusercontent.com/PolyMC/PolyMC/develop/CMakeLists.txt | grep Launcher_MSA_CLIENT_ID | awk '{print $2}' | sed 's/"//g' > client_id } -function login() { +function ms_login() { res="$(curl "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode?client_id=$(cat client_id)&scope=XboxLive.signin%20offline_access")" jq '.message' <<< "$res" echo "Press after authenticating" diff --git a/launcher/windows/build.sh b/launcher/windows/build.sh new file mode 100644 index 0000000..099e9f1 --- /dev/null +++ b/launcher/windows/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash +rm -R build/curseme-w32/meow/ +curl -L -o meow.tar.gz https://git.sakamoto.pl/domi/curseme/-/archive/launcher/curseme-launcher.tar.gz?path=launcher +tar xvf meow.tar.gz +mkdir -p build/curseme-w32/meow +mv curseme-launcher-launcher/launcher/* build/curseme-w32/meow/ + +styrene -o ./build ./curseme.cfg diff --git a/launcher/windows/curseme.cfg b/launcher/windows/curseme.cfg new file mode 100644 index 0000000..6d24efd --- /dev/null +++ b/launcher/windows/curseme.cfg @@ -0,0 +1,34 @@ +# Styrene config file for gtk-demo and related apps. +# https://github.com/achadwick/styrene/ + +[bundle] +packages = p7zip {pkg_prefix}jq {pkg_prefix}curl msys2-runtime +filename_stub = curseme +display_name = CurseMe +description = 3rd-party Minecraft launcher +version = 0.1 +url = https://git.sakamoto.pl/domi/curseme/ +launchers = meow + +delete = + mingw*/share/man/* + mingw*/share/doc/* + mingw*/include/* + + +# messy, but idc +nodelete = + usr/bin/7z + usr/bin/msys-2.0.dll + usr/lib/p7zip/* + usr/bin/cygpath.exe + + mingw*/bin/*.dll + mingw*/bin/*.exe + +[meow] +name = CurseMe +comment = nie wiem +exec = bash --rcfile /meow/helper.sh +icon = input-tablet +terminal = true