mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
Add additional CLI input validation
This commit is contained in:
parent
501889e954
commit
c35cd00ba4
5
emu-configs/defaults/retrodeck/input_validation.cfg
Normal file
5
emu-configs/defaults/retrodeck/input_validation.cfg
Normal file
|
@ -0,0 +1,5 @@
|
|||
uuddlrlrstart^set_setting_value /var/config/retrodeck/retrodeck.cfg developer_options true retrodeck
|
||||
uuddlrlrstart^echo Visit the Configurator to behold your new-found powers.
|
||||
uuddlrlrstart^echo But beware, with great power comes great responsibility...
|
||||
gameovermangameover^set_setting_value /var/config/retrodeck/retrodeck.cfg developer_options false retrodeck
|
||||
gameovermangameover^echo You have relinquished your powers in the name of saftey.
|
11
functions.sh
11
functions.sh
|
@ -631,6 +631,17 @@ check_network_connectivity() {
|
|||
fi
|
||||
}
|
||||
|
||||
validate_input() {
|
||||
while IFS="^" read -r input action
|
||||
do
|
||||
if [[ "$input" == "$1" ]]; then
|
||||
# $action line must be completely literal in the $input_validation file. No shell expansion or extra characters.
|
||||
$action
|
||||
input_validated="true"
|
||||
fi
|
||||
done < $input_validation
|
||||
}
|
||||
|
||||
update_rd_conf() {
|
||||
# This function will import a default retrodeck.cfg file and update it with any current settings. This will allow us to expand the file over time while retaining current user settings.
|
||||
# USAGE: update_rd_conf
|
||||
|
|
|
@ -13,6 +13,7 @@ rd_update_patch="/var/config/retrodeck/rd_update.patch"
|
|||
bios_checklist="$emuconfigs/defaults/retrodeck/bios_checklist.cfg" # A config file listing BIOS file information that can be verified
|
||||
compression_targets="$emuconfigs/defaults/retrodeck/compression_targets.cfg" # A config file containing supported compression types per system
|
||||
easter_egg_checklist="$emuconfigs/defaults/retrodeck/easter_egg_checklist.cfg" # A config file listing days and times when special splash screens should show up
|
||||
input_validation="$emuconfigs/defaults/retrodeck/input_validation.cfg" # List of valid CLI inputs
|
||||
splashscreen_dir="/var/config/emulationstation/.emulationstation/resources/graphics/extra-splashes" # The default location of extra splash screens
|
||||
current_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash.svg" # The active splash file that will be shown on boot
|
||||
default_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash-orig.svg" # The default RetroDECK splash screen
|
||||
|
|
|
@ -96,7 +96,10 @@ https://retrodeck.net
|
|||
exit 1
|
||||
;;
|
||||
*)
|
||||
validate_input "$i"
|
||||
if [[ ! $input_validated == "true" ]]; then
|
||||
echo "Please specify a valid option. Use -h for more information."
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue