Skip to content

Commit 625fb22

Browse files
author
crcerror
committed
support: added version reporting to web [tbd]
1og viewer supports quick report to web This will help to better determine user issues Usage: User clicks **Create support PIN** and postes the 8 char-key to discord and dev/moderators/helper can support the user No photos, just a single click To stop spamming the server. The created support file has a lifespawn of 60 minutes. So it's only possible to create a new PIN after 60-wait time or a reboot. Future view: Batocera host a own server instance (possible, this app is on github and free to host) Integration into ES with view of the created PIN, so that users can easily report and are not forced to limited usage like now - you need pcmanfm :(
1 parent e34a259 commit 625fb22

2 files changed

Lines changed: 78 additions & 36 deletions

File tree

package/batocera/core/batocera-desktopapps/apps/view-eslog.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Desktop Entry]
22
Version=1.0
33
Icon=/usr/share/icons/batocera/view-eslog.png
4-
Exec=/usr/bin/view-eslog
4+
Exec=/usr/bin/view-eslog pcmanfm
55
Terminal=false
66
Type=Application
77
Categories=System;batocera.linux;

package/batocera/core/batocera-desktopapps/scripts/view-eslog

Lines changed: 77 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,22 @@
1616

1717

1818
# View ES log files, as yad notebook dialog style
19-
# 02-2026 v1.0
19+
# 02-2026 v1.0 by cyperghost aka crcerror
2020
# Icon view-eslog.png created with icon.kitchen
21+
# 09.05.2026 v2.0, added web report-tool
22+
# errorcode: ec 1 = general, ec 2 = no log files found (nearly impossible!)
2123

24+
################################
25+
# INIT #
26+
################################
2227

23-
# user added logs to /userdata/system/user-logs.txt - use absolute pathes
24-
# strings that contains # will be ignored
28+
## user added logs to /userdata/system/user-logs.txt - use absolute pathes
29+
## strings that contains # will be ignored
2530
i=/userdata/system/user-logs.txt
2631
[[ -e "$i" ]] && readarray -t LOGS < <(grep -v -E "^[[:space:]*]|[#]|^[[:space:]]*$" "$i")
27-
# defaults log
32+
unset i
33+
34+
## set defaults log
2835
LOGS+=(
2936
/userdata/system/logs/es_launch_stdout.log
3037
/userdata/system/logs/es_launch_stderr.log
@@ -33,36 +40,71 @@ LOGS+=(
3340
/userdata/system/batocera.conf
3441
)
3542

36-
# Ensure DISPLAY is set
37-
if test -z "${DISPLAY}"
38-
then
39-
export DISPLAY=$(getLocalXDisplay || echo :0.0)
40-
fi
41-
42-
# Create notebook subsets per file found
43-
KEY=$RANDOM
44-
for i in "${LOGS[@]}"; do
45-
if [[ -e "${i}" ]]; then
46-
TABS+=( "--tab=$(basename "$i")" )
47-
yad --plug=$KEY --tabnum=${#TABS[@]} --text-info < "${i}" &>/dev/null &
43+
################################
44+
# FUNCTIONS #
45+
################################
46+
47+
# Send batocera-info to a server if /tmp-file is not available or older than 60min (aka 1h)
48+
netreport(){
49+
if $(find "$1" -mmin -60 -printf false 2>/dev/null || echo true); then
50+
rm -f -- "$1"
51+
{ date; /usr/bin/batocera-info; /usr/bin/batocera-version; stat /usr/bin/batocera-version; } | curl -s -F BatoceraInfo=@- https://pastefy.app > "$1"
4852
fi
49-
done
50-
51-
# Do nothing if no file is found, use TABS arr as counter
52-
[[ ${#TABS[@]} -eq 0 ]] && exit
53-
54-
# else show tabs, left sided, close button or create support file
55-
yad --tab-pos=left --notebook \
56-
--text-align=center --text="BATOCERA 1og Viewer\nOS ver. $(batocera-version)" \
57-
--button="Create support file...":5 \
58-
--button="Close":0 \
59-
--key=$KEY "${TABS[@]}" &>/dev/null
60-
61-
# Button handler
62-
case $? in
63-
0) true ;;
64-
5) text=$(batocera-support)
65-
printf "%s\n\n\t%s" "Finished!" "${text}" | yad --text-info --button="Close":0
66-
;;
67-
*) exit 1
53+
[[ -e "$1" ]] || return 1
54+
}
55+
56+
# Create Notebook subsets per file found in LOG-array
57+
pcmanfm_gui(){
58+
local KEY=$RANDOM
59+
local TABS i
60+
local PIN="${1}"
61+
local TEXT_MSG
62+
63+
for i in "${LOGS[@]}"; do
64+
if [[ -e "${i}" ]]; then
65+
TABS+=( "--tab=$(basename "$i")" )
66+
yad --plug=$KEY --tabnum=${#TABS[@]} --text-info < "${i}" &>/dev/null &
67+
fi
68+
done
69+
70+
# Do nothing if no file is found, use TABS arr as counter, ec-2
71+
[[ ${#TABS[@]} -eq 0 ]] && return 2
72+
73+
# else show tabs, left sided, close button or create support file
74+
yad --tab-pos=left --notebook \
75+
--text-align=center --text="BATOCERA 1og Viewer\nOS ver. $(batocera-version)" \
76+
--button="Create support PIN":7 \
77+
--button="Create support file...":5 \
78+
--button="Close":0 \
79+
--key=$KEY "${TABS[@]}" &>/dev/null
80+
81+
# Button handler
82+
case $? in
83+
0) true ;;
84+
7) netreport "${PIN}" || return 1
85+
PIN=$(basename $(cat "${PIN}"))
86+
printf "Your support PIN is: %s\n\n\\nReport to our Discord and visit https://pastefy.app/%s" "${PIN}" "${PIN}" | yad --text-info --button="Close":0
87+
;;
88+
5) TEXT_MSG=$(batocera-support)
89+
printf "%s\n\n\t%s" "Finished!" "${TEXT_MSG}" | yad --text-info --button="Close":0
90+
;;
91+
*) return 1
92+
esac
93+
}
94+
95+
# Create the file from output
96+
batocera_es(){
97+
netreport "${1}" && cat "${1}" || return $?
98+
}
99+
100+
################################
101+
# MAIN #
102+
################################
103+
104+
105+
case "${1}" in
106+
pcmanfm) pcmanfm_gui "/tmp/net_report.dat"; ret=$? ;;
107+
es-gui) batocera_es "/tmp/net_report.dat"; ret=$? ;;
108+
*) echo "Usage: $(basename $0) [pcmanfm, es-gui]"; ret=1
68109
esac
110+
exit $ret

0 commit comments

Comments
 (0)