This commit is contained in:
Rodrigo 2023-12-03 00:39:57 +01:00
parent cd70619a1b
commit 116e21e5f9
3 changed files with 35 additions and 5 deletions

24
api.sh
View file

@ -1,9 +1,7 @@
#!/bin/bash
. "$HOME/.config/EmuDeck/backend/functions/all.sh"
API_pull(){
local branch = $1
cd ~/.config/EmuDeck/backend && touch ~/emudeck/logs/git.log && script ~/emudeck/logs/git.log -c 'git reset --hard && git clean -fd && git checkout $branch && git pull' && . ~/.config/EmuDeck/backend/functions/all.sh && appImageInit
cd ~/.config/EmuDeck/backend && touch ~/emudeck/logs/git.log && script ~/emudeck/logs/git.log -c 'git reset --hard && git clean -fd && git checkout $branch && git pull' && appImageInit
}
API_autoSave(){
@ -51,4 +49,22 @@ API_setCloud(){
else
setSetting cloud_sync_status "false" > /dev/null
fi
}
}
API_setToken(){
local token=$1
local user=$2
echo $token > "$HOME/.config/EmuDeck/.rat" && echo $user > "$HOME/.config/EmuDeck/.rau" && RetroArch_retroAchievementsSetLogin && DuckStation_retroAchievementsSetLogin && PCSX2QT_retroAchievementsSetLogin && echo true
}
API_getToken(){
local escapedUserName=$1
local escapedPass=$2
curl --location --data-urlencode u='$escapedUserName' --data-urlencode p='$escapedPass' --request POST 'https://retroachievements.org/dorequest.php?r=login'
}
let bashCommand = `curl --location --data-urlencode u='${escapedUserName}' --data-urlencode p='${escapedPass}' --request POST 'https://retroachievements.org/dorequest.php?r=login'`;
if (os.platform().includes('win32')) {
bashCommand = `curl "https://retroachievements.org/dorequest.php?r=login&u=${command.user}&p=${command.pass}"`;
}

13
darwin/api.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/bash
#
##
### Darwin overrides
##
#
API_pull(){
local branch = $1
cd ~/.config/EmuDeck/backend && git reset --hard && git clean -fd && git checkout ${branchGIT} && git pull && . ~/.config/EmuDeck/backend/functions/all.sh && appImageInit
}

View file

@ -24,6 +24,7 @@ if [ "$system" != "darwin" ]; then
fi
chmod +x "${EMUDECKGIT}/tools/binaries/xmlstarlet"
source "$EMUDECKGIT"/api.sh
source "$EMUDECKGIT"/functions/checkBIOS.sh
source "$EMUDECKGIT"/functions/checkInstalledEmus.sh
#source "$EMUDECKGIT"/functions/cloudServicesManager.sh
@ -105,5 +106,5 @@ if [ "$system" = "darwin" ]; then
source "$EMUDECKGIT/darwin/functions/all-darwin.sh"
source "$EMUDECKGIT/darwin/functions/helperFunctions.sh"
source "$EMUDECKGIT/darwin/functions/overrides.sh"
source "$EMUDECKGIT/darwin/api.sh"
fi