Fix bugs
This commit is contained in:
@@ -524,34 +524,6 @@ class AdminWindow(QDialog):
|
||||
|
||||
lay.addWidget(grp1)
|
||||
|
||||
grp_ks = QGroupBox("🔒 Kill Switch (Linux)")
|
||||
g_ks = QVBoxLayout(grp_ks)
|
||||
note_ks = QLabel(
|
||||
"Bloque tout trafic internet si le tunnel VPN tombe.\n"
|
||||
"Nécessite des droits root (iptables)."
|
||||
)
|
||||
note_ks.setWordWrap(True)
|
||||
note_ks.setStyleSheet("color: rgba(255,255,255,0.7); font-size: 11px;")
|
||||
g_ks.addWidget(note_ks)
|
||||
ks_row = QHBoxLayout()
|
||||
self._btn_ks_enable = QPushButton("🔒 Activer")
|
||||
self._btn_ks_enable.clicked.connect(self._enable_kill_switch)
|
||||
self._btn_ks_disable = QPushButton("🔓 Désactiver")
|
||||
self._btn_ks_disable.setStyleSheet(
|
||||
"QPushButton { background: #6e2e1c; border-radius: 5px; padding: 7px 12px;"
|
||||
" color: white; border: none; } QPushButton:hover { background: #922b21; }"
|
||||
)
|
||||
self._btn_ks_disable.clicked.connect(self._disable_kill_switch)
|
||||
self._ks_status = QLabel("—")
|
||||
self._ks_status.setStyleSheet("font-size: 11px; color: #aed6f1;")
|
||||
ks_row.addWidget(self._btn_ks_enable)
|
||||
ks_row.addWidget(self._btn_ks_disable)
|
||||
ks_row.addWidget(self._ks_status)
|
||||
ks_row.addStretch()
|
||||
g_ks.addLayout(ks_row)
|
||||
lay.addWidget(grp_ks)
|
||||
self._refresh_ks_status()
|
||||
|
||||
grp2 = QGroupBox("Auto-reconnexion")
|
||||
form2 = QFormLayout(grp2)
|
||||
|
||||
@@ -965,29 +937,6 @@ class AdminWindow(QDialog):
|
||||
f"padding: 8px; border-radius: 6px; font-size: 11px; {css}"
|
||||
)
|
||||
|
||||
def _refresh_ks_status(self):
|
||||
active = wg_core.kill_switch_active()
|
||||
if active:
|
||||
self._ks_status.setText("🔒 Actif")
|
||||
self._ks_status.setStyleSheet("color: #a9dfbf; font-size: 11px;")
|
||||
else:
|
||||
self._ks_status.setText("🔓 Inactif")
|
||||
self._ks_status.setStyleSheet("color: #f1948a; font-size: 11px;")
|
||||
|
||||
def _enable_kill_switch(self):
|
||||
self._save_values()
|
||||
ok, msg = wg_core.enable_kill_switch(self._cfg)
|
||||
self._refresh_ks_status()
|
||||
if ok:
|
||||
QMessageBox.information(self, "Kill Switch", msg)
|
||||
else:
|
||||
QMessageBox.warning(self, "Kill Switch", msg)
|
||||
|
||||
def _disable_kill_switch(self):
|
||||
ok, msg = wg_core.disable_kill_switch(self._cfg)
|
||||
self._refresh_ks_status()
|
||||
QMessageBox.information(self, "Kill Switch", msg)
|
||||
|
||||
def _set_admin_password(self):
|
||||
p1 = self._admin_pw1.text()
|
||||
p2 = self._admin_pw2.text()
|
||||
|
||||
Reference in New Issue
Block a user