Spaces:
Running
Running
Somrat Sorkar commited on
Commit Β·
9cf2dd4
1
Parent(s): 3d2dc6a
Fix: use dangerouslyDisableDeviceAuth to bypass pairing for Docker
Browse files
start.sh
CHANGED
|
@@ -157,6 +157,9 @@ if [ -n "$SPACE_HOST" ]; then
|
|
| 157 |
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.controlUi.allowedOrigins = [\"https://${SPACE_HOST}\"]")
|
| 158 |
fi
|
| 159 |
|
|
|
|
|
|
|
|
|
|
| 160 |
# Telegram (supports multiple user IDs, comma-separated)
|
| 161 |
if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
|
| 162 |
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.telegram = {"enabled": true}')
|
|
@@ -193,7 +196,7 @@ printf " β %-40s β\n" "Backup: β not configured"
|
|
| 193 |
fi
|
| 194 |
if [ -n "$SPACE_HOST" ]; then
|
| 195 |
printf " β %-40s β\n" "Keep-alive: β
every ${KEEP_ALIVE_INTERVAL:-300}s"
|
| 196 |
-
printf " β %-40s β\n" "Control UI: https://${SPACE_HOST}
|
| 197 |
else
|
| 198 |
printf " β %-40s β\n" "Keep-alive: βΈοΈ local mode"
|
| 199 |
fi
|
|
@@ -242,38 +245,7 @@ echo ""
|
|
| 242 |
# Set model via environment for the gateway
|
| 243 |
export LLM_MODEL="$LLM_MODEL"
|
| 244 |
|
| 245 |
-
# For headless Docker: auto-approve the Control UI by injecting token into localStorage
|
| 246 |
-
# Create a wrapper page that auto-configures the token and loads the dashboard
|
| 247 |
-
mkdir -p /home/node/.openclaw/canvas
|
| 248 |
-
cat > /home/node/.openclaw/canvas/auto-login.html <<'HTMLEOF'
|
| 249 |
-
<!DOCTYPE html>
|
| 250 |
-
<html>
|
| 251 |
-
<head>
|
| 252 |
-
<meta charset="utf-8">
|
| 253 |
-
<title>HuggingClaw β Connecting...</title>
|
| 254 |
-
<script>
|
| 255 |
-
// Auto-inject gateway token into Control UI on startup
|
| 256 |
-
const token = 'GATEWAY_TOKEN_PLACEHOLDER';
|
| 257 |
-
if (token && token !== 'GATEWAY_TOKEN_PLACEHOLDER') {
|
| 258 |
-
localStorage.setItem('openclaw:gateway:token', token);
|
| 259 |
-
localStorage.setItem('openclaw:gateway:url', window.location.origin);
|
| 260 |
-
console.log('β
Gateway token auto-configured. Redirecting to dashboard...');
|
| 261 |
-
// Redirect to the actual Control UI after a tiny delay
|
| 262 |
-
setTimeout(() => window.location.href = '/', 100);
|
| 263 |
-
} else {
|
| 264 |
-
document.body.innerHTML = '<h1>β οΈ Gateway token not configured</h1>';
|
| 265 |
-
}
|
| 266 |
-
</script>
|
| 267 |
-
</head>
|
| 268 |
-
<body>
|
| 269 |
-
<h1>Connecting to OpenClaw...</h1>
|
| 270 |
-
<p>If this page doesn't redirect, your gateway token may not be set.</p>
|
| 271 |
-
</body>
|
| 272 |
-
</html>
|
| 273 |
-
HTMLEOF
|
| 274 |
|
| 275 |
-
# Replace the placeholder with the actual token
|
| 276 |
-
sed -i "s|GATEWAY_TOKEN_PLACEHOLDER|$GATEWAY_TOKEN|g" /home/node/.openclaw/canvas/auto-login.html
|
| 277 |
|
| 278 |
openclaw gateway run --port 7860 --bind lan --verbose 2>&1 | tee -a /home/node/.openclaw/gateway.log &
|
| 279 |
GATEWAY_PID=$!
|
|
|
|
| 157 |
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.controlUi.allowedOrigins = [\"https://${SPACE_HOST}\"]")
|
| 158 |
fi
|
| 159 |
|
| 160 |
+
# Disable device auth (pairing) for headless Docker β token-only auth
|
| 161 |
+
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq ".gateway.controlUi.dangerouslyDisableDeviceAuth = true")
|
| 162 |
+
|
| 163 |
# Telegram (supports multiple user IDs, comma-separated)
|
| 164 |
if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
|
| 165 |
CONFIG_JSON=$(echo "$CONFIG_JSON" | jq '.plugins.entries.telegram = {"enabled": true}')
|
|
|
|
| 196 |
fi
|
| 197 |
if [ -n "$SPACE_HOST" ]; then
|
| 198 |
printf " β %-40s β\n" "Keep-alive: β
every ${KEEP_ALIVE_INTERVAL:-300}s"
|
| 199 |
+
printf " β %-40s β\n" "Control UI: https://${SPACE_HOST}"
|
| 200 |
else
|
| 201 |
printf " β %-40s β\n" "Keep-alive: βΈοΈ local mode"
|
| 202 |
fi
|
|
|
|
| 245 |
# Set model via environment for the gateway
|
| 246 |
export LLM_MODEL="$LLM_MODEL"
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
|
|
|
|
|
|
|
| 249 |
|
| 250 |
openclaw gateway run --port 7860 --bind lan --verbose 2>&1 | tee -a /home/node/.openclaw/gateway.log &
|
| 251 |
GATEWAY_PID=$!
|