1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-28 21:32:36 +01:00
This commit is contained in:
aclist 2022-10-11 23:16:53 +09:00
commit 006e037866
4 changed files with 102 additions and 25 deletions

View file

@ -5,7 +5,36 @@
- Custom query API
- Standardize dialogs
## [2.8.0-rc.2] 2022-10-11
## [2.8.0-rc.9] 2022-10-11
### Changed
- Reordered main menu elements
## [2.8.0-rc.8] 2022-10-11
### Changed
- Changed notification title
## [2.8.0-rc.7] 2022-10-11
### Changed
- Reword menu option
### Fixed
- Redirect stderr on popup
## [2.8.0-rc.6] 2022-10-11
### Dropped
- Stop using BM for query ports
### Added
- Deprecation warning/enforced Steam API
## [2.8.0-rc.5] 2022-10-11
### Fixed
- Width of some popups on Steam Deck
## [2.8.0-rc.4] 2022-10-11
### Changed
- Abstract news urls
- Clarify dependency warning
## [2.8.0-rc.3] 2022-10-11
### Added
- Add forums link

View file

@ -1,16 +1,14 @@
= DZGUI documentation
DayZ community server graphical launcher for Linux | Last updated: 2022-09-08
DayZ community server graphical launcher for Linux | Last updated: 2022-10-11
:nofooter:
:toc: left
:stylesheet: custom.css
== What this is
A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically.
A GUI version of https://github.com/aclist/dztui[DZTUI] for Linux. Used to list official and community server details and quick connect to preferred servers by staging mods and concatenating launch options automatically.
DZGUI contains some expanded functionality that will eventually be backported to DZTUI. It is intended to be more of a user-friendly, turnkey solution for graphical desktop environments, and could also be used on the Steam Deck or similar devices.
== Setup
=== Dependencies
If not already installed, the below can be found in your system's package manager.
@ -19,7 +17,7 @@ If not already installed, the below can be found in your system's package manage
- `jq`
- `zenity`
- `steam`
- `wmctrl` or `xdotool`
=== Preparation
. Download DZGUI and make it executable:
@ -57,6 +55,7 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently
=== API key & server IDs
==== BattleMetrics API key
1. Register for an API key at https://www.battlemetrics.com/account/register?after=%2Fdevelopers[BattleMetrics] (free)
2. From the **Personal Access Tokens** area, Select **New Token**
3. Give the token any name in the field at the top
@ -68,6 +67,10 @@ If it detects an incorrect map count value, DZGUI will prompt you to permanently
[NOTE]
You will be prompted to enter these IDs when starting the app, so you could refer to them in another window while you complete setup. More IDs can be added later.
==== Steam API key
1. Register for a https://steamcommunity.com/dev/apikey[Steam API key] using your Steam account. You will be asked for a unique URL for your app when registering.
2. Since this key is for a personal use application and does not actually call back anywhere, set a generic local identifier here like "127.0.0.1".
3. Once configured, you can insert this key in the app when launching the "Connect by IP" feature for the first time.
=== First-time launch

View file

@ -93,7 +93,7 @@ init_items(){
#array order determines menu selector; this is destructive
items=(
"[Connect]"
" NEW: Server browser"
" Server browser"
" My servers"
" Quick connect to favorite server"
"[Manage servers]"
@ -103,11 +103,12 @@ items=(
" Delete server"
"[Options]"
" List installed mods"
" Report bug (opens in browser)"
" Help file (opens in browser)"
" Forum (opens in browser)"
" View changelog"
" Advanced options"
"[Help]"
" Help file ⧉"
" Report bug ⧉"
" Become a beta tester ⧉"
)
}
warn_and_exit(){
@ -668,10 +669,11 @@ fetch_ip_metadata(){
test_steam_api(){
local code=$(curl -ILs "https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100&limit=10&key=$steam_api" \
| grep -E "^HTTP")
[[ $code =~ 403 ]] && return 1
[[ $code =~ 403 ]] && echo 1
[[ $code =~ 200 ]] && echo 0
}
add_steam_api(){
[[ ! $(test_steam_api) ]] && return 1
[[ $(test_steam_api) -eq 1 ]] && return 1
mv $config_file ${config_path}dztuirc.old
nr=$(awk '/steam_api=/ {print NR}' ${config_path}dztuirc.old)
steam_api="steam_api=\"$steam_api\""
@ -685,7 +687,7 @@ check_steam_api(){
steam_api=$(zenity --entry --text="Key 'steam_api' not present in config file. Enter Steam API key:" --title="DZGUI" 2>/dev/null)
if [[ $? -eq 1 ]] ; then
return
elif [[ ${#steam_api} -lt 32 ]] || [[ ! $(test_steam_api) ]]; then
elif [[ ${#steam_api} -lt 32 ]] || [[ $(test_steam_api) -eq 1 ]]; then
zenity --warning --title="DZGUI" --text="Check API key and try again." 2>/dev/null
return 1
else
@ -847,10 +849,16 @@ delete_or_connect(){
else
#hotfix for bug #36
local lookup_ip=$(echo "$sel" | awk -F%% '{print $1}')
local lookup_id="$(echo "$sel" | awk -F%% '{print $2}')"
local qport=$(echo "$response" | jq --arg id $lookup_id '.data[]|select(.id==$id).attributes.portQuery')
local lookup_port=$(echo "$lookup_ip" | awk -F: '{print $2}')
source $config_file
file=$(mktemp)
url="https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\221100\gameaddr\\$lookup_ip&key=$steam_api"
curl -Ls "$url" > $file
local qport_res=$(< $file jq -r --arg port $lookup_port '.response.servers[]|select(.gameport==($port|tonumber)).addr')
local qport=$(echo "$qport_res" | awk -F: '{print $2}')
qport_list="$lookup_ip%%$qport"
connect "$sel" "ip"
echo "$response" > resp
connect "$qport_list" "ip"
fi
}
@ -975,7 +983,7 @@ toggle_automods(){
source $config_file
local big_prompt
[[ $is_steam_deck -eq 1 ]] && big_prompt="--width=800"
[[ $auto_install == "1" ]] && zenity --info --text="$(automods_prompt)" $big_prompt
[[ $auto_install == "1" ]] && zenity --info --text="$(automods_prompt)" $big_prompt 2>/dev/null
}
options_menu(){
debug_list=(
@ -1330,17 +1338,19 @@ main_menu(){
--title="DZGUI" $sd_res --text="$(mods_disk_size)" \
--print-column="" 2>/dev/null
elif [[ $sel == "${items[11]}" ]]; then
report_bug
elif [[ $sel == "${items[12]}" ]]; then
help_file
elif [[ $sel == "${items[13]}" ]]; then
forum
elif [[ $sel == "${items[14]}" ]]; then
changelog | zenity --text-info $sd_res --title="DZGUI" 2>/dev/null
elif [[ $sel == "${items[15]}" ]]; then
elif [[ $sel == "${items[12]}" ]]; then
options_menu
main_menu
return
elif [[ $sel == "${items[13]}" ]]; then
:
elif [[ $sel == "${items[14]}" ]]; then
help_file
elif [[ $sel == "${items[15]}" ]]; then
report_bug
elif [[ $sel == "${items[16]}" ]]; then
forum
else
warn "This feature is not yet implemented."
fi
@ -1628,6 +1638,40 @@ fetch_scmd_helper(){
[[ ! -f "$helpers_path/d.html" ]] && curl -Ls "$notify_url" > "$helpers_path/d.html"
[[ ! -f "$helpers_path/d.webp" ]] && curl -Ls "$notify_img_url" > "$helpers_path/d.webp"
}
deprecation_warning(){
warn(){
cat <<- HERE
IMPORTANT ANNOUNCEMENT
(Steam API key not found)
A Steam API key is now mandatory to run the app.
The BM API returns incorrect mod data on some servers
and cannot be relied upon for up to date information.
Going forward, we will only use the BM API as a convenience
function to manage server names and your favorite servers list,
and migrate to indexing servers on an IP basis.
This is a backend change. You can continue adding servers by ID,
but we will retrieve information from Valve instead, as we do for the
server browser and connect-by-ip methods.
Click [OK] to open the help page describing how to set up your key.
After you input a valid key, the app will resume.
HERE
}
if [[ -z $steam_api ]]; then
echo "100"
zenity --info --text="$(warn)"
key_setup_url="https://aclist.github.io/dzgui/dzgui.html#_api_key_server_ids"
browser "$key_setup_url" 2>/dev/null &
while true; do
if [[ $(check_steam_api) ]]; then
break
fi
done
fi
}
initial_setup(){
echo "# Initial setup"
run_depcheck
@ -1640,6 +1684,7 @@ initial_setup(){
run_varcheck
init_items
setup
deprecation_warning
echo "100"
}
main(){

View file

@ -297,7 +297,7 @@ return_to_dzg(){
done
cleanup
else
$(cd $HOME/.local/share/dzgui/helpers; zenity --text-info --html --width=390 --height=452 --filename="d.html" 2>/dev/null)
$(cd $HOME/.local/share/dzgui/helpers; zenity --text-info --title=DZGUI --html --width=390 --height=452 --filename="d.html" 2>/dev/null)
cleanup
fi
}