mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-14 11:37:31 +08:00
- Settings → Models: inline API key, frosted drawer, dark-mode polish, provider icons, i18n sweep - WeChat Work channel: rebuild HttpClient on reconnect, dedup failure signals, route auth_succeed errcode!=0 through failure handler - Channel framework: per-adapter error isolation, QR auth SPI, health indicators - Agent: patch cross-turn assistants for DeepSeek thinking-mode - GitHub: bilingual issue templates with required fields
41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package vip.mate.channel.qrcode;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Optional;
|
|
|
|
/**
|
|
* Routing registry for {@link ChannelQRCodeAuthProvider} implementations.
|
|
*
|
|
* <p>Spring auto-collects every {@code ChannelQRCodeAuthProvider} bean on
|
|
* startup and indexes them by {@link ChannelQRCodeAuthProvider#channelType()}.
|
|
* The generic QR controller hands off to {@code lookup(channelType)} for
|
|
* the requested channel.
|
|
*/
|
|
@Slf4j
|
|
@Component
|
|
public class ChannelQRCodeAuthRegistry {
|
|
|
|
private final Map<String, ChannelQRCodeAuthProvider> byType = new HashMap<>();
|
|
|
|
public ChannelQRCodeAuthRegistry(List<ChannelQRCodeAuthProvider> providers) {
|
|
for (ChannelQRCodeAuthProvider p : providers) {
|
|
ChannelQRCodeAuthProvider prev = byType.put(p.channelType(), p);
|
|
if (prev != null) {
|
|
log.warn("[qrcode-auth] duplicate provider for type={} — {} replaced {}",
|
|
p.channelType(), p.getClass().getSimpleName(),
|
|
prev.getClass().getSimpleName());
|
|
}
|
|
}
|
|
log.info("[qrcode-auth] registered {} provider(s): {}", byType.size(), byType.keySet());
|
|
}
|
|
|
|
public Optional<ChannelQRCodeAuthProvider> lookup(String channelType) {
|
|
return Optional.ofNullable(byType.get(channelType));
|
|
}
|
|
}
|