diff --git a/Furious/Actions/Import.py b/Furious/Actions/Import.py index c8335a9..0f043c6 100644 --- a/Furious/Actions/Import.py +++ b/Furious/Actions/Import.py @@ -558,7 +558,7 @@ class ImportAction(AppQAction): menu=AppQMenu( ImportURIFromClipboardAction(), ImportJSONFromClipboardAction(), - AppQSeperator(), + AppQSeparator(), ImportQRCodeOnTheScreenAction(), ), useActionGroup=False, diff --git a/Furious/Actions/Routing.py b/Furious/Actions/Routing.py index 2f5f23f..a34ca09 100644 --- a/Furious/Actions/Routing.py +++ b/Furious/Actions/Routing.py @@ -74,7 +74,7 @@ class RoutingAction(AppQAction): for option in options: if option.separatorBefore and actions: - actions.append(AppQSeperator()) + actions.append(AppQSeparator()) actions.append( RoutingChildAction( @@ -107,7 +107,7 @@ class RoutingAction(AppQAction): actions = self.routingActions(options, routing) for action in actions: - if isinstance(action, AppQSeperator): + if isinstance(action, AppQSeparator): self._menu._actions.append(action) self._menu.addSeparator() else: diff --git a/Furious/Application/DesktopApplication.py b/Furious/Application/DesktopApplication.py index 612c470..3813749 100644 --- a/Furious/Application/DesktopApplication.py +++ b/Furious/Application/DesktopApplication.py @@ -94,8 +94,8 @@ class SingletonApplication(ApplicationExitHelper): self.socket = QLocalSocket(self) self.server = QLocalServer(self) - def hasRunningApp(self) -> bool: - """Return whether running app.""" + def shouldExitForExistingInstance(self) -> bool: + """Claim the single-instance endpoint or notify the running instance.""" self.socket.connectToServer(self.serverName) if self.socket.waitForConnected(1000): @@ -473,7 +473,7 @@ class DesktopApplication(ApplicationRunner, SingletonApplication): def run(self): """Run the application task.""" try: - if self.hasRunningApp(): + if self.shouldExitForExistingInstance(): # See: https://github.com/python/cpython/issues/79908 # sys.exit(None) in multiprocessing will produce # exitcode 1 in some Python version, which is diff --git a/Furious/Application/TrayIcon.py b/Furious/Application/TrayIcon.py index da279ea..358e478 100644 --- a/Furious/Application/TrayIcon.py +++ b/Furious/Application/TrayIcon.py @@ -57,9 +57,9 @@ class TrayIcon( ConnectAction(isTrayAction=True), RoutingAction(isTrayAction=True), ImportAction(isTrayAction=True), - AppQSeperator(), + AppQSeparator(), ShowHomePageAction(isTrayAction=True), - AppQSeperator(), + AppQSeparator(), ExitAction(isTrayAction=True), ] @@ -123,7 +123,7 @@ class TrayIcon( menu.clear() for childAction in action._menu._actions: - if isinstance(childAction, AppQSeperator): + if isinstance(childAction, AppQSeparator): menu.addSeparator() elif isinstance(childAction, AppQAction): menu.addAction(childAction) diff --git a/Furious/Backends/Configuration.py b/Furious/Backends/Configuration.py index 936e36e..8e0e9a0 100644 --- a/Furious/Backends/Configuration.py +++ b/Furious/Backends/Configuration.py @@ -19,7 +19,7 @@ from __future__ import annotations -from Furious.Models.Configuration import ConfigFactory +from Furious.Models.Configuration import CoreConfiguration from Furious.Models.Encoding import * from Furious.Models.Protocol import Protocol from Furious.Backends.ShadowsocksURI import ( @@ -369,7 +369,7 @@ BLANK_CONFIG_XRAY = { } -class ConfigXray(ConfigFactory): +class ConfigXray(CoreConfiguration): """Represent Xray configuration and supported share-link formats.""" def __init__(self, config: Union[str, dict] = ''): @@ -1704,7 +1704,7 @@ BLANK_CONFIG_HYSTERIA1 = { } -class ConfigHysteria1(ConfigFactory): +class ConfigHysteria1(CoreConfiguration): """Represent Hysteria 1 client configuration and share links.""" def __init__(self, config: Union[str, dict] = ''): @@ -1978,7 +1978,7 @@ BLANK_CONFIG_HYSTERIA2 = { } -class ConfigHysteria2(ConfigFactory): +class ConfigHysteria2(CoreConfiguration): """Represent Hysteria 2 client configuration and share links.""" def __init__(self, config: Union[str, dict] = ''): diff --git a/Furious/Backends/ExternalCore/Configuration.py b/Furious/Backends/ExternalCore/Configuration.py index 0b95355..c599d2e 100644 --- a/Furious/Backends/ExternalCore/Configuration.py +++ b/Furious/Backends/ExternalCore/Configuration.py @@ -19,7 +19,7 @@ from __future__ import annotations -from Furious.Models import ConfigFactory +from Furious.Models import CoreConfiguration from pathlib import Path from typing import Mapping @@ -54,7 +54,7 @@ class ExternalCoreConfigurationError(ValueError): """Describe an invalid external-core process invocation.""" -class ConfigExternalCore(ConfigFactory): +class ConfigExternalCore(CoreConfiguration): """Store one external executable invocation as structured JSON data.""" def __init__(self, config: Mapping | str = ''): diff --git a/Furious/Backends/ExternalCore/Editor.py b/Furious/Backends/ExternalCore/Editor.py index 4bcbd9e..de4e94d 100644 --- a/Furious/Backends/ExternalCore/Editor.py +++ b/Furious/Backends/ExternalCore/Editor.py @@ -21,7 +21,7 @@ from __future__ import annotations from Furious.Frozenlib import GOLDEN_RATIO from Furious.Interface import EditorWidgetBinding -from Furious.Models import ConfigFactory, ServerProfile +from Furious.Models import CoreConfiguration, ServerProfile from Furious.Qt import ( AppQLabel, AppQLineEdit, @@ -131,7 +131,7 @@ class ExternalCorePathInput(EditorWidgetBinding): if selected: self._input.setText(str(Path(selected).resolve(strict=False))) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist this path without combining it with command arguments.""" config = _connection(config) oldValue = str(config.get(self._key, '')) @@ -144,7 +144,7 @@ class ExternalCorePathInput(EditorWidgetBinding): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load this path from a profile connection mapping.""" self._input.setText(str(_connection(config).get(self._key, ''))) @@ -176,7 +176,7 @@ class ExternalCoreArgumentsInput(EditorWidgetBinding): except ValueError as ex: raise ValueError('Arguments contain invalid quoting') from ex - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist the literal argument vector.""" config = _connection(config) oldValue = config.get('arguments', []) @@ -189,7 +189,7 @@ class ExternalCoreArgumentsInput(EditorWidgetBinding): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the argument vector using reversible quoted syntax.""" values = _connection(config).get('arguments', []) @@ -237,7 +237,7 @@ class ExternalCoreEnvironmentInput(EditorWidgetBinding): return result - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist validated environment overrides as a mapping.""" config = _connection(config) oldValue = config.get('environment', {}) @@ -250,7 +250,7 @@ class ExternalCoreEnvironmentInput(EditorWidgetBinding): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load environment overrides as KEY=VALUE lines.""" values = _connection(config).get('environment', {}) @@ -270,7 +270,7 @@ class ExternalCoreShutdownTimeoutInput(GuiEditorItemTextSpinBox): self.setRange(1, 60) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist the selected shutdown timeout.""" config = _connection(config) oldValue = config.get('shutdownTimeout', 5) @@ -283,7 +283,7 @@ class ExternalCoreShutdownTimeoutInput(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configured shutdown timeout.""" value = _connection(config).get('shutdownTimeout', 5) @@ -301,11 +301,11 @@ class ExternalCoreApplicationTun2socksInput(GuiEditorItemTextSwitch): """Connect a same-lifetime field-state callback to this control.""" self._input.toggled.connect(callback) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist the explicit application tun2socks preference.""" return _connection(config).setUseApplicationTun2socks(self.isChecked()) - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Restore the application tun2socks preference.""" self.setChecked(_connection(config).usesApplicationTun2socks()) @@ -337,11 +337,11 @@ class ExternalCoreTunRemoteAddressInput(EditorWidgetBinding): self._title.setEnabled(enabled) self._input.setEnabled(enabled) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist the remote destination without interpreting it as a path.""" return _connection(config).setTunRemoteAddress(self.text()) - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Restore the configured TUN remote destination.""" self._input.setText(_connection(config).tunRemoteAddress()) @@ -458,7 +458,7 @@ class ExternalCoreEditor(GuiEditorWidgetQDialog): ) ] - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Persist editor values and normalize both local paths.""" modified = super().inputToFactory(config) connection = _connection(config) diff --git a/Furious/Backends/Hysteria1/Editor.py b/Furious/Backends/Hysteria1/Editor.py index 6c536f8..4a744ec 100644 --- a/Furious/Backends/Hysteria1/Editor.py +++ b/Furious/Backends/Hysteria1/Editor.py @@ -21,7 +21,7 @@ from __future__ import annotations from Furious.Frozenlib import * from Furious.Interface import * -from Furious.Models import ConfigFactory, Protocol +from Furious.Models import CoreConfiguration, Protocol from Furious.Qt import * from Furious.Qt import gettext as _ @@ -47,7 +47,7 @@ class GuiHy1ItemTextInput(GuiEditorItemTextInput): self.key = key - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldValue = config.get(self.key, '') newValue = self.text() @@ -68,7 +68,7 @@ class GuiHy1ItemTextInput(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setText(config.get(self.key, '')) @@ -87,7 +87,7 @@ class GuiHy1ItemBasicProtocol(GuiEditorItemTextComboBox): self.addItems(['', 'udp', 'wechat-video', 'faketcp']) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldProtocol = config.get('protocol', '') newProtocol = self.text() @@ -104,7 +104,7 @@ class GuiHy1ItemBasicProtocol(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setText(config.get('protocol', 'udp')) @@ -124,7 +124,7 @@ class GuiHy1ItemSpeedUpMbps(GuiEditorItemTextSpinBox): # Range self.setRange(0, 1048576) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldUpMbps = config.get('up_mbps') newUpMbps = self.value() @@ -141,7 +141,7 @@ class GuiHy1ItemSpeedUpMbps(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setValue(config.get('up_mbps')) @@ -161,7 +161,7 @@ class GuiHy1ItemSpeedDownMbps(GuiEditorItemTextSpinBox): # Range self.setRange(0, 1048576) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldDownMbps = config.get('down_mbps') newDownMbps = self.value() @@ -178,7 +178,7 @@ class GuiHy1ItemSpeedDownMbps(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setValue(config.get('down_mbps')) @@ -195,7 +195,7 @@ class GuiHy1ItemTLSInsecure(GuiEditorItemTextSwitch): """Initialize the GuiHy1ItemTLSInsecure.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" try: oldChecked = config.get('insecure') @@ -227,7 +227,7 @@ class GuiHy1ItemTLSInsecure(GuiEditorItemTextSwitch): # Modified silently return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: checked = config['insecure'] @@ -356,11 +356,11 @@ class GuiHy1GroupBoxOther(EditorBinding, AppQGroupBox): self.setLayout(layout) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" pass diff --git a/Furious/Backends/Hysteria2/Editor.py b/Furious/Backends/Hysteria2/Editor.py index 2d7d4ba..93fb88c 100644 --- a/Furious/Backends/Hysteria2/Editor.py +++ b/Furious/Backends/Hysteria2/Editor.py @@ -21,7 +21,7 @@ from __future__ import annotations from Furious.Frozenlib import * from Furious.Interface import * -from Furious.Models import ConfigFactory, Protocol +from Furious.Models import CoreConfiguration, Protocol from Furious.Qt import * from Furious.Qt import gettext as _ @@ -45,7 +45,7 @@ class GuiHy2ItemBasicServer(GuiEditorItemTextInput): """Initialize the GuiHy2ItemBasicServer.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldServer = config.get('server', '') newServer = self.text() @@ -62,7 +62,7 @@ class GuiHy2ItemBasicServer(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setText(config.get('server', '')) @@ -79,7 +79,7 @@ class GuiHy2ItemBasicAuth(GuiEditorItemTextInput): """Initialize the GuiHy2ItemBasicAuth.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldAuth = config.get('auth') newAuth = self.text() @@ -104,7 +104,7 @@ class GuiHy2ItemBasicAuth(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setText(config.get('auth', '')) @@ -139,7 +139,7 @@ class GuiHy2ItemBasicCongestionComboBox(GuiEditorItemTextComboBox): # Should not reach here raise - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" newValue = self.text() @@ -194,7 +194,7 @@ class GuiHy2ItemBasicCongestionComboBox(GuiEditorItemTextComboBox): else: return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: value = config['congestion'][self.key] @@ -215,7 +215,7 @@ class GuiHy2ItemObfsType(GuiEditorItemTextComboBox): self.addItems(HY2_OBFS_TYPES) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" try: oldObfsType = config['obfs']['type'] @@ -249,7 +249,7 @@ class GuiHy2ItemObfsType(GuiEditorItemTextComboBox): else: return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: obfsType = config['obfs']['type'] @@ -273,7 +273,7 @@ class GuiHy2ItemObfsPassword(GuiEditorItemTextInput): super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" newObfsPassword = self.text() @@ -313,7 +313,7 @@ class GuiHy2ItemObfsPassword(GuiEditorItemTextInput): else: return modified - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: obfsType = config['obfs']['type'] @@ -353,7 +353,7 @@ class GuiHy2ItemObfsPacketSize(GuiEditorItemTextSpinBox): self.setRange(1, 2048) self.setValue(self.default) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" try: obfsType = config['obfs']['type'] @@ -381,7 +381,7 @@ class GuiHy2ItemObfsPacketSize(GuiEditorItemTextSpinBox): return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: obfsType = config['obfs']['type'] @@ -538,7 +538,7 @@ class GuiHy2ItemTLSTextInput(GuiEditorItemTextInput): self.key = key - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" newValue = self.text() @@ -595,7 +595,7 @@ class GuiHy2ItemTLSTextInput(GuiEditorItemTextInput): else: return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: value = config['tls'][self.key] @@ -614,7 +614,7 @@ class GuiHy2ItemTLSInsecure(GuiEditorItemTextSwitch): """Initialize the GuiHy2ItemTLSInsecure.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" try: oldChecked = config['tls']['insecure'] @@ -646,7 +646,7 @@ class GuiHy2ItemTLSInsecure(GuiEditorItemTextSwitch): else: return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: checked = config['tls']['insecure'] @@ -707,7 +707,7 @@ class GuiHy2GroupBoxObfs(EditorBinding, AppQGroupBox): super().__init__('obfs', **kwargs, translatable=translatable) - self._config = ConfigFactory() + self._config = CoreConfiguration() self._widget = GuiHy2ObfsPageStackedWidget() self._widget.connectActivated(self.handleActivated) @@ -737,7 +737,7 @@ class GuiHy2GroupBoxObfs(EditorBinding, AppQGroupBox): self.setCurrentIndex(index) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldObfs = config.get('obfs') oldObfsType = '' @@ -772,7 +772,7 @@ class GuiHy2GroupBoxObfs(EditorBinding, AppQGroupBox): return modified - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" self._config = config @@ -861,11 +861,11 @@ class GuiHy2GroupBoxOther(EditorBinding, AppQGroupBox): self.setLayout(layout) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" pass diff --git a/Furious/Backends/Xray/AssetDownloadManager.py b/Furious/Backends/Xray/AssetDownloadManager.py index fcf0f78..9dadd85 100644 --- a/Furious/Backends/Xray/AssetDownloadManager.py +++ b/Furious/Backends/Xray/AssetDownloadManager.py @@ -54,7 +54,7 @@ class SHA256Worker(QtCore.QObject, QtCore.QRunnable): self.finished.emit(hashlib.sha256(self.string).hexdigest()) -class XrayAssetSHA256DownloadManager(WebGETManager): +class XrayAssetSHA256DownloadManager(HttpGetManager): """Coordinate Xray asset SHA-256 download operations.""" def __init__(self, parent=None, **kwargs): @@ -124,7 +124,7 @@ class XrayAssetSHA256DownloadManager(WebGETManager): ) -class XrayAssetAssetsDownloadManager(WebGETManager): +class XrayAssetAssetsDownloadManager(HttpGetManager): """Coordinate Xray asset assets download operations.""" def __init__(self, parent=None, **kwargs): diff --git a/Furious/Backends/Xray/AssetWindow.py b/Furious/Backends/Xray/AssetWindow.py index 3d4ea86..fd23769 100644 --- a/Furious/Backends/Xray/AssetWindow.py +++ b/Furious/Backends/Xray/AssetWindow.py @@ -72,13 +72,13 @@ class XrayAssetWindow(AppQMainWindow): QtCore.Qt.Key.Key_R, ), ), - AppQSeperator(), + AppQSeparator(), *openAssetDirectoryActions, AppQAction( _('Import From File...'), callback=lambda: self.appendNewItem(), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Exit'), callback=lambda: self.close(), diff --git a/Furious/Backends/Xray/Plugin.py b/Furious/Backends/Xray/Plugin.py index f776d36..b9add89 100644 --- a/Furious/Backends/Xray/Plugin.py +++ b/Furious/Backends/Xray/Plugin.py @@ -91,7 +91,7 @@ class XrayActionProvider(ActionProvider): # These modules require a fully initialized Furious.Qt package. from Furious.Qt import ( AppQAction, - AppQSeperator, + AppQSeparator, bootstrapIcon, showMBoxNewChangesNextTime, ) @@ -135,7 +135,7 @@ class XrayActionProvider(ActionProvider): icon=bootstrapIcon('signpost.svg'), callback=showRoutingDialog, ), - AppQSeperator(), + AppQSeparator(), useXrayTUNAction, AppQAction( _('Customize Xray-core TUN Settings...'), @@ -144,7 +144,7 @@ class XrayActionProvider(ActionProvider): isConnectionActive=lambda: isCoreActive(XrayCore), ).open(), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Manage Xray-core Asset File...'), callback=assetViewer.show, diff --git a/Furious/Backends/Xray/Process.py b/Furious/Backends/Xray/Process.py index 086a67d..5d15a49 100644 --- a/Furious/Backends/Xray/Process.py +++ b/Furious/Backends/Xray/Process.py @@ -153,7 +153,7 @@ class XrayCore(CoreProcessWorker): return '0.0.0' def launchSpec( - self, config: Union[str, ConfigFactory, dict], **kwargs + self, config: Union[str, CoreConfiguration, dict], **kwargs ) -> Union[CoreLaunchSpec, None]: """Build the child-process launch specification.""" param = self.toJSONString(config) @@ -170,7 +170,7 @@ class XrayCore(CoreProcessWorker): processKwargs=kwargs, ) - def start(self, config: Union[str, ConfigFactory, dict], **kwargs) -> bool: + def start(self, config: Union[str, CoreConfiguration, dict], **kwargs) -> bool: """Start the Xray core.""" launchSpec = self.launchSpec(config, **kwargs) diff --git a/Furious/Backends/Xray/ShadowsocksEditor.py b/Furious/Backends/Xray/ShadowsocksEditor.py index 23c2089..eb42bb6 100644 --- a/Furious/Backends/Xray/ShadowsocksEditor.py +++ b/Furious/Backends/Xray/ShadowsocksEditor.py @@ -50,7 +50,7 @@ class GuiSSItemTextInput(GuiEditorItemTextInput): self.key = key - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -73,7 +73,7 @@ class GuiSSItemTextInput(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -95,7 +95,7 @@ class GuiSSItemBasicPort(GuiEditorItemTextSpinBox): # Range self.setRange(0, 65535) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -114,7 +114,7 @@ class GuiSSItemBasicPort(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -150,7 +150,7 @@ class GuiSSItemBasicMethod(GuiEditorItemTextComboBox): ] ) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -169,7 +169,7 @@ class GuiSSItemBasicMethod(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) diff --git a/Furious/Backends/Xray/SocksEditor.py b/Furious/Backends/Xray/SocksEditor.py index bba3f75..ab49280 100644 --- a/Furious/Backends/Xray/SocksEditor.py +++ b/Furious/Backends/Xray/SocksEditor.py @@ -50,7 +50,7 @@ class GuiSocksItemTextInput(GuiEditorItemTextInput): self.key = key - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -72,7 +72,7 @@ class GuiSocksItemTextInput(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -93,7 +93,7 @@ class GuiSocksItemBasicPort(GuiEditorItemTextSpinBox): self.setRange(1, 65535) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -112,7 +112,7 @@ class GuiSocksItemBasicPort(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) diff --git a/Furious/Backends/Xray/TlsEditor.py b/Furious/Backends/Xray/TlsEditor.py index 267256c..4a8422e 100644 --- a/Furious/Backends/Xray/TlsEditor.py +++ b/Furious/Backends/Xray/TlsEditor.py @@ -48,7 +48,7 @@ class GuiVTLSItemSecurity(GuiEditorItemTextComboBox): self.addItems(STREAM_SECURITY) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -89,7 +89,7 @@ class GuiVTLSItemSecurity(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -113,7 +113,7 @@ class GuiVTLSItemXXXServerName(GuiEditorItemTextInput): self.securityKey = securityKey - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -150,7 +150,7 @@ class GuiVTLSItemXXXServerName(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xxxObject = ConfigXray.getProxyOutboundStream(config)[self.securityKey] @@ -194,7 +194,7 @@ class GuiVTLSItemXXXFingerprint(GuiEditorItemTextInput): self.securityKey = securityKey - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -231,7 +231,7 @@ class GuiVTLSItemXXXFingerprint(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xxxObject = ConfigXray.getProxyOutboundStream(config)[self.securityKey] @@ -270,7 +270,7 @@ class GuiVTLSItemTLSAlpn(GuiEditorItemTextInput): """Initialize the GuiVTLSItemTLSAlpn.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -307,7 +307,7 @@ class GuiVTLSItemTLSAlpn(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: tlsObject = ConfigXray.getProxyOutboundStream(config)['tlsSettings'] @@ -331,7 +331,7 @@ class GuiVTLSItemTLSXXXTextInput(GuiEditorItemTextInput): self.key = key - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -362,7 +362,7 @@ class GuiVTLSItemTLSXXXTextInput(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: tlsObject = ConfigXray.getProxyOutboundStream(config)['tlsSettings'] @@ -381,7 +381,7 @@ class GuiVTLSItemTLSAllowInsecure(GuiEditorItemTextSwitch): """Initialize the GuiVTLSItemTLSAllowInsecure.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -414,7 +414,7 @@ class GuiVTLSItemTLSAllowInsecure(GuiEditorItemTextSwitch): else: return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: tlsObject = ConfigXray.getProxyOutboundStream(config)['tlsSettings'] @@ -438,7 +438,7 @@ class GuiVTLSItemRealityXXX(GuiEditorItemTextInput): self.realityKey = realityKey - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -475,7 +475,7 @@ class GuiVTLSItemRealityXXX(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: realityObject = ConfigXray.getProxyOutboundStream(config)['realitySettings'] @@ -747,7 +747,7 @@ class GuiVTLSQGroupBox(EditorBinding, AppQGroupBox): super().__init__('TLS', **kwargs, translatable=translatable) - self._config = ConfigFactory() + self._config = CoreConfiguration() self._widget = GuiVTLSPageStackedWidget() self._widget.connectActivated(self.handleActivated) @@ -777,11 +777,11 @@ class GuiVTLSQGroupBox(EditorBinding, AppQGroupBox): self.setCurrentIndex(index) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" return self.page(self.currentIndex()).inputToFactory(config) - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): # Shallow copy """Load the configuration value into the editor.""" self._config = config diff --git a/Furious/Backends/Xray/TransportEditor.py b/Furious/Backends/Xray/TransportEditor.py index 6734385..6f2c531 100644 --- a/Furious/Backends/Xray/TransportEditor.py +++ b/Furious/Backends/Xray/TransportEditor.py @@ -55,7 +55,7 @@ class GuiVTransportItemNetwork(GuiEditorItemTextComboBox): self.addItems(STREAM_NETWORK) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -96,7 +96,7 @@ class GuiVTransportItemNetwork(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -115,7 +115,7 @@ class GuiVTransportItemFinalMask(GuiEditorItemTextInput): """Initialize the GuiVTransportItemFinalMask.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -149,7 +149,7 @@ class GuiVTransportItemFinalMask(GuiEditorItemTextInput): return False - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: finalMaskObject = ConfigXray.getProxyOutboundStream(config)['finalmask'] @@ -172,7 +172,7 @@ class GuiVTransportItemTypeXXX(GuiEditorItemTextComboBox): self.networkKey = networkKey - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -212,7 +212,7 @@ class GuiVTransportItemTypeXXX(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xxxObject = ConfigXray.getProxyOutboundStream(config)[self.networkKey] @@ -253,7 +253,7 @@ class GuiVTransportItemHostTcpOrRaw(GuiEditorItemTextInput): self.networkKey = networkKey - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -299,7 +299,7 @@ class GuiVTransportItemHostTcpOrRaw(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: tcpObject = ConfigXray.getProxyOutboundStream(config)[self.networkKey] @@ -322,7 +322,7 @@ class GuiVTransportItemPathTcpOrRaw(GuiEditorItemTextInput): self.networkKey = networkKey - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -365,7 +365,7 @@ class GuiVTransportItemPathTcpOrRaw(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: tcpObject = ConfigXray.getProxyOutboundStream(config)[self.networkKey] @@ -407,7 +407,7 @@ class GuiVTransportItemSeedKcp(GuiEditorItemTextInput): """Initialize the GuiVTransportItemSeedKcp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -444,7 +444,7 @@ class GuiVTransportItemSeedKcp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: kcpObject = ConfigXray.getProxyOutboundStream(config)['kcpSettings'] @@ -463,7 +463,7 @@ class GuiVTransportItemHostWs(GuiEditorItemTextInput): """Initialize the GuiVTransportItemHostWs.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -503,7 +503,7 @@ class GuiVTransportItemHostWs(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: wsObject = ConfigXray.getProxyOutboundStream(config)['wsSettings'] @@ -522,7 +522,7 @@ class GuiVTransportItemPathWs(GuiEditorItemTextInput): """Initialize the GuiVTransportItemPathWs.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -559,7 +559,7 @@ class GuiVTransportItemPathWs(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: wsObject = ConfigXray.getProxyOutboundStream(config)['wsSettings'] @@ -578,7 +578,7 @@ class GuiVTransportItemHostHttpUpgrade(GuiEditorItemTextInput): """Initialize the GuiVTransportItemHostHttpUpgrade.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -615,7 +615,7 @@ class GuiVTransportItemHostHttpUpgrade(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: httpUpgradeObject = ConfigXray.getProxyOutboundStream(config)[ @@ -636,7 +636,7 @@ class GuiVTransportItemPathHttpUpgrade(GuiEditorItemTextInput): """Initialize the GuiVTransportItemPathHttpUpgrade.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -673,7 +673,7 @@ class GuiVTransportItemPathHttpUpgrade(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: httpUpgradeObject = ConfigXray.getProxyOutboundStream(config)[ @@ -694,7 +694,7 @@ class GuiVTransportItemHostSplitHttp(GuiEditorItemTextInput): """Initialize the GuiVTransportItemHostSplitHttp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -731,7 +731,7 @@ class GuiVTransportItemHostSplitHttp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: splitHttpObject = ConfigXray.getProxyOutboundStream(config)[ @@ -752,7 +752,7 @@ class GuiVTransportItemPathSplitHttp(GuiEditorItemTextInput): """Initialize the GuiVTransportItemPathSplitHttp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -789,7 +789,7 @@ class GuiVTransportItemPathSplitHttp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: splitHttpObject = ConfigXray.getProxyOutboundStream(config)[ @@ -810,7 +810,7 @@ class GuiVTransportItemHostXHttp(GuiEditorItemTextInput): """Initialize the GuiVTransportItemHostXHttp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -847,7 +847,7 @@ class GuiVTransportItemHostXHttp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xhttpObject = ConfigXray.getProxyOutboundStream(config)['xhttpSettings'] @@ -866,7 +866,7 @@ class GuiVTransportItemPathXHttp(GuiEditorItemTextInput): """Initialize the GuiVTransportItemPathXHttp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -903,7 +903,7 @@ class GuiVTransportItemPathXHttp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xhttpObject = ConfigXray.getProxyOutboundStream(config)['xhttpSettings'] @@ -931,7 +931,7 @@ class GuiVTransportItemModeXHttp(GuiEditorItemTextComboBox): ] ) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -968,7 +968,7 @@ class GuiVTransportItemModeXHttp(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xhttpObject = ConfigXray.getProxyOutboundStream(config)['xhttpSettings'] @@ -987,7 +987,7 @@ class GuiVTransportItemExtraXHttp(GuiEditorItemTextInput): """Initialize the GuiVTransportItemExtraXHttp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1032,7 +1032,7 @@ class GuiVTransportItemExtraXHttp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: xhttpObject = ConfigXray.getProxyOutboundStream(config)['xhttpSettings'] @@ -1054,7 +1054,7 @@ class GuiVTransportItemHostH2(GuiEditorItemTextInput): """Initialize the GuiVTransportItemHostH2.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1091,7 +1091,7 @@ class GuiVTransportItemHostH2(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: httpObject = ConfigXray.getProxyOutboundStream(config)['httpSettings'] @@ -1110,7 +1110,7 @@ class GuiVTransportItemPathH2(GuiEditorItemTextInput): """Initialize the GuiVTransportItemPathH2.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1147,7 +1147,7 @@ class GuiVTransportItemPathH2(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: httpObject = ConfigXray.getProxyOutboundStream(config)['httpSettings'] @@ -1197,7 +1197,7 @@ class GuiVTransportItemSecurityQuic(GuiEditorItemTextComboBox): ] ) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1231,7 +1231,7 @@ class GuiVTransportItemSecurityQuic(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: quicObject = ConfigXray.getProxyOutboundStream(config)['quicSettings'] @@ -1250,7 +1250,7 @@ class GuiVTransportItemKeyQuic(GuiEditorItemTextInput): """Initialize the GuiVTransportItemKeyQuic.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1287,7 +1287,7 @@ class GuiVTransportItemKeyQuic(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: quicObject = ConfigXray.getProxyOutboundStream(config)['quicSettings'] @@ -1314,7 +1314,7 @@ class GuiVTransportItemModeGRPC(GuiEditorItemTextComboBox): ] ) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1356,7 +1356,7 @@ class GuiVTransportItemModeGRPC(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: grpcObject = ConfigXray.getProxyOutboundStream(config)['grpcSettings'] @@ -1382,7 +1382,7 @@ class GuiVTransportItemAuthorityGRPC(GuiEditorItemTextInput): """Initialize the GuiVTransportItemAuthorityGRPC.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1419,7 +1419,7 @@ class GuiVTransportItemAuthorityGRPC(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: grpcObject = ConfigXray.getProxyOutboundStream(config)['grpcSettings'] @@ -1438,7 +1438,7 @@ class GuiVTransportItemServiceNameGRPC(GuiEditorItemTextInput): """Initialize the GuiVTransportItemServiceNameGRPC.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1475,7 +1475,7 @@ class GuiVTransportItemServiceNameGRPC(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: grpcObject = ConfigXray.getProxyOutboundStream(config)['grpcSettings'] @@ -1497,7 +1497,7 @@ class GuiVTransportItemVersionHysteria(GuiEditorItemTextSpinBox): # Range. 0 means invalid self.setRange(0, 2) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1521,7 +1521,7 @@ class GuiVTransportItemVersionHysteria(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: hysteriaObject = ConfigXray.getProxyOutboundStream(config)[ @@ -1542,7 +1542,7 @@ class GuiVTransportItemAuthHysteria(GuiEditorItemTextInput): """Initialize the GuiVTransportItemAuthHysteria.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" streamSettings = ConfigXray.getProxyOutboundStream(config) @@ -1579,7 +1579,7 @@ class GuiVTransportItemAuthHysteria(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: hysteriaObject = ConfigXray.getProxyOutboundStream(config)[ @@ -1866,7 +1866,7 @@ class GuiVTransportQGroupBox(EditorBinding, AppQGroupBox): """Initialize the GuiVTransportQGroupBox.""" super().__init__(_('Transport'), **kwargs) - self._config = ConfigFactory() + self._config = CoreConfiguration() self._widget = GuiVTransportPageStackedWidget() self._widget.connectActivated(self.handleActivated) @@ -1896,11 +1896,11 @@ class GuiVTransportQGroupBox(EditorBinding, AppQGroupBox): self.setCurrentIndex(index) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" return self.page(self.currentIndex()).inputToFactory(config) - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): # Shallow copy """Load the configuration value into the editor.""" self._config = config diff --git a/Furious/Backends/Xray/TrojanEditor.py b/Furious/Backends/Xray/TrojanEditor.py index 0440886..61ba6e0 100644 --- a/Furious/Backends/Xray/TrojanEditor.py +++ b/Furious/Backends/Xray/TrojanEditor.py @@ -50,7 +50,7 @@ class GuiTrojanItemTextInput(GuiEditorItemTextInput): self.key = key - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -73,7 +73,7 @@ class GuiTrojanItemTextInput(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -95,7 +95,7 @@ class GuiTrojanItemBasicPort(GuiEditorItemTextSpinBox): # Range self.setRange(0, 65535) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -114,7 +114,7 @@ class GuiTrojanItemBasicPort(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) diff --git a/Furious/Backends/Xray/VlessEditor.py b/Furious/Backends/Xray/VlessEditor.py index e22c127..d30b83f 100644 --- a/Furious/Backends/Xray/VlessEditor.py +++ b/Furious/Backends/Xray/VlessEditor.py @@ -55,7 +55,7 @@ class GuiVLESSItemBasicAddress(GuiEditorItemTextInput): """Initialize the GuiVLESSItemBasicAddress.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -78,7 +78,7 @@ class GuiVLESSItemBasicAddress(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -100,7 +100,7 @@ class GuiVLESSItemBasicPort(GuiEditorItemTextSpinBox): # Range self.setRange(0, 65535) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -119,7 +119,7 @@ class GuiVLESSItemBasicPort(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -156,7 +156,7 @@ class GuiVLESSItemBasicId(GuiEditorItemTextInput): """Return the widgets owned by this editor item.""" return self._title, self._widget - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundUser = getProxyOutboundUser(config) @@ -179,7 +179,7 @@ class GuiVLESSItemBasicId(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundUser = getProxyOutboundUser(config) @@ -198,7 +198,7 @@ class GuiVLESSItemBasicEncryption(GuiEditorItemTextInput): """Initialize the GuiVLESSItemBasicEncryption.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundUser = getProxyOutboundUser(config) @@ -221,7 +221,7 @@ class GuiVLESSItemBasicEncryption(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundUser = getProxyOutboundUser(config) @@ -249,7 +249,7 @@ class GuiVLESSItemBasicFlow(GuiEditorItemTextComboBox): ] ) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundUser = getProxyOutboundUser(config) @@ -268,7 +268,7 @@ class GuiVLESSItemBasicFlow(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundUser = getProxyOutboundUser(config) diff --git a/Furious/Backends/Xray/VmessEditor.py b/Furious/Backends/Xray/VmessEditor.py index e05c1ce..46ece2d 100644 --- a/Furious/Backends/Xray/VmessEditor.py +++ b/Furious/Backends/Xray/VmessEditor.py @@ -55,7 +55,7 @@ class GuiVMessItemBasicAddress(GuiEditorItemTextInput): """Initialize the GuiVMessItemBasicAddress.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -78,7 +78,7 @@ class GuiVMessItemBasicAddress(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -100,7 +100,7 @@ class GuiVMessItemBasicPort(GuiEditorItemTextSpinBox): # Range self.setRange(0, 65535) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundServer = getProxyOutboundServer(config) @@ -119,7 +119,7 @@ class GuiVMessItemBasicPort(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundServer = getProxyOutboundServer(config) @@ -156,7 +156,7 @@ class GuiVMessItemBasicId(GuiEditorItemTextInput): """Return the widgets owned by this editor item.""" return self._title, self._widget - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundUser = getProxyOutboundUser(config) @@ -179,7 +179,7 @@ class GuiVMessItemBasicId(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundUser = getProxyOutboundUser(config) @@ -201,7 +201,7 @@ class GuiVMessItemBasicAlterId(GuiEditorItemTextSpinBox): # Range self.setRange(0, 65535) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundUser = getProxyOutboundUser(config) @@ -220,7 +220,7 @@ class GuiVMessItemBasicAlterId(GuiEditorItemTextSpinBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundUser = getProxyOutboundUser(config) @@ -250,7 +250,7 @@ class GuiVMessItemBasicSecurity(GuiEditorItemTextComboBox): ] ) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" proxyOutboundUser = getProxyOutboundUser(config) @@ -269,7 +269,7 @@ class GuiVMessItemBasicSecurity(GuiEditorItemTextComboBox): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: proxyOutboundUser = getProxyOutboundUser(config) diff --git a/Furious/Controllers/ConnectionController.py b/Furious/Controllers/ConnectionController.py index a729e90..4c61d40 100644 --- a/Furious/Controllers/ConnectionController.py +++ b/Furious/Controllers/ConnectionController.py @@ -84,7 +84,7 @@ class ConnectionController(QtCore.QObject): """Coordinate one connection lifecycle and publish observable state.""" stateChanged = QtCore.Signal(object) - activeConfigurationChanged = QtCore.Signal(object) + activeProfileChanged = QtCore.Signal(object) interactionEnabledChanged = QtCore.Signal(bool) runtimesChanged = QtCore.Signal(object) progressStarted = QtCore.Signal() @@ -100,7 +100,7 @@ class ConnectionController(QtCore.QObject): self._coreManager = coreManager or ConnectionManager() self._updatesManager = updatesManager or UpdateManager() self._state = ConnectionState.Disconnected - self._activeConfiguration = None + self._activeProfile = None self._lastError = None self._actionTimer = QtCore.QTimer(self) @@ -112,9 +112,9 @@ class ConnectionController(QtCore.QObject): return self._state @property - def activeConfiguration(self): + def activeProfile(self): """Return the profile owned by the current connection lifecycle.""" - return self._activeConfiguration + return self._activeProfile @property def runtimes(self): @@ -159,13 +159,13 @@ class ConnectionController(QtCore.QObject): if self.interactionEnabled != interactionWasEnabled: self.interactionEnabledChanged.emit(self.interactionEnabled) - def _setActiveConfiguration(self, configuration): + def _setActiveProfile(self, profile): """Publish the profile owned by the current lifecycle.""" - if configuration is self._activeConfiguration: + if profile is self._activeProfile: return - self._activeConfiguration = configuration - self.activeConfigurationChanged.emit(configuration) + self._activeProfile = profile + self.activeProfileChanged.emit(profile) def _emitRuntimesChanged(self): """Publish a stable snapshot after managed runtimes change.""" @@ -188,7 +188,7 @@ class ConnectionController(QtCore.QObject): def _reset(self): """Restore disconnected state after all runtime resources stop.""" self.progressFinished.emit(True) - self._setActiveConfiguration(None) + self._setActiveProfile(None) AppSettings.turnOFF('Connect') @@ -268,7 +268,7 @@ class ConnectionController(QtCore.QObject): return False self._lastError = None - self._setActiveConfiguration(configuration) + self._setActiveProfile(configuration) self._startConnecting() logManager = AppLogManager() diff --git a/Furious/Controllers/RoutingController.py b/Furious/Controllers/RoutingController.py index 2ef7f64..62f9eff 100644 --- a/Furious/Controllers/RoutingController.py +++ b/Furious/Controllers/RoutingController.py @@ -58,13 +58,13 @@ class RoutingController(QtCore.QObject): self.refresh() @staticmethod - def activeConfiguration(): + def currentProfileForRouting(): """Return the connected profile, falling back to repository selection.""" try: - configuration = AppConnectionController().activeConfiguration + profile = AppConnectionController().activeProfile - if configuration is not None: - return configuration + if profile is not None: + return profile except (AttributeError, RuntimeError): # The connection controller may not exist during early startup. pass @@ -106,12 +106,12 @@ class RoutingController(QtCore.QObject): def refresh(self, *, force=False): """Refresh routing capabilities from the active proxy-core plugin.""" - config = self.activeConfiguration() + profile = self.currentProfileForRouting() registry = getPluginRegistry() - options = registry.routingOptions(config) if config is not None else tuple() + options = registry.routingOptions(profile) if profile is not None else tuple() routing = ( - registry.normalizeRouting(config, AppSettings.get('Routing')) - if config is not None + registry.normalizeRouting(profile, AppSettings.get('Routing')) + if profile is not None else str(AppSettings.get('Routing')) ) diff --git a/Furious/Frozenlib/SystemRoutingTable.py b/Furious/Frozenlib/SystemRoutingTable.py index 728376e..fe267ec 100644 --- a/Furious/Frozenlib/SystemRoutingTable.py +++ b/Furious/Frozenlib/SystemRoutingTable.py @@ -52,7 +52,7 @@ def dictRepr(returncode, stdout, stderr): class SystemRoutingTable: """Represent system routing table.""" - Relations = list() + managedRoutes = list() DEFAULT_GATEWAY_WIN32 = re.compile( r'0\.0\.0\.0.\s*0\.0\.0\.0.\s*(\S+)\s*(\S+)', @@ -121,7 +121,7 @@ class SystemRoutingTable: @staticmethod def addRelations(): """Add relations.""" - for sourceIP, destinationIP in SystemRoutingTable.Relations: + for sourceIP, destinationIP in SystemRoutingTable.managedRoutes: SystemRoutingTable.add(sourceIP, destinationIP) @staticmethod @@ -689,13 +689,13 @@ class SystemRoutingTable: def deleteRelations(clear=True): """Delete relations.""" if PLATFORM == 'Windows': - if len(SystemRoutingTable.Relations): + if len(SystemRoutingTable.managedRoutes): SystemRoutingTable.delete( '0.0.0.0', APPLICATION_TUN2SOCKS_GATEWAY_ADDRESS ) - for sourceIP, destinationIP in SystemRoutingTable.Relations[::-1]: + for sourceIP, destinationIP in SystemRoutingTable.managedRoutes[::-1]: SystemRoutingTable.delete(sourceIP, destinationIP) if clear: - SystemRoutingTable.Relations.clear() + SystemRoutingTable.managedRoutes.clear() diff --git a/Furious/Models/Configuration.py b/Furious/Models/Configuration.py index 20fe51c..9b0eb8e 100644 --- a/Furious/Models/Configuration.py +++ b/Furious/Models/Configuration.py @@ -26,13 +26,13 @@ import functools import ujson __all__ = [ - 'ConfigFactory', + 'CoreConfiguration', ] -class ConfigFactory(dict): +class CoreConfiguration(dict): """ - ConfigurationFactory is how Furious sees the core config. + CoreConfiguration is how Furious represents a proxy-core configuration. It subclasses from dict and can be constructed from: 1. dictionary -- from existing JSON object @@ -137,7 +137,7 @@ class ConfigFactory(dict): return super().__setitem__(item, value) - def deepcopy(self) -> ConfigFactory: + def deepcopy(self) -> CoreConfiguration: """Return an independent copy of the configuration.""" return copy.deepcopy(self) diff --git a/Furious/Models/Profile.py b/Furious/Models/Profile.py index 9ac81cc..a176710 100644 --- a/Furious/Models/Profile.py +++ b/Furious/Models/Profile.py @@ -28,7 +28,7 @@ import hashlib import json import uuid -from .Configuration import ConfigFactory +from .Configuration import CoreConfiguration __all__ = [ 'ProfileMetadata', @@ -180,7 +180,7 @@ class ProfileMetadata: class ServerProfile(MutableMapping[str, Any]): """Compose profile metadata with a core-neutral connection document.""" - connection: ConfigFactory + connection: CoreConfiguration metadata: ProfileMetadata = field(default_factory=ProfileMetadata) index: int = 0 deleted: bool = False @@ -188,7 +188,7 @@ class ServerProfile(MutableMapping[str, Any]): @classmethod def fromConfiguration( cls, - configuration: ConfigFactory, + configuration: CoreConfiguration, metadata: ProfileMetadata | Mapping[str, Any] | None = None, *, index: int = 0, @@ -198,8 +198,8 @@ class ServerProfile(MutableMapping[str, Any]): if isinstance(configuration, ServerProfile): return configuration - if not isinstance(configuration, ConfigFactory): - raise TypeError('profile connection must be a ConfigFactory') + if not isinstance(configuration, CoreConfiguration): + raise TypeError('profile connection must be a CoreConfiguration') if isinstance(metadata, ProfileMetadata): profileMetadata = copy.deepcopy(metadata) @@ -244,7 +244,7 @@ class ServerProfile(MutableMapping[str, Any]): return profile - def replaceConnection(self, connection: ConfigFactory): + def replaceConnection(self, connection: CoreConfiguration): """Return this profile's metadata composed with a new connection.""" return ServerProfile.fromConfiguration( connection, diff --git a/Furious/Models/__init__.py b/Furious/Models/__init__.py index 4b0421d..8c91fc7 100644 --- a/Furious/Models/__init__.py +++ b/Furious/Models/__init__.py @@ -19,7 +19,7 @@ from __future__ import annotations -from .Configuration import ConfigFactory +from .Configuration import CoreConfiguration from .Encoding import ( Base64Encoder, JSONEncoder, @@ -38,7 +38,7 @@ from .Protocol import Protocol __all__ = [ 'Base64Encoder', - 'ConfigFactory', + 'CoreConfiguration', 'JSONEncoder', 'LogCategory', 'LogEntry', diff --git a/Furious/Plugins/Profile.py b/Furious/Plugins/Profile.py index 6011388..5661346 100644 --- a/Furious/Plugins/Profile.py +++ b/Furious/Plugins/Profile.py @@ -19,7 +19,7 @@ from __future__ import annotations -from Furious.Models import ConfigFactory, ServerProfile, ensureProfile +from Furious.Models import CoreConfiguration, ServerProfile, ensureProfile from typing import Mapping, Union @@ -41,10 +41,12 @@ __all__ = [ logger = logging.getLogger(__name__) -def configurationFromMapping(config: Mapping, registry=None, **kwargs) -> ConfigFactory: +def configurationFromMapping( + config: Mapping, registry=None, **kwargs +) -> CoreConfiguration: """Construct a connection document from a normalized mapping.""" if not isinstance(config, Mapping): - return ConfigFactory() + return CoreConfiguration() try: factory = (registry or getPluginRegistry()).configFromDict( @@ -57,17 +59,19 @@ def configurationFromMapping(config: Mapping, registry=None, **kwargs) -> Config factory = None - return factory if factory is not None else ConfigFactory(dict(config)) + return factory if factory is not None else CoreConfiguration(dict(config)) def configurationFromAny( - config: Union[str, Mapping, ConfigFactory, ServerProfile], registry=None, **kwargs -) -> ConfigFactory: + config: Union[str, Mapping, CoreConfiguration, ServerProfile], + registry=None, + **kwargs, +) -> CoreConfiguration: """Construct a connection document from supported input data.""" if isinstance(config, ServerProfile): return config.connection.deepcopy() - if isinstance(config, ConfigFactory): + if isinstance(config, CoreConfiguration): return config.deepcopy() if isinstance(config, str): @@ -84,19 +88,19 @@ def configurationFromAny( except Exception: # Any non-exit exceptions - return ConfigFactory() + return CoreConfiguration() if isinstance(config, Mapping): return configurationFromMapping(config, registry=registry, **kwargs) - return ConfigFactory() + return CoreConfiguration() -def blankConfiguration(protocol, registry=None, **kwargs) -> ConfigFactory: +def blankConfiguration(protocol, registry=None, **kwargs) -> CoreConfiguration: """Create a blank connection through an exact protocol capability.""" factory = (registry or getPluginRegistry()).blankConfig(protocol, **kwargs) - return factory if factory is not None else ConfigFactory() + return factory if factory is not None else CoreConfiguration() def exportConfiguration(config, remark: str = '', registry=None) -> str: @@ -120,7 +124,7 @@ def profileFromMapping(config: Mapping, registry=None, **metadata) -> ServerProf def profileFromAny( - config: Union[str, Mapping, ConfigFactory, ServerProfile], + config: Union[str, Mapping, CoreConfiguration, ServerProfile], registry=None, **metadata, ) -> ServerProfile: diff --git a/Furious/Qt/EditorWidgets.py b/Furious/Qt/EditorWidgets.py index bfffd3b..f87c95a 100644 --- a/Furious/Qt/EditorWidgets.py +++ b/Furious/Qt/EditorWidgets.py @@ -21,7 +21,7 @@ from __future__ import annotations from Furious.Frozenlib import * from Furious.Interface import * -from Furious.Models import ConfigFactory, ServerProfile +from Furious.Models import CoreConfiguration, ServerProfile from Furious.Qt.DynamicTranslate import gettext as _ from Furious.Qt.QtWidgets import * @@ -209,7 +209,7 @@ class GuiEditorItemProxyHttp(GuiEditorItemTextInput): """Initialize the GuiEditorItemProxyHttp.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldHttp = config.httpProxy() newHttp = self.text() @@ -234,7 +234,7 @@ class GuiEditorItemProxyHttp(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setText(config.httpProxy()) @@ -251,7 +251,7 @@ class GuiEditorItemProxySocks(GuiEditorItemTextInput): """Initialize the GuiEditorItemProxySocks.""" super().__init__(*args, **kwargs) - def inputToFactory(self, config: ConfigFactory) -> bool: + def inputToFactory(self, config: CoreConfiguration) -> bool: """Apply the current editor value to the configuration.""" oldSocks = config.socksProxy() newSocks = self.text() @@ -276,7 +276,7 @@ class GuiEditorItemProxySocks(GuiEditorItemTextInput): return True - def factoryToInput(self, config: ConfigFactory): + def factoryToInput(self, config: CoreConfiguration): """Load the configuration value into the editor.""" try: self.setText(config.socksProxy()) diff --git a/Furious/Qt/WebGETManager.py b/Furious/Qt/HttpGetManager.py similarity index 85% rename from Furious/Qt/WebGETManager.py rename to Furious/Qt/HttpGetManager.py index cdcc27a..deca6bf 100644 --- a/Furious/Qt/WebGETManager.py +++ b/Furious/Qt/HttpGetManager.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""Provide Qt support for web get manager.""" +"""Provide reusable Qt support for HTTP GET workflows.""" from __future__ import annotations @@ -29,22 +29,22 @@ from typing import Union import logging -__all__ = ['WebGETManager'] +__all__ = ['HttpGetManager'] logger = logging.getLogger(__name__) -class WebGETManager(AppQNetworkAccessManager): - """Coordinate web get operations.""" +class HttpGetManager(AppQNetworkAccessManager): + """Coordinate HTTP GET operations and their completion lifecycle.""" def __init__(self, parent=None, actionMessage='web GET', **kwargs): - """Initialize the WebGETManager.""" + """Initialize the HttpGetManager.""" super().__init__(parent) self.actionMessage = actionMessage - self.mustCallOnce = kwargs.pop('mustCallOnce', True) - self.mustCalled = False + self.completionRunsOnce = kwargs.pop('completionRunsOnce', True) + self.completionHasRun = False self._replyContexts = {} def successCallback(self, networkReply: QNetworkReply, **kwargs): @@ -59,27 +59,27 @@ class WebGETManager(AppQNetworkAccessManager): """Handle a failed network operation.""" pass - def mustCall(self, **kwargs): + def completionCallback(self, **kwargs): """Perform the required completion hook.""" pass - def must(self, **kwargs): - """Run the required completion hook according to its call policy.""" + def runCompletionCallback(self, **kwargs): + """Run the completion callback according to its call policy.""" def call(): """Invoke the registered completion callback.""" try: - self.mustCall(**kwargs) + self.completionCallback(**kwargs) except Exception as ex: # Any non-exit exceptions - logger.error(f'error calling must(): {ex}') + logger.error(f'error calling completion callback: {ex}') finally: - self.mustCalled = True + self.completionHasRun = True - if not self.mustCallOnce: + if not self.completionRunsOnce: call() - elif not self.mustCalled: + elif not self.completionHasRun: call() def handleReadyReadByNetworkReply(self, networkReply: QNetworkReply, **kwargs): @@ -137,7 +137,7 @@ class WebGETManager(AppQNetworkAccessManager): self.successCallback(networkReply, **kwargs) finally: try: - self.must(**kwargs) + self.runCompletionCallback(**kwargs) finally: # QNetworkAccessManager owns replies by default and does not # remove completed children automatically. All response data @@ -157,7 +157,7 @@ class WebGETManager(AppQNetworkAccessManager): return useProxy def webGET(self, request: Union[QNetworkRequest, str], **kwargs) -> QNetworkReply: - """Return the web get value used by the web get manager.""" + """Start an HTTP GET request managed by this instance.""" if isinstance(request, QNetworkRequest): networkReply = self.get(request) else: diff --git a/Furious/Qt/QtGui.py b/Furious/Qt/QtGui.py index 4bda549..e26d3e9 100644 --- a/Furious/Qt/QtGui.py +++ b/Furious/Qt/QtGui.py @@ -38,7 +38,7 @@ __all__ = [ 'AppQIcon', 'AppQAction', 'AppQActionGroup', - 'AppQSeperator', + 'AppQSeparator', ] @@ -315,9 +315,9 @@ class AppQActionGroup(QActionGroup): self.addAction(action) -class AppQSeperator(QAction): - """Represent app q seperator.""" +class AppQSeparator(QAction): + """Represent an application action separator.""" def __init__(self): - """Initialize the AppQSeperator.""" + """Initialize the AppQSeparator.""" super().__init__() diff --git a/Furious/Qt/QtWidgets.py b/Furious/Qt/QtWidgets.py index 1687ee2..9ddf45e 100644 --- a/Furious/Qt/QtWidgets.py +++ b/Furious/Qt/QtWidgets.py @@ -680,7 +680,7 @@ class AppQMenu(Mixins.QTranslatable, QMenu): self._actions = [] for action in actions: - if isinstance(action, AppQSeperator): + if isinstance(action, AppQSeparator): self._actions.append(action) self.addSeparator() elif isinstance(action, AppQAction): @@ -1973,7 +1973,7 @@ class AppQToolBar(Mixins.QTranslatable, QToolBar): self._actions = [] for action in actions: - if isinstance(action, AppQSeperator): + if isinstance(action, AppQSeparator): self._actions.append(action) self.addSeparator() elif isinstance(action, AppQAction): diff --git a/Furious/Qt/__init__.py b/Furious/Qt/__init__.py index 0db5253..cd096cc 100644 --- a/Furious/Qt/__init__.py +++ b/Furious/Qt/__init__.py @@ -43,7 +43,7 @@ from .QtGui import ( AppQAction, AppQActionGroup, AppQIcon, - AppQSeperator, + AppQSeparator, bootstrapIcon, bootstrapIconMask, bootstrapIconWhite, @@ -96,7 +96,7 @@ from .TextEditorTheme import ( DraculaLoggerSyntaxHighlighter, configureEditorLogMetadata, ) -from .WebGETManager import WebGETManager +from .HttpGetManager import HttpGetManager __all__ = [ 'ABBR_TO_LANGUAGE', @@ -123,7 +123,7 @@ __all__ = [ 'AppQNetworkAccessManager', 'AppQPlainTextEdit', 'AppQPushButton', - 'AppQSeperator', + 'AppQSeparator', 'AppQSpinBox', 'AppQSwitch', 'AppQTabWidget', @@ -154,7 +154,7 @@ __all__ = [ 'MBoxQuestionDelete', 'MBoxUnrecognizedConfig', 'SUPPORTED_LANGUAGE', - 'WebGETManager', + 'HttpGetManager', 'bootstrapIcon', 'bootstrapIconMask', 'bootstrapIconWhite', diff --git a/Furious/Repository/Storage.py b/Furious/Repository/Storage.py index 32ff118..0432b57 100644 --- a/Furious/Repository/Storage.py +++ b/Furious/Repository/Storage.py @@ -129,12 +129,10 @@ class Storage: try: controller = AppConnectionController() - configuration = controller.activeConfiguration + profile = controller.activeProfile - if controller.isConnected() and isinstance( - configuration, ServerProfile - ): - return configuration.httpProxy() + if controller.isConnected() and isinstance(profile, ServerProfile): + return profile.httpProxy() return None except Exception: @@ -148,10 +146,10 @@ class Storage: try: controller = AppConnectionController() - configuration = controller.activeConfiguration + profile = controller.activeProfile if not controller.isConnected() or not isinstance( - configuration, ServerProfile + profile, ServerProfile ): return '' @@ -159,7 +157,7 @@ class Storage: ( index for index, server in enumerate(Storage.UserServers()) - if server is configuration + if server is profile ), -1, ) diff --git a/Furious/Service/ConnectionManager.py b/Furious/Service/ConnectionManager.py index b304e44..8116c71 100644 --- a/Furious/Service/ConnectionManager.py +++ b/Furious/Service/ConnectionManager.py @@ -125,7 +125,7 @@ class ConnectionManager(Mixins.CleanupOnExit): def start( self, - config: ConfigFactory | ServerProfile, + config: CoreConfiguration | ServerProfile, routing: str, exitCallback=None, msgCallbackCore=None, @@ -324,7 +324,7 @@ class ConnectionManager(Mixins.CleanupOnExit): f'error when processing user TUN bypass settings: {ex}' ) - SystemRoutingTable.Relations.clear() + SystemRoutingTable.managedRoutes.clear() return abortStart() else: @@ -332,14 +332,14 @@ class ConnectionManager(Mixins.CleanupOnExit): if isValidIPAddress(bypass): logger.info(f'processing user TUN bypass IP: {bypass}') - SystemRoutingTable.Relations.append([bypass, gateway]) + SystemRoutingTable.managedRoutes.append([bypass, gateway]) else: logger.error( f'invalid IP address when processing ' f'user TUN bypass settings: {bypass}' ) - SystemRoutingTable.Relations.clear() + SystemRoutingTable.managedRoutes.clear() return abortStart() else: @@ -356,14 +356,14 @@ class ConnectionManager(Mixins.CleanupOnExit): error, resolved = DnsResolver.resolve(address) if error: - SystemRoutingTable.Relations.clear() + SystemRoutingTable.managedRoutes.clear() return abortStart(f'DNS resolution failed: {address}') else: for address in resolved: - SystemRoutingTable.Relations.append([address, gateway]) + SystemRoutingTable.managedRoutes.append([address, gateway]) else: - SystemRoutingTable.Relations.append([address, gateway]) + SystemRoutingTable.managedRoutes.append([address, gateway]) # Platform specific implementation if PLATFORM == 'Windows': @@ -442,7 +442,7 @@ class ConnectionManager(Mixins.CleanupOnExit): *list(f'{2 ** (8 - x)}.0.0.0/{x}' for x in range(8, 0, -1)), '198.18.0.0/15', ]: - SystemRoutingTable.Relations.append( + SystemRoutingTable.managedRoutes.append( [address, APPLICATION_TUN2SOCKS_GATEWAY_ADDRESS] ) @@ -525,7 +525,7 @@ class ConnectionManager(Mixins.CleanupOnExit): commandBypass = '\n'.join( list( f'ip route add {route(sourceIP, destinationIP)}' - for sourceIP, destinationIP in SystemRoutingTable.Relations + for sourceIP, destinationIP in SystemRoutingTable.managedRoutes if iproute.find(route(sourceIP, destinationIP)) == -1 ) ) diff --git a/Furious/Service/ConnectivityManager.py b/Furious/Service/ConnectivityManager.py index 430d9a5..17ea1e7 100644 --- a/Furious/Service/ConnectivityManager.py +++ b/Furious/Service/ConnectivityManager.py @@ -20,7 +20,7 @@ from __future__ import annotations from Furious.Frozenlib import * -from Furious.Qt.WebGETManager import * +from Furious.Qt.HttpGetManager import * from PySide6 import QtCore from PySide6.QtNetwork import * @@ -32,7 +32,7 @@ __all__ = ['ConnectivityManager'] logger = logging.getLogger(__name__) -class ConnectivityManager(Mixins.ConnectionAware, WebGETManager): +class ConnectivityManager(Mixins.ConnectionAware, HttpGetManager): """Coordinate network connectivity operations.""" MIN_JOB_INTERVAL = 2500 diff --git a/Furious/Service/DnsResolver.py b/Furious/Service/DnsResolver.py index 432768b..d285d76 100644 --- a/Furious/Service/DnsResolver.py +++ b/Furious/Service/DnsResolver.py @@ -21,7 +21,7 @@ from __future__ import annotations from Furious.Frozenlib import * from Furious.Models import * -from Furious.Qt.WebGETManager import * +from Furious.Qt.HttpGetManager import * from PySide6 import QtCore from PySide6.QtNetwork import * @@ -35,7 +35,7 @@ __all__ = ['DnsResolver'] logger = logging.getLogger(__name__) -class _DnsResolver(WebGETManager): +class _DnsResolver(HttpGetManager): """Represent DNS resolver.""" MAX_REFERENCE_DEPTH = 32 diff --git a/Furious/Service/EndpointInfoService.py b/Furious/Service/EndpointInfoService.py index 6015413..3fd58fb 100644 --- a/Furious/Service/EndpointInfoService.py +++ b/Furious/Service/EndpointInfoService.py @@ -278,15 +278,13 @@ class EndpointInfoService(QtCore.QObject): self.httpClient.completed.connect(self._requestCompleted) stateChanged = getattr(self.controller, 'stateChanged', None) - activeConfigurationChanged = getattr( - self.controller, 'activeConfigurationChanged', None - ) + activeProfileChanged = getattr(self.controller, 'activeProfileChanged', None) if stateChanged is not None: stateChanged.connect(self._connectionStateChanged) - if activeConfigurationChanged is not None: - activeConfigurationChanged.connect(self._activeConfigurationChanged) + if activeProfileChanged is not None: + activeProfileChanged.connect(self._activeProfileChanged) self._syncConnectionState() @@ -362,7 +360,7 @@ class EndpointInfoService(QtCore.QObject): self._syncConnectionState() @QtCore.Slot(object) - def _activeConfigurationChanged(self, _configuration): + def _activeProfileChanged(self, _profile): """Reject late data when the active profile identity changes.""" self._invalidate() self._syncConnectionState() diff --git a/Furious/Service/MetricsDataManager.py b/Furious/Service/MetricsHistory.py similarity index 98% rename from Furious/Service/MetricsDataManager.py rename to Furious/Service/MetricsHistory.py index 18a55cb..5ab80ab 100644 --- a/Furious/Service/MetricsDataManager.py +++ b/Furious/Service/MetricsHistory.py @@ -34,9 +34,9 @@ import time __all__ = [ 'DOWNLOAD_SPEED_METRIC', 'DOWNLOAD_USAGE_METRIC', - 'MetricPoint', + 'MetricSeriesPoint', 'MetricSample', - 'MetricsDataManager', + 'MetricsHistory', 'UPLOAD_SPEED_METRIC', 'UPLOAD_USAGE_METRIC', ] @@ -60,7 +60,7 @@ class MetricSample: @dataclass(frozen=True) -class MetricPoint: +class MetricSeriesPoint: """Represent one graph-ready raw or aggregated metric value.""" sampledAt: float @@ -75,7 +75,7 @@ class MetricPoint: return self.sampleCount > 1 -class MetricsDataManager(QtCore.QObject): +class MetricsHistory(QtCore.QObject): """Maintain bounded metric history and aggregate it for consumers.""" historyChanged = QtCore.Signal() @@ -270,7 +270,7 @@ class MetricsDataManager(QtCore.QObject): granularitySeconds=0, *, now=None, - ) -> tuple[MetricPoint, ...]: + ) -> tuple[MetricSeriesPoint, ...]: """Return graph-ready values aggregated into time buckets.""" aggregation = self._aggregations.get(metricKey) @@ -325,7 +325,7 @@ class MetricsDataManager(QtCore.QObject): continue points.append( - MetricPoint( + MetricSeriesPoint( sampledAt, value, sampleTimes[0], diff --git a/Furious/Service/UpdateManager.py b/Furious/Service/UpdateManager.py index 525e100..b1e1847 100644 --- a/Furious/Service/UpdateManager.py +++ b/Furious/Service/UpdateManager.py @@ -23,7 +23,7 @@ from Furious.Frozenlib import * from Furious.Models import * from Furious.Qt.QtWidgets import * from Furious.Qt.DynamicTranslate import gettext as _ -from Furious.Qt.WebGETManager import * +from Furious.Qt.HttpGetManager import * from PySide6 import QtCore from PySide6.QtGui import * @@ -65,7 +65,7 @@ class MBoxQuestionUpdate(AppQMessageBox): self.moveToCenter() -class UpdateManager(WebGETManager): +class UpdateManager(HttpGetManager): """Coordinate updates operations.""" API_URL = ( diff --git a/Furious/Service/__init__.py b/Furious/Service/__init__.py index 03fa8a9..9783bac 100644 --- a/Furious/Service/__init__.py +++ b/Furious/Service/__init__.py @@ -40,14 +40,14 @@ from .LogManager import ( coreLogCallback, formatLogEntry, ) -from .MetricsDataManager import ( +from .MetricsHistory import ( DOWNLOAD_SPEED_METRIC, DOWNLOAD_USAGE_METRIC, UPLOAD_SPEED_METRIC, UPLOAD_USAGE_METRIC, - MetricPoint, + MetricSeriesPoint, MetricSample, - MetricsDataManager, + MetricsHistory, ) from .PluginUIManager import PluginNavigationManager, isCoreActive from .SubscriptionImporter import ( @@ -84,9 +84,9 @@ __all__ = [ 'DOWNLOAD_USAGE_METRIC', 'UPLOAD_SPEED_METRIC', 'UPLOAD_USAGE_METRIC', - 'MetricPoint', + 'MetricSeriesPoint', 'MetricSample', - 'MetricsDataManager', + 'MetricsHistory', 'PluginNavigationManager', 'coreLogCallback', 'SubscriptionImportResult', diff --git a/Furious/Widget/MetricsGraph.py b/Furious/Widget/MetricsGraph.py index 6432672..a3ba6bf 100644 --- a/Furious/Widget/MetricsGraph.py +++ b/Furious/Widget/MetricsGraph.py @@ -22,7 +22,7 @@ from __future__ import annotations from Furious.Frozenlib import APP from Furious.Qt import AppStyleSheet from Furious.Qt import gettext as _ -from Furious.Service.MetricsDataManager import MetricPoint +from Furious.Service.MetricsHistory import MetricSeriesPoint from PySide6 import QtCore, QtGui from PySide6.QtWidgets import QSizePolicy, QToolTip, QWidget @@ -80,14 +80,14 @@ class MetricsGraphWidget(QWidget): def setSeries( self, - points: Iterable[MetricPoint], + points: Iterable[MetricSeriesPoint], rangeSeconds: float, currentTime: float, currentWallTime=None, ): """Replace the prepared series and schedule one repaint.""" self._points = tuple( - point for point in points if isinstance(point, MetricPoint) + point for point in points if isinstance(point, MetricSeriesPoint) ) self._pointTimes = tuple(point.sampledAt for point in self._points) self._rangeSeconds = max(float(rangeSeconds), 1.0) diff --git a/Furious/Widget/ServerTableView.py b/Furious/Widget/ServerTableView.py index eaa5a93..7848c30 100644 --- a/Furious/Widget/ServerTableView.py +++ b/Furious/Widget/ServerTableView.py @@ -149,7 +149,7 @@ class MBoxUpdateSubsInfo(AppQMessageBox): self.moveToCenter() -class SubscriptionManager(WebGETManager): +class SubscriptionManager(HttpGetManager): """Coordinate subscription operations.""" subscriptionsChanged = QtCore.Signal() @@ -158,7 +158,7 @@ class SubscriptionManager(WebGETManager): """Initialize the SubscriptionManager.""" actionMessage = kwargs.pop('actionMessage', 'update subs') - super().__init__(parent, actionMessage=actionMessage, mustCallOnce=False) + super().__init__(parent, actionMessage=actionMessage, completionRunsOnce=False) self.importer = SubscriptionImportService() self.synchronizer = SubscriptionSynchronizer() @@ -212,7 +212,7 @@ class SubscriptionManager(WebGETManager): self.subscriptionsChanged.emit() - def mustCall(self, **kwargs): + def completionCallback(self, **kwargs): """Perform the required completion hook.""" depthMap = kwargs.get('depthMap', {}) depthMap['depth'] -= 1 @@ -489,7 +489,7 @@ class TestTcpingLatencyWorker(QtCore.QObject, QtCore.QRunnable): self.finished.emit() -class TestDownloadSpeedWorker(WebGETManager): +class TestDownloadSpeedWorker(HttpGetManager): """Run test download speed work in the background.""" progressed = QtCore.Signal() @@ -527,7 +527,7 @@ class TestDownloadSpeedWorker(WebGETManager): self.timeoutTimer.setSingleShot(True) self.timeoutTimer.timeout.connect(self.handleTimeout) - def mustCall(self, **kwargs): + def completionCallback(self, **kwargs): """Perform the required completion hook.""" self.timeoutTimer.stop() self.finished.emit(self) @@ -556,9 +556,9 @@ class TestDownloadSpeedWorker(WebGETManager): if not self.isFinished(): self.abort() finally: - self.must() + self.runCompletionCallback() - def coreExitCallback(self, config: ConfigFactory, exitcode: int): + def coreExitCallback(self, config: CoreConfiguration, exitcode: int): """Handle the core exit callback.""" try: if exitcode == CoreRuntime.ExitCode.ConfigurationError.value: @@ -573,7 +573,7 @@ class TestDownloadSpeedWorker(WebGETManager): self.factory.metadata.speed = f'Core exited {exitcode}' self.sync() finally: - self.must() + self.runCompletionCallback() def _startCoreRuntime(self, config) -> bool: """Prepare and start a download test through its runtime factory.""" @@ -636,7 +636,7 @@ class TestDownloadSpeedWorker(WebGETManager): self.timeoutTimer.start(self.timeout) finally: if self.networkReply is None: - self.must() + self.runCompletionCallback() def successCallback(self, networkReply, **kwargs): """Handle a successful network operation.""" @@ -781,7 +781,7 @@ class DownloadSpeedTestScheduler(QtCore.QObject): worker.abort() worker.coreManager.stopAll() - worker.must() + worker.runCompletionCallback() def scheduleDrain(self): """Handle schedule drain for the download speed test scheduler.""" @@ -1083,7 +1083,7 @@ class ServerTableVerticalHeader(AppQHeaderView): class ServerTableColumn: """Describe and render user servers Qt table view table columns.""" - def __init__(self, name: str, func: Callable[[ConfigFactory], str] = None): + def __init__(self, name: str, func: Callable[[CoreConfiguration], str] = None): """Initialize the ServerTableColumn.""" self.name = name self.func = func @@ -1597,7 +1597,7 @@ class ServerTableView( QtCore.Qt.Key.Key_Delete, ), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Select All'), callback=lambda: self.selectAll(), @@ -1606,7 +1606,7 @@ class ServerTableView( QtCore.Qt.Key.Key_A, ), ), - AppQSeperator(), + AppQSeparator(), self.activateSelectedServerActionRef, AppQAction( _('Scroll To Activated Server'), @@ -1616,7 +1616,7 @@ class ServerTableView( QtCore.Qt.Key.Key_G, ), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Test Ping Latency'), callback=lambda: self.testSelectedItemPingLatency(), @@ -1657,9 +1657,9 @@ class ServerTableView( QtCore.Qt.Key.Key_R, ), ), - AppQSeperator(), + AppQSeparator(), self.advancedActionRef, - AppQSeperator(), + AppQSeparator(), AppQAction( _('New Empty Configuration'), callback=lambda: self.newEmptyItem(), @@ -1669,7 +1669,7 @@ class ServerTableView( ), ), *importActionsFactory(), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Export Share Link To Clipboard'), callback=lambda: self.exportSelectedItemURI(), @@ -2607,7 +2607,7 @@ class ServerTableView( return result - def appendNewItemByFactory(self, factory: ConfigFactory | ServerProfile): + def appendNewItemByFactory(self, factory: CoreConfiguration | ServerProfile): """Append new item by factory.""" factory = ensureProfile(factory) index = len(Storage.UserServers()) diff --git a/Furious/Widget/SubscriptionTableView.py b/Furious/Widget/SubscriptionTableView.py index 8c0c2cf..30eafe6 100644 --- a/Furious/Widget/SubscriptionTableView.py +++ b/Furious/Widget/SubscriptionTableView.py @@ -567,7 +567,7 @@ class SubscriptionTableView(Mixins.QTranslatable, AppQTableView): _('Move Down'), callback=lambda: self.moveSelectedGroup(1), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Delete'), callback=lambda: self.deleteSelectedItem(), diff --git a/Furious/Window/HomePage.py b/Furious/Window/HomePage.py index a6067b6..c4ae006 100644 --- a/Furious/Window/HomePage.py +++ b/Furious/Window/HomePage.py @@ -199,7 +199,7 @@ class NetworkStateBadge(Mixins.QTranslatable, Mixins.ThemeAware, QFrame): connectionController = AppConnectionController() connectionController.stateChanged.connect(self.handleConnectionStateChanged) - connectionController.activeConfigurationChanged.connect( + connectionController.activeProfileChanged.connect( self.handleActiveConfigurationChanged ) @@ -226,10 +226,10 @@ class NetworkStateBadge(Mixins.QTranslatable, Mixins.ThemeAware, QFrame): @staticmethod def activeProfileRemark() -> str: """Return the active profile remark without its presentation row index.""" - configuration = AppConnectionController().activeConfiguration + profile = AppConnectionController().activeProfile - if isinstance(configuration, ServerProfile): - return configuration.itemRemark + if isinstance(profile, ServerProfile): + return profile.itemRemark return '' @@ -668,7 +668,7 @@ class HomePage(Mixins.QTranslatable, QMainWindow): continue if descriptor.separatorBefore and serverActions: - serverActions.append(AppQSeperator()) + serverActions.append(AppQSeparator()) actionText = ( _(descriptor.addActionText) @@ -687,7 +687,7 @@ class HomePage(Mixins.QTranslatable, QMainWindow): ) if serverActions: - serverActions.append(AppQSeperator()) + serverActions.append(AppQSeparator()) serverActions.append( AppQAction( _('New Empty Configuration'), @@ -871,7 +871,7 @@ class HomePage(Mixins.QTranslatable, QMainWindow): """Update subs by unique.""" self.userServersQTableWidget.updateSubsByUnique(unique, httpProxy, **kwargs) - def appendNewItemByFactory(self, factory: ConfigFactory | ServerProfile): + def appendNewItemByFactory(self, factory: CoreConfiguration | ServerProfile): """Append new item by factory.""" self.userServersQTableWidget.appendNewItemByFactory(factory) @@ -907,10 +907,8 @@ class HomePage(Mixins.QTranslatable, QMainWindow): def setNetworkState(self, success: bool, **kwargs): """Set network state.""" - configuration = AppConnectionController().activeConfiguration - remark = ( - configuration.itemRemark if isinstance(configuration, ServerProfile) else '' - ) + profile = AppConnectionController().activeProfile + remark = profile.itemRemark if isinstance(profile, ServerProfile) else '' if not remark: self.resetNetworkState() diff --git a/Furious/Window/LogPage.py b/Furious/Window/LogPage.py index 3a59411..bcb9d69 100644 --- a/Furious/Window/LogPage.py +++ b/Furious/Window/LogPage.py @@ -261,7 +261,7 @@ class LogPage(Mixins.QTranslatable, QMainWindow): QtCore.Qt.Key.Key_C, ), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Select All'), callback=lambda: self.textBrowser.selectAll(), diff --git a/Furious/Window/MainWindow.py b/Furious/Window/MainWindow.py index b3cf0fd..24fee38 100644 --- a/Furious/Window/MainWindow.py +++ b/Furious/Window/MainWindow.py @@ -20,10 +20,10 @@ from __future__ import annotations from Furious.Frozenlib import * -from Furious.Models import ConfigFactory, ServerProfile +from Furious.Models import CoreConfiguration, ServerProfile from Furious.Qt import * from Furious.Qt import gettext as _ -from Furious.Service import MetricsDataManager, PluginNavigationManager +from Furious.Service import MetricsHistory, PluginNavigationManager from Furious.Widget.NavigationView import NavigationView from Furious.Window.HomePage import HomePage from Furious.Window.LogPage import LogPage @@ -78,15 +78,15 @@ class MainWindow(AppQMainWindow): self.homePage.userServersQTableWidget, parent=self.navigationView, ) - self.metricsDataManager = MetricsDataManager(parent=self) + self.metricsHistory = MetricsHistory(parent=self) self.homePage.trafficStatsManager.sampleChanged.connect( - self.metricsDataManager.recordTrafficSample + self.metricsHistory.recordTrafficSample ) self.homePage.trafficStatsManager.usageHistoryReset.connect( - self.metricsDataManager.clearTrafficUsageHistory + self.metricsHistory.clearTrafficUsageHistory ) self.metricsPage = MetricsPage( - self.metricsDataManager, + self.metricsHistory, parent=self.navigationView, ) self.logPage = AppLogPage() @@ -202,7 +202,7 @@ class MainWindow(AppQMainWindow): """Forward a subscription update to the dedicated page controller.""" self.subscriptionPage.updateSubsByUnique(unique, httpProxy, **kwargs) - def appendNewItemByFactory(self, factory: ConfigFactory | ServerProfile): + def appendNewItemByFactory(self, factory: CoreConfiguration | ServerProfile): """Forward a new server profile to the home page.""" self.homePage.appendNewItemByFactory(factory) diff --git a/Furious/Window/MetricsPage.py b/Furious/Window/MetricsPage.py index 25ed6c7..97715a8 100644 --- a/Furious/Window/MetricsPage.py +++ b/Furious/Window/MetricsPage.py @@ -28,7 +28,7 @@ from Furious.Service import ( UPLOAD_SPEED_METRIC, UPLOAD_USAGE_METRIC, EndpointInfoService, - MetricsDataManager, + MetricsHistory, formatTrafficSpeed, formatTrafficUsage, ) @@ -114,19 +114,19 @@ class MetricsPage(Mixins.QTranslatable, Mixins.ThemeAware, QMainWindow): def __init__( self, - manager: MetricsDataManager, + history: MetricsHistory, parent=None, *, endpointInfoService=None, ): - """Initialize the network metrics page around a data-only manager.""" + """Initialize the network metrics page around its metrics history.""" super().__init__(parent) - if not isinstance(manager, MetricsDataManager): - raise TypeError('manager must be a MetricsDataManager') + if not isinstance(history, MetricsHistory): + raise TypeError('history must be a MetricsHistory') self.setObjectName('MetricsPage') - self.manager = manager + self.history = history if endpointInfoService is None: self.endpointInfoService = EndpointInfoService(parent=self) @@ -250,7 +250,7 @@ class MetricsPage(Mixins.QTranslatable, Mixins.ThemeAware, QMainWindow): self._timelineTimer.setInterval(self.TimelineRefreshInterval) self._timelineTimer.timeout.connect(self._timelineAdvanced) - self.manager.historyChanged.connect(self._historyChanged) + self.history.historyChanged.connect(self._historyChanged) self.timeRangeComboBox.currentIndexChanged.connect(self._selectionChanged) self.granularityComboBox.currentIndexChanged.connect(self._selectionChanged) @@ -361,7 +361,7 @@ class MetricsPage(Mixins.QTranslatable, Mixins.ThemeAware, QMainWindow): for graph, metricKey in graphMetrics: graph.setSeries( - self.manager.series( + self.history.series( metricKey, rangeSeconds, granularity, diff --git a/Furious/Window/SettingsPage.py b/Furious/Window/SettingsPage.py index 7048406..f26fdce 100644 --- a/Furious/Window/SettingsPage.py +++ b/Furious/Window/SettingsPage.py @@ -1029,7 +1029,7 @@ class SettingsPage(Mixins.QTranslatable, QMainWindow): ) for action in actions: - if isinstance(action, AppQSeperator): + if isinstance(action, AppQSeparator): continue if not isinstance(action, AppQAction): diff --git a/Furious/Window/TextEditorWindow.py b/Furious/Window/TextEditorWindow.py index 2b9d14f..fc8a4e3 100644 --- a/Furious/Window/TextEditorWindow.py +++ b/Furious/Window/TextEditorWindow.py @@ -136,7 +136,7 @@ class TextEditorWindow(AppQMainWindow): _('Save As...'), callback=lambda: self.saveAsFile(), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Close Window'), icon=bootstrapIcon('window-x.svg'), @@ -166,7 +166,7 @@ class TextEditorWindow(AppQMainWindow): QtCore.Qt.Key.Key_Z, ), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Cut'), icon=bootstrapIcon('scissors.svg'), @@ -193,7 +193,7 @@ class TextEditorWindow(AppQMainWindow): QtCore.Qt.Key.Key_V, ), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Select All'), callback=lambda: self.jsonEditor.selectAll(), @@ -202,7 +202,7 @@ class TextEditorWindow(AppQMainWindow): QtCore.Qt.Key.Key_A, ), ), - AppQSeperator(), + AppQSeparator(), AppQAction( _('Indent...'), callback=lambda: self.setIndent(),