Update controller profile

Add GitHub API reachability check to online version check
This commit is contained in:
icenine451 2023-06-02 09:38:31 -04:00
parent 2badb902dc
commit 1bc98a1713
2 changed files with 66 additions and 84 deletions

View file

@ -1,18 +1,18 @@
"controller_mappings"
{
"version" "3"
"revision" "1556"
"title" "RetroDECK: Official Layout - v.0.7b"
"description" "The Official RetroDECK Layout"
"revision" "1581"
"title" "RetroDECK: Official Layout - v0.7b"
"description" "The Official RetroDECK Layout""
"creator" ""
"progenitor" ""
"url" "autosave:///home/deck/.local/share/Steam/steamapps/common/Steam Controller Configs/25233020/config/retrodeck/controller_neptune.vdf"
"export_type" "template"
"url" ""
"export_type" "personal_cloud"
"controller_type" "controller_neptune"
"controller_caps" "23117823"
"major_revision" "0"
"minor_revision" "0"
"Timestamp" "-999421760"
"Timestamp" "-1230584288"
"actions"
{
"Default"
@ -708,14 +708,6 @@
"binding" "key_press RETURN, FULLSCREEN TOGGLE, , "
}
}
"Full_Press"
{
"bindings"
{
"binding" "key_press LEFT_ALT, , "
"binding" "key_press RETURN, , "
}
}
}
"disabled_activators"
{
@ -1561,14 +1553,6 @@
"binding" "key_press RETURN, Fullscreen On/Off, RD-zoom-fit-best.png, #232323 #FFFFFF"
}
}
"Full_Press"
{
"bindings"
{
"binding" "key_press LEFT_ALT, , "
"binding" "key_press RETURN, , "
}
}
}
"disabled_activators"
{
@ -2748,14 +2732,6 @@
"binding" "key_press RETURN, Fullscreen On/Off, RD-zoom-fit-best.png, "
}
}
"Full_Press"
{
"bindings"
{
"binding" "key_press LEFT_ALT, , "
"binding" "key_press RETURN, , "
}
}
}
"disabled_activators"
{
@ -2803,8 +2779,8 @@
{
"bindings"
{
"binding" "key_press LEFT_ALT, Change Dual-Screenlayout, RD-preferences-system-windows-actions.png, "
"binding" "key_press 0, Change Dual-Screenlayout, RD-preferences-system-windows-actions.png, "
"binding" "key_press LEFT_CONTROL, Change Dual-Screenlayout, RD-preferences-system-windows-actions.png, "
"binding" "key_press L, Change Dual-Screenlayout, RD-preferences-system-windows-actions.png, "
}
}
}
@ -3183,8 +3159,8 @@
{
"bindings"
{
"binding" "key_press LEFT_CONTROL, Open Menu, RD-preferences-desktop-icons.png, "
"binding" "key_press M, Open Menu, RD-preferences-desktop-icons.png, "
"binding" "key_press LEFT_CONTROL, Exit / Quit Emulator, RD-process-stop.png, "
"binding" "key_press ESCAPE, Exit / Quit Emulator, RD-process-stop.png, "
}
}
}
@ -3200,8 +3176,8 @@
{
"bindings"
{
"binding" "key_press LEFT_CONTROL, Exit / Quit Emulator, RD-process-stop.png, "
"binding" "key_press ESCAPE, Exit / Quit Emulator, RD-process-stop.png, "
"binding" "key_press LEFT_CONTROL, Open Menu, RD-preferences-desktop-icons.png, "
"binding" "key_press M, Open Menu, RD-preferences-desktop-icons.png, "
}
}
}
@ -3748,7 +3724,7 @@
"bindings"
{
"binding" "key_press LEFT_ALT, ALT + F4, RD-F4.png, "
"binding" "controller_action empty_sub_command, ALT + F4, RD-F4.png, "
"binding" "key_press F4, ALT + F4, RD-F4.png, "
}
}
}

View file

@ -27,58 +27,64 @@ check_desktop_mode() {
check_for_version_update() {
# This function will perform a basic online version check and alert the user if there is a new version available.
local online_version=$(curl --silent "https://api.github.com/repos/XargonWan/$update_repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
wget -q --spider "https://api.github.com/repos/XargonWan/$update_repo/releases/latest"
if [[ ! "$update_ignore" == "$online_version" ]]; then
if [[ "$update_repo" == "RetroDECK" ]] && [[ $(sed -e 's/[\.a-z]//g' <<< $version) -le $(sed -e 's/[\.a-z]//g' <<< $online_version) ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Update Available" \
--text="There is a new version of RetroDECK available!\nYou are running version $hard_version, the latest is $online_version.\n\nIf you would like to update to the new version now, click \"Yes\".\nIf you would like to skip reminders about this version, click \"Ignore this version\".\nYou will be reminded again at the next version update.\n\nIf you would like to disable these update notifications entirely, disable Online Update Checks in the Configurator.")
rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
if [[ $choice == "Ignore this version" ]]; then
set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks
if [ $? -eq 0 ]; then
local online_version=$(curl --silent "https://api.github.com/repos/XargonWan/$update_repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ ! "$update_ignore" == "$online_version" ]]; then
if [[ "$update_repo" == "RetroDECK" ]] && [[ $(sed -e 's/[\.a-z]//g' <<< $version) -le $(sed -e 's/[\.a-z]//g' <<< $online_version) ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Update Available" \
--text="There is a new version of RetroDECK available!\nYou are running version $hard_version, the latest is $online_version.\n\nIf you would like to update to the new version now, click \"Yes\".\nIf you would like to skip reminders about this version, click \"Ignore this version\".\nYou will be reminded again at the next version update.\n\nIf you would like to disable these update notifications entirely, disable Online Update Checks in the Configurator.")
rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
if [[ $choice == "Ignore this version" ]]; then
set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks
fi
else # User clicked "Yes"
configurator_generic_dialog "RetroDECK Online Update" "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version."
(
flatpak-spawn --host flatpak update --noninteractive -y net.retrodeck.retrodeck
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Updater" \
--text="RetroDECK is updating to the latest version, please wait."
configurator_generic_dialog "RetroDECK Online Update" "The update process is now complete!\n\nPlease restart RetroDECK to keep the fun going."
exit 1
fi
else # User clicked "Yes"
configurator_generic_dialog "RetroDECK Online Update" "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version."
(
flatpak-spawn --host flatpak update --noninteractive -y net.retrodeck.retrodeck
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Updater" \
--text="RetroDECK is updating to the latest version, please wait."
configurator_generic_dialog "RetroDECK Online Update" "The update process is now complete!\n\nPlease restart RetroDECK to keep the fun going."
exit 1
fi
elif [[ "$update_repo" == "RetroDECK-cooker" ]] && [[ ! $version == $online_version ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Update Available" \
--text="There is a more recent build of the RetroDECK cooker branch.\nYou are running version $hard_version, the latest is $online_version.\n\nWould you like to update to it?\nIf you would like to skip reminders about this version, click \"Ignore this version\".\nYou will be reminded again at the next version update.\n\nIf you would like to disable these update notifications entirely, disable Online Update Checks in the Configurator.")
rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
if [[ $choice == "Ignore this version" ]]; then
set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks.
elif [[ "$update_repo" == "RetroDECK-cooker" ]] && [[ ! $version == $online_version ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Update Available" \
--text="There is a more recent build of the RetroDECK cooker branch.\nYou are running version $hard_version, the latest is $online_version.\n\nWould you like to update to it?\nIf you would like to skip reminders about this version, click \"Ignore this version\".\nYou will be reminded again at the next version update.\n\nIf you would like to disable these update notifications entirely, disable Online Update Checks in the Configurator.")
rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
if [[ $choice == "Ignore this version" ]]; then
set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks.
fi
else # User clicked "Yes"
configurator_generic_dialog "RetroDECK Online Update" "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version."
(
local latest_cooker_download=$(curl --silent https://api.github.com/repos/XargonWan/$update_repo/releases/latest | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/')
mkdir -p "$rdhome/RetroDECK_Updates"
wget -P "$rdhome/RetroDECK_Updates" $latest_cooker_download
flatpak-spawn --host flatpak install --user --bundle --noninteractive -y "$rdhome/RetroDECK_Updates/RetroDECK.flatpak"
rm -rf "$rdhome/RetroDECK_Updates" # Cleanup old bundles to save space
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Updater" \
--text="RetroDECK is updating to the latest version, please wait."
configurator_generic_dialog "RetroDECK Online Update" "The update process is now complete!\n\nPlease restart RetroDECK to keep the fun going."
exit 1
fi
else # User clicked "Yes"
configurator_generic_dialog "RetroDECK Online Update" "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version."
(
local latest_cooker_download=$(curl --silent https://api.github.com/repos/XargonWan/$update_repo/releases/latest | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/')
mkdir -p "$rdhome/RetroDECK_Updates"
wget -P "$rdhome/RetroDECK_Updates" $latest_cooker_download
flatpak-spawn --host flatpak install --user --bundle --noninteractive -y "$rdhome/RetroDECK_Updates/RetroDECK.flatpak"
rm -rf "$rdhome/RetroDECK_Updates" # Cleanup old bundles to save space
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Updater" \
--text="RetroDECK is updating to the latest version, please wait."
configurator_generic_dialog "RetroDECK Online Update" "The update process is now complete!\n\nPlease restart RetroDECK to keep the fun going."
exit 1
fi
fi
else # Unable to reach the GitHub API for some reason
configurator_generic_dialog "RetroDECK Online Update" "RetroDECK is unable to reach the GitHub API to perform a version check.\nIt's possible that location is being blocked by your network or ISP.\n\nIf the problem continues, you will need to disable internal checks through the Configurator\nand perform updates manually through the Discover store."
fi
}