anurag008w commited on
Commit
64857cd
·
1 Parent(s): f54eaff

fix: login template, wa-guardian interval, remove invalid import

Browse files
Files changed (3) hide show
  1. Dockerfile +3 -16
  2. start.sh +1 -0
  3. wa-guardian.js +1 -1
Dockerfile CHANGED
@@ -58,8 +58,8 @@ RUN if [ "${DEV_MODE}" = "true" ] || [ "${DEV_MODE}" = "1" ] || [ "${DEV_MODE}"
58
  jupyterlab==4.5.7 \
59
  tornado==6.5.5 \
60
  ipywidgets==8.1.8 && \
61
- # Prebuild frontend assets to speed up startup
62
- python3 -c "from jupyterlab.labapp import build_lab_static" || true; \
63
  fi
64
 
65
  # Reuse existing node user (UID 1000). Allow passwordless package-manager
@@ -97,20 +97,7 @@ COPY --chown=1000:1000 wa-guardian.js /home/node/app/wa-guardian.js
97
  COPY --chown=1000:1000 cloudflare-keepalive-setup.py /home/node/app/cloudflare-keepalive-setup.py
98
  COPY --chown=1000:1000 openclaw-sync.py /home/node/app/openclaw-sync.py
99
  COPY --chown=1000:1000 multi-provider-key-rotator.cjs /home/node/app/multi-provider-key-rotator.cjs
100
- # Copy Jupyter login template only when DEV_MODE is enabled
101
- # This avoids import errors when JupyterLab is not installed
102
- RUN printf '%s\n' \
103
- '#!/usr/bin/env bash' \
104
- 'set -u' \
105
- 'case "$(printf "%s" "${DEV_MODE}" | tr "[:upper:]" "[:lower:]")" in' \
106
- ' true|1|yes|on)' \
107
- " python3 -c \"from pathlib import Path; import shutil, jupyter_server; template_dir = Path(jupyter_server.__file__).parent / 'templates'; template_dir.mkdir(parents=True, exist_ok=True); shutil.copyfile('/home/node/app/login.html', template_dir / 'login.html')\"" \
108
- ' ;;' \
109
- 'esac' \
110
- > /tmp/setup-jupyter-template.sh && \
111
- chmod +x /tmp/setup-jupyter-template.sh && \
112
- /tmp/setup-jupyter-template.sh || echo "Jupyter template setup skipped" ; \
113
- rm -f /tmp/setup-jupyter-template.sh
114
  RUN chmod +x /home/node/app/start.sh \
115
  /home/node/app/cloudflare-proxy-setup.py \
116
  /home/node/app/cloudflare-keepalive-setup.py \
 
58
  jupyterlab==4.5.7 \
59
  tornado==6.5.5 \
60
  ipywidgets==8.1.8 && \
61
+ # Copy login template into jupyter_server templates dir
62
+ python3 -c "from pathlib import Path; import shutil, jupyter_server; d=Path(jupyter_server.__file__).parent/'templates'; d.mkdir(parents=True,exist_ok=True); shutil.copyfile('/home/node/app/login.html', d/'login.html')" || true; \
63
  fi
64
 
65
  # Reuse existing node user (UID 1000). Allow passwordless package-manager
 
97
  COPY --chown=1000:1000 cloudflare-keepalive-setup.py /home/node/app/cloudflare-keepalive-setup.py
98
  COPY --chown=1000:1000 openclaw-sync.py /home/node/app/openclaw-sync.py
99
  COPY --chown=1000:1000 multi-provider-key-rotator.cjs /home/node/app/multi-provider-key-rotator.cjs
100
+ # login.html template is now copied inside the DEV_MODE install block above
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  RUN chmod +x /home/node/app/start.sh \
102
  /home/node/app/cloudflare-proxy-setup.py \
103
  /home/node/app/cloudflare-keepalive-setup.py \
start.sh CHANGED
@@ -757,6 +757,7 @@ if [ "$DEV_MODE_ENABLED" = "true" ] && ! python3 -c "import jupyterlab" >/dev/nu
757
  echo "DEV_MODE enabled but jupyter-lab is missing; attempting runtime install..."
758
  if python3 -m pip install --user --no-cache-dir --break-system-packages "jupyterlab>=4.2,<5" "tornado>=6.3" "ipywidgets>=8.1"; then
759
  echo "Runtime Jupyter install complete."
 
760
  else
761
  echo "WARNING: Runtime Jupyter install failed; disabling terminal for this boot."
762
  RUNTIME_JUPYTER_ENABLED=false
 
757
  echo "DEV_MODE enabled but jupyter-lab is missing; attempting runtime install..."
758
  if python3 -m pip install --user --no-cache-dir --break-system-packages "jupyterlab>=4.2,<5" "tornado>=6.3" "ipywidgets>=8.1"; then
759
  echo "Runtime Jupyter install complete."
760
+ python3 -c "from pathlib import Path; import shutil, jupyter_server; d=Path(jupyter_server.__file__).parent/'templates'; d.mkdir(parents=True,exist_ok=True); shutil.copyfile('/home/node/app/login.html', d/'login.html')" || true
761
  else
762
  echo "WARNING: Runtime Jupyter install failed; disabling terminal for this boot."
763
  RUNTIME_JUPYTER_ENABLED=false
wa-guardian.js CHANGED
@@ -20,7 +20,7 @@ const { randomUUID } = require('node:crypto');
20
  const GATEWAY_URL = "ws://127.0.0.1:7860";
21
  const GATEWAY_TOKEN = process.env.GATEWAY_TOKEN || "huggingclaw";
22
  const WHATSAPP_ENABLED = /^true$/i.test(process.env.WHATSAPP_ENABLED || "");
23
- const CHECK_INTERVAL = 5000;
24
  const WAIT_TIMEOUT = 120000;
25
  const POST_515_NO_LOGOUT_MS = 90 * 1000;
26
  const SUCCESS_COOLDOWN_MS = 60 * 1000;
 
20
  const GATEWAY_URL = "ws://127.0.0.1:7860";
21
  const GATEWAY_TOKEN = process.env.GATEWAY_TOKEN || "huggingclaw";
22
  const WHATSAPP_ENABLED = /^true$/i.test(process.env.WHATSAPP_ENABLED || "");
23
+ const CHECK_INTERVAL = 30000;
24
  const WAIT_TIMEOUT = 120000;
25
  const POST_515_NO_LOGOUT_MS = 90 * 1000;
26
  const SUCCESS_COOLDOWN_MS = 60 * 1000;