feat(maa): 森空岛签到功能上线

This commit is contained in:
DLmaster361
2025-06-02 02:35:01 +08:00
parent 2d72ca66a4
commit e505ea8c51
7 changed files with 354 additions and 22 deletions

View File

@@ -608,6 +608,83 @@ class PushAndSwitchButtonSettingCard(SettingCard):
self.switchButton.setText("" if isChecked else "")
class PasswordLineAndSwitchButtonSettingCard(SettingCard):
"""Setting card with PasswordLineEdit and SwitchButton"""
textChanged = Signal()
def __init__(
self,
icon: Union[str, QIcon, FluentIconBase],
title: str,
content: Union[str, None],
text: str,
algorithm: str,
qconfig: QConfig,
configItem_bool: ConfigItem,
configItem_info: ConfigItem,
parent=None,
):
super().__init__(icon, title, content, parent)
self.algorithm = algorithm
self.qconfig = qconfig
self.configItem_bool = configItem_bool
self.configItem_info = configItem_info
self.LineEdit = PasswordLineEdit(self)
self.LineEdit.setMinimumWidth(200)
self.LineEdit.setPlaceholderText(text)
if algorithm == "AUTO":
self.LineEdit.setViewPasswordButtonVisible(False)
self.SwitchButton = SwitchButton(self)
self.hBoxLayout.addWidget(self.LineEdit, 0, Qt.AlignRight)
self.hBoxLayout.addSpacing(16)
self.hBoxLayout.addWidget(self.SwitchButton, 0, Qt.AlignRight)
self.hBoxLayout.addSpacing(16)
self.configItem_info.valueChanged.connect(self.setInfo)
self.LineEdit.textChanged.connect(self.__textChanged)
self.configItem_bool.valueChanged.connect(self.SwitchButton.setChecked)
self.SwitchButton.checkedChanged.connect(
lambda isChecked: self.qconfig.set(self.configItem_bool, isChecked)
)
self.setInfo(self.qconfig.get(configItem_info))
self.SwitchButton.setChecked(self.qconfig.get(configItem_bool))
def __textChanged(self, content: str):
self.configItem_info.valueChanged.disconnect(self.setInfo)
if self.algorithm == "DPAPI":
self.qconfig.set(self.configItem_info, Crypto.win_encryptor(content))
elif self.algorithm == "AUTO":
self.qconfig.set(self.configItem_info, Crypto.AUTO_encryptor(content))
self.configItem_info.valueChanged.connect(self.setInfo)
self.textChanged.emit()
def setInfo(self, content: str):
self.LineEdit.textChanged.disconnect(self.__textChanged)
if self.algorithm == "DPAPI":
self.LineEdit.setText(Crypto.win_decryptor(content))
elif self.algorithm == "AUTO":
if Crypto.check_PASSWORD(Config.PASSWORD):
self.LineEdit.setText(Crypto.AUTO_decryptor(content, Config.PASSWORD))
self.LineEdit.setPasswordVisible(True)
self.LineEdit.setReadOnly(False)
elif Config.PASSWORD:
self.LineEdit.setText("管理密钥错误")
self.LineEdit.setPasswordVisible(True)
self.LineEdit.setReadOnly(True)
else:
self.LineEdit.setText("************")
self.LineEdit.setPasswordVisible(False)
self.LineEdit.setReadOnly(True)
self.LineEdit.textChanged.connect(self.__textChanged)
class PushAndComboBoxSettingCard(SettingCard):
"""Setting card with push & combo box"""
@@ -1129,6 +1206,13 @@ class UserLableSettingCard(SettingCard):
== Config.server_date().isocalendar()[:2]
else "本周剿灭未完成"
)
if self.qconfig.get(self.configItems["IfSkland"]):
text_list.append(
"森空岛已签到"
if datetime.now().strftime("%Y-%m-%d")
== self.qconfig.get(self.configItems["LastSklandDate"])
else "森空岛未签到"
)
self.Lable.setText(" | ".join(text_list))

View File

@@ -80,6 +80,7 @@ from .Widget import (
EditableComboBoxWithPlanSettingCard,
SpinBoxWithPlanSettingCard,
PasswordLineEditSettingCard,
PasswordLineAndSwitchButtonSettingCard,
UserLableSettingCard,
UserTaskSettingCard,
ComboBoxSettingCard,
@@ -1585,6 +1586,18 @@ class MemberManager(QWidget):
parent=self,
)
)
self.card_Skland = PasswordLineAndSwitchButtonSettingCard(
icon=FluentIcon.CERTIFICATE,
title="森空岛签到",
content="此功能具有一定风险,请谨慎使用",
text="鹰角网络通行证登录凭证",
algorithm="DPAPI",
qconfig=self.config,
configItem_bool=self.config.Info_IfSkland,
configItem_info=self.config.Info_SklandToken,
parent=self,
)
self.card_Skland.LineEdit.setMinimumWidth(250)
self.card_UserLable = UserLableSettingCard(
icon=FluentIcon.INFO,
@@ -1596,6 +1609,8 @@ class MemberManager(QWidget):
"LastAnnihilationDate": self.config.Data_LastAnnihilationDate,
"ProxyTimes": self.config.Data_ProxyTimes,
"IfPassCheck": self.config.Data_IfPassCheck,
"IfSkland": self.config.Info_IfSkland,
"LastSklandDate": self.config.Data_LastSklandDate,
},
parent=self,
)
@@ -1778,6 +1793,7 @@ class MemberManager(QWidget):
Layout.addLayout(h6_layout)
Layout.addLayout(h7_layout)
Layout.addLayout(h8_layout)
Layout.addWidget(self.card_Skland)
Layout.addWidget(self.card_TaskSet)
Layout.addWidget(self.card_NotifySet)