Link support codes to agent sessions
- Server: Accept support_code param in WebSocket connection - Server: Link code to session when agent connects, mark as connected - Server: Mark code as completed when agent disconnects - Agent: Accept support code from command line argument - Agent: Send hostname and support_code in WebSocket params - Portal: Trigger agent download with code in filename - Portal: Show code reminder in download instructions - Dashboard: Add machines list fetching (Access tab) - Add TODO.md for feature tracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -147,6 +147,27 @@ impl SupportCodeManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Link a support code to an actual WebSocket session
|
||||
pub async fn link_session(&self, code: &str, real_session_id: Uuid) {
|
||||
let mut codes = self.codes.write().await;
|
||||
if let Some(support_code) = codes.get_mut(code) {
|
||||
// Update session_to_code mapping with real session ID
|
||||
let old_session_id = support_code.session_id;
|
||||
support_code.session_id = real_session_id;
|
||||
|
||||
// Update the reverse mapping
|
||||
let mut session_to_code = self.session_to_code.write().await;
|
||||
session_to_code.remove(&old_session_id);
|
||||
session_to_code.insert(real_session_id, code.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
/// Get code by its code string
|
||||
pub async fn get_code(&self, code: &str) -> Option<SupportCode> {
|
||||
let codes = self.codes.read().await;
|
||||
codes.get(code).cloned()
|
||||
}
|
||||
|
||||
/// Mark a code as completed
|
||||
pub async fn mark_completed(&self, code: &str) {
|
||||
let mut codes = self.codes.write().await;
|
||||
|
||||
Reference in New Issue
Block a user