1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-29 13:52:03 +01:00

fix: ports from stable

This commit is contained in:
aclist 2023-05-19 23:29:21 +09:00
parent 8e8befcf72
commit 8d886699b5

101
dzgui.sh
View file

@ -79,7 +79,7 @@ changelog(){
prefix="This window can be scrolled." prefix="This window can be scrolled."
echo $prefix echo $prefix
echo "" echo ""
curl -Ls "$md" | awk '/Unreleased/ {flag=1}flag' curl -Ls "$md"
} }
depcheck(){ depcheck(){
@ -115,6 +115,8 @@ items=(
" Help file ⧉" " Help file ⧉"
" Report bug ⧉" " Report bug ⧉"
" Forum ⧉" " Forum ⧉"
" NEW: Sponsor ⧉"
" NEW: Hall of fame ⧉"
) )
} }
warn(){ warn(){
@ -876,35 +878,30 @@ launch(){
one_shot_launch=0 one_shot_launch=0
} }
browser(){ browser(){
if [[ $is_steam_deck -eq 1 ]]; then
steam steam://openurl/"$1" 2>/dev/null
elif [[ $is_steam_deck -eq 0 ]]; then
if [[ -n "$BROWSER" ]]; then if [[ -n "$BROWSER" ]]; then
"$BROWSER" "$1" 2>/dev/null "$BROWSER" "$1" 2>/dev/null
else else
xdg-open "$1" 2>/dev/null xdg-open "$1" 2>/dev/null
fi fi
fi
} }
report_bug(){ report_bug(){
echo "[DZGUI] Opening issues page in browser" browser "$issues_url"
if [[ $is_steam_deck -eq 1 ]]; then
steam steam://openurl/"$issues_url" 2>/dev/null
elif [[ $is_steam_deck -eq 0 ]]; then
browser "$issues_url" 2>/dev/null &
fi
} }
forum(){ forum(){
echo "[DZGUI] Opening forum in browser" browser "$forum_url"
if [[ $is_steam_deck -eq 1 ]]; then
steam steam://openurl/"$forum_url" 2>/dev/null
elif [[ $is_steam_deck -eq 0 ]]; then
browser "$forum_url" 2>/dev/null &
fi
} }
help_file(){ help_file(){
echo "[DZGUI] Opening help file in browser" browser "$help_url"
if [[ $is_steam_deck -eq 1 ]]; then }
steam steam://openurl/"$help_url" 2>/dev/null sponsor(){
elif [[ $is_steam_deck -eq 0 ]]; then browser "$sponsor_url"
browser "$help_url" 2>/dev/null & }
fi hof(){
browser "${help_url}#_hall_of_fame"
} }
set_mode(){ set_mode(){
if [[ $debug -eq 1 ]]; then if [[ $debug -eq 1 ]]; then
@ -1006,6 +1003,7 @@ connect_to_fav(){
} }
set_header(){ set_header(){
print_news
[[ $auto_install -eq 2 ]] && install_mode="auto" [[ $auto_install -eq 2 ]] && install_mode="auto"
[[ $auto_install -eq 1 ]] && install_mode="headless" [[ $auto_install -eq 1 ]] && install_mode="headless"
[[ $auto_install -eq 0 ]] && install_mode=manual [[ $auto_install -eq 0 ]] && install_mode=manual
@ -1518,65 +1516,45 @@ server_browser(){
return return
fi fi
} }
mods_disk_size(){ mods_disk_size(){
printf "Total size on disk: %s | " $(du -sh "$game_dir" | awk '{print $1}') printf "Total size on disk: %s | " $(du -sh "$game_dir" | awk '{print $1}')
printf "%s mods | " $(ls -1 "$game_dir" | wc -l) printf "%s mods | " $(ls -1 "$game_dir" | wc -l)
printf "Location: %s/steamapps/workshop/content/221100" "$steam_path" printf "Location: %s/steamapps/workshop/content/221100" "$steam_path"
} }
main_menu(){ main_menu(){
print_news
set_mode set_mode
while true; do while true; do
set_header ${FUNCNAME[0]} set_header ${FUNCNAME[0]}
rc=$? rc=$?
if [[ $rc -eq 0 ]]; then if [[ $rc -eq 0 ]]; then
if [[ -z $sel ]]; then case "$sel" in
warn "No item was selected." "") warn "No item was selected." ;;
elif [[ $sel == "${items[0]}" ]]; then " Server browser") server_browser ;;
: " My servers") query_and_connect ;;
elif [[ $sel == "${items[1]}" ]]; then " Quick connect to favorite server") connect_to_fav ;;
server_browser " Connect by IP") connect_by_ip ;;
elif [[ $sel == "${items[2]}" ]]; then " Recent servers (last 10)") history_table ;;
query_and_connect " Add server by ID") add_by_id ;;
elif [[ $sel == "${items[3]}" ]]; then " Add favorite server") add_by_fav ;;
connect_to_fav " Change favorite server") add_by_fav ;;
elif [[ $sel == "${items[4]}" ]]; then " Delete server") delete=1; query_and_connect ;;
connect_by_ip " List installed mods")
elif [[ $sel == "${items[5]}" ]]; then
history_table
elif [[ $sel == "${items[6]}" ]]; then
:
elif [[ $sel == "${items[7]}" ]]; then
add_by_id
elif [[ $sel == "${items[8]}" ]]; then
add_by_fav
elif [[ $sel == "${items[9]}" ]]; then
delete=1
query_and_connect
elif [[ $sel == "${items[10]}" ]]; then
:
elif [[ $sel == "${items[11]}" ]]; then
list_mods | sed 's/\t/\n/g' | $steamsafe_zenity --list --column="Mod" --column="Symlink" --column="Dir" \ list_mods | sed 's/\t/\n/g' | $steamsafe_zenity --list --column="Mod" --column="Symlink" --column="Dir" \
--title="DZGUI" $sd_res --text="$(mods_disk_size)" \ --title="DZGUI" $sd_res --text="$(mods_disk_size)" \
--print-column="" 2>/dev/null --print-column="" 2>/dev/null
elif [[ $sel == "${items[12]}" ]]; then ;;
changelog | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null " View changelog") changelog | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null ;;
elif [[ $sel == "${items[13]}" ]]; then " Advanced options")
options_menu options_menu
main_menu main_menu
return return
elif [[ $sel == "${items[14]}" ]]; then ;;
: " Help file ⧉") help_file ;;
elif [[ $sel == "${items[15]}" ]]; then " Report bug ⧉") report_bug ;;
help_file " Forum ⧉") forum ;;
elif [[ $sel == "${items[16]}" ]]; then " NEW: Sponsor ⧉") sponsor ;;
report_bug " NEW: Hall of fame ⧉") hof ;;
elif [[ $sel == "${items[17]}" ]]; then esac
forum
else
warn "This feature is not yet implemented."
fi
else else
return return
fi fi
@ -1795,6 +1773,7 @@ setup(){
fi fi
} }
check_map_count(){ check_map_count(){
[[ $is_steam_deck -eq 1 ]] && return
local count=1048576 local count=1048576
echo "[DZGUI] Checking system map count" echo "[DZGUI] Checking system map count"
if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then if [[ ! -f /etc/sysctl.d/dayz.conf ]]; then