mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-04 12:58:08 +03:00
Disable TUN mode in Flatpak settings
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -646,7 +646,11 @@ class SettingsPage(Mixins.QTranslatable, QMainWindow):
|
||||
self.pluginSections = []
|
||||
self._pluginActions = []
|
||||
|
||||
self._tunModeAvailable = PLATFORM == 'Linux' or SystemRuntime.isAdmin()
|
||||
if PLATFORM == 'Linux':
|
||||
self._tunModeAvailable = not SystemRuntime.flatpakID()
|
||||
else:
|
||||
self._tunModeAvailable = SystemRuntime.isAdmin()
|
||||
|
||||
self.tunModeCard = _ToggleSettingsCard(
|
||||
'shield-check.svg',
|
||||
'VPNMode',
|
||||
|
||||
@@ -353,7 +353,7 @@ class SettingsPageOrganizationTest(unittest.TestCase):
|
||||
"""Finish deferred Settings-page deletion between tests."""
|
||||
collectAtBoundary()
|
||||
|
||||
def buildPage(self, *, platform='Windows', flatpakID=''):
|
||||
def buildPage(self, *, platform='Windows', flatpakID='', isAdmin=False):
|
||||
"""Build one isolated Settings page for the requested platform state."""
|
||||
callbacks = {
|
||||
'checkForUpdates': mock.Mock(),
|
||||
@@ -369,7 +369,7 @@ class SettingsPageOrganizationTest(unittest.TestCase):
|
||||
mock.patch('Furious.Window.SettingsPage.PLATFORM', platform),
|
||||
mock.patch(
|
||||
'Furious.Window.SettingsPage.SystemRuntime.isAdmin',
|
||||
return_value=False,
|
||||
return_value=isAdmin,
|
||||
),
|
||||
mock.patch(
|
||||
'Furious.Window.SettingsPage.SystemRuntime.flatpakID',
|
||||
@@ -444,6 +444,25 @@ class SettingsPageOrganizationTest(unittest.TestCase):
|
||||
page.close()
|
||||
page.deleteLater()
|
||||
|
||||
def testFlatpakShowsDisabledTunModeCardRegardlessOfPrivileges(self):
|
||||
"""Keep the Flatpak TUN mode toggle visible but always disabled."""
|
||||
for isAdmin in (False, True):
|
||||
with self.subTest(isAdmin=isAdmin):
|
||||
page, _callbacks = self.buildPage(
|
||||
platform='Linux',
|
||||
flatpakID='io.github.LorenEteval.Furious',
|
||||
isAdmin=isAdmin,
|
||||
)
|
||||
|
||||
self.assertIn(page.tunModeCard, page.generalSection.cards)
|
||||
self.assertFalse(page.tunModeCard.checkBox.isEnabled())
|
||||
|
||||
page.setConnectionControlsEnabled(True)
|
||||
self.assertFalse(page.tunModeCard.checkBox.isEnabled())
|
||||
|
||||
page.close()
|
||||
page.deleteLater()
|
||||
|
||||
def testMovedCardsPreservePlatformVisibility(self):
|
||||
"""Retain the existing restart, Darwin, and Flatpak visibility gates."""
|
||||
cases = (
|
||||
|
||||
Reference in New Issue
Block a user