Status LED
Dieser Commit ist enthalten in:
@ -322,6 +322,96 @@ wsl bash {bash_wsl_path}
|
||||
|
||||
REM Clean up temp file
|
||||
del "{bash_path}" 2>nul
|
||||
"""
|
||||
return script_content
|
||||
|
||||
def create_activity_server_script(self) -> str:
|
||||
"""Create a script for SSH connection to Activity Server"""
|
||||
import tempfile
|
||||
import os
|
||||
logger.info("Creating Activity Server connection script")
|
||||
|
||||
# Create a robust script with multiple approaches
|
||||
script_content = f"""@echo off
|
||||
cls
|
||||
echo ================================================================================
|
||||
echo CPM Activity Server Connection
|
||||
echo ================================================================================
|
||||
echo.
|
||||
echo Server: {self.server}
|
||||
echo Username: {self.username}
|
||||
echo Target Directory: /home/claude-dev/cpm-activity-server
|
||||
echo.
|
||||
|
||||
REM Check if PowerShell is available and use it for better plink integration
|
||||
where powershell >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo Using PowerShell for enhanced connection...
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command "& {{$plinkPath = Get-Command plink -ErrorAction SilentlyContinue; if ($plinkPath) {{ Write-Host 'Connecting via plink...' -ForegroundColor Green; Write-Host ''; $process = Start-Process -FilePath 'plink' -ArgumentList '-ssh', '-l', '{self.username}', '-pw', '{self.password}', '-t', '{self.server}', 'cd /home/claude-dev/cpm-activity-server && echo \"Successfully changed to Activity Server directory\" && echo && bash -l' -PassThru -NoNewWindow -Wait; if ($process.ExitCode -ne 0) {{ Write-Host ''; Write-Host 'Automatic directory change failed. Starting interactive session...' -ForegroundColor Yellow; Write-Host ''; Write-Host 'IMPORTANT: After login, run these commands:' -ForegroundColor Red; Write-Host ' cd /home/claude-dev/cpm-activity-server' -ForegroundColor White; Write-Host ' claude' -ForegroundColor White; Write-Host ''; & plink -ssh -l {self.username} -pw '{self.password}' -t {self.server} }} }} else {{ Write-Host 'Plink not found, trying standard SSH...' -ForegroundColor Yellow; Write-Host 'Password: {self.password}'; Write-Host 'After login, run: cd /home/claude-dev/cpm-activity-server && claude'; & ssh {self.username}@{self.server} }} }}"
|
||||
goto end
|
||||
)
|
||||
|
||||
REM First, try the plink approach with RemoteCommand
|
||||
where plink >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo Using PuTTY plink for connection...
|
||||
echo.
|
||||
|
||||
REM Try plink with direct command execution
|
||||
echo Attempting automatic directory change...
|
||||
plink -batch -ssh -l {self.username} -pw "{self.password}" {self.server} "cd /home/claude-dev/cpm-activity-server && exec bash -l"
|
||||
|
||||
REM If that didn't work, try interactive mode
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo.
|
||||
echo Direct command execution failed. Starting interactive session...
|
||||
echo.
|
||||
echo ================================================================================
|
||||
echo IMPORTANT: After login, please run these commands:
|
||||
echo.
|
||||
echo cd /home/claude-dev/cpm-activity-server
|
||||
echo claude
|
||||
echo.
|
||||
echo ================================================================================
|
||||
echo.
|
||||
plink -ssh -l {self.username} -pw "{self.password}" -t {self.server}
|
||||
)
|
||||
goto end
|
||||
)
|
||||
|
||||
REM Check if we have WSL available
|
||||
where wsl >nul 2>&1
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
echo Using WSL for connection...
|
||||
echo.
|
||||
|
||||
REM Create inline bash command for WSL
|
||||
wsl bash -c "echo 'Connecting to Activity Server...' && if command -v sshpass >/dev/null 2>&1; then sshpass -p '{self.password}' ssh -o StrictHostKeyChecking=no -t {self.username}@{self.server} 'cd /home/claude-dev/cpm-activity-server && echo \"Successfully changed to Activity Server directory\" && echo && claude || bash -l'; else echo 'Manual password entry required.' && echo 'Password: {self.password}' && echo && echo 'After login, run: cd /home/claude-dev/cpm-activity-server && claude' && echo && ssh -o StrictHostKeyChecking=no {self.username}@{self.server}; fi"
|
||||
goto end
|
||||
)
|
||||
|
||||
REM Fallback to standard SSH
|
||||
echo No automated tools found. Using standard SSH...
|
||||
echo.
|
||||
echo ================================================================================
|
||||
echo Connection Instructions:
|
||||
echo.
|
||||
echo 1. Enter this password when prompted: {self.password}
|
||||
echo (You can right-click to paste in most terminals)
|
||||
echo.
|
||||
echo 2. After successful login, run these commands:
|
||||
echo cd /home/claude-dev/cpm-activity-server
|
||||
echo claude
|
||||
echo.
|
||||
echo ================================================================================
|
||||
echo.
|
||||
pause
|
||||
ssh {self.username}@{self.server}
|
||||
|
||||
:end
|
||||
echo.
|
||||
echo Connection closed.
|
||||
pause
|
||||
"""
|
||||
return script_content
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren