1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-28 05:12:36 +01:00

chore: merge

This commit is contained in:
aclist 2023-11-23 00:00:02 +09:00
commit 6838afab8b
4 changed files with 1017 additions and 2 deletions

391
changelog.md Normal file
View file

@ -0,0 +1,391 @@
# Changelog
## [4.0.0] 2023-11-22
Hello players, this is a major version update which overhauls many of DZGUI's underlying systems to improve responsiveness of the application and make menus more intuitive to interact with. It should be considerably more difficult, if not impossible, to inadvertently crash a dialog, and nested dialogs should behave in a more expected fashion, such as when going back and forth between menus or changing options dynamically within a given menu.
In addition, with this update we are querying servers directly. The net benefit of this is that results will returned faster, bootup is faster, and it also paves the way for future features like connecting to servers on a LAN. The Battlemetrics API is now entirely optional and can be skipped during the setup process. However, if you have already set up a BM API key, you can continue using it if you want to query or add servers by ID instead of IP.
As part of this change, version 4.0.0 introduces the ability to connect to or add servers to your list based on either ID or IP. Previously, you could only connect by IP and add by IP, but now you can connect by IP/ID or add by IP/ID. If you choose the ID method, this will be translated into an IP seamlessly in the background. Similarly, favorite servers are now stored using the full IP rather than the ID. Due to the variety of systems and methods for connecting to servers, the application was carrying around and converting server IPs, IDs, and other formats back and forth, creating unnecessary complexity. By normalizing everything to an IP basis, maintainability should be more consistent. When upgrading to this version, your old favorites lists will be updated automatically to the new IP method. Note that as a result of this change, we must purge old history lists ("Recent Servers"), but everything else should carry over as before.
If you encounter any problems with this new release or with the migration of configs, please do not hesitate to submit a bug report.
Attention Fedora 38 users: problems with upstream GNOME packages causing crashes have been reported to GNOME development and a fix has been issued. You have the choice of compiling the zenity package
from source or waiting until the latest version is merged into Fedora's package manager.
## Added
- Change in game name: dynamically change your profile name via the Advanced Options menu
- Connect by ID: supply a Battlemetrics ID to connect to a server; this can be used in lieu of the IP
- Add by IP: supply a standard IP to add a server to your list; this can be used as a more direct way of saving servers
- Filter by 1PP and 3PP in the server browser
- Save connected server to favorites: prior to connecting, asks the user if they want to save this server for future use
- Generate additional output when generating system logs
## Fixed
- Rare cases where the keyword filter would not filter server results correctly
- Handling of dialog exit signals: made it much more difficult to crash the application in rare cases when spamming input or returning from menus
- Update menus in place: when toggling options in the Advanced Options menu, displays the current state/mode of the option for better readability into what option is currently enabled
- More intuitive menu navigation: dialog setup and teardown is more responsive and follows expected flows when inside of nested menus
- Message formatting: fold long messages inside of popup dialogs for proper word wrapping regardless of screen type
- Fixed a rare case where dialogs would spawn twice during first-time setup
- Properly remain inside of menus when looping where it would make sense to do so : e.g., Delete Servers list, Advanced Options
## Changed
- Query servers directly to reduce API hops: initial bootup and subsequent server queries should be considerably faster
- Store complete IP:Port instead of server IDs
- Make Battlemetrics API key optional: this is only used for the 'Connect by ID' and 'Add server by ID' methods and is not required. If you prefer, you can simply connect/add by IP.
- Prevent the application from launching in Game Mode on Steam Deck: Steam Deck's kiosk mode has problems sending keyboard input to third party applications. To prevent unintended usage, DZGUI now warns the user to launch the app in Desktop Mode if they attempt to use it from Game Mode. Adding DZGUI as a Non-Steam Game does work on desktop PCs, but is not recommended due to the way Steam handles subshells. For best results, launch DZGUI directly via the script/applications menu (PC) or via the desktop icon (Steam Deck).
- Omit null servers from list: servers that time out or send an empty response are now omitted entirely from the My Servers list, as they will not return meaningful metadata unless they are online.
The My Servers list thus shows online and accessible servers
## [3.3.0] 2023-05-16
### Added
- Fetch more inclusive global "players in-game" count
- List mod directory on installed mods list
- Detect default Flatpak Steam path
- Dark mode/light mode theme to help file
- Alpha-sort My Servers list
- Add description of how to enable hidden folders on GTK2/3
- Initial logging framework
### Changed
- Test for wmctrl when enabling full auto mod installation
- Steam Deck: block toggling full auto mod installation due to extra dependencies needed
- First-time setup: sudo escalation when checking system map count for the first time
### Fixed
- Steam Deck: non-ASCII delimiter causing setup menu to despawn on some devices
- Don't add items in My Servers multiple times to array when the list of favorites is paginated
- Trigger progress dialogs sooner and in sequence to reduce appearance of visual lag
- First-time setup: break out of dialogs correctly when user backs out
- First-time setup: break out of automatic path discovery when user specifies a path manually
- More portable interpreter invocation
- Properly size down window resolution when returning from server browser
## [3.2.10] 2023-05-11
### Fixed
- Return from lockfile function if first-time setup has not been run
- Sanitize inputs when using file picker
- Require both wmctrl and xdotool
## [3.2.9] 2023-05-10
### Changed
- Reword button to "Choose path manually" instead of "Retry"
## [3.2.7] 2023-05-10
### Changed
- Better sudo escalation within zenity dialogs if vm map count is too small
## [3.2.6] 2023-05-10
### Fixed
- Don't parse Flatpak symlinks when setting up default Steam path
## [3.2.5] 2023-05-07
### Fixed
- Require sudo when checking vm map count
## [3.2.4] 2023-03-01
### Fixed
- BM API returning stale query port and preventing fetching modlist
## [3.2.3] 2023-02-17
### Fixed
- sysctl map count value not being loaded immediately after setting
- Application terminating when user declines to update map count value
- Erroneous stderror output when flatpak is not installed
## [3.2.0] 2023-01-19
### Added
- Support Flatpak version of Steam
## [3.1.8] 2023-01-18
### Fixed
- Progress window blocking rest of window stack
- Bug when updating old mods if automod set to ON
## [3.1.7] 2023-01-06
### Fixed
- Hotfix for xdotool repeating input
## [3.1.6] 2023-01-01
### Changed
- Tick low pop servers by default
## [3.1.5] 2023-01-01
### Fixed
- Validate BM key on initial setup
- Fix history menu not parsing query ports correctly
### Changed
- More permissive Steam client discovery for tiling WMs
## [3.1.4] 2022-12-10
### Fixed
- Issue #43: Hotfix for workspace-driven WMs
## [3.1.3] 2022-12-06
### Fixed
- Explicitly require Python 3
## [3.1.1-2] 2022-12-03
### Fixed
- Fix lockfile path
## [3.1.0] 2022-12-03
### Added
- Recent connect history
- Simple, OS-agnostic automod installation
- Track local mod versions
- Force update local mods option
- Added python to dependencies
- File-picker driven path discovery on initial setup
### Dropped
- Headless mod installation
- Drop server ID field requirement on initial setup
### Changed
- Clean up main menu options
- Enforce Steam API key on initial setup
- More accurate path discovery on initial setup
- Add thousands separator to player counts in server browser
### Fixed
- Initial setup dialog causing early crash
- Improved error handling on initial setup to avoid malformed config files
- Delete server menu not clearing when returning to main menu
- Handle whitelist deletion when only one entry present
- Include path to drives under /run in path discovery
- Use Steam-safe local zenity version
## [3.0.7] 2022-11-25
### Fixed
- Hotfix for server reporting multiple versions of same mod
## [3.0.6] 2022-11-09
### Changed
- More verbose logs
## [3.0.5] 2022-10-27
### Fixed
- Properly create .desktop file on desktop PCs
## [3.0.3-4] 2022-10-16
### Fixed
- Steam Deck path discovery on first-time setup
## [3.0.2] 2022-10-12
### Fixed
- Size of certain popups on Steam Deck
## [3.0.1] 2022-10-12
### Fixed
- Initial popup size on Steam Deck
## [3.0.0] 2022-10-12
### Added
- Foreground progress of manual mod subscriptions
- Automatic mod helper through steamcmd
- Forum link
- Enforce Steam API
### Dropped
- Stop retrieving extra metadata from BM
### Changed
- Reorder main menu
- More verbose error messages
- Better abstraction of URLs
### Fixed
- Width and text of some popups on Steam Deck
## [2.7.2] 2022-10-07
### Fixed
- Fix internal URL
## [2.7.1] 2022-10-05
### Fixed
- Game launch not kicking off after symlink creation
## [2.7.0] 2022-10-04
### Added
- Server browser and geolocation algorithm
- More verbose error codes
- Additional progress bar setup and destruction throughout the application
- Additional API response validation
### Fixed
- Encapsulate title strings to prevent leaky arguments in title bars
- Remove erroneous slow boot process if first-time setup was already complete
- Delete server list not emptying when returning to main menu
### Changed
- Group main menu entries in advance of future functionality
- Better abstraction of paths
- Clarification of certain options and errors
## [2.6.3] 2022-10-02
### Fixed
- Hotfix for connect-to-fav not getting modlist
## [2.6.2] 2022-10-02
### Fixed
- Hotfix for BM API returning malformed publishedfileids
## [2.6.1] 2022-09-25
### Fixed
- Freedesktop shortcut errors
## [2.6.0] 2022-09-05
### Added
- Connect by IP method
## [2.5.1] 2022-08-17
### Fixed
- Hotfix for malformed paths during first-time setup
## [2.5.0] 2022-08-16
### Added
- Lockfile: prevent concurrent instances of DZGUI from being opened
### Changed
- Faster path discovery on first-time setup
### Fixed
- Symlink collision on servers with many mods
- API response pagination for large server lists
## [2.4.1] 2022-08-09
### Fixed
- Hotfix for progress bar breaking table when >9 servers in list
## [2.4.0] 2022-08-07
### Added
- Delete server command added to main menu
- Write log to file for bug reports
- Prompt to permanently increase map count size
- Dependency check for Steam
- Cover artwork
- News backend for OTA updates
- Clean up stale symlinks when checking mods
### Fixed
- Minify long mod launch params for servers with launch params breaking the upper limit
- Port DZTUI method of handling legacy symlinks
- Prevent user from entering invalid data on first-time setup
- Prompt to re-run first-time setup if config is malformed
- Better handling of field output from table
- Better Steam Deck detection and handling
- Prevent garbage in error messages
- Miscellaneous backend improvements
### Changed
- Enforce download when switching branches
## [2.3.2] 2022-08-04
### Fixed
Set branch flag to 'stable' if no config file present
## [2.3.1] 2022-08-04
### Fixed
- Improved error handling of first-time setup fields
- Interpolate config file values for debug, branch when writing file
### Changed
- Prompt user to restart first-time setup if broken config is found
>>>>>>> c293fcd8c5136b6578f519b2f400d45bc01335cc
## [2.3.0] 2022-07-18
### Added
- Numbered mod links in browser
- Admonition to upgrade versions for bug fixes
- Toggle branch between stable/testing
### Fixed
- Hotfix for fav server select on main menu
## [2.2.1] 2022-07-17
### Fixed
- Hotfix for upstream API returning malformed modlists
- Handle servers with no mods
- Fix dialog window depending on browser exit
- Remove stray newlines in config file
## [2.2.0] 2022-06-22
### Added
- Toggle debug mode in-app
## [2.1.0] 2022-06-19
### Changed
- Updated link to new documentation
## [2.0.3] 2022-06-17
### Fixed
- Safer expansion of originating script path
## [2.0.2] 2022-06-16
### Fixed
- Remove enforced runtime check of workshop path
## [2.0.2] 2022-06-16
### Fixed
- Expansion of Steam path prefix when default path was found
## [2.0.1] 2022-06-16
### Fixed
- Regenerate mod links file in browser when clicking dialog
- Reset whitelist when canceling one-shot (fav) mode
## [2.0.0] 2022-06-15
### Added
- Attempt to find DayZ path and write to config on first launch
- Merge existing config values into new config format when upgrading version
- Dynamically detect Steam Deck and set launch parameters
- Add "gametime" column to server list
- One-shot mode to open mod links in browser if using desktop
- Add favorite server from main menu
- Update favorite server changes in real time
- Add link to help pages from main menu
- Add link to changelog from main menu
### Changed
- Don't require duplication of fav server in whitelist
- More permissive truncation of long server names (50 char limit)
- Render mod list as a scrollable menu
- Reword errors for greater verbosity
- Initial support of granular error handling for API response codes
- Move extended path variables out of user config
### Fixed
- Check if mod dir is sane before listing mods
- Prevent favorite server launch if none set
- Reset server list to entire whitelist if canceling out of fav connect
- Do not load table on empty API response and warn user
- Suppress stderr cruft in logs and use logger instead
## [1.2.1] 2022-06-12
### Fixed
- Print the entire changelog
- Add confirmation dialog before run
## [1.2.0] 2022-06-12
### Changed
- Mod validation process now uses faster, single-pass API query
- Improved logger output when setting fav server
### Added
- In-app changelog
## [1.1.2] 2022-06-08
### Fixed
- Fix array used for mod concatenation; fetch post-sanitized list of mods
## [1.1.1] 2022-06-05
### Fixed
- Stricter regex to parse upstream version number
## [1.1.0] 2022-06-05
### Added
- Main menu: fav server label on header
- Main menu: add servers by ID directly into config file
- Main menu: link to report a bug
- Main menu: quick connect to fav server
- Connect: mod compatibility check
- Connect: mod download prompt
- Connect: mod auto symlinks
- New version download prompt
- Additional visualization of progress/menus
### Fixed
- Menu recursion when navigating backwards
### Changed
- Reduced ping timeout interval

View file

@ -34,7 +34,7 @@ If any dependencies are missing when the application starts, it will warn you, s
Automatic method: generic OS (skip to step 3 below when complete)
```
curl -s "https://raw.githubusercontent.com/aclist/dztui/main/install.sh" | bash
curl -s "https://raw.githubusercontent.com/aclist/dztui/dzgui/install.sh" | bash
```
Automatic method: nix-based systems (contributed by lelgenio)

624
dzgui.sh
View file

@ -68,6 +68,7 @@ print_news(){
}
declare -A deps
<<<<<<< HEAD
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1" [fold]="9.0")
changelog(){
build(){
@ -87,6 +88,19 @@ changelog(){
curl -Ls "$md"
}
build | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
=======
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [tr]="9.0" [$steamsafe_zenity]="3.42.1")
changelog(){
if [[ $branch == "stable" ]]; then
md="https://raw.githubusercontent.com/aclist/dztui/dzgui/changelog.md"
else
md="https://raw.githubusercontent.com/aclist/dztui/testing/changelog.md"
fi
prefix="This window can be scrolled."
echo $prefix
echo ""
curl -Ls "$md"
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
depcheck(){
@ -144,6 +158,36 @@ set_api_params(){
list_response=$response
first_entry=1
}
<<<<<<< HEAD
=======
query_api(){
logger INFO ${FUNCNAME[0]}
echo "# Querying API"
#TODO: prevent drawing list if null values returned without API error
if [[ $one_shot_launch -eq 1 ]]; then
list_of_ids="$fav"
else
list_of_ids="$whitelist"
fi
set_api_params
if [[ "$(jq -r 'keys[]' <<< "$response")" == "errors" ]]; then
code=$(jq -r '.errors[] .status' <<< $response)
#TODO: fix granular api codes
if [[ $code -eq 401 ]]; then
warn "Error $code: malformed API key"
return
elif [[ $code -eq 500 ]]; then
warn "Error $code: malformed server list"
return
fi
fi
if [[ -z $(echo $response | jq '.data[]') ]]; then
warn "95: API returned empty response. Check config file."
return
fi
}
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
write_config(){
cat <<-END
#Path to DayZ installation
@ -244,9 +288,16 @@ create_config(){
write_config > $config_file
info "Config file created at $config_file."
source $config_file
<<<<<<< HEAD
}
while true; do
player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="Steam API key" --add-entry="BattleMetrics API key (optional)" --title="DZGUI" --text="DZGUI" $sd_res --separator="@" 2>/dev/null)"
=======
return
}
while true; do
player_input="$($steamsafe_zenity --forms --add-entry="Player name (required for some servers)" --add-entry="BattleMetrics API key" --add-entry="Steam API key" --title="DZGUI" --text="DZGUI" $sd_res --separator="@" 2>/dev/null)"
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
#explicitly setting IFS crashes $steamsafe_zenity in loop
#and mapfile does not support high ascii delimiters
#so split fields with newline
@ -265,6 +316,7 @@ create_config(){
fi
if [[ -n $api_key ]] && [[ $(test_bm_api $api_key) -eq 1 ]]; then
warn "Invalid BM API key"
<<<<<<< HEAD
continue
fi
while true; do
@ -289,6 +341,28 @@ create_config(){
return
fi
done
=======
else
while true; do
logger INFO "steamsafe_zenity is $steamsafe_zenity"
[[ -n $steam_path ]] && { write_to_config; return; }
find_default_path
find_library_folder "$default_steam_path"
if [[ -z $steam_path ]]; then
logger WARN "Steam path was empty"
zenity --question --text="DayZ not found or not installed at the chosen path." --ok-label="Choose path manually" --cancel-label="Exit"
if [[ $? -eq 0 ]]; then
logger INFO "User selected file picker"
file_picker
else
exit
fi
else
write_to_config
fi
done
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
done
}
@ -390,8 +464,51 @@ manual_mod_install(){
[[ $is_steam_deck -eq 1 ]] && test_display_mode
if [[ $gamemode -eq 1 ]]; then
<<<<<<< HEAD
popup 1400
return
=======
steam_deck_mods
else
local ex="/tmp/dzc.tmp"
[[ -f $ex ]] && rm $ex
watcher(){
readarray -t stage_mods <<< "$diff"
for((i=0;i<${#stage_mods[@]};i++)); do
[[ -f $ex ]] && return 1
local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid"
local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
$steam_cmd "steam://url/CommunityFilePage/${stage_mods[$i]}"
echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences."
sleep 1s
foreground
until [[ -d $downloads_dir/${stage_mods[$i]} ]]; do
[[ -f $ex ]] && return 1
sleep 0.1s
if [[ -d $workshop_dir/${stage_mods[$i]} ]]; then
break
fi
done
foreground
echo "# Steam is downloading ${stage_mods[$i]} (mod $((i+1)) of ${#stage_mods[@]})"
until [[ -d $workshop_dir/${stage_mods[$i]} ]]; do
[[ -f $ex ]] && return 1
sleep 0.1s
done
foreground
echo "# ${stage_mods[$i]} moved to mods dir"
done
echo "100"
}
watcher > >($steamsafe_zenity --pulsate --progress --auto-close --title="DZG Watcher" --width=500 2>/dev/null; rc=$?; [[ $rc -eq 1 ]] && touch $ex)
compare
if [[ -z $diff ]]; then
passed_mod_check > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
launch
else
return 1
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
fi
local ex="/tmp/dzc.tmp"
[[ -f $ex ]] && rm $ex
@ -478,6 +595,7 @@ passed_mod_check(){
}
auto_mod_install(){
<<<<<<< HEAD
local ip="$1"
local gameport="$2"
popup 300
@ -505,6 +623,36 @@ auto_mod_install(){
else
manual_mod_install "$ip" "$gameport"
fi
=======
popup 300
rc=$?
if [[ $rc -eq 0 ]]; then
#calc_mod_sizes
#local total_size=$(numfmt --to=iec $totalmodsize)
log="$default_steam_path/logs/content_log.txt"
[[ -f "/tmp/dz.status" ]] && rm "/tmp/dz.status"
touch "/tmp/dz.status"
console_dl "$diff" &&
$steam_cmd steam://open/downloads && 2>/dev/null 1>&2
win=$(xdotool search --name "DZG Watcher")
xdotool windowactivate $win
until [[ -z $(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort)) ]]; do
local missing=$(comm -23 <(printf "%s\n" "${modids[@]}" | sort) <(ls -1 $workshop_dir | sort) | wc -l)
echo "# Downloaded $((${#modids[@]}-missing)) of ${#modids[@]} mods. ESC cancels"
done | $steamsafe_zenity --pulsate --progress --title="DZG Watcher" --auto-close --no-cancel --width=500 2>/dev/null
compare
[[ $force_update -eq 1 ]] && { unset force_update; return; }
if [[ -z $diff ]]; then
check_timestamps
passed_mod_check > >($steamsafe_zenity --pulsate --progress --title="DZGUI" --auto-close --width=500 2>/dev/null)
launch
else
manual_mod_install
fi
else
manual_mod_install
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
get_local_stamps(){
concat(){
@ -644,10 +792,51 @@ prepare_ip_list(){
done
fi
}
<<<<<<< HEAD
=======
history_table(){
[[ -f /tmp/dz.hist ]] && rm /tmp/dz.hist
for i in $(cat $hist_file); do
echo "# Getting metadata for $i"
local meta_file=$(mktemp)
source $config_file
local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$i&key=$steam_api"
curl -Ls "$url" > $meta_file
json=$(mktemp)
< $meta_file jq '.response' > $json
res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null)
prepare_ip_list "$meta_file" >> /tmp/dz.hist
sleep 0.5s
done | $steamsafe_zenity --pulsate --progress --auto-close --title="DZGUI" --width=500 --no-cancel 2>/dev/null
[[ $? -eq 1 ]] && return
while true; do
sel=$(cat /tmp/dz.hist | $steamsafe_zenity --width 1200 --height 800 --title="DZGUI" --text="Recent servers" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2,5 --separator=%% 2>/dev/null)
if [[ $? -eq 1 ]]; then
return_from_table=1
rm /tmp/dz.hist
return
fi
if [[ -z $sel ]]; then
echo "No selection"
else
local addr="$(echo "$sel" | awk -F"%%" '{print $1}')"
local qport="$(echo "$sel" | awk -F"%%" '{print $2}')"
local ip=$(awk -F: '{print $1}' <<< $addr)
local gameport=$(awk -F: '{print $2}' <<< $addr)
local sa_ip=$(echo "$ip:$gameport%%$qport")
qport_list="$sa_ip"
connect "$sel" "ip"
fi
done
rm /tmp/dz.hist
}
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
ip_table(){
local sel
local res="$1"
while true; do
<<<<<<< HEAD
sel=$(prepare_ip_list "$res" | $steamsafe_zenity --width 1200 --height 800 --text="Multiple maps found at this server. Select map from the list below" --title="DZGUI" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=1,2,5 --separator=%% 2>/dev/null)
[[ $? -eq 1 ]] && return 1
echo "$sel"
@ -659,6 +848,34 @@ fetch_ip_metadata(){
source $config_file
local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api"
curl -Ls "$url"
=======
sel=$(prepare_ip_list "$meta_file" | $steamsafe_zenity --width 1200 --height 800 --text="One or more maps found at this server. Select map from the list below" --title="DZGUI" --list --column=Name --column=IP --column=Players --column=Gametime --column=Qport --print-column=2 --separator=%% 2>/dev/null)
if [[ $? -eq 1 ]]; then
return_from_table=1
return
fi
if [[ -z $sel ]]; then
echo "No selection"
else
local gameport="$(echo "$sel" | awk -F: '{print $2}')"
local ip="$(echo "$sel" | awk -F: '{print $1}')"
local addr=$(< $json jq -r --arg gameport $gameport '.servers[]|select(.gameport == ($gameport|tonumber)).addr')
local qport=$(echo "$addr" | awk -F: '{print $2}')
local sa_ip=$(echo "$ip:$gameport%%$qport")
qport_list="$sa_ip"
connect "$sel" "ip"
fi
done
}
fetch_ip_metadata(){
meta_file=$(mktemp)
source $config_file
url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$ip&key=$steam_api"
curl -Ls "$url" > $meta_file
json=$(mktemp)
< $meta_file jq '.response' > $json
res=$(< $meta_file jq -er '.response.servers[]' 2>/dev/null)
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
#TODO: local servers
@ -733,6 +950,7 @@ parse_ips(){
source $config_file
check_steam_api
[[ $? -eq 1 ]] && return
<<<<<<< HEAD
while true; do
local ip
ip=$($steamsafe_zenity --entry --text="Enter server IP (omit port)" --title="DZGUI" 2>/dev/null)
@ -761,6 +979,31 @@ parse_ips(){
warn "Invalid IP"
fi
done
=======
while true; do
if [[ $return_from_table -eq 1 ]]; then
return_from_table=0
return
fi
ip=$($steamsafe_zenity --entry --text="Enter server IP (omit port)" --title="DZGUI" 2>/dev/null)
[[ $? -eq 1 ]] && return
if validate_ip "$ip"; then
fetch_ip_metadata
if [[ ! $? -eq 0 ]]; then
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
echo "[DZGUI] 96: Failed to retrieve IP metadata"
else
ip_table
fi
else
continue
fi
done
}
fetch_mods(){
remote_mods=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d filter[ids][whitelist]="$1" -d "sort=-players" \
| jq -r '.data[] .attributes .details .modIds[]')
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
query_defunct(){
readarray -t modlist <<< "$@"
@ -817,7 +1060,11 @@ launch(){
fi
fi
if [[ $debug -eq 1 ]]; then
<<<<<<< HEAD
launch_options="$steam_cmd -applaunch $aid -connect=$ip:$gameport -nolauncher -nosplash -name=$name -skipintro \"-mod=$mods\""
=======
launch_options="$steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -name=$name -skipintro \"-mod=$mods\""
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
print_launch_options="$(printf "This is a dry run.\nThese options would have been used to launch the game:\n\n$launch_options\n" | fold -w 60)"
$steamsafe_zenity --question --title="DZGUI" --ok-label="Write to file" --cancel-label="Back"\
--text="$print_launch_options" 2>/dev/null
@ -829,8 +1076,15 @@ launch(){
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote launch options to \n$source_dir/options.log" 2>/dev/null
fi
else
<<<<<<< HEAD
$steamsafe_zenity --width=500 --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null
$steam_cmd -applaunch $aid -connect=$ip:$gameport -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\"
=======
echo "[DZGUI] All OK. Launching DayZ"
$steamsafe_zenity --width=500 --title="DZGUI" --info --text="Launch conditions satisfied.\nDayZ will now launch after clicking [OK]." 2>/dev/null
$steam_cmd -applaunch $aid -connect=$ip -nolauncher -nosplash -skipintro -name=$name \"-mod=$mods\"
exit
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
fi
}
browser(){
@ -891,6 +1145,7 @@ format_table_results(){
printf "%s\n%s\n%s\n%s\n" "$name" "$ip" "$gameport" "$qport"
}
delete_or_connect(){
<<<<<<< HEAD
local sel="$1"
local mode="$2"
@ -922,6 +1177,39 @@ delete_or_connect(){
connect "$ip" "$gameport" "$qport"
return
esac
=======
if [[ $delete -eq 1 ]]; then
server_name=$(echo "$sel" | awk -F"%%" '{print $1}')
server_id=$(echo "$sel" | awk -F"%%" '{print $2}')
$steamsafe_zenity --question --text="Delete this server? \n$server_name" --title="DZGUI" --width=500 2>/dev/null
if [[ $? -eq 0 ]]; then
delete_by_id $server_id
fi
source $config_file
unset delete
else
local lookup_ip=$(echo "$sel" | awk -F: '{print $1}')
ip=$lookup_ip
fetch_ip_metadata
if [[ ! $? -eq 0 ]]; then
warn "[ERROR] 96: Failed to retrieve IP metadata. Check IP or API key and try again."
echo "[DZGUI] 96: Failed to retrieve IP metadata"
else
local jad=$(echo "$res" | jq -r '.addr')
if [[ $(<<< "$jad" wc -l ) -gt 1 ]]; then
ip_table
elif [[ $(<<< "$jad" wc -l ) -eq 1 ]]; then
local gameport="$(echo "$res" | jq -r '.gameport')"
local ip="$(echo "$jad" | awk -F: '{print $1}')"
local qport=$(echo "$jad" | awk -F: '{print $2}')
local sa_ip=$(echo "$ip:$gameport%%$qport")
qport_list="$sa_ip"
local sel="$ip:$gameport%%$qport"
connect "$sel" "ip"
fi
fi
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
populate(){
local switch="$1"
@ -969,7 +1257,10 @@ connect_to_fav(){
[[ $? -eq 1 ]] && return 1
}
set_header(){
<<<<<<< HEAD
local switch="$1"
=======
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
logger INFO "${FUNCNAME[0]}"
logger INFO "Header mode is $1"
print_news
@ -1060,6 +1351,15 @@ focus_beta_client(){
console_dl(){
readarray -t modids <<< "$@"
focus_beta_client
<<<<<<< HEAD
=======
# steam steam://open/console 2>/dev/null 1>&2 &&
# sleep 1s
#https://github.com/jordansissel/xdotool/issues/67
#https://dwm.suckless.org/patches/current_desktop/
# local wid=$(xdotool search --onlyvisible --name Steam)
#xdotool windowactivate $wid
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
sleep 1.5s
for i in "${modids[@]}"; do
xdotool type --delay 0 "workshop_download_item $aid $i"
@ -1121,11 +1421,15 @@ popup(){
700) pop "Toggled to Flatpak Steam." ;;
800) pop "Toggled to native Steam." ;;
900) pop "This feature is not supported on Steam Deck." ;;
<<<<<<< HEAD
1000) pop "No recent history." ;;
1100) pop "No results found." ;;
1200) pop "Timed out. Server may be temporarily offline or not responding to queries." ;;
1300) pop "No favorite server configured." ;;
1400) pop "DZGUI must be run in Desktop Mode on Steam Deck." ;;
=======
1000) pop "No recent history."
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
esac
}
toggle_console_dl(){
@ -1162,6 +1466,7 @@ toggle_steam_binary(){
steam_cmd="steam"
update_steam_cmd
popup 800;;
<<<<<<< HEAD
esac
}
options_menu(){
@ -1319,6 +1624,68 @@ exclude_fpp(){
}
exclude_tpp(){
response=$(<<< "$response" jq '[.[]|select(.gametype|split(",")|any(. == "no3rd"))]')
=======
esac
}
options_menu(){
case "$auto_install" in
0|1|"") auto_hr="OFF"; ;;
2) auto_hr="ON"; ;;
esac
debug_list=(
"Toggle branch"
"Toggle debug mode"
"Output system info"
"Toggle auto mod install [$auto_hr]"
)
#TODO: tech debt: drop old flags
[[ $auto_install -eq 2 ]] || [[ $auto_install -eq 1 ]] && debug_list+=("Force update local mods")
case "$steam_cmd" in
steam) steam_hr=Steam ;;
flatpak*) steam_hr=Flatpak ;;
esac
[[ $toggle_steam -eq 1 ]] && debug_list+=("Toggle native Steam or Flatpak [$steam_hr]")
debug_sel=$($steamsafe_zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null)
[[ -z $debug_sel ]] && return
case "$debug_sel" in
"Toggle branch")
enforce_dl=1
toggle_branch &&
check_version
;;
"Toggle debug mode") toggle_debug ;;
"Output system info")
source_script=$(realpath "$0")
source_dir=$(dirname "$source_script")
generate_log > "$source_dir/DZGUI.log"
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote log file to \n$source_dir/log" 2>/dev/null
printf "[DZGUI] Wrote log file to %s/log\n" "$source_dir"
;;
Toggle[[:space:]]auto*) toggle_console_dl ;;
"Force update local mods")
force_update=1
force_update_mods
merge_modlists > >($steamsafe_zenity --pulsate --progress --no-cancel --auto-close --title="DZGUI" --width=500 2>/dev/null)
auto_mod_install
;;
Toggle[[:space:]]native*) toggle_steam_binary ;;
esac
}
query_and_connect(){
[[ -z $whitelist ]] && { popup 600; return; }
q(){
query_api
parse_json
create_array
}
q | $steamsafe_zenity --width=500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
rc=$?
if [[ $rc -eq 1 ]]; then
:
else
populate
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
exclude_full(){
response=$(echo "$response" | jq '[.[]|select(.players!=.max_players)]')
@ -1407,6 +1774,7 @@ check_geo_file(){
md5sum -c "$sums_path" 2>/dev/null 1>&2
local res=$?
cd $OLDPWD
<<<<<<< HEAD
[[ $res -eq 0 ]] && return
update(){
mkdir -p "$helpers_path"
@ -1421,6 +1789,23 @@ check_geo_file(){
echo "100"
}
update > >(pdialog)
=======
if [[ $res -eq 1 ]]; then
run(){
mkdir -p "$helpers_path"
echo "# Fetching new geolocation DB"
curl -Ls "$db_file" > "$gzip"
echo "# Extracting coordinates"
#force overwrite
gunzip -f "$gzip"
echo "# Preparing helper file"
curl -Ls "$km_helper_url" > "$km_helper"
chmod +x $km_helper
echo "100"
}
run > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
choose_filters(){
if [[ $is_steam_deck -eq 0 ]]; then
@ -1428,6 +1813,7 @@ choose_filters(){
fi
sels=$($steamsafe_zenity --title="DZGUI" --text="Server search" --list --checklist --column "Check" --column "Option" --hide-header TRUE "All maps (untick to select from map list)" TRUE "Daytime" TRUE "Nighttime" TRUE "1PP" TRUE "3PP" False "Empty" False "Full" TRUE "Low population" FALSE "Non-ASCII titles" FALSE "Keyword search" $sd_res 2>/dev/null)
if [[ $sels =~ Keyword ]]; then
<<<<<<< HEAD
local search
while true; do
search=$($steamsafe_zenity --entry --text="Search (case insensitive)" --width=500 --title="DZGUI" 2>/dev/null | awk '{print tolower($0)}')
@ -1439,6 +1825,13 @@ choose_filters(){
[[ -z $sels ]] && return
echo "$sels" | sed 's/|/, /g;s/ (untick to select from map list)//'
echo "$search"
=======
search=$($steamsafe_zenity --entry --text="Search (case insensitive)" --width=500 --title="DZGUI" 2>/dev/null | awk '{print tolower($0)}')
[[ -z $search ]] && { ret=97; return; }
fi
[[ -z $sels ]] && return
filters=$(echo "$sels" | sed 's/|/, /g;s/ (untick to select from map list)//')
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
get_dist(){
local given_ip="$1"
@ -1536,6 +1929,7 @@ munge_servers(){
fi
}
debug_servers(){
<<<<<<< HEAD
debug_res=$(curl -Ls "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api")
local len=$(<<< "$debug_res" jq '[.response.servers[]]|length')
if [[ $len -eq 0 ]]; then
@ -1543,6 +1937,19 @@ debug_servers(){
else
return 0
fi
=======
if [[ -n $steam_api ]]; then
exists=true
else
exists=false
fi
key_len=${#steam_api}
first_char=${steam_api:0:1}
last_char=${steam_api:0-1}
debug_res=$(curl -Ls "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api")
debug_len=$(echo "$debug_res" | jq '[.response.servers[]]|length')
[[ -z $debug_len ]] && debug_len=0
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
server_browser(){
unset ret
@ -1556,6 +1963,7 @@ server_browser(){
echo "# Calculating server distances"
local_latlon
[[ $ret -eq 97 ]] && return
<<<<<<< HEAD
local limit=20000
local url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=$limit&key=$steam_api"
@ -1586,6 +1994,36 @@ server_browser(){
connect "$ip" "$gameport" "$qport"
sd_res="--width=1280 --height=800"
=======
#TODO: some error handling here
fetch(){
echo "# Getting server list"
response=$(curl -Ls "$url" | jq -r '.response.servers')
}
fetch > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
total_servers=$(echo "$response" | jq 'length' | numfmt --grouping)
players_online=$(curl -Ls "https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=$aid" \
| jq '.response.player_count' | numfmt --grouping)
debug_servers
local sel=$(munge_servers)
if [[ -z $sel ]]; then
unset filters
unset search
ret=98
sd_res="--width=1280 --height=800"
return
fi
local sel_ip=$(echo "$sel" | awk -F%% '{print $1}')
local sel_port=$(echo "$sel" | awk -F%% '{print $2}')
qport_list="$sel_ip%%$sel_port"
if [[ -n "$sel_ip" ]]; then
connect "$sel_ip" "ip"
sd_res="--width=1280 --height=800"
else
sd_res="--width=1280 --height=800"
return
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
mods_disk_size(){
printf "Total size on disk: %s | " $(du -sh "$workshop_dir" | awk '{print $1}')
@ -1597,12 +2035,17 @@ main_menu(){
logger INFO "Setting mode"
set_mode
while true; do
<<<<<<< HEAD
set_header "main_menu"
=======
set_header ${FUNCNAME[0]}
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
rc=$?
logger INFO "set_header rc is $rc"
if [[ $rc -eq 0 ]]; then
case "$sel" in
"") warn "No item was selected." ;;
<<<<<<< HEAD
" Server browser")
local filters=$(choose_filters)
[[ -z $filters ]] && continue
@ -1617,12 +2060,27 @@ main_menu(){
" Add favorite server") add_by_fav ;;
" Change favorite server") add_by_fav ;;
" Delete server") query_and_connect "delete" ;;
=======
" Server browser") server_browser ;;
" My servers") query_and_connect ;;
" Quick connect to favorite server") connect_to_fav ;;
" Connect by IP") connect_by_ip ;;
" Recent servers (last 10)") history_table ;;
" Add server by ID") add_by_id ;;
" Add favorite server") add_by_fav ;;
" Change favorite server") add_by_fav ;;
" Delete server") delete=1; query_and_connect ;;
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
" List installed mods")
list_mods | sed 's/\t/\n/g' | $steamsafe_zenity --list --column="Mod" --column="Symlink" --column="Dir" \
--title="DZGUI" $sd_res --text="$(mods_disk_size)" \
--print-column="" 2>/dev/null
;;
<<<<<<< HEAD
" View changelog") changelog ;;
=======
" View changelog") changelog | $steamsafe_zenity --text-info $sd_res --title="DZGUI" 2>/dev/null ;;
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
" Advanced options")
options_menu
main_menu
@ -1640,6 +2098,7 @@ main_menu(){
fi
done
}
<<<<<<< HEAD
set_fav(){
local fav="$1"
logger INFO "${FUNCNAME[0]}"
@ -1653,6 +2112,83 @@ set_fav(){
local info=$(a2s "$ip" "$qport" info)
local name=$(<<< $info jq -r '.name')
echo "'$name'"
=======
page_through(){
list_response=$(curl -s "$page")
list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
idarr+=("$list")
parse_json
}
parse_json(){
echo "# Parsing servers"
page=$(echo "$list_response" | jq -r '.links.next?')
if [[ $first_entry -eq 1 ]]; then
local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
idarr+=("$list")
first_entry=0
fi
if [[ "$page" != "null" ]]; then
page_through
else
printf "%s\n" "${idarr[@]}" > $tmp
idarr=()
fetch_query_ports
fi
}
check_ping(){
ping_ip=$(echo "$1" | awk -F'\t' '{print $2}' | awk -F: '{print $1}')
ms=$(ping -c 1 -W 1 "$ping_ip" | awk -Ftime= '/time=/ {print $2}')
if [[ -z $ms ]]; then
echo "Timeout"
else
echo "$ms"
fi
}
create_array(){
rows=()
#TODO: improve error handling for null values
lc=1
while read line; do
name=$(echo "$line" | awk -F'\t' '{print $1}')
#truncate names
if [[ $(echo "$name" | wc -m) -gt 50 ]]; then
name="$(echo "$name" | awk '{print substr($0,1,50) "..."}')"
else
:
fi
ip=$(echo "$line" | awk -F'\t' '{print $2}')
players=$(echo "$line" | awk -F'\t' '{print $3}')
time=$(echo "$line" | awk -F'\t' '{print $4}')
stat=$(echo "$line" | awk -F'\t' '{print $5}')
#TODO: probe offline return codes
id=$(echo "$line" | awk -F'\t' '{print $6}')
tc=$(awk 'END{print NR}' $tmp)
if [[ $delete -eq 1 ]]; then
declare -g -a rows=("${rows[@]}" "$name" "$id")
else
echo "# Checking ping: $lc/$tc"
ping=$(check_ping "$line")
declare -g -a rows=("${rows[@]}" "$name" "$ip" "$players" "$time" "$stat" "$id" "$ping")
fi
let lc++
done < <(cat "$tmp" | sort -k1)
for i in "${rows[@]}"; do echo -e "$i"; done > $tmp
}
set_fav(){
logger INFO "${FUNCNAME[0]}"
echo "[DZGUI] Querying favorite server"
query_api
fav_label=$(curl -s "$api" -H "Authorization: Bearer "$api_key"" -G -d "filter[game]=$game" -d "filter[ids][whitelist]=$fav" \
| jq -r '.data[] .attributes .name')
if [[ -z $fav_label ]]; then
fav_label=null
else
fav_label="'$fav_label'"
fi
logger INFO "Fav label is $fav_label"
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
check_unmerged(){
logger INFO "${FUNCNAME[0]}"
@ -1666,8 +2202,15 @@ merge_config(){
legacy_fav
legacy_ids
[[ -z $staging_dir ]] && staging_dir="/tmp"
<<<<<<< HEAD
update_config
tdialog "Wrote new config format to \n${config_file}\nIf errors occur, you can restore the file:\n${config_file}.old"
=======
write_config > $config_file
printf "[DZGUI] Wrote new config file to %sdztuirc\n" $config_path
$steamsafe_zenity --info --width=500 --title="DZGUI" --text="Wrote new config format to \n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" 2>/dev/null
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
download_new_version(){
if [[ $is_steam_deck -eq 1 ]]; then
@ -1734,6 +2277,11 @@ check_version(){
logger INFO "Local version is same as upstream"
check_unmerged
else
<<<<<<< HEAD
=======
# echo "100"
echo "[DZGUI] Upstream ($upstream) != local ($version)"
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
logger INFO "Local and remote version mismatch"
if [[ $enforce_dl -eq 1 ]]; then
enforce_dl
@ -1748,6 +2296,7 @@ check_architecture(){
if [[ -n "$cpu" ]]; then
is_steam_deck=1
logger INFO "Setting architecture to 'Steam Deck'"
<<<<<<< HEAD
[[ $is_steam_deck -eq 1 ]] && test_display_mode
if [[ $gamemode -eq 1 ]]; then
popup 1400 &&
@ -1756,6 +2305,13 @@ check_architecture(){
else
is_steam_deck=0
logger INFO "Setting architecture to 'desktop'"
=======
echo "[DZGUI] Setting architecture to 'Steam Deck'"
else
is_steam_deck=0
logger INFO "Setting architecture to 'desktop'"
echo "[DZGUI] Setting architecture to 'desktop'"
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
fi
}
print_ip_list(){
@ -1865,6 +2421,7 @@ add_by_id(){
done
fi
while true; do
<<<<<<< HEAD
local id
id=$(edialog "Enter server ID")
[[ $? -eq 1 ]] && return 1
@ -1891,6 +2448,26 @@ add_by_id(){
;;
esac
fi
=======
id=$($steamsafe_zenity --entry --text="Enter server ID" --title="DZGUI" 2>/dev/null)
rc=$?
if [[ $rc -eq 1 ]]; then
return
else
if [[ ! $id =~ ^[0-9]+$ ]]; then
$steamsafe_zenity --warning --title="DZGUI" --text="Invalid ID" 2>/dev/null
else
[[ -z $whitelist ]] && new_whitelist="whitelist=\"$id\""
[[ -n $whitelist ]] && new_whitelist="whitelist=\"$whitelist,$id\""
mv $config_file ${config_path}dztuirc.old
nr=$(awk '/whitelist=/ {print NR}' ${config_path}dztuirc.old)
awk -v "var=$new_whitelist" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc
$steamsafe_zenity --info --title="DZGUI" --text="Added "$id" to:\n${config_path}dztuirc\nIf errors occur, you can restore the file:\n${config_path}dztuirc.old" --width=500 2>/dev/null
source $config_file
return
fi
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
done
}
toggle_debug(){
@ -1904,11 +2481,18 @@ toggle_debug(){
}
setup(){
logger INFO "${FUNCNAME[0]}"
<<<<<<< HEAD
[[ -z $fav_server ]] && return
items[10]=" Change favorite server"
[[ -n $fav_label ]] && return
fav_label=$(set_fav $fav_server)
update_config
=======
if [[ -n $fav ]]; then
set_fav
items[8]=" Change favorite server"
fi
>>>>>>> bcc5bb8ad8d2c346873c88c26466d7bc43590ee7
}
check_map_count(){
logger INFO "${FUNCNAME[0]}"
@ -2043,6 +2627,35 @@ steam_deps(){
fi
logger INFO "steam_cmd set to $steam_cmd"
}
update_steam_cmd(){
local new_cmd
preferred_client="$steam_cmd"
new_cmd="preferred_client=\"$preferred_client\""
mv $config_file ${config_path}dztuirc.old
nr=$(awk '/preferred_client=/ {print NR}' ${config_path}dztuirc.old)
awk -v "var=$new_cmd" -v "nr=$nr" 'NR==nr {$0=var}{print}' ${config_path}dztuirc.old > ${config_path}dztuirc
}
steam_deps(){
logger INFO "${FUNCNAME[0]}"
local flatpak steam
[[ $(command -v flatpak) ]] && flatpak=$(flatpak list | grep valvesoftware.Steam)
steam=$(command -v steam)
if [[ -z "$steam" ]] && [[ -z "$flatpak" ]]; then
warn "Requires Steam or Flatpak Steam"
logger ERROR "Steam was missing"
exit
elif [[ -n "$steam" ]] && [[ -n "$flatpak" ]]; then
toggle_steam=1
steam_cmd="steam"
[[ -n $preferred_client ]] && steam_cmd="$preferred_client"
[[ -z $preferred_client ]] && update_steam_cmd
elif [[ -n "$steam" ]]; then
steam_cmd="steam"
else
steam_cmd="flatpak run com.valvesoftware.Steam"
fi
logger INFO "steam_cmd set to $steam_cmd"
}
initial_setup(){
echo "# Initial setup"
run_depcheck
@ -2061,6 +2674,17 @@ initial_setup(){
check_news
echo "100"
}
test_zenity_version(){
local current="$1"
local cutoff="3.99.1"
if [[ "$(printf '%s\n' "$cutoff" "$current" | sort -V | head -n1)" == "$cutoff" ]]; then
logger INFO "zenity version greater than or equal to $cutoff"
echo greater
else
logger INFO "zenity version lesser than $cutoff"
echo lesser
fi
}
main(){
local parent=$(cat /proc/$PPID/comm)
[[ -f "$debug_log" ]] && rm "$debug_log"

2
news
View file

@ -1 +1 @@
NEWS: Major 4.0.0 update. Full details via the View Changelog menu option.
NEWS: Major 4.0.0 update. Full details via the View Changelog menu option.