#!/bin/bash
echo "Reading cookie from clipboard (xsel --clipboard)..."
if ! command -v xsel >/dev/null 2>&1; then
echo "xsel is not installed"
exit 1
fi
COOKIE_VALUE=$(xsel --clipboard --output)
if [ -z "$COOKIE_VALUE" ]; then
echo "Clipboard is empty"
exit 1
fi
python3 - <<EOF > dev_server/proxyConstants.mjs
import json
cookie = """$COOKIE_VALUE"""
print("export const URL = 'https://sber911-ift-iam.delta.sbrf.ru/'")
print("export const cookie =", json.dumps(cookie))
EOF
node dev_server/proxy.mjs &
npm run dev