diff --git a/Furious/Externals/GenTranslation.py b/Furious/Externals/GenTranslation.py index 2564ac7..d4b48a5 100644 --- a/Furious/Externals/GenTranslation.py +++ b/Furious/Externals/GenTranslation.py @@ -2164,5 +2164,14 @@ TRANSLATION = { "RU": "Закрыть", "ZH": "关闭", "isReviewed": "True" + }, + "Generate": { + "source": [ + "Furious.Widget.GuiVLESS", + "Furious.Widget.GuiVMess" + ], + "RU": "Сгенерировать", + "ZH": "生成", + "isReviewed": "True" } } diff --git a/Furious/Widget/GuiVLESS.py b/Furious/Widget/GuiVLESS.py index e80907d..13ece08 100644 --- a/Furious/Widget/GuiVLESS.py +++ b/Furious/Widget/GuiVLESS.py @@ -25,6 +25,9 @@ from Furious.Qt import gettext as _ from Furious.Widget.GuiVTransport import * from Furious.Widget.GuiVTLS import * +from PySide6.QtWidgets import * + +import uuid import functools __all__ = ['GuiVLESS'] @@ -119,6 +122,22 @@ class GuiVLESSItemBasicId(GuiEditorItemTextInput): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.generateButton = AppQPushButton(_('Generate')) + self.generateButton.clicked.connect(self.generateUUID) + + self._widget = QWidget() + + layout = QHBoxLayout(self._widget) + layout.setContentsMargins(0, 0, 0, 0) + layout.addWidget(self._input) + layout.addWidget(self.generateButton) + + def generateUUID(self): + self.setText(str(uuid.uuid4())) + + def widgets(self): + return self._title, self._widget + def inputToFactory(self, config: ConfigFactory) -> bool: proxyOutboundUser = getProxyOutboundUser(config) diff --git a/Furious/Widget/GuiVMess.py b/Furious/Widget/GuiVMess.py index e894e2e..991555e 100644 --- a/Furious/Widget/GuiVMess.py +++ b/Furious/Widget/GuiVMess.py @@ -25,6 +25,9 @@ from Furious.Qt import gettext as _ from Furious.Widget.GuiVTransport import * from Furious.Widget.GuiVTLS import * +from PySide6.QtWidgets import * + +import uuid import functools __all__ = ['GuiVMess'] @@ -119,6 +122,22 @@ class GuiVMessItemBasicId(GuiEditorItemTextInput): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.generateButton = AppQPushButton(_('Generate')) + self.generateButton.clicked.connect(self.generateUUID) + + self._widget = QWidget() + + layout = QHBoxLayout(self._widget) + layout.setContentsMargins(0, 0, 0, 0) + layout.addWidget(self._input) + layout.addWidget(self.generateButton) + + def generateUUID(self): + self.setText(str(uuid.uuid4())) + + def widgets(self): + return self._title, self._widget + def inputToFactory(self, config: ConfigFactory) -> bool: proxyOutboundUser = getProxyOutboundUser(config)