openclaw/scripts/install-desktop-launcher.sh
Spacehunterz fa2b77230b feat(ollama): add auto-discovery with Anthropic API and security hardening
- Auto-detect Ollama without requiring API key configuration
- Switch to Anthropic Messages API for better Claude compatibility
- Add security checks to prevent network exposure (0.0.0.0 binding)
- Add desktop launcher with security validation
- Hardcode localhost-only connections (127.0.0.1:11434)

Security features:
- Launch script forces OLLAMA_HOST=127.0.0.1:11434
- Warns if Ollama is exposed to network interfaces
- Checks .bashrc/.profile for dangerous OLLAMA_HOST settings
- ollama-security.ts module for URL validation

New files:
- scripts/launch-clawdbot-ollama.sh - Secure launcher script
- scripts/install-desktop-launcher.sh - Desktop entry installer
- assets/clawdbot-ollama.desktop - Linux desktop entry
- src/agents/ollama-security.ts - Security utilities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 14:05:12 -06:00

51 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Install Clawdbot Ollama desktop launcher
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# Paths
DESKTOP_FILE="$PROJECT_DIR/assets/clawdbot-ollama.desktop"
LAUNCH_SCRIPT="$PROJECT_DIR/scripts/launch-clawdbot-ollama.sh"
ICON_FILE="$PROJECT_DIR/assets/chrome-extension/icons/icon128.png"
DEST_DIR="$HOME/.local/share/applications"
# Create destination directory if it doesn't exist
mkdir -p "$DEST_DIR"
# Make launch script executable
chmod +x "$LAUNCH_SCRIPT"
# Create the desktop file with absolute paths
cat > "$DEST_DIR/clawdbot-ollama.desktop" << EOF
[Desktop Entry]
Name=Clawdbot (Ollama)
Comment=AI Assistant with local Ollama models
Exec=$LAUNCH_SCRIPT
Icon=$ICON_FILE
Terminal=true
Type=Application
Categories=Development;Utility;
Keywords=ai;chat;ollama;local;llm;
StartupNotify=true
EOF
# Make desktop file executable (required on some distros)
chmod +x "$DEST_DIR/clawdbot-ollama.desktop"
# Update desktop database
if command -v update-desktop-database &> /dev/null; then
update-desktop-database "$DEST_DIR" 2>/dev/null || true
fi
echo "Desktop launcher installed!"
echo "Location: $DEST_DIR/clawdbot-ollama.desktop"
echo ""
echo "You can now find 'Clawdbot (Ollama)' in your application menu."
echo ""
echo "To also add it to your desktop:"
echo " cp $DEST_DIR/clawdbot-ollama.desktop ~/Desktop/"
echo " # Then right-click the icon and select 'Allow Launching'"