Skip to content

Commit e05e9e5

Browse files
file and protocol handling made more safe
1 parent d0fb24a commit e05e9e5

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/app.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ def main():
1212
app.setWindowIcon(QIcon(AE_ICON_PATH))
1313

1414
mainWindow = MainWindow()
15-
mainWindow.show()
15+
16+
show_window = True
17+
18+
for arg in sys.argv:
19+
if 'misterhorsepm://' in arg or '.aep' in arg:
20+
show_window = False
21+
break
22+
23+
if show_window:
24+
mainWindow.show()
1625

1726
return app.exec()

src/mainwindow.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def try_autoopen_mhtb(self):
106106
self.run_mhtb_thread.finished_signal.connect(self._finished)
107107

108108
self.run_mhtb_thread.start()
109-
exit(0)
110109

111110
def try_autoopen_aep(self):
112111
self.run_ae_thread.clear_aep_file_arg()
@@ -127,7 +126,6 @@ def try_autoopen_aep(self):
127126

128127
self.run_ae_thread.add_aep_file_arg(aep_file)
129128
self.run_ae_button_clicked()
130-
exit(0)
131129

132130
def init_installation(self):
133131
if check_aegnux_installed():
@@ -189,6 +187,12 @@ def toggle_logs(self):
189187

190188
@Slot(bool)
191189
def _finished(self, success: bool):
190+
if self.ran_from_mhtb_link:
191+
exit(0)
192+
193+
if self.ran_from_aep_file:
194+
exit(0)
195+
192196
self.lock_ui(False)
193197
self.progress_bar.hide()
194198
self.init_installation()

0 commit comments

Comments
 (0)