|
25 | 25 | import random #Random number generation |
26 | 26 | import traceback #Error management |
27 | 27 | import webbrowser #Open links like the bug link |
28 | | -import tarfile #Create archives |
29 | 28 | import gzip #Compression utilities |
30 | 29 | import time #Timezone data |
31 | 30 | import copy #Object copies |
@@ -241,13 +240,11 @@ def error_handling(e:Exception,message="A serious error has occured"): |
241 | 240 | _SCREEN.clear() |
242 | 241 | _SCREEN.nodelay(0) |
243 | 242 | _SCREEN.bkgd(cursesplus.set_colour(cursesplus.BLUE,cursesplus.WHITE)) |
244 | | - #cursesplus.messagebox.showerror(_SCREEN,[ |
245 | | - # "o3 / We are sorry, but a serious error occured ", |
246 | | - # " - | In the next menu, you will choose some options", |
247 | | - # "o3 \\ You should probably report this as a bug " |
248 | | - #]) |
| 243 | + |
| 244 | + telemetry.crash_report(e) |
| 245 | + |
249 | 246 | while True: |
250 | | - erz = cursesplus.optionmenu(_SCREEN,["Exit Program","View Error info","Return to main menu","Advanced options","Report bug on GitHub"],f"{message}. What do you want to do?") |
| 247 | + erz = cursesplus.optionmenu(_SCREEN,["Exit Program","View Error info","Return to main menu","Advanced options","Report bug on GitHub"],f":( {message}. What do you want to do?") |
251 | 248 | if erz == 0: |
252 | 249 | safe_exit(1) |
253 | 250 | elif erz == 1: |
@@ -302,16 +299,16 @@ def safe_error_handling(e:Exception): |
302 | 299 | raw = f"TYPE: {type(e)}"+"\n"+f"MESSAGE: {str(e)[0:os.get_terminal_size()[0]-1]}"+"\n"+traceback.format_exc() |
303 | 300 | #splitext = textwrap.wrap(raw,_SCREEN.getmaxyx()[1]-1) |
304 | 301 | splitext = raw.splitlines() |
| 302 | + |
| 303 | + telemetry.crash_report(e) |
| 304 | + |
305 | 305 | while True: |
306 | 306 | _SCREEN.clear() |
307 | 307 | my,mx = _SCREEN.getmaxyx() |
308 | | - cursesplus.utils.fill_line(_SCREEN,0,cursesplus.set_colour(cursesplus.RED,cursesplus.WHITE)) |
309 | | - cursesplus.utils.fill_line(_SCREEN,1,cursesplus.set_colour(cursesplus.RED,cursesplus.WHITE)) |
310 | | - cursesplus.utils.fill_line(_SCREEN,2,cursesplus.set_colour(cursesplus.RED,cursesplus.WHITE)) |
311 | 308 | _SCREEN.addstr(3,0,"─"*(mx-1)) |
312 | | - _SCREEN.addstr(0,0,"A fatal error has occured in CraftServerSetup. Info is listed below.",cursesplus.set_colour(cursesplus.RED,cursesplus.WHITE)) |
313 | | - _SCREEN.addstr(1,0,"Press C to return to the main menu.",cursesplus.set_colour(cursesplus.RED,cursesplus.WHITE)) |
314 | | - _SCREEN.addstr(2,0,"Press R to open a bug report on Github. Include information listed below.",cursesplus.set_colour(cursesplus.RED,cursesplus.WHITE)) |
| 309 | + _SCREEN.addstr(0,0,":( A fatal error has occured in CraftServerSetup. Info is listed below.",cursesplus.set_colour(cursesplus.BLUE,cursesplus.WHITE)) |
| 310 | + _SCREEN.addstr(1,0,">>> Press C to return to the main menu.",cursesplus.set_colour(cursesplus.BLUE,cursesplus.WHITE)) |
| 311 | + _SCREEN.addstr(2,0,">>> Press R to open a bug report on Github. Include information listed below.",cursesplus.set_colour(cursesplus.BLUE,cursesplus.WHITE)) |
315 | 312 | ey = 3 |
316 | 313 | for eline in splitext: |
317 | 314 | ey += 1 |
@@ -2068,6 +2065,7 @@ def formattediplist_getindexbyip(search:str,haystack:list[FormattedIP]): |
2068 | 2065 | return None |
2069 | 2066 |
|
2070 | 2067 | def ip_lookup(stdscr,serverdir): |
| 2068 | + telemetry.telemetric_action("iplookup") |
2071 | 2069 | if uicomponents.resource_warning(stdscr): |
2072 | 2070 | return |
2073 | 2071 | renaminghandler.autoupdate_cache(stdscr,serverdir) |
@@ -2508,7 +2506,7 @@ def write(path:str,data:dict) -> None: |
2508 | 2506 | f.write(gzip.compress(json.dumps(data).encode())) |
2509 | 2507 |
|
2510 | 2508 | def sanalytics(stdscr,serverdir): |
2511 | | - |
| 2509 | + telemetry.telemetric_action("analytics") |
2512 | 2510 | if uicomponents.resource_warning(stdscr): |
2513 | 2511 | return |
2514 | 2512 | renaminghandler.autoupdate_cache(stdscr,serverdir) |
@@ -3287,6 +3285,7 @@ def create_uuid_index(stdscr) -> None: |
3287 | 3285 | appdata.updateappdata() |
3288 | 3286 |
|
3289 | 3287 | def playerstat(stdscr,serverdir): |
| 3288 | + telemetry.telemetric_action("playerstat") |
3290 | 3289 | worlds = find_world_folders(serverdir) |
3291 | 3290 | selworld = uicomponents.menu(stdscr,["Cancel"]+worlds,"Choose a world to search statistics for") |
3292 | 3291 | if selworld == 0: |
@@ -4120,6 +4119,11 @@ def main(stdscr): |
4120 | 4119 | threading.Thread(target=internet_thread,args=(stdscr,)).start() |
4121 | 4120 | appdata.setup_appdata() |
4122 | 4121 | #Telemetry demands special startup |
| 4122 | + |
| 4123 | + if appdata.APPDATA["telemetry"]["level"] == -1: |
| 4124 | + cursesplus.messagebox.showinfo(stdscr,["On the next screen, you will be prompted to","choose a telemetry level ","(how much data is sent to Enderbyte Programs)"]) |
| 4125 | + telemetry.set_telemetry_level(stdscr,False) |
| 4126 | + |
4123 | 4127 | eptel.startup(appdata.APPDATA["telemetry"]["telkey"],"CraftServerSetup",APP_UF_VERSION) |
4124 | 4128 | telemetry.telemetric_action("startup") |
4125 | 4129 |
|
|
0 commit comments