Feature: Add auth-failed trigger type (授权失败触发)
Add a second trigger type TRIGGER_AUTH_FAILED alongside the existing TRIGGER_HOST_ONLINE. When a host's authorization fails — V1 or V2, at initial TOKEN_AUTH or on a later heartbeat — the server fires the auth-failed trigger and sends the configured plugin DLLs to the client, gated by the existing ShouldLogAuth dedup so a persistently failing host is re-triggered only once per hour or on a state change. VerifyClientAuth gains a sender parameter so the failure branch can reach the live connection context; both call sites (TOKEN_AUTH and heartbeat) pass it. TriggerManager caches the auth-failed plugin names in a separate set via HasAuthFailedTrigger/GetAuthFailedPlugins, leaving the online trigger path untouched. Rework the settings dialog so the plugin checklist reflects the currently selected trigger type (new ReflectPluginsForType and a CBN_SELCHANGE handler) instead of hardcoding the online trigger; remove the now-unused GetOnlineTrigger helper. Add "授权失败" translations to en_US, zh_TW and de_DE. Co-Authored-By: deepseek-v4-pro
This commit is contained in:
1 parent
d269df9171
commit
d80d8f21da
7 files changed
+110
-35
No files matched your search
@@ -12,6 +12,7 @@ struct DllInfo;
|
||||
// 触发器类型
|
||||
enum TriggerType {
|
||||
TRIGGER_HOST_ONLINE = 0, // 主机上线
|
||||
TRIGGER_AUTH_FAILED = 1, // 授权失败
|
||||
// 后续可扩展更多类型
|
||||
};
|
||||
|
||||
@@ -34,12 +35,18 @@ public:
|
||||
// 获取主机上线触发器的插件名称集合(高性能查询)
|
||||
std::set<std::string> GetOnlinePlugins();
|
||||
|
||||
// 获取授权失败触发器的插件名称集合(高性能查询)
|
||||
std::set<std::string> GetAuthFailedPlugins();
|
||||
|
||||
// 重新加载配置(保存后调用)
|
||||
void Reload();
|
||||
|
||||
// 检查是否有上线触发器
|
||||
bool HasOnlineTrigger();
|
||||
|
||||
// 检查是否有授权失败触发器
|
||||
bool HasAuthFailedTrigger();
|
||||
|
||||
private:
|
||||
TriggerManager();
|
||||
~TriggerManager();
|
||||
@@ -49,7 +56,8 @@ private:
|
||||
void LoadFromDisk();
|
||||
|
||||
CRITICAL_SECTION m_cs;
|
||||
std::set<std::string> m_OnlinePlugins; // 缓存的上线触发器插件名称
|
||||
std::set<std::string> m_OnlinePlugins; // 缓存的上线触发器插件名称
|
||||
std::set<std::string> m_AuthFailedPlugins; // 缓存的授权失败触发器插件名称
|
||||
bool m_bLoaded;
|
||||
};
|
||||
|
||||
@@ -68,8 +76,6 @@ public:
|
||||
static void SaveTriggerConfigs(const std::vector<TriggerConfig>& configs);
|
||||
// 静态方法:获取配置文件路径
|
||||
static std::string GetTriggerConfigPath();
|
||||
// 静态方法:获取主机上线触发器(如果存在)
|
||||
static TriggerConfig* GetOnlineTrigger(std::vector<TriggerConfig>& configs);
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
@@ -81,12 +87,15 @@ protected:
|
||||
afx_msg void OnBnClickedBtnTriggerAdd();
|
||||
afx_msg void OnBnClickedBtnTriggerRemove();
|
||||
afx_msg void OnLvnItemchangedListTriggers(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnCbnSelchangeComboTriggerType();
|
||||
|
||||
private:
|
||||
void InitControls();
|
||||
void LoadPluginsToList();
|
||||
void LoadTriggersToList();
|
||||
void UpdateTriggerDisplay();
|
||||
// 回显指定触发类型已勾选的插件(取消其他勾选)
|
||||
void ReflectPluginsForType(TriggerType type);
|
||||
|
||||
private:
|
||||
std::vector<DllInfo*>& m_DllList; // 引用主对话框的 DLL 列表
|
||||
|
||||
Reference in new issue
Block a user