···523523function getValidURL(str) {
524524 if (!str) return { valid: false };
525525526526- // Check if it starts with a valid protocol
527527- const hasValidProtocol = /^(https?|ftp|file):\/\//.test(str);
526526+ // Check if it starts with a valid protocol (including peek:// for internal pages)
527527+ const hasValidProtocol = /^(https?|ftp|file|peek):\/\//.test(str);
528528529529 if (!hasValidProtocol) {
530530 // Check if it looks like a domain (e.g., "example.com" or "localhost")
···6060 }
6161});
62626363-// Get the root directory (two levels up from dist/backend/electron/)
6464-const ROOT_DIR = path.resolve(import.meta.dirname, '..', '..', '..');
6363+// Get the root directory - app.getAppPath() works in both dev and packaged modes
6464+const ROOT_DIR = app.getAppPath();
65656666const DEBUG = !!process.env.DEBUG;
6767
···11+#!/bin/bash
22+# Test dev app - runs the dev app with a fresh profile
33+# Usage: ./scripts/test-dev.sh [--visible] [duration_seconds]
44+# Example: ./scripts/test-dev.sh # 8 seconds, headless
55+# Example: ./scripts/test-dev.sh --visible # 8 seconds, show UI
66+# Example: ./scripts/test-dev.sh --visible 15
77+88+VISIBLE=0
99+if [ "$1" = "--visible" ]; then
1010+ VISIBLE=1
1111+ shift
1212+fi
1313+1414+DURATION=${1:-8}
1515+PROFILE="test-$$"
1616+LOGFILE="/tmp/peek-dev-test.log"
1717+1818+cleanup() {
1919+ pkill -f "/Users/dietrich/misc/peek/node_modules/electron" 2>/dev/null || true
2020+}
2121+2222+trap cleanup EXIT
2323+2424+# Kill any existing dev instances
2525+pkill -f "/Users/dietrich/misc/peek/node_modules/electron" 2>/dev/null || true
2626+sleep 1
2727+2828+echo "Running dev Peek with test profile '$PROFILE' for ${DURATION}s..."
2929+echo "Log file: $LOGFILE"
3030+echo ""
3131+3232+if [ "$VISIBLE" = "1" ]; then
3333+ PROFILE="$PROFILE" DEBUG=1 yarn start > "$LOGFILE" 2>&1 &
3434+else
3535+ PROFILE="$PROFILE" DEBUG=1 PEEK_HEADLESS=1 yarn start > "$LOGFILE" 2>&1 &
3636+fi
3737+PID=$!
3838+3939+sleep "$DURATION"
4040+4141+echo "=== Errors ==="
4242+grep -iE "error|failed|exception" "$LOGFILE" | grep -v "Autofill" | head -20 || echo "(no errors found)"
4343+echo ""
4444+4545+echo "=== Warnings ==="
4646+grep -iE "warning|warn" "$LOGFILE" | head -10 || echo "(no warnings found)"
4747+echo ""
4848+4949+echo "=== Key events ==="
5050+grep -E "onReady|Loading|loaded|register" "$LOGFILE" | head -20
5151+echo ""
5252+5353+echo "=== Full log available at: $LOGFILE ==="
+10
scripts/test-persistence.sh
···11+#!/bin/bash
22+# Run data persistence tests
33+# Usage: ./scripts/test-persistence.sh
44+55+echo "Running data persistence tests..."
66+npx playwright test tests/smoke.spec.ts --grep "Data Persistence" --timeout=120000
77+88+echo ""
99+echo "Done. Test profiles created in ~/Library/Application Support/Peek/test-persistence-*"
1010+echo "You can delete them with: rm -rf ~/Library/Application\\ Support/Peek/test-*"